Rex::Apache::Build - Build your WebApp Package
With this module you can prepare your WebApp for deployment.
yui_path "./yuicompressor-2.4.6.jar"; get_version_from "webapp/lib/MyApp.pm", qr{\$VERSION=([^;]+);}; get_version_from "webapp/index.php", qr{\$VERSION=([^;]+);}; task "build", sub { sprocketize; sprocketize "app/assets/javascript/*.js", out => "public/js/sprockets.js"; coffee; coffee "app/assets/coffee", out => "public/js"; sass; sass "app/assets/stylesheets", out => "public/stylesheets"; yui; yui compress => "file1.js", "file2.js", "file3.css"; yui compress => glob("public/javascript/*.js"), glob("public/css/*.css"); build; build "webapp", source => "webapp/", version => "1.0"; };
This function sets the path to the yui_compressor. If a relative path is given it will search from the path where the Rexfile is in.
This function sets the path to the coffee compiler. If a relative path is given it will search from the path where the Rexfile is in.
This function sets the path to the sprocketize compiler. If a relative path is given it will search from the path where the Rexfile is in.
This function sets the path to the sass compiler. If a relative path is given it will search from the path where the Rexfile is in.
Run a yui command.
task "build", sub { # this will compress the given files yui compress => "file1.js", "file2.js", ...; # yui without any parameters will compress all files in public/javascripts yui; };
This function builds your package. Currently only tar.gz packages are supported.
# this will a package of the current directory named after the # directory of the Rexfile and append the version provided by # get_version_from() function # This function builds a tar.gz archive. task "build", sub { build; }; # this will build a package of the current directory named "my-web-app" and # append the version provided by get_version_from() function. task "build", sub { build "my-web-app"; }; # this function will build a package of the directory "html", name it # "my-web-app" and append the version "1.0" to it. task "build", sub { build "my-web-app", path => "html", version => "1.0", exclude => ["yuicompressor.jar", "foobar.html"], type => "tgz"; };
Get the version out of a file.
This function calls the sprocketize command with the given options.
task "build", sub { sprocketize "app/javascript/*.js", include => [qw|app/javascripts vendor/sprockets/prototype/src|], asset_root => "public/js", out => "public/js/sprockets.js"; # to include more use an arrayRef sprocketize ["app/javascript/*.js", "app/javascript/po/*.js"], include => [qw|app/javascripts vendor/sprockets/prototype/src|], asset_root => "public/js", out => "public/js/sprockets.js"; # if called without parameters sprocketize; # it will use the following defaults: # - javascript (sprockets) in assets/javascripts/*.js # - include assets/javascripts # - asset_root public # - out public/${name_of_directory_where_Rexfile_lives}.js };
Compile coffee files to javascript.
task "build", sub { # this command will build all files in "coffeesrc" and # write the output to "javascripts" coffee "coffeesrc", out => "javascripts"; # without parameters it will build all files in assets/coffee # and write the output to public/javascripts. coffee; };
This command will compile all sass files in $input_dir.
task "build", sub { # this command will compile all sass files from app/assets/stylesheets # and put the output into public/stylesheets. sass "app/assets/stylesheets", out => "public/stylesheets"; # The default is to build all files in assets/sass and put the output # into public/css. sass; };
To install Rex::Apache::Deploy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rex::Apache::Deploy
CPAN shell
perl -MCPAN -e shell install Rex::Apache::Deploy
For more information on module installation, please visit the detailed CPAN module installation guide.