Permalink
Browse files

Initial commit. Pretty much a dead copy of cpanminus

  • Loading branch information...
0 parents commit fe783193b44e9d0a4be654474f18138a360669f5 @miyagawa committed Mar 6, 2011
Showing with 1,970 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +2 −0 .shipit
  3. +4 −0 Changes
  4. +19 −0 MANIFEST
  5. +14 −0 MANIFEST.SKIP
  6. +27 −0 Makefile.PL
  7. +25 −0 README
  8. +18 −0 bin/camp
  9. +72 −0 lib/Camp.pm
  10. +49 −0 lib/Camp/CLI.pm
  11. +32 −0 lib/Camp/Command.pm
  12. +35 −0 lib/Camp/Command/Help.pm
  13. +29 −0 lib/Camp/Command/Install.pm
  14. +16 −0 lib/Camp/Command/Usage.pm
  15. +1,615 −0 lib/Camp/Gut.pm
  16. +4 −0 t/00_compile.t
  17. +4 −0 xt/pod.t
@@ -0,0 +1,5 @@
+META.yml
+Makefile
+inc/
+pm_to_blib
+*~
@@ -0,0 +1,2 @@
+steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist, UploadCPAN
+git.push_to = origin
@@ -0,0 +1,4 @@
+Revision history for Perl extension Camp
+
+0.01 Sat Mar 5 23:23:47 2011
+ - original version
@@ -0,0 +1,19 @@
+.gitignore
+Changes
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/ReadmeFromPod.pm
+inc/Module/Install/Repository.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/Camp.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/00_compile.t
+xt/pod.t
@@ -0,0 +1,14 @@
+\bRCS\b
+\bCVS\b
+\.svn/
+\.git/
+^MANIFEST\.
+^Makefile$
+~$
+\.old$
+^blib/
+^pm_to_blib
+^MakeMaker-\d
+\.gz$
+\.cvsignore
+\.shipit
@@ -0,0 +1,27 @@
+use inc::Module::Install;
+all_from 'lib/Camp.pm';
+readme_from('lib/Camp.pm');
+
+requires 'LWP::UserAgent', 5.802;
+requires 'Try::Tiny';
+requires 'parent';
+requires 'version', 0.77;
+requires 'Pod::Usage';
+
+requires 'Parse::CPAN::Meta';
+requires 'local::lib';
+requires 'Module::Metadata';
+requires 'CPAN::DistnameInfo';
+requires 'Module::CoreList';
+requires 'JSON';
+requires 'YAML';
+requires 'Archive::Zip';
+requires 'Compress::Zlib';
+
+install_script 'bin/camp';
+
+build_requires 'Test::More', 0.88;
+test_requires 'Test::Requires';
+
+auto_set_repository();
+WriteAll;
25 README
@@ -0,0 +1,25 @@
+NAME
+ Camp - CPAN Suite (aka cpanminus plus)
+
+SYNOPSIS
+ camp install Modules
+
+INSTALLATION
+ curl -L cpanmin.us | perl - Camp
+
+DESCRIPTION
+ Camp is a fork of cpanminus with more awesomeness.
+
+AUTHOR
+ Tatsuhiko Miyagawa <miyagawa@bulknews.net>
+
+COPYRIGHT
+ Copyright 2011- Tatsuhiko Miyagawa
+
+LICENSE
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
+SEE ALSO
+ cpanminus
+
@@ -0,0 +1,18 @@
+#!perl
+use strict;
+use warnings;
+use Camp::CLI;
+
+Camp::CLI->run(@ARGV);
+
+__END__
+
+=head1 NAME
+
+camp - CPAN Suite
+
+=head1 SYNOPSIS
+
+ camp install Plack
+
+=cut
@@ -0,0 +1,72 @@
+package Camp;
+
+use strict;
+use 5.008_001;
+use version 0.77; our $VERSION = qv('v0.9.0');
+
+sub gut {
+ my $self = shift;
+ require Camp::Gut;
+ Camp::Gut->new(quiet => 1, @_);
+}
+
+sub new {
+ my($class, @args) = @_;
+ my $self = bless {}, $class;
+ $self->init;
+ $self;
+}
+
+sub init {}
+
+sub load_plugins {}
+
+sub install_modules {
+ my($self, @args) = @_;
+
+ my $gut = $self->gut;
+ $gut->parse_options(@args);
+ $gut->doit;
+}
+
+1;
+__END__
+
+=encoding utf-8
+
+=for stopwords
+
+=head1 NAME
+
+Camp - CPAN Suite (aka cpanminus plus)
+
+=head1 SYNOPSIS
+
+ camp install Modules
+
+=head1 INSTALLATION
+
+ curl -L cpanmin.us | perl - Camp
+
+=head1 DESCRIPTION
+
+Camp is a fork of cpanminus with more awesomeness.
+
+=head1 AUTHOR
+
+Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
+
+=head1 COPYRIGHT
+
+Copyright 2011- Tatsuhiko Miyagawa
+
+=head1 LICENSE
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<cpanminus>
+
+=cut
@@ -0,0 +1,49 @@
+package Camp::CLI;
+use strict;
+use warnings;
+use Getopt::Long ();
+
+use Camp;
+
+sub run {
+ my($class, @args) = @_;
+
+ # global options
+ my %options = (
+ verbose => 0,
+ quiet => 0,
+ color => 1,
+ );
+
+ Getopt::Long::Configure("no_ignore_case", "pass_through");
+ Getopt::Long::GetOptionsFromArray(
+ \@args,
+ "h|help" => \$options{help},
+ );
+
+ unshift @args, 'help' if $options{help};
+
+ my $cmd = shift @args || "usage";
+ my $command = $class->command($cmd);
+ if ($command) {
+ $command->new(\%options)->run(@args);
+ } else {
+ require Camp::Command::Usage;
+ Camp::Command::Usage->new(\%options)->run($cmd);
+ }
+}
+
+sub command {
+ my($class, $cmd) = @_;
+
+ my $command = "Camp::Command::" . ucfirst($cmd);
+ if (eval "require $command; 1") {
+ return $command;
+ }
+
+ die $@ if $@ && $@ !~ /Can\'t locate/;
+
+ return;
+}
+
+1;
@@ -0,0 +1,32 @@
+package Camp::Command;
+use strict;
+use warnings;
+
+sub new {
+ my($class, $options) = @_;
+ bless { options => $options }, $class;
+}
+
+sub cmd {
+ my $self = shift;
+ my $name = ref $self;
+ $name =~ s/.*:://;
+ return lc $name;
+}
+
+sub help {
+ my $class = shift;
+ require Pod::Usage;
+ Pod::Usage::pod2usage({ -exitval => 0, -input => $class->inc_file });
+}
+
+sub inc_file {
+ my $class = shift;
+
+ my $file = ref $class || $class;
+ $file =~ s!::!/!g;
+
+ return $INC{"$file.pm"};
+}
+
+1;
@@ -0,0 +1,35 @@
+package Camp::Command::Help;
+use strict;
+use warnings;
+use parent qw(Camp::Command);
+
+sub COLUMN() { 12 }
+
+sub run {
+ my($self, $cmd) = @_;
+
+ if ($cmd) {
+ my $command = Camp::CLI->command($cmd);
+ return $command->help if $command;
+ }
+
+ my $camp = Camp->new;
+ $camp->load_plugins;
+
+ print <<HELP;
+Usage: camp COMMAND [OPTIONS]
+
+Options:
+ -h, --help Show help
+ -v, --version Show program's version
+
+Available commands:
+ install Install distributions
+ uninstall Uninstall distributions
+ upgrade Upgrade all distributions
+ info Show the information about distributions
+ scandeps Scan and show the depednencies tree
+HELP
+}
+
+1;
@@ -0,0 +1,29 @@
+package Camp::Command::Install;
+use strict;
+use warnings;
+use parent qw(Camp::Command);
+
+sub run {
+ my($self, @args) = @_;
+
+ my $camp = Camp->new;
+ $camp->install_modules(@args);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+CLI::Command::Install - Install modules
+
+=head1 SYNOPSIS
+
+ camp install Plack
+
+=head1 OPTIONS
+
+blah blah blah
+
+=cut
@@ -0,0 +1,16 @@
+package Camp::Command::Usage;
+use strict;
+use warnings;
+use parent qw(Camp::Command);
+
+sub run {
+ my($self, $cmd) = @_;
+
+ my $usage = "Usage: camp COMMAND [OPTIONS]\n\n";
+ $usage .= "Unknown command: $cmd\n\n" if $cmd;
+ $usage .= "Type `camp help` to see the list of commands\n";
+
+ die $usage;
+}
+
+1;
Oops, something went wrong.

0 comments on commit fe78319

Please sign in to comment.