Merge
Tomas Doran [Thu, 27 Aug 2009 00:24:28 +0000 (01:24 +0100)]
14 files changed:
.gitignore [new file with mode: 0644]
ChangeLog
MANIFEST [deleted file]
MANIFEST.SKIP
Makefile.PL
README
lib/MooseX/Getopt.pm
lib/MooseX/Getopt/Meta/Attribute.pm
lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm
lib/MooseX/Getopt/Meta/Attribute/Trait.pm
lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm
lib/MooseX/Getopt/OptionTypeMap.pm
t/005_strict.t
t/008_configfromfile.t

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..dc5027d
--- /dev/null
@@ -0,0 +1,8 @@
+pm_to_blib
+inc
+blib
+Makefile
+Makefile.old
+META.yml
+MANIFEST
+MANIFEST.bak
index 3a0007c..10b28cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 Revision history for Perl extension MooseX-Getopt
 
+0.20 Wed. July 9 2009
+       ~ fix MANIFEST.SKIP to avoid double-packaging
+
+0.19 Wed. July 8 2009
+  * MooseX::Getopt
+    - Fix Getopt config spec for --configfile (t0m)
+    - Add support for --usage/--help/--? (drew@drewtaylor.com)
+    - Fix new_with_options to accept a hashref (DOUGDUDE@cpan.org)
+
+  * Tests
+    - Fix warning from tests with new Moose (t0m)
+    - Fix tests on Win32 from RT#44909 (taro-nishino)
+
 0.18 Thu. April 9 2009
        * MooseX::Getopt::Dashes
                - New module, for converting undercores to dashes (ilmari)
diff --git a/MANIFEST b/MANIFEST
deleted file mode 100644 (file)
index bec9b4b..0000000
--- a/MANIFEST
+++ /dev/null
@@ -1,38 +0,0 @@
-ChangeLog
-inc/Module/AutoInstall.pm
-inc/Module/Install.pm
-inc/Module/Install/AutoInstall.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Include.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
-lib/MooseX/Getopt.pm
-lib/MooseX/Getopt/Dashes.pm
-lib/MooseX/Getopt/Meta/Attribute.pm
-lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm
-lib/MooseX/Getopt/Meta/Attribute/Trait.pm
-lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm
-lib/MooseX/Getopt/OptionTypeMap.pm
-lib/MooseX/Getopt/Strict.pm
-Makefile.PL
-MANIFEST
-META.yml
-README
-t/000_load.t
-t/001_basic.t
-t/002_custom_option_type.t
-t/003_inferred_option_type.t
-t/004_nogetop.t
-t/005_strict.t
-t/006_metaclass_traits.t
-t/007_nogetopt_trait.t
-t/008_configfromfile.t
-t/009_gld_and_explicit_options.t
-t/010_dashes.t
-t/100_gld_default_bug.t
-t/pod.t
-t/pod_coverage.t
index 3de3ebc..45ff306 100644 (file)
@@ -1,3 +1,4 @@
+^.git
 ^_build
 ^Build$
 ^blib
@@ -16,4 +17,5 @@ cover_db
 \.old$
 ^#.*#$
 ^\.#
-^TODO$
\ No newline at end of file
+^TODO$
+^MooseX-Getopt
index 3ab0c74..681fd58 100644 (file)
@@ -15,6 +15,6 @@ build_requires 'Test::More'       => '0.62';
 build_requires 'Test::Exception'  => '0.21';
 
 tests_recursive();
-auto_install;
+auto_manifest();
 
 WriteAll;
diff --git a/README b/README
index 3978368..5c6b104 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-MooseX::Getopt version 0.18
+MooseX::Getopt version 0.20
 ===========================
 
 See the individual module documentation for more information
index 8907942..8369321 100644 (file)
@@ -11,7 +11,7 @@ use Carp ();
 use Getopt::Long (); # GLD uses it anyway, doesn't hurt
 use constant HAVE_GLD => not not eval { require Getopt::Long::Descriptive };
 
-our $VERSION   = '0.18';
+our $VERSION   = '0.20';
 our $AUTHORITY = 'cpan:STEVAN';
 
 has ARGV       => (is => 'rw', isa => 'ArrayRef', metaclass => "NoGetopt");
@@ -52,10 +52,16 @@ sub new_with_options {
 
     my $params = $config_from_file ? { %$config_from_file, %{$processed{params}} } : $processed{params};
 
+    # did the user request usage information?
+    if ( $processed{usage} && ($params->{'?'} or $params->{help} or $params->{usage}) )
+    {
+        $processed{usage}->die();
+    }
+
     $class->new(
         ARGV       => $processed{argv_copy},
         extra_argv => $processed{argv},
-        @params, # explicit params to ->new
+        %$constructor_params, # explicit params to ->new
         %$params, # params from CLI
     );
 }
@@ -193,7 +199,10 @@ sub _attrs_to_options {
 
         my $opt_string = join(q{|}, $flag, @aliases);
 
-        if ($attr->has_type_constraint) {
+        if ($attr->name eq 'configfile') {
+            $opt_string .= '=s';
+        }
+        elsif ($attr->has_type_constraint) {
             my $type = $attr->type_constraint;
             if (MooseX::Getopt::OptionTypeMap->has_option_type($type)) {
                 $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type)
@@ -414,9 +423,21 @@ This method will take a set of default C<%params> and then collect
 params from the command line (possibly overriding those in C<%params>)
 and then return a newly constructed object.
 
+The special parameter C<argv>, if specified should point to an array  
+reference with an array to use instead of C<@ARGV>.
+
 If L<Getopt::Long/GetOptions> fails (due to invalid arguments),
 C<new_with_options> will throw an exception.
 
+If L<Getopt::Long::Descriptive> is installed and any of the following
+command line params are passed, the program will exit with usage 
+information. You can add descriptions for each option by including a
+B<documentation> option for each attribute to document.
+
+  --?
+  --help
+  --usage
+
 If you have L<Getopt::Long::Descriptive> the C<usage> param is also passed to
 C<new>.
 
@@ -455,6 +476,8 @@ Yuval Kogman, E<lt>nothingmuch@woobling.orgE<gt>
 
 Ryan D Johnson, E<lt>ryan@innerfence.comE<gt>
 
+Drew Taylor, E<lt>drew@drewtaylor.comE<gt>
+
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2007-2008 by Infinity Interactive, Inc.
index f71ea67..7bb6477 100644 (file)
@@ -3,7 +3,7 @@ package MooseX::Getopt::Meta::Attribute;
 use Moose;
 use Moose::Util::TypeConstraints;
 
-our $VERSION   = '0.18';
+our $VERSION   = '0.20';
 our $AUTHORITY = 'cpan:STEVAN';
 
 extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
index 69be43d..1d98a83 100644 (file)
@@ -2,7 +2,7 @@
 package MooseX::Getopt::Meta::Attribute::NoGetopt;
 use Moose;
 
-our $VERSION   = '0.18';
+our $VERSION   = '0.20';
 our $AUTHORITY = 'cpan:STEVAN';
 
 extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
index 3171837..74177d5 100644 (file)
@@ -3,7 +3,7 @@ package MooseX::Getopt::Meta::Attribute::Trait;
 use Moose::Role;
 use Moose::Util::TypeConstraints;
 
-our $VERSION   = '0.18';
+our $VERSION   = '0.20';
 our $AUTHORITY = 'cpan:STEVAN';
 
 has 'cmd_flag' => (
index c618f0b..180d705 100644 (file)
@@ -2,7 +2,7 @@
 package MooseX::Getopt::Meta::Attribute::Trait::NoGetopt;
 use Moose::Role;
 
-our $VERSION   = '0.18';
+our $VERSION   = '0.20';
 our $AUTHORITY = 'cpan:STEVAN';
 
 no Moose::Role;
index b0157f1..f634726 100644 (file)
@@ -4,7 +4,7 @@ package MooseX::Getopt::OptionTypeMap;
 use Moose 'confess', 'blessed';
 use Moose::Util::TypeConstraints 'find_type_constraint';
 
-our $VERSION   = '0.18';
+our $VERSION   = '0.20';
 our $AUTHORITY = 'cpan:STEVAN';
 
 my %option_type_map = (
index 8a8d634..206cb64 100644 (file)
@@ -70,14 +70,6 @@ BEGIN {
         isa      => 'Int',
         default  => 713
     );
-
-    has '_private_stuff_cmdline' => (
-        is        => 'ro',
-        isa       => 'Int',
-        default   => 832,
-        cmd_flag  => 'p',
-    );
-
 }
 
 {
index 93700b9..292e6f5 100644 (file)
@@ -5,6 +5,7 @@ use warnings;
 
 use Test::Exception;
 use Test::More;
+use File::Spec;
 
 if ( !eval { require MooseX::ConfigFromFile } )
 {
@@ -55,7 +56,8 @@ else
             optional_from_config => 'from_config_2',
         );
 
-        if ( $file ne '/notused/default' ) {
+        my $cpath = File::Spec->canonpath('/notused/default');
+        if ( $file ne $cpath ) {
             $config{config_from_override} = 1;
         }
 
@@ -70,7 +72,7 @@ else
     extends 'App';
 
     has '+configfile' => (
-        default => '/notused/default',
+        default => File::Spec->canonpath('/notused/default'),
     );
 }
 
@@ -88,7 +90,7 @@ else
         ok(  !$app->config_from_override,
             '... config_from_override false as expected' );
 
-        is( $app->configfile, '/notused/default',
+        is( $app->configfile, File::Spec->canonpath('/notused/default'),
             '... configfile is /notused/default as expected' );
     }
 }
@@ -111,7 +113,7 @@ else
         ok( $app->config_from_override,
              '... config_from_override true as expected' );
 
-        is( $app->configfile, '/notused',
+        is( $app->configfile, File::Spec->canonpath('/notused'),
             '... configfile is /notused as expected' );
     }
 }