The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Module::Build::JSAN::Installable - Build JavaScript distributions for JSAN, which can be installed locally

SYNOPSIS

In Build.PL:

  use Module::Build::JSAN::Installable;

  my $build = Module::Build::JSAN::Installable->new(
      module_name    => 'Foo.Bar',
      license        => 'perl',
      keywords       => [qw(Foo Bar pithyness)],
      requires     => {
          'JSAN'     => 0.10,
          'Baz.Quux' => 0.02,
      },
      build_requires => {
          'Test.Simple' => 0.20,
      },
      
      static_dir => 'assets',
      docs_markup => 'mmd'
  );

  $build->create_build_script;

To build, test and install a distribution:

  % perl Build.PL
  % ./Build
  % ./Build test  
  % ./Build install

In Components.js:

    COMPONENTS = {
        
        "Kernel" : [
            "JooseX.Namespace.Depended.Manager",
            "JooseX.Namespace.Depended.Resource",
            
            "JooseX.Namespace.Depended.Materialize.Eval",
            "JooseX.Namespace.Depended.Materialize.ScriptTag"
        ],
        
        
        "Web" : [
            "+Kernel",
        
            "JooseX.Namespace.Depended.Transport.AjaxAsync",
            "JooseX.Namespace.Depended.Transport.AjaxSync",
            "JooseX.Namespace.Depended.Transport.ScriptTag",
            
            "JooseX.Namespace.Depended.Resource.URL",
            "JooseX.Namespace.Depended.Resource.URL.JS",
            "JooseX.Namespace.Depended.Resource.JS",
            "JooseX.Namespace.Depended.Resource.JS.External",
            
            //should be the last        
            "JooseX.Namespace.Depended"
        ],
        
        
        "ServerJS" : [
            "+Kernel",
            
            "JooseX.Namespace.Depended.Transport.Require",
            "JooseX.Namespace.Depended.Resource.Require",
            
            //should be the last
            "JooseX.Namespace.Depended"
        ]
        
    } 

DESCRIPTION

This is a developer aid for creating JSAN distributions, which can be also installed in the local system. JSAN is the "JavaScript Archive Network," a JavaScript library akin to CPAN. Visit http://www.openjsan.org/ for details.

This module works nearly identically to Module::Build::JSAN, so please refer to its documentation for additional details.

DIFFERENCES

1 ./Build install

This action will install current distribution in your local JSAN library. See below for details.

2 ./Build docs

This action will build a documentation files for this distribution. Default markup for documentation is POD. Alternative markup can be specified with docs_markup configuration parameter (see Synopsis). Currently supported markups: 'pod', 'md' (Markdown via Text::Markdown), 'mmd' (MultiMarkdown via Text::MultiMarkdown).

Resulting documentation files will be placed under /docs directory, categorized by the formats. For 'pod' markup there will be /doc/html, /doc/pod and /doc/text directories. For 'md' and 'mmd' markups there will be /doc/html and /doc/[m]md directories.

For 'md' and 'mmd' markups, its possible to keep the module's documentation in separate file. The file should have the same name as module, with extensions, changed to markup abbreviature. An example:

      /lib/Module/Name.js
      /lib/Module/Name.mmd
      
3 ./Build task [--task_name=foo]

This action will build a specific concatenated version (task) of current distribution. Default task name is 'Core', task name can be specified with --task_name command line option.

Information about tasks is stored in the Components.JS file in the root of distribution. See the Synposys for example of Components.JS.

After concatenation, resulting file is placed on the following path: /lib/Task/Distribution/Name/SampleTask.js, assuming the name of your distribution was Distribution.Name and the task name was SampleTask

4 ./Build test

This action relies on not yet released JSAN::Prove module, stay tuned for further updates.

LOCAL JSAN LIBRARY

This module uses concept of local JSAN library, which is organized in the same way as perl library.

The path to the library is resolved in the following order:

1. --install_base command-line argument

2. environment variable JSANLIB

3. Either the first directory in $Config{libspath}, followed with /jsan (probably /usr/local/lib on linux systems) or C:\JSAN (on Windows)

As a convention, it is recommended, that you configure your local web-server that way, that /jsan will point at the /lib subdirectory of your local JSAN library. This way you can access any module from it, with URLs like: '/jsan/Test/Run.js'

STATIC FILES HANDLING

Under static files we'll assume any files other than javascript (*.js). Typically those are *.css files and images (*.jpg, *.gif, *.png etc).

All such files should be placed in the "static" directory. Default name for share directory is '/static'. Alternative name can be specified with static_dir configuration parameter (see Synopsis). Static directory can be organized in any way you prefere.

Lets assume you have the following distribution structure:

  /lib/Distribution/Name.js
  /static/css/style1.css 
  /static/img/image1.png

After building (./Build) it will be processed as:

  /blib/lib/Distribution/Name.js
  /blib/lib/Distribution/Name/static/css/style1.css 
  /blib/lib/Distribution/Name/static/img/image1.png

During installation (./Build install) the whole 'blib' tree along with static files will be installed in your local library.

AUTHOR

Nickolay Platonov, <nplatonov at cpan.org>

BUGS

Please report any bugs or feature requests to bug-module-build-jsan-installable at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Build-JSAN-Installable. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO

Examples of installable JSAN distributions

http://github.com/SamuraiJack/JooseX-Namespace-Depended/tree

http://github.com/SamuraiJack/joosex-bridge-ext/tree

http://www.openjsan.org/

Home of the JavaScript Archive Network.

http://code.google.com/p/joose-js/

Joose - Moose for JavaScript

http://github.com/SamuraiJack/test.run/tree

Yet another testing platform for JavaScript

SUPPORT

This module is stored in an open repository at the following address:

http://github.com/SamuraiJack/Module-Build-JSAN-Installable/tree/

You can also look for information at:

ACKNOWLEDGEMENTS

Thanks to David Wheeler for his excelent Module::Build::JSAN, on top of which this module is built.

COPYRIGHT & LICENSE

Copyright 2009 Nickolay Platonov, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.