r56284 - in /trunk/libversion-requirements-perl: Changes MANIFEST META.json META.yml Makefile.PL README debian/changelog debian/control lib/Version/Requirements.pm t/accepts.t t/finalize.t t/release-pod-coverage.t
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sat Apr 17 08:08:43 UTC 2010
Author: ansgar-guest
Date: Sat Apr 17 08:08:26 2010
New Revision: 56284
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=56284
Log:
* New upstream release.
* Add myself to Uploaders.
Added:
trunk/libversion-requirements-perl/t/finalize.t
- copied unchanged from r56283, branches/upstream/libversion-requirements-perl/current/t/finalize.t
Removed:
trunk/libversion-requirements-perl/t/release-pod-coverage.t
Modified:
trunk/libversion-requirements-perl/Changes
trunk/libversion-requirements-perl/MANIFEST
trunk/libversion-requirements-perl/META.json
trunk/libversion-requirements-perl/META.yml
trunk/libversion-requirements-perl/Makefile.PL
trunk/libversion-requirements-perl/README
trunk/libversion-requirements-perl/debian/changelog
trunk/libversion-requirements-perl/debian/control
trunk/libversion-requirements-perl/lib/Version/Requirements.pm
trunk/libversion-requirements-perl/t/accepts.t
Modified: trunk/libversion-requirements-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/Changes?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/Changes (original)
+++ trunk/libversion-requirements-perl/Changes Sat Apr 17 08:08:26 2010
@@ -1,6 +1,12 @@
Revision history for Version-Requirements
-0.100660 2010-03-07 13:04:25 America/New_York
+0.101020 2010-04-12 09:08:26 America/New_York
+ add finalization with ->finalize and ->is_finalized
+
+0.101010 2010-04-11 10:20:02 America/New_York
+ add a public accepts_module version
+
+0.100660 2010-03-07 13:05:59 America/New_York
specify that we need version.pm 0.77
0.100630 2010-03-04 22:54:15 America/New_York
Modified: trunk/libversion-requirements-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/MANIFEST?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/MANIFEST (original)
+++ trunk/libversion-requirements-perl/MANIFEST Sat Apr 17 08:08:26 2010
@@ -9,7 +9,7 @@
lib/Version/Requirements.pm
t/accepts.t
t/basic.t
+t/finalize.t
t/from-hash.t
t/merge.t
-t/release-pod-coverage.t
t/release-pod-syntax.t
Modified: trunk/libversion-requirements-perl/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/META.json?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/META.json (original)
+++ trunk/libversion-requirements-perl/META.json Sat Apr 17 08:08:26 2010
@@ -1,28 +1,196 @@
{
+ "abstract" : "a set of version requirements for a CPAN dist",
+ "author" : [
+ "Ricardo Signes <rjbs at cpan.org>"
+ ],
+ "build_requires" : {
+ "Test::More" : "0.88"
+ },
+ "configure_requires" : {
+ "ExtUtils::MakeMaker" : "6.31"
+ },
+ "generated_by" : "Dist::Zilla version 2.100991",
+ "license" : "perl",
+ "meta-spec" : {
+ "url" : "http://module-build.sourceforge.net/META-spec-v1.4.html",
+ "version" : 1.4
+ },
+ "name" : "Version-Requirements",
+ "recommends" : {},
+ "requires" : {
+ "Carp" : "0",
+ "Scalar::Util" : "0",
+ "version" : "0.77"
+ },
"resources" : {
"repository" : "git://git.codesimply.com/Version-Requirements.git"
},
- "meta-spec" : {
- "version" : 1.4,
- "url" : "http://module-build.sourceforge.net/META-spec-v1.4.html"
- },
- "generated_by" : "Dist::Zilla version 1.100660",
- "version" : "0.100660",
- "name" : "Version-Requirements",
- "author" : [
- "Ricardo Signes <rjbs at cpan.org>"
- ],
- "license" : "perl",
- "build_requires" : {},
- "requires" : {
- "Scalar::Util" : "0",
- "Test::More" : "0.88",
- "version" : "0.77",
- "Carp" : "0"
- },
- "abstract" : "a set of version requirements for a CPAN dist",
- "configure_requires" : {
- "ExtUtils::MakeMaker" : "6.11"
+ "version" : "0.101020",
+ "x_Dist_Zilla" : {
+ "plugins" : [
+ {
+ "class" : "Dist::Zilla::Plugin::GatherDir",
+ "name" : "@RJBS/@Basic/GatherDir",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PruneCruft",
+ "name" : "@RJBS/@Basic/PruneCruft",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ManifestSkip",
+ "name" : "@RJBS/@Basic/ManifestSkip",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaYAML",
+ "name" : "@RJBS/@Basic/MetaYAML",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::License",
+ "name" : "@RJBS/@Basic/License",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Readme",
+ "name" : "@RJBS/@Basic/Readme",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ExtraTests",
+ "name" : "@RJBS/@Basic/ExtraTests",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ExecDir",
+ "name" : "@RJBS/@Basic/ExecDir",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ShareDir",
+ "name" : "@RJBS/@Basic/ShareDir",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MakeMaker",
+ "name" : "@RJBS/@Basic/MakeMaker",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Manifest",
+ "name" : "@RJBS/@Basic/Manifest",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::TestRelease",
+ "name" : "@RJBS/@Basic/TestRelease",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ConfirmRelease",
+ "name" : "@RJBS/@Basic/ConfirmRelease",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::UploadToCPAN",
+ "name" : "@RJBS/@Basic/UploadToCPAN",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::AutoPrereq",
+ "name" : "@RJBS/AutoPrereq",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::AutoVersion",
+ "name" : "@RJBS/AutoVersion",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PkgVersion",
+ "name" : "@RJBS/PkgVersion",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaConfig",
+ "name" : "@RJBS/MetaConfig",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaJSON",
+ "name" : "@RJBS/MetaJSON",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::NextRelease",
+ "name" : "@RJBS/NextRelease",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
+ "name" : "@RJBS/PodSyntaxTests",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodWeaver",
+ "name" : "@RJBS/PodWeaver",
+ "version" : "3.100710"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Repository",
+ "name" : "@RJBS/Repository",
+ "version" : "0.11"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Check",
+ "name" : "@RJBS/@Git/Check",
+ "version" : "1.100970"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Commit",
+ "name" : "@RJBS/@Git/Commit",
+ "version" : "1.100970"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Tag",
+ "name" : "@RJBS/@Git/Tag",
+ "version" : "1.100970"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Push",
+ "name" : "@RJBS/@Git/Push",
+ "version" : "1.100970"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":InstallModules",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":TestFiles",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":ExecFiles",
+ "version" : "2.100991"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":ShareFiles",
+ "version" : "2.100991"
+ }
+ ],
+ "zilla" : {
+ "class" : "Dist::Zilla",
+ "config" : {
+ "is_trial" : 0
+ },
+ "version" : "2.100991"
+ }
}
}
Modified: trunk/libversion-requirements-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/META.yml?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/META.yml (original)
+++ trunk/libversion-requirements-perl/META.yml Sat Apr 17 08:08:26 2010
@@ -2,20 +2,152 @@
abstract: 'a set of version requirements for a CPAN dist'
author:
- 'Ricardo Signes <rjbs at cpan.org>'
-build_requires: {}
+build_requires:
+ Test::More: 0.88
configure_requires:
- ExtUtils::MakeMaker: 6.11
-generated_by: 'Dist::Zilla version 1.100660'
+ ExtUtils::MakeMaker: 6.31
+generated_by: 'Dist::Zilla version 2.100991'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Version-Requirements
+recommends: {}
requires:
Carp: 0
Scalar::Util: 0
- Test::More: 0.88
version: 0.77
resources:
repository: git://git.codesimply.com/Version-Requirements.git
-version: 0.100660
+version: 0.101020
+x_Dist_Zilla:
+ plugins:
+ -
+ class: Dist::Zilla::Plugin::GatherDir
+ name: '@RJBS/@Basic/GatherDir'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::PruneCruft
+ name: '@RJBS/@Basic/PruneCruft'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::ManifestSkip
+ name: '@RJBS/@Basic/ManifestSkip'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::MetaYAML
+ name: '@RJBS/@Basic/MetaYAML'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::License
+ name: '@RJBS/@Basic/License'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::Readme
+ name: '@RJBS/@Basic/Readme'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::ExtraTests
+ name: '@RJBS/@Basic/ExtraTests'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::ExecDir
+ name: '@RJBS/@Basic/ExecDir'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::ShareDir
+ name: '@RJBS/@Basic/ShareDir'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::MakeMaker
+ name: '@RJBS/@Basic/MakeMaker'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::Manifest
+ name: '@RJBS/@Basic/Manifest'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::TestRelease
+ name: '@RJBS/@Basic/TestRelease'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::ConfirmRelease
+ name: '@RJBS/@Basic/ConfirmRelease'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::UploadToCPAN
+ name: '@RJBS/@Basic/UploadToCPAN'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::AutoPrereq
+ name: '@RJBS/AutoPrereq'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::AutoVersion
+ name: '@RJBS/AutoVersion'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::PkgVersion
+ name: '@RJBS/PkgVersion'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::MetaConfig
+ name: '@RJBS/MetaConfig'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::MetaJSON
+ name: '@RJBS/MetaJSON'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::NextRelease
+ name: '@RJBS/NextRelease'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::PodSyntaxTests
+ name: '@RJBS/PodSyntaxTests'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::PodWeaver
+ name: '@RJBS/PodWeaver'
+ version: 3.100710
+ -
+ class: Dist::Zilla::Plugin::Repository
+ name: '@RJBS/Repository'
+ version: 0.11
+ -
+ class: Dist::Zilla::Plugin::Git::Check
+ name: '@RJBS/@Git/Check'
+ version: 1.100970
+ -
+ class: Dist::Zilla::Plugin::Git::Commit
+ name: '@RJBS/@Git/Commit'
+ version: 1.100970
+ -
+ class: Dist::Zilla::Plugin::Git::Tag
+ name: '@RJBS/@Git/Tag'
+ version: 1.100970
+ -
+ class: Dist::Zilla::Plugin::Git::Push
+ name: '@RJBS/@Git/Push'
+ version: 1.100970
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':InstallModules'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':TestFiles'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':ExecFiles'
+ version: 2.100991
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':ShareFiles'
+ version: 2.100991
+ zilla:
+ class: Dist::Zilla
+ config:
+ is_trial: 0
+ version: 2.100991
Modified: trunk/libversion-requirements-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/Makefile.PL?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/Makefile.PL (original)
+++ trunk/libversion-requirements-perl/Makefile.PL Sat Apr 17 08:08:26 2010
@@ -4,7 +4,7 @@
-use ExtUtils::MakeMaker 6.11;
+use ExtUtils::MakeMaker 6.31;
@@ -15,16 +15,17 @@
'NAME' => 'Version::Requirements',
'DISTNAME' => 'Version-Requirements',
'CONFIGURE_REQUIRES' => {
- 'ExtUtils::MakeMaker' => '6.11'
+ 'ExtUtils::MakeMaker' => '6.31'
},
'AUTHOR' => 'Ricardo Signes <rjbs at cpan.org>',
- 'BUILD_REQUIRES' => {},
+ 'BUILD_REQUIRES' => {
+ 'Test::More' => '0.88'
+ },
'ABSTRACT' => 'a set of version requirements for a CPAN dist',
'EXE_FILES' => [],
- 'VERSION' => '0.100660',
+ 'VERSION' => '0.101020',
'PREREQ_PM' => {
'Scalar::Util' => '0',
- 'Test::More' => '0.88',
'version' => '0.77',
'Carp' => '0'
},
@@ -32,8 +33,11 @@
);
-delete $WriteMakefileArgs{LICENSE}
- unless eval { ExtUtils::MakeMaker->VERSION(6.31) };
+delete $WriteMakefileArgs{BUILD_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.56) };
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
Modified: trunk/libversion-requirements-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/README?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/README (original)
+++ trunk/libversion-requirements-perl/README Sat Apr 17 08:08:26 2010
@@ -1,7 +1,7 @@
-This archive contains the distribution Version-Requirements, version
-0.100660:
+This archive contains the distribution Version-Requirements,
+version 0.101020:
a set of version requirements for a CPAN dist
@@ -10,3 +10,4 @@
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
+
Modified: trunk/libversion-requirements-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/debian/changelog?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/debian/changelog (original)
+++ trunk/libversion-requirements-perl/debian/changelog Sat Apr 17 08:08:26 2010
@@ -1,3 +1,10 @@
+libversion-requirements-perl (0.101020-1) unstable; urgency=low
+
+ * New upstream release.
+ * Add myself to Uploaders.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Sat, 17 Apr 2010 17:08:15 +0900
+
libversion-requirements-perl (0.100660-1) unstable; urgency=low
* Initial release (closes: #572907).
Modified: trunk/libversion-requirements-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/debian/control?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/debian/control (original)
+++ trunk/libversion-requirements-perl/debian/control Sat Apr 17 08:08:26 2010
@@ -4,7 +4,8 @@
Build-Depends: debhelper (>= 7)
Build-Depends-Indep: perl (>= 5.10.1)
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: gregor herrmann <gregoa at debian.org>
+Uploaders: gregor herrmann <gregoa at debian.org>,
+ Ansgar Burchardt <ansgar at 43-1.org>
Standards-Version: 3.8.4
Homepage: http://search.cpan.org/dist/Version-Requirements/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libversion-requirements-perl/
Modified: trunk/libversion-requirements-perl/lib/Version/Requirements.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/lib/Version/Requirements.pm?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/lib/Version/Requirements.pm (original)
+++ trunk/libversion-requirements-perl/lib/Version/Requirements.pm Sat Apr 17 08:08:26 2010
@@ -1,7 +1,9 @@
use strict;
use warnings;
package Version::Requirements;
-our $VERSION = '0.100660';
+BEGIN {
+ $Version::Requirements::VERSION = '0.101020';
+}
# ABSTRACT: a set of version requirements for a CPAN dist
@@ -36,9 +38,7 @@
$version = $self->_version_object( $version );
- my $old = $self->{ $name } || 'Version::Requirements::_Spec::Range';
-
- $self->{ $name } = $old->$method($version);
+ $self->__modify_entry_for($name, $method, $version);
return $self;
};
@@ -64,15 +64,31 @@
}
+sub accepts_module {
+ my ($self, $module, $version) = @_;
+
+ $version = $self->_version_object( $version );
+
+ return 1 unless my $range = $self->__entry_for($module);
+ return $range->_accepts($version);
+}
+
+
sub clear_requirement {
my ($self, $module) = @_;
- delete $self->{ $module };
+
+ return $self unless $self->__entry_for($module);
+
+ Carp::confess("can't clear requirements on finalized requirements")
+ if $self->is_finalized;
+
+ delete $self->{requirements}{ $module };
return $self;
}
-sub required_modules { keys %{ $_[ 0 ] } }
+sub required_modules { keys %{ $_[0]{requirements} } }
sub clone {
@@ -82,8 +98,24 @@
return $new->add_requirements($self);
}
-sub __entry_for {
- $_[0]{ $_[1] }
+sub __entry_for { $_[0]{requirements}{ $_[1] } }
+
+sub __modify_entry_for {
+ my ($self, $name, $method, $version) = @_;
+
+ my $fin = $self->is_finalized;
+ my $old = $self->__entry_for($name);
+
+ Carp::confess("can't add new requirements to finalized requirements")
+ if $fin and not $old;
+
+ my $new = ($old || 'Version::Requirements::_Range::Range')
+ ->$method($version);
+
+ Carp::confess("can't modify finalized requirements")
+ if $fin and $old->as_string ne $new->as_string;
+
+ $self->{requirements}{ $name } = $new;
}
@@ -98,10 +130,17 @@
}
+sub is_finalized { $_[0]{finalized} }
+
+
+sub finalize { $_[0]{finalized} = 1 }
+
+
sub as_string_hash {
my ($self) = @_;
- my %hash = map {; $_ => $self->{$_}->as_string } keys %$self;
+ my %hash = map {; $_ => $self->{requirements}{$_}->as_string }
+ $self->required_modules;
return \%hash;
}
@@ -144,8 +183,10 @@
{
package
- Version::Requirements::_Spec::Exact;
-our $VERSION = '0.100660';
+ Version::Requirements::_Range::Exact;
+BEGIN {
+ $Version::Requirements::_Range::Exact::VERSION = '0.101020';
+}
sub _new { bless { version => $_[1] } => $_[0] }
sub _accepts { return $_[0]{version} == $_[1] }
@@ -153,30 +194,34 @@
sub as_string { return "== $_[0]{version}" }
sub as_modifiers { return [ [ exact_version => $_[0]{version} ] ] }
+
+ sub _clone {
+ (ref $_[0])->_new( version->new( $_[0]{version} ) )
+ }
sub with_exact_version {
my ($self, $version) = @_;
- return $self if $self->_accepts($version);
+ return $self->_clone if $self->_accepts($version);
Carp::confess("illegal requirements: unequal exact version specified");
}
sub with_minimum {
my ($self, $minimum) = @_;
- return $self if $self->{version} >= $minimum;
+ return $self->_clone if $self->{version} >= $minimum;
Carp::confess("illegal requirements: minimum above exact specification");
}
sub with_maximum {
my ($self, $maximum) = @_;
- return $self if $self->{version} <= $maximum;
+ return $self->_clone if $self->{version} <= $maximum;
Carp::confess("illegal requirements: maximum below exact specification");
}
sub with_exclusion {
my ($self, $exclusion) = @_;
- return $self unless $exclusion == $self->{version};
+ return $self->_clone unless $exclusion == $self->{version};
Carp::confess("illegal requirements: excluded exact specification");
}
}
@@ -185,10 +230,28 @@
{
package
- Version::Requirements::_Spec::Range;
-our $VERSION = '0.100660';
+ Version::Requirements::_Range::Range;
+BEGIN {
+ $Version::Requirements::_Range::Range::VERSION = '0.101020';
+}
sub _self { ref($_[0]) ? $_[0] : (bless { } => $_[0]) }
+
+ sub _clone {
+ return (bless { } => $_[0]) unless ref $_[0];
+
+ my ($s) = @_;
+ my %guts = (
+ (exists $s->{minimum} ? (minimum => version->new($s->{minimum})) : ()),
+ (exists $s->{maximum} ? (maximum => version->new($s->{maximum})) : ()),
+
+ (exists $s->{exclusions}
+ ? (exclusions => [ map { version->new($_) } @{ $s->{exclusions} } ])
+ : ()),
+ );
+
+ bless \%guts => ref($s);
+ }
sub as_modifiers {
my ($self) = @_;
@@ -233,12 +296,12 @@
sub with_exact_version {
my ($self, $version) = @_;
- $self = $self->_self;
+ $self = $self->_clone;
Carp::confess("illegal requirements: exact specification outside of range")
unless $self->_accepts($version);
- return Version::Requirements::_Spec::Exact->_new($version);
+ return Version::Requirements::_Range::Exact->_new($version);
}
sub _simplify {
@@ -249,7 +312,7 @@
Carp::confess("illegal requirements: excluded all values")
if grep { $_ == $self->{minimum} } @{ $self->{exclusions} || [] };
- return Version::Requirements::_Spec::Exact->_new($self->{minimum})
+ return Version::Requirements::_Range::Exact->_new($self->{minimum})
}
Carp::confess("illegal requirements: minimum exceeds maximum")
@@ -273,7 +336,7 @@
sub with_minimum {
my ($self, $minimum) = @_;
- $self = $self->_self;
+ $self = $self->_clone;
if (defined (my $old_min = $self->{minimum})) {
$self->{minimum} = (sort { $b cmp $a } ($minimum, $old_min))[0];
@@ -286,7 +349,7 @@
sub with_maximum {
my ($self, $maximum) = @_;
- $self = $self->_self;
+ $self = $self->_clone;
if (defined (my $old_max = $self->{maximum})) {
$self->{maximum} = (sort { $a cmp $b } ($maximum, $old_max))[0];
@@ -299,7 +362,7 @@
sub with_exclusion {
my ($self, $exclusion) = @_;
- $self = $self->_self;
+ $self = $self->_clone;
push @{ $self->{exclusions} ||= [] }, $exclusion;
@@ -329,7 +392,7 @@
=head1 VERSION
-version 0.100660
+version 0.101020
=head1 SYNOPSIS
@@ -424,6 +487,21 @@
This method returns the requirements object.
+=head2 accepts_module
+
+ my $bool = $req->accepts_modules($module => $version);
+
+Given an module and version, this method returns true if the version
+specification for the module accepts the provided version. In other words,
+given:
+
+ Module => '>= 1.00, < 2.00'
+
+We will accept 1.00 and 1.75 but not 0.50 or 2.00.
+
+For modules that do not appear in the requirements, this method will return
+true.
+
=head2 clear_requirement
$req->clear_requirement( $module );
@@ -448,6 +526,20 @@
This method returns true if and only if all requirements are inclusive minimums
-- that is, if their string expression is just the version number.
+
+=head2 is_finalized
+
+This method returns true if the requirements have been finalized by having the
+C<finalize> method called on them.
+
+=head2 finalize
+
+This method marks the requirements finalized. Subsequent attempts to change
+the requirements will be fatal, I<if> they would result in a change. If they
+would not alter the requirements, they have no effect.
+
+If a finalized set of requirements is cloned, the cloned requirements are not
+also finalized.
=head2 as_string_hash
Modified: trunk/libversion-requirements-perl/t/accepts.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libversion-requirements-perl/t/accepts.t?rev=56284&op=diff
==============================================================================
--- trunk/libversion-requirements-perl/t/accepts.t (original)
+++ trunk/libversion-requirements-perl/t/accepts.t Sat Apr 17 08:08:26 2010
@@ -5,30 +5,25 @@
use Test::More 0.88;
-# XXX: We're gonna violate us some encapsulation here and call us some private
-# methods. Y'all better just resign yourself to it. -- rjbs, 2010-02-22
{
my $req = Version::Requirements->new->add_minimum(Foo => 1);
- my $foo = $req->{Foo};
- ok($foo->_accepts(1));
- ok(! $foo->_accepts(0));
+ ok( $req->accepts_module(Foo => 1));
+ ok(! $req->accepts_module(Foo => 0));
}
{
my $req = Version::Requirements->new->add_maximum(Foo => 1);
- my $foo = $req->{Foo};
- ok($foo->_accepts(1));
- ok(! $foo->_accepts(2));
+ ok( $req->accepts_module(Foo => 1));
+ ok(! $req->accepts_module(Foo => 2));
}
{
my $req = Version::Requirements->new->add_exclusion(Foo => 1);
- my $foo = $req->{Foo};
- ok($foo->_accepts(0));
- ok(! $foo->_accepts(1));
+ ok( $req->accepts_module(Foo => 0));
+ ok(! $req->accepts_module(Foo => 1));
}
done_testing;
More information about the Pkg-perl-cvs-commits
mailing list