Clustericious

 view release on metacpan or  search on metacpan

lib/Clustericious/Command/generate/app.pm  view on Meta::CPAN

  my $name = lc $class;

  (my $relpath = $file) =~ s/^$templatedir/$class/;
  $relpath =~ s/APPCLASS/$class/g;
  $relpath =~ s/APPNAME/$name/g;

  return if -e $relpath;

  my $content = Mojo::Template->new->render_file( $file, $class );
  $self->write_file($relpath, $content );
  -x $file && $self->chmod_file($relpath, 0755);
}

sub run
{
  my ($self, $class, @args ) = @_;
  $class ||= 'MyClustericiousApp';
  if (@args % 2) {
    die "usage : $0 generate app <name>\n";
  }
  my %args = @args;

lib/Clustericious/Command/generate/client.pm  view on Meta::CPAN

  my $name = lc $serverclass;

  (my $relpath = $file) =~ s/^$templatedir/$moduledir/;
  $relpath =~ s/APPCLASS/$serverclass/g;
  $relpath =~ s/APPNAME/$name/g;

  return if -e $relpath;

  my $content = Mojo::Template->new->render_file( $file, $serverclass );
  $self->write_file($relpath, $content );
  -x $file && $self->chmod_file($relpath, 0755);
}

sub run
{
  my ($self, $serverclass, @args ) = @_;
  $serverclass ||= 'MyClustericiousApp';
  if (@args % 2)
  {
    die "usage : $0 generate client <app_name>\n";
  }

lib/Test/Clustericious/Command.pm  view on Meta::CPAN

our %EXPORT_TAGS = ( all => \@EXPORT );

unshift @INC, dir(bsd_glob '~/lib')->stringify;
unshift @PERL5LIB, map { dir($_)->absolute->stringify } @INC;
unshift @PATH, dir(bsd_glob '~/bin')->stringify;

sub _can_execute_in_tmp
{
  my $script = file( tempdir( CLEANUP => 1 ), 'mytest' );
  $script->spew("#!$^X\nexit 0");
  chmod 0755, "$script";
  my $exit;
  capture { system "$script", "okay"; $exit = $? };
  $exit == 0;
}

sub requires
{
  my($command, $num) = @_;

  my $ctx = context();

lib/Test/Clustericious/Command.pm  view on Meta::CPAN

    }
    unless(-f $file)
    {
      $ctx->note("[extract] FILE $file@{[ $name =~ m{^bin/} ? ' (*)' : '']}");
      
      if($name =~ m{^bin/})
      {
        my $content = $all->{$name};
        $content =~ s{^#!/usr/bin/perl}{#!$^X};
        $file->spew($content);
        chmod 0700, "$file";
      }
      else
      {
        $file->spew($all->{$name});
      }
    }
  }
  
  $ctx->release;
}

lib/Test/Clustericious/Command.pm  view on Meta::CPAN

    {
      my $dst = $dst->file($child->basename);
      unless(-f $dst)
      {
        if(-x $child)
        {
          $ctx->note("[mirror ] FILE $dst (*)");
          my $content = scalar $child->slurp;
          $content =~ s{^#!/usr/bin/perl}{#!$^X};
          $dst->spew($content);
          chmod 0700, "$dst";
        }
        else
        {
          $ctx->note("[mirror ] FILE $dst");
          $dst->spew(scalar $child->slurp);
          chmod 0600, "$dst";
        }
      }
    }
  }
  
  $ctx->release;
}

sub run_ok
{



( run in 0.272 second using v1.01-cache-2.11-cpan-496ff517765 )