Dist-Zilla-BeLike-CSJEWELL

changeset 14:26ff2a3c185a

Perltidy run.
author Curtis Jewell <csjewell@cpan.org>
date Fri Aug 13 11:17:06 2010 -0600 (2010-08-13)
parents 35f52d796bbe
children cc452e849ea7
files lib/Dist/Zilla/Plugin/CSJEWELL/FTPUploadToOwnSite.pm lib/Dist/Zilla/Plugin/CSJEWELL/SubversionDist.pm lib/Dist/Zilla/PluginBundle/CSJEWELL.pm
line diff
     1.1 --- a/lib/Dist/Zilla/Plugin/CSJEWELL/FTPUploadToOwnSite.pm	Fri Aug 13 11:16:33 2010 -0600
     1.2 +++ b/lib/Dist/Zilla/Plugin/CSJEWELL/FTPUploadToOwnSite.pm	Fri Aug 13 11:17:06 2010 -0600
     1.3 @@ -10,69 +10,72 @@
     1.4  $VERSION =~ s/_//sm;
     1.5  
     1.6  has site => (
     1.7 -  is   => 'ro',
     1.8 -  isa  => 'Str',
     1.9 -  required => 1,
    1.10 +	is       => 'ro',
    1.11 +	isa      => 'Str',
    1.12 +	required => 1,
    1.13  );
    1.14  
    1.15  has directory => (
    1.16 -  is   => 'ro',
    1.17 -  isa  => 'Str',
    1.18 -  required => 1,
    1.19 +	is       => 'ro',
    1.20 +	isa      => 'Str',
    1.21 +	required => 1,
    1.22  );
    1.23  
    1.24  has passive_ftp => (
    1.25 -  is   => 'ro',
    1.26 -  isa  => 'Int',
    1.27 -  default => 1,
    1.28 +	is      => 'ro',
    1.29 +	isa     => 'Int',
    1.30 +	default => 1,
    1.31  );
    1.32  
    1.33  has debug => (
    1.34 -  is   => 'ro',
    1.35 -  isa  => 'Int',
    1.36 -  default => 0,
    1.37 +	is      => 'ro',
    1.38 +	isa     => 'Int',
    1.39 +	default => 0,
    1.40  );
    1.41  
    1.42  sub release {
    1.43 -	my ($self, $archive) = @_;
    1.44 +	my ( $self, $archive ) = @_;
    1.45  
    1.46 -	my $site = $self->site();
    1.47 -	my $siteinfo = Net::Netrc->lookup($self->site());
    1.48 -	my ($user, $password, undef) = $siteinfo->lpa();
    1.49 -	
    1.50 +	my $site     = $self->site();
    1.51 +	my $siteinfo = Net::Netrc->lookup( $self->site() );
    1.52 +	my ( $user, $password, undef ) = $siteinfo->lpa();
    1.53 +
    1.54  	my $ftp = Net::FTP->new(
    1.55  		$site,
    1.56  		Debug   => $self->debug(),
    1.57  		Passive => $self->passive_ftp(),
    1.58  	);
    1.59 -	
    1.60 -	$ftp->login($user, $password) or $self->log_fatal("Could not log in to " . $site);
    1.61 -	
    1.62 +
    1.63 +	$ftp->login( $user, $password )
    1.64 +	  or $self->log_fatal( 'Could not log in to ' . $site );
    1.65 +
    1.66  	$ftp->binary;
    1.67  
    1.68 -	$ftp->cwd($self->directory()) or $self->log_fatal("Could not change remote site directory to" . $self->directory());
    1.69 -	
    1.70 -	my $remote_file = $ftp->put($archive, $archive);
    1.71 -	
    1.72 +	$ftp->cwd( $self->directory() )
    1.73 +	  or $self->log_fatal(
    1.74 +		'Could not change remote site directory to' . $self->directory() );
    1.75 +
    1.76 +	my $remote_file = $ftp->put( $archive, $archive );
    1.77 +
    1.78  	if ( $remote_file ne $archive ) {
    1.79 -		$self->log_fatal( "Could not upload file: " . $ftp->message );
    1.80 +		$self->log_fatal( 'Could not upload file: ' . $ftp->message() );
    1.81  	}
    1.82 -	
    1.83 -	my $remote_size = $ftp->size( $self->remote_file );
    1.84 +
    1.85 +	my $remote_size = $ftp->size($remote_file);
    1.86  	$remote_size ||= 0;
    1.87  	my $local_size = -s $archive;
    1.88 -	
    1.89 -	if ($remote_size != $local_size) {
    1.90 -		$self->log("Uploaded file is $remote_size bytes, " .
    1.91 -			"but local file is $local_size bytes")
    1.92 +
    1.93 +	if ( $remote_size != $local_size ) {
    1.94 +		$self->log( "Uploaded file is $remote_size bytes, "
    1.95 +			  . "but local file is $local_size bytes" );
    1.96  	}
    1.97  
    1.98  	$ftp->quit;
    1.99  
   1.100 -	print "File uploaded to " . $self->site();
   1.101 +	print 'File uploaded to ' . $self->site();
   1.102  
   1.103  	return 1;
   1.104 -}
   1.105 +} ## end sub release
   1.106  
   1.107  __PACKAGE__->meta()->make_immutable();
   1.108  no Moose;
     2.1 --- a/lib/Dist/Zilla/Plugin/CSJEWELL/SubversionDist.pm	Fri Aug 13 11:16:33 2010 -0600
     2.2 +++ b/lib/Dist/Zilla/Plugin/CSJEWELL/SubversionDist.pm	Fri Aug 13 11:17:06 2010 -0600
     2.3 @@ -8,48 +8,48 @@
     2.4  $VERSION =~ s/_//sm;
     2.5  
     2.6  has directory => (
     2.7 -  is   => 'ro',
     2.8 -  isa  => 'Str',
     2.9 -  required => 1,
    2.10 +	is       => 'ro',
    2.11 +	isa      => 'Str',
    2.12 +	required => 1,
    2.13  );
    2.14  
    2.15  has name => (
    2.16 -  is   => 'ro',
    2.17 -  isa  => 'Str',
    2.18 -  default => 'DZ::Plugin::CSJEWELL::SubversionDist',
    2.19 +	is      => 'ro',
    2.20 +	isa     => 'Str',
    2.21 +	default => 'DZ::Plugin::CSJEWELL::SubversionDist',
    2.22  );
    2.23  
    2.24  has debug => (
    2.25 -  is   => 'ro',
    2.26 -  isa  => 'Bool',
    2.27 -  default => 0,
    2.28 +	is      => 'ro',
    2.29 +	isa     => 'Bool',
    2.30 +	default => 0,
    2.31  );
    2.32  
    2.33  sub release {
    2.34 -	my ($self, $archive) = @_;
    2.35 +	my ( $self, $archive ) = @_;
    2.36  
    2.37  	my $zilla = $self->zilla();
    2.38 -	
    2.39 +
    2.40  	$self->log($archive);
    2.41  
    2.42  	my $remote_file = $self->directory() . $archive;
    2.43  	my $bot_name    = $self->name();
    2.44  	my ( $release, $version ) =
    2.45 -	  $archive =~ m/([\w-]+)-([\d_\.]+).tar.gz/msx;
    2.46 -	$release =~ s/-/::/gms;
    2.47 +	  $archive =~ m/([\w-]+)-([\d_.]+)(?:-TRIAL)?.tar.gz/msx;
    2.48 +	$release   =~ s/-/::/gms;
    2.49  	my $message = "[$bot_name] Importing upload file for $release $version";
    2.50  
    2.51 -	my $command = qq(svn import $archive $remote_file -m "$message" 2>&1); 
    2.52 -	if ($self->fake_release()) {
    2.53 +	my $command = qq(svn import $archive $remote_file -m "$message" 2>&1);
    2.54 +	if ( $self->fake_release() ) {
    2.55  		$self->log($command);
    2.56  	} else {
    2.57 -		system $command;
    2.58 +		my $i = system $command;
    2.59  	}
    2.60  
    2.61  	$self->log('Release file committed to SVN.');
    2.62 -	
    2.63 +
    2.64  	return 1;
    2.65 -}
    2.66 +} ## end sub release
    2.67  
    2.68  __PACKAGE__->meta()->make_immutable();
    2.69  no Moose;
     3.1 --- a/lib/Dist/Zilla/PluginBundle/CSJEWELL.pm	Fri Aug 13 11:16:33 2010 -0600
     3.2 +++ b/lib/Dist/Zilla/PluginBundle/CSJEWELL.pm	Fri Aug 13 11:17:06 2010 -0600
     3.3 @@ -11,8 +11,10 @@
     3.4  	is      => 'ro',
     3.5  	isa     => 'Bool',
     3.6  	lazy    => 1,
     3.7 -	default => sub { 
     3.8 -		exists $_[0]->payload->{fake_release} : $_[0]->payload->{fake_release} : 1;
     3.9 +	default => sub {
    3.10 +		exists $_[0]->payload->{fake_release}
    3.11 +		  ? $_[0]->payload->{fake_release}
    3.12 +		  : 1;
    3.13  	},
    3.14  );
    3.15  
    3.16 @@ -20,18 +22,20 @@
    3.17  	my ($self) = @_;
    3.18  
    3.19  	my @plugins = qw(
    3.20 -		CSJEWELL::BeforeBuild
    3.21 -		GatherDir
    3.22 -		ManifestSkip
    3.23 -		CSJEWELL::VersionGetter
    3.24 +	  CSJEWELL::BeforeBuild
    3.25 +	  GatherDir
    3.26 +	  ManifestSkip
    3.27 +	  CSJEWELL::VersionGetter
    3.28 +	  CSJEWELL::AuthorTest
    3.29  
    3.30 -		TestRelease
    3.31 -		ConfirmRelease
    3.32 +	  TestRelease
    3.33 +	  ConfirmRelease
    3.34  	);
    3.35  
    3.36 -	push @plugins, ( $self->fake_release() ? 'FakeRelease' : 'UploadToCPAN');
    3.37 +	push @plugins,
    3.38 +	  ( $self->fake_release() ? 'FakeRelease' : 'UploadToCPAN' );
    3.39  
    3.40 -	$self->add_plugins( @plugins );
    3.41 +	$self->add_plugins(@plugins);
    3.42  
    3.43  	return $self;
    3.44  } ## end sub configure