Egg::Helper::Build::Prototype - Helper who outputs prototype.js


Egg-Release documentation Contained in the Egg-Release distribution.

Index


Code Index:

NAME

Top

Egg::Helper::Build::Prototype - Helper who outputs prototype.js

SYNOPSIS

Top

  % cd /path/to/MyApp/bin
  % ./myapp_helper Build::Prototype

DESCRIPTION

Top

It is a helper according to HTML::Prototype to whom the project outputs 'htdocs' below as for 'prototype.js' etc.

The usage only specifies 'Build::Prototype' and the mode for the helper script of the project.

SEE ALSO

Top

Egg::Release, Egg::Helper, Egg::Plugin::Prototype, HTML::Prototype, File::Spec,

AUTHOR

Top

Masatoshi Mizuno <lushe&64;cpan.org>

COPYRIGHT AND LICENSE

Top


Egg-Release documentation Contained in the Egg-Release distribution.

package Egg::Helper::Build::Prototype;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: Prototype.pm 337 2008-05-14 12:30:09Z lushe $
#
use strict;
use warnings;
use File::Spec;
use HTML::Prototype;

our $VERSION= '3.00';

sub _start_helper {
	my($self)= @_;
	my $c= $self->config;
	my $o= $self->_helper_get_options;
	return $self->_helper_help() if $o->{help};

	my $htdocs= $c->{dir}{htdocs} || $c->{dir}{static}
	   || return $self->_helper_help('I want configuration dir->{htdocs}.');
	-e $htdocs
	   || return $self->_helper_help("'$htdocs' is not found.");

	my $prototype = File::Spec->catfile( $htdocs, 'prototype.js' );
	my $controls  = File::Spec->catfile( $htdocs, 'controls.js' );
	my $dragdrop  = File::Spec->catfile( $htdocs, 'dragdrop.js' );
	my $complete  = <<END_INFO;

... completed.

  prototype.js : $prototype
  controls.js  : $controls
  dragdrop.js  : $dragdrop

END_INFO

	$self->helper_generate_files(
	  param => {}, chdir => [$c->{root}],
	  complete_msg => $complete,
	  create_files => [
	    { filename=> $prototype, value=> $HTML::Prototype::prototype },
	    { filename=> $controls,  value=> $HTML::Prototype::controls  },
	    { filename=> $dragdrop,  value=> $HTML::Prototype::controls  },
	    ],
	  );
}
sub _helper_help {
	my $self = shift;
	my $msg  = shift || "";
	   $msg .= "\n\n" if $msg;
	my $pname= lc $self->project_name;
	print <<END_HELP;
${msg}% perl ${pname}_helper.pl Plugin::Prototype [-h]

END_HELP
}

1;

__END__