]> granicus.if.org Git - fortune-mod/commitdiff
Extract a common class/struct.
authorShlomi Fish <shlomif@shlomifish.org>
Fri, 3 Apr 2020 17:49:20 +0000 (20:49 +0300)
committerShlomi Fish <shlomif@shlomifish.org>
Fri, 3 Apr 2020 17:49:20 +0000 (20:49 +0300)
This is Refactoring / code cleanup.

See:

* https://en.wikipedia.org/wiki/God_object

* https://en.wikipedia.org/wiki/Extract_class

* https://en.wikipedia.org/wiki/Code_refactoring

* https://www.refactoring.com/

* https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/

Some small optimisations may have slipped in as well.

scripts/debian-packaging/docker-test.pl

index d0fc51684748fb5ba856f3bb86865a7068438f41..55e195a13b2d030a6e8435eb5a3223e403172961 100644 (file)
@@ -12,14 +12,13 @@ use 5.014;
 use autodie;
 
 use Path::Tiny qw/ path tempdir tempfile cwd /;
-use Docker::CLI::Wrapper::Base ();
+use Docker::CLI::Wrapper::Container ();
 
-my $obj = Docker::CLI::Wrapper::Base->new();
+my $obj = Docker::CLI::Wrapper::Container->new( { sys => "debian:sid", } );
 
 my @deps;    #= map { /^BuildRequires:\s*(\S+)/ ? ("'$1'") : () }
 
 # path("freecell-solver.spec.in")->lines_utf8;
-my $SYS       = "debian:sid";
 my $CONTAINER = "fortune-mod--deb--test-build";
 my $USER      = "mygbp";
 my $HOMEDIR   = "/home/$USER";
@@ -31,8 +30,9 @@ sub _clean_up_containers
     eval { $obj->docker( { cmd => [ 'rm', $CONTAINER, ] } ); };
 }
 _clean_up_containers();
-$obj->docker( { cmd => [ 'pull', $SYS ] } );
-$obj->docker( { cmd => [ 'run', "-t", "-d", "--name", $CONTAINER, $SYS, ] } );
+$obj->docker( { cmd => [ 'pull', $obj->sys() ] } );
+$obj->docker(
+    { cmd => [ 'run', "-t", "-d", "--name", $CONTAINER, $obj->sys(), ] } );
 my $REPO = 'fortune-mod';
 my $URL  = "https://salsa.debian.org/shlomif-guest/$REPO";