This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit 637dad8b253f82fd1dcb9cefbd737cf50c1b6307
Author: Tatsuhiko Miyagawa <miyag...@bulknews.net>
Date:   Tue Jul 23 18:45:04 2013 -0700

    rename "Lockfile" variables/classes/methods to Snapshots all the way
---
 lib/Carton/Builder.pm                        |  4 +--
 lib/Carton/CLI.pm                            | 48 ++++++++++++++--------------
 lib/Carton/Environment.pm                    |  8 ++---
 lib/Carton/Error.pm                          |  4 +--
 lib/Carton/Requirements.pm                   |  4 +--
 lib/Carton/{Lockfile.pm => Snapshot.pm}      | 16 +++++-----
 lib/Carton/{Lockfile => Snapshot}/Emitter.pm |  8 ++---
 lib/Carton/{Lockfile => Snapshot}/Parser.pm  | 18 +++++------
 8 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/lib/Carton/Builder.pm b/lib/Carton/Builder.pm
index b642b56..05ca980 100644
--- a/lib/Carton/Builder.pm
+++ b/lib/Carton/Builder.pm
@@ -28,9 +28,9 @@ sub custom_mirror {
 }
 
 sub bundle {
-    my($self, $path, $cache_path, $lockfile) = @_;
+    my($self, $path, $cache_path, $snapshot) = @_;
 
-    for my $dist ($lockfile->distributions) {
+    for my $dist ($snapshot->distributions) {
         my $source = $path->child("cache/authors/id/" . $dist->pathname);
         my $target = $cache_path->child("authors/id/" . $dist->pathname);
 
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 268fb83..749d6bb 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -13,7 +13,7 @@ use Scalar::Util qw(blessed);
 use Carton;
 use Carton::Builder;
 use Carton::Mirror;
-use Carton::Lockfile;
+use Carton::Snapshot;
 use Carton::Util;
 use Carton::Environment;
 use Carton::Error;
@@ -144,7 +144,7 @@ sub cmd_bundle {
     my($self, @args) = @_;
 
     my $env = Carton::Environment->build;
-    $env->lockfile->load;
+    $env->snapshot->load;
 
     $self->print("Bundling modules using @{[$env->cpanfile]}\n");
 
@@ -152,7 +152,7 @@ sub cmd_bundle {
         mirror => $self->mirror,
         cpanfile => $env->cpanfile,
     );
-    $builder->bundle($env->install_path, $env->vendor_cache, $env->lockfile);
+    $builder->bundle($env->install_path, $env->vendor_cache, $env->snapshot);
 
     $self->printf("Complete! Modules were bundled into %s\n", 
$env->vendor_cache, SUCCESS);
 }
@@ -172,9 +172,9 @@ sub cmd_install {
     );
 
     my $env = Carton::Environment->build($cpanfile_path, $install_path);
-    $env->lockfile->load_if_exists;
+    $env->snapshot->load_if_exists;
 
-    if ($deployment && !$env->lockfile->loaded) {
+    if ($deployment && !$env->snapshot->loaded) {
         $self->error("--deployment requires cpanfile.snapshot: Run `carton 
install` and make sure carton.lock is checked into your version control.\n");
     }
 
@@ -195,11 +195,11 @@ sub cmd_install {
     }
 
     # TODO merge CPANfile git to mirror even if lock doesn't exist
-    if ($env->lockfile->loaded) {
+    if ($env->snapshot->loaded) {
         my $index_file = 
$env->install_path->child("cache/modules/02packages.details.txt");
            $index_file->parent->mkpath;
 
-        $env->lockfile->write_index($index_file);
+        $env->snapshot->write_index($index_file);
         $builder->index($index_file);
     }
 
@@ -211,8 +211,8 @@ sub cmd_install {
 
     unless ($deployment) {
         $env->cpanfile->load;
-        $env->lockfile->find_installs($env->install_path, 
$env->cpanfile->requirements);
-        $env->lockfile->save;
+        $env->snapshot->find_installs($env->install_path, 
$env->cpanfile->requirements);
+        $env->snapshot->save;
     }
 
     $self->print("Complete! Modules were installed into 
@{[$env->install_path]}\n", SUCCESS);
@@ -222,10 +222,10 @@ sub cmd_show {
     my($self, @args) = @_;
 
     my $env = Carton::Environment->build;
-    $env->lockfile->load;
+    $env->snapshot->load;
 
     for my $module (@args) {
-        my $dist = $env->lockfile->find($module)
+        my $dist = $env->snapshot->find($module)
             or $self->error("Couldn't locate $module in cpanfile.snapshot\n");
         $self->print( $dist->name . "\n" );
     }
@@ -242,9 +242,9 @@ sub cmd_list {
     );
 
     my $env = Carton::Environment->build;
-    $env->lockfile->load;
+    $env->snapshot->load;
 
-    for my $dist ($env->lockfile->distributions) {
+    for my $dist ($env->snapshot->distributions) {
         $self->print($dist->$format . "\n");
     }
 }
@@ -253,10 +253,10 @@ sub cmd_tree {
     my($self, @args) = @_;
 
     my $env = Carton::Environment->build;
-    $env->lockfile->load;
+    $env->snapshot->load;
     $env->cpanfile->load;
 
-    my $requirements = Carton::Requirements->new(lockfile => $env->lockfile, 
requirements => $env->cpanfile->requirements);
+    my $requirements = Carton::Requirements->new(snapshot => $env->snapshot, 
requirements => $env->cpanfile->requirements);
 
     my %seen;
     my $dumper = sub {
@@ -278,17 +278,17 @@ sub cmd_check {
     );
 
     my $env = Carton::Environment->build($cpanfile_path);
-    $env->lockfile->load;
+    $env->snapshot->load;
     $env->cpanfile->load;
 
-    # TODO remove lockfile
+    # TODO remove snapshot
     # TODO pass git spec to Requirements?
-    my $requirements = Carton::Requirements->new(lockfile => $env->lockfile, 
requirements => $env->cpanfile->requirements);
+    my $requirements = Carton::Requirements->new(snapshot => $env->snapshot, 
requirements => $env->cpanfile->requirements);
     $requirements->walk_down(sub { });
 
     my @missing;
     for my $module ($requirements->all->required_modules) {
-        my $install = $env->lockfile->find_or_core($module);
+        my $install = $env->snapshot->find_or_core($module);
         if ($install) {
             unless ($requirements->all->accepts_module($module => 
$install->version_for($module))) {
                 push @missing, [ $module, 1, $install->version ];
@@ -327,11 +327,11 @@ sub cmd_update {
     my $cpanfile = Module::CPANfile->load($env->cpanfile);
     @args = grep { $_ ne 'perl' } $env->cpanfile->required_modules unless 
@args;
 
-    $env->lockfile->load;
+    $env->snapshot->load;
 
     my @modules;
     for my $module (@args) {
-        my $dist = $env->lockfile->find_or_core($module)
+        my $dist = $env->snapshot->find_or_core($module)
             or $self->error("Could not find module $module.\n");
         next if $dist->is_core;
         push @modules, "$module~" . 
$env->cpanfile->requirements_for_module($module);
@@ -343,15 +343,15 @@ sub cmd_update {
     );
     $builder->update($env->install_path, @modules);
 
-    $env->lockfile->find_installs($env->install_path, 
$env->cpanfile->requirements);
-    $env->lockfile->save;
+    $env->snapshot->find_installs($env->install_path, 
$env->cpanfile->requirements);
+    $env->snapshot->save;
 }
 
 sub cmd_exec {
     my($self, @args) = @_;
 
     my $env = Carton::Environment->build;
-    $env->lockfile->load;
+    $env->snapshot->load;
 
     # allows -Ilib
     @args = map { /^(-[I])(.+)/ ? ($1,$2) : $_ } @args;
diff --git a/lib/Carton/Environment.pm b/lib/Carton/Environment.pm
index 9c9ef42..6fb31c3 100644
--- a/lib/Carton/Environment.pm
+++ b/lib/Carton/Environment.pm
@@ -3,18 +3,18 @@ use strict;
 use Moo;
 
 use Carton::CPANfile;
-use Carton::Lockfile;
+use Carton::Snapshot;
 use Carton::Error;
 use Path::Tiny;
 
 has cpanfile => (is => 'rw');
-has lockfile => (is => 'lazy');
+has snapshot => (is => 'lazy');
 has install_path => (is => 'rw', lazy => 1, builder => 1, coerce => sub { 
Path::Tiny->new($_[0])->absolute });
 has vendor_cache  => (is => 'lazy');
 
-sub _build_lockfile {
+sub _build_snapshot {
     my $self = shift;
-    Carton::Lockfile->new(path => $self->cpanfile->stringify . ".snapshot");
+    Carton::Snapshot->new(path => $self->cpanfile->stringify . ".snapshot");
 }
 
 sub _build_install_path {
diff --git a/lib/Carton/Error.pm b/lib/Carton/Error.pm
index bcc3bbd..7c8074f 100644
--- a/lib/Carton/Error.pm
+++ b/lib/Carton/Error.pm
@@ -5,8 +5,8 @@ use Exception::Class (
     'Carton::Error::CommandNotFound' => { isa => 'Carton::Error' },
     'Carton::Error::CommandExit' => { isa => 'Carton::Error', fields => [ 
'code' ] },
     'Carton::Error::CPANfileNotFound' => { isa => 'Carton::Error' },
-    'Carton::Error::LockfileParseError' => { isa => 'Carton::Error', fields => 
[ 'path' ] },
-    'Carton::Error::LockfileNotFound' => { isa => 'Carton::Error', fields => [ 
'path' ] },
+    'Carton::Error::SnapshotParseError' => { isa => 'Carton::Error', fields => 
[ 'path' ] },
+    'Carton::Error::SnapshotNotFound' => { isa => 'Carton::Error', fields => [ 
'path' ] },
 );
 
 1;
diff --git a/lib/Carton/Requirements.pm b/lib/Carton/Requirements.pm
index 1eb7a47..29a6b6b 100644
--- a/lib/Carton/Requirements.pm
+++ b/lib/Carton/Requirements.pm
@@ -4,7 +4,7 @@ use Carton::Dependency;
 use Moo;
 use CPAN::Meta::Requirements;
 
-has lockfile => (is => 'ro');
+has snapshot => (is => 'ro');
 has requirements => (is => 'ro');
 has all => (is => 'ro', default => sub { CPAN::Meta::Requirements->new });
 
@@ -46,7 +46,7 @@ sub dependency_for {
     $dep->module($module);
     $dep->requirement($requirement);
 
-    if (my $dist = $self->lockfile->find_or_core($module)) {
+    if (my $dist = $self->snapshot->find_or_core($module)) {
         $dep->dist($dist);
     }
 
diff --git a/lib/Carton/Lockfile.pm b/lib/Carton/Snapshot.pm
similarity index 91%
rename from lib/Carton/Lockfile.pm
rename to lib/Carton/Snapshot.pm
index 19dee70..5262433 100644
--- a/lib/Carton/Lockfile.pm
+++ b/lib/Carton/Snapshot.pm
@@ -1,4 +1,4 @@
-package Carton::Lockfile;
+package Carton::Snapshot;
 use strict;
 use Config;
 use Carton::Dist;
@@ -7,8 +7,8 @@ use Carton::Error;
 use Carton::Package;
 use Carton::Index;
 use Carton::Util;
-use Carton::Lockfile::Emitter;
-use Carton::Lockfile::Parser;
+use Carton::Snapshot::Emitter;
+use Carton::Snapshot::Parser;
 use CPAN::Meta;
 use CPAN::Meta::Requirements;
 use File::Find ();
@@ -17,10 +17,10 @@ use Path::Tiny ();
 use Module::CoreList;
 use Moo;
 
-use constant CARTON_LOCK_VERSION => '1.0';
+use constant CARTON_SNAPSHOT_VERSION => '1.0';
 
 has path    => (is => 'rw', coerce => sub { Path::Tiny->new($_[0]) });
-has version => (is => 'rw', default => sub { CARTON_LOCK_VERSION });
+has version => (is => 'rw', default => sub { CARTON_SNAPSHOT_VERSION });
 has loaded  => (is => 'rw');
 has _distributions => (is => 'rw', default => sub { +[] });
 
@@ -35,13 +35,13 @@ sub load {
     return 1 if $self->loaded;
 
     if ($self->path->is_file) {
-        my $parser = Carton::Lockfile::Parser->new;
+        my $parser = Carton::Snapshot::Parser->new;
         $parser->parse($self->path->slurp_utf8, $self);
         $self->loaded(1);
 
         return 1;
     } else {
-        Carton::Error::LockfileNotFound->throw(
+        Carton::Error::SnapshotNotFound->throw(
             error => "Can't find cpanfile.snapshot: Run `carton install` to 
build the lock file.",
             path => $self->path,
         );
@@ -50,7 +50,7 @@ sub load {
 
 sub save {
     my $self = shift;
-    $self->path->spew_utf8( Carton::Lockfile::Emitter->new->emit($self) );
+    $self->path->spew_utf8( Carton::Snapshot::Emitter->new->emit($self) );
 }
 
 sub find {
diff --git a/lib/Carton/Lockfile/Emitter.pm b/lib/Carton/Snapshot/Emitter.pm
similarity index 76%
rename from lib/Carton/Lockfile/Emitter.pm
rename to lib/Carton/Snapshot/Emitter.pm
index 8ffd254..651bb63 100644
--- a/lib/Carton/Lockfile/Emitter.pm
+++ b/lib/Carton/Snapshot/Emitter.pm
@@ -1,15 +1,15 @@
-package Carton::Lockfile::Emitter;
+package Carton::Snapshot::Emitter;
 use strict;
 use Moo;
 
 sub emit {
-    my($self, $lockfile) = @_;
+    my($self, $snapshot) = @_;
 
     my $data = '';
-    $data .= "# carton snapshot format: version @{[$lockfile->version]}\n";
+    $data .= "# carton snapshot format: version @{[$snapshot->version]}\n";
     $data .= "DISTRIBUTIONS\n";
 
-    for my $dist (sort { $a->name cmp $b->name } $lockfile->distributions) {
+    for my $dist (sort { $a->name cmp $b->name } $snapshot->distributions) {
         $data .= "  @{[$dist->name]}\n";
         $data .= "    pathname: @{[$dist->pathname]}\n";
 
diff --git a/lib/Carton/Lockfile/Parser.pm b/lib/Carton/Snapshot/Parser.pm
similarity index 85%
rename from lib/Carton/Lockfile/Parser.pm
rename to lib/Carton/Snapshot/Parser.pm
index 92eed89..b3e720d 100644
--- a/lib/Carton/Lockfile/Parser.pm
+++ b/lib/Carton/Snapshot/Parser.pm
@@ -1,4 +1,4 @@
-package Carton::Lockfile::Parser;
+package Carton::Snapshot::Parser;
 use strict;
 use Carton::Dist;
 use Moo;
@@ -6,10 +6,10 @@ use Moo;
 my $machine = {
     init => [
         {
-            re => qr/^\# carton snapshot format: version ([\d\.]+)/,
+            re => qr/^\# carton snapshot format: version (1\.0)/,
             code => sub {
-                my($stash, $lockfile, $ver) = @_;
-                $lockfile->version($ver);
+                my($stash, $snapshot, $ver) = @_;
+                $snapshot->version($ver);
             },
             goto => 'section',
         },
@@ -57,8 +57,8 @@ my $machine = {
         {
             re => qr/^\s{0,2}\S/,
             code => sub {
-                my($stash, $lockfile) = @_;
-                $lockfile->add_distribution($stash->{dist});
+                my($stash, $snapshot) = @_;
+                $snapshot->add_distribution($stash->{dist});
                 %$stash = (); # clear
             },
             goto => 'dists',
@@ -69,7 +69,7 @@ my $machine = {
         {
             re => qr/^\s{6}([0-9A-Za-z_:]+) (v?[0-9\._]+|undef)/,
             code => sub {
-                my($stash, $lockfile, $module, $version) = @_;
+                my($stash, $snapshot, $module, $version) = @_;
 
                 if ($stash->{property} eq 'provides') {
                     $stash->{dist}->provides->{$module} = { version => 
$version };
@@ -87,7 +87,7 @@ my $machine = {
 };
 
 sub parse {
-    my($self, $data, $lockfile) = @_;
+    my($self, $data, $snapshot) = @_;
 
     my @lines = split /\n/, $data;
 
@@ -102,7 +102,7 @@ sub parse {
             for my $trans (@{$state}) {
                 if (my @match = $line =~ $trans->{re}) {
                     if (my $code = $trans->{code}) {
-                        $code->($stash, $lockfile, @match);
+                        $code->($stash, $snapshot, @match);
                     }
                     if (my $goto = $trans->{goto}) {
                         $state = $machine->{$goto};

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/carton.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to