Explorar el Código

Refactored arguments / method names according to terminology change

Alois Mahdal (@azzgoat) hace 11 años
padre
commit
dcb4a4710e
Se han modificado 5 ficheros con 18 adiciones y 18 borrados
  1. 6
    6
      lib/SugarTrail/Repo.pm
  2. 2
    2
      lib/SugarTrail/Repo/Filesystem.pm
  3. 1
    1
      lib/SugarTrail/Template/Master.pm
  4. 7
    7
      t/Repo.t
  5. 2
    2
      t/Slave.t

+ 6
- 6
lib/SugarTrail/Repo.pm Ver fichero

@@ -1,7 +1,7 @@
1 1
 package SugarTrail::Repo;
2 2
 # provide access to STM objects
3 3
 #
4
-# * load_stm()
4
+# * load_master()
5 5
 
6 6
 use strict;
7 7
 use warnings;
@@ -20,16 +20,16 @@ sub new {
20 20
     return $class->new(%$args);
21 21
 }
22 22
 
23
-sub load_stm {
23
+sub load_master {
24 24
     my $self = shift;
25 25
     my $args = { @_ };
26 26
 
27
-    my $stm = SugarTrail::Template::Master->new();
28
-    $stm->{text} = $self->load_text(stm => $args->{stm})
27
+    my $master = SugarTrail::Template::Master->new();
28
+    $master->{text} = $self->load_text(source => $args->{source})
29 29
         or return;
30
-    $stm->{stm} = $args->{stm};
30
+    $master->{source} = $args->{source};
31 31
 
32
-    return $stm;
32
+    return $master;
33 33
 }
34 34
 
35 35
 1;

+ 2
- 2
lib/SugarTrail/Repo/Filesystem.pm Ver fichero

@@ -29,10 +29,10 @@ sub load_text {
29 29
     my $args = { @_ };
30 30
 
31 31
     # load
32
-    my $fn = $self->{root} . $args->{stm};
32
+    my $fn = $self->{root} . $args->{source};
33 33
     my $fh;
34 34
     unless (open $fh, "<", $fn) {
35
-        $self->{last_error} = "cannot open STM file $fn for reading: $!";
35
+        $self->{last_error} = "cannot open master $fn for reading: $!";
36 36
         carp $self->{last_error};
37 37
         return;
38 38
     }

+ 1
- 1
lib/SugarTrail/Template/Master.pm Ver fichero

@@ -98,7 +98,7 @@ sub generate_slave {
98 98
             if ($accept || scalar @{$slave_step->{warnings}});
99 99
     }
100 100
 
101
-    $slave->{meta}->{'Stm'} = $self->{stm};
101
+    $slave->{meta}->{'Stm'} = $self->{source};
102 102
     $slave->{meta}->{'Stm Revision'} = $self->get_current_revision();
103 103
     $slave->{meta}->{'Params'} = mkmymime($args);
104 104
 

+ 7
- 7
t/Repo.t Ver fichero

@@ -12,17 +12,17 @@ require_ok( 'SugarTrail::Repo' );
12 12
 my $repo = SugarTrail::Repo->new(root => './t/data/strepo', vcs => 'git');
13 13
 ok($repo,           "repo is true");
14 14
 
15
-my $stm = $repo->load_stm(stm=>'/release/rc.stm');
16
-ok($stm,            "master is true");
15
+my $master = $repo->load_master(source=>'/release/rc.stm');
16
+ok($master,         "master is true");
17 17
 
18
-my ($hc,$bc) = $stm->parse();
18
+my ($hc,$bc) = $master->parse();
19 19
 is($hc, 6,  "parse() reported 6 headers");
20 20
 is($bc, 13, "parse() reported 13 non-header lines");
21 21
 
22
-my $sts = $stm->generate_slave({ proto => "imap", os => "wxx" });
23
-ok($sts,            "slave is true");
22
+my $slave = $master->generate_slave({ proto => "imap", os => "wxx" });
23
+ok($slave,          "slave is true");
24 24
 
25
-&helper::dmup(master=>$stm);
26
-&helper::dmup(slave=>$sts);
25
+&helper::dmup(master=>$master);
26
+&helper::dmup(slave=>$slave);
27 27
 
28 28
 done_testing();

+ 2
- 2
t/Slave.t Ver fichero

@@ -10,8 +10,8 @@ use SugarTrail::Repo;
10 10
 my $repo = SugarTrail::Repo->new(root => './t/data/strepo', vcs => 'git');
11 11
 
12 12
 my $data;
13
-$data->{mp} = $repo->load_stm(stm=>'/selftest/positive/multiple_parameters.stm');
14
-$data->{mw} = $repo->load_stm(stm=>'/selftest/negative/multiple_warnings.stm');
13
+$data->{mp} = $repo->load_master(source=>'/selftest/positive/multiple_parameters.stm');
14
+$data->{mw} = $repo->load_master(source=>'/selftest/negative/multiple_warnings.stm');
15 15
 
16 16
 ok($data->{mp}, "multiple_parameters: master is true");
17 17
 ok($data->{mw}, "multiple_warnings: master is true");