aemkei / pyte

JavaScript Dependency Management and Deployment Framework

This URL has Read+Write access

aemkei (author)
Wed Dec 10 12:02:41 -0800 2008
commit  257947c016d5598fbdda8a86993bdb40c1de12f9
tree    1b1ff6b39b39f04e4f79f9e07823c95d3b096f3c
parent  2cdbe84bf500a67e99195fd40149f422309cc2b0
pyte /
README
Pyte - JavaScript Dependency Management and Deployment Tasks
============================================================

Pyte is a JavaScript dependency management and deployment library.


Features
========

JavaScript class includes:
 - Synchronous script loading
 - On the fly dependencies
 - Application pattern
 - Light and easy class includes

Development and production mode:
 - Concatenation of depending files
 - Deployment tasks and postprocessor
 - Minification and obfuscating (Using YUI Compressor)


Example JavaScript Usage
========================

To register an application class with your layout only include this single statement (this will be automatically done by 
Pyte if you use the Rails plugin):

  new Application("my.app.SampleApplication");


Content of my/app/Explore.js:

  Class.include(
    "my.app.Abstract"
    "my.sample.Control"
  );

  // inherits from my.app.Abstract
  my.app.Explore = Class.create(my.app.Abstract, {
    initialize: function(){
      this.control = new my.sample.Control();
    }
  });


Example Rail Usage
==================

Simply add :pyte to your javascript_include_tag:

  <%= javascript_include_tag :defaults, :pyte, :cache => true %>

In environment.rb you'll have to set the main application folder. All files in this folder will be analysed and all 
depencencies are merged into a single compressed file:

  Pyte::Settings.application_path = "my/app/"
  
  
To specify a custom application class, add @pyte_app to your controller. Otherwise "Abstract" will be used.

  class MyController < ApplicationController

    def index
      @pyte_app = "Explore"
      # hack your explore stuff
    end
  
    def search
      @pyte_app = "Search"
      # hack your search stuff
    end
  end


Deployment Process
==================

Once you deploy your application, all JavaScript sources will be analysed and three single files are generated:

  - all.uncompressed.js   # Single merged file with comments and whitespace
  - all.js                # YUI compressed file
  - all.js.gz             # Gzipped version of compressed file


Development Mode
================

In development mode, all required classes are loaded and evaluated by the pyte.js library via synchronous AJAX calls.


About this project
==================

This library has been developed at Ubilabs (http://www.ubilabs.net)

Author: "Martin Kleppe" <kleppe@ubilabs.net>
Released under the MIT license