Browse Source

Refactored arguments / method names according to terminology change

Alois Mahdal (@azzgoat) 11 years ago
parent
commit
dcb4a4710e
5 changed files with 18 additions and 18 deletions
  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 View File

1
 package SugarTrail::Repo;
1
 package SugarTrail::Repo;
2
 # provide access to STM objects
2
 # provide access to STM objects
3
 #
3
 #
4
-# * load_stm()
4
+# * load_master()
5
 
5
 
6
 use strict;
6
 use strict;
7
 use warnings;
7
 use warnings;
20
     return $class->new(%$args);
20
     return $class->new(%$args);
21
 }
21
 }
22
 
22
 
23
-sub load_stm {
23
+sub load_master {
24
     my $self = shift;
24
     my $self = shift;
25
     my $args = { @_ };
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
         or return;
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
 1;
35
 1;

+ 2
- 2
lib/SugarTrail/Repo/Filesystem.pm View File

29
     my $args = { @_ };
29
     my $args = { @_ };
30
 
30
 
31
     # load
31
     # load
32
-    my $fn = $self->{root} . $args->{stm};
32
+    my $fn = $self->{root} . $args->{source};
33
     my $fh;
33
     my $fh;
34
     unless (open $fh, "<", $fn) {
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
         carp $self->{last_error};
36
         carp $self->{last_error};
37
         return;
37
         return;
38
     }
38
     }

+ 1
- 1
lib/SugarTrail/Template/Master.pm View File

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

+ 7
- 7
t/Repo.t View File

12
 my $repo = SugarTrail::Repo->new(root => './t/data/strepo', vcs => 'git');
12
 my $repo = SugarTrail::Repo->new(root => './t/data/strepo', vcs => 'git');
13
 ok($repo,           "repo is true");
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
 is($hc, 6,  "parse() reported 6 headers");
19
 is($hc, 6,  "parse() reported 6 headers");
20
 is($bc, 13, "parse() reported 13 non-header lines");
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
 done_testing();
28
 done_testing();

+ 2
- 2
t/Slave.t View File

10
 my $repo = SugarTrail::Repo->new(root => './t/data/strepo', vcs => 'git');
10
 my $repo = SugarTrail::Repo->new(root => './t/data/strepo', vcs => 'git');
11
 
11
 
12
 my $data;
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
 ok($data->{mp}, "multiple_parameters: master is true");
16
 ok($data->{mp}, "multiple_parameters: master is true");
17
 ok($data->{mw}, "multiple_warnings: master is true");
17
 ok($data->{mw}, "multiple_warnings: master is true");