Permalink
Browse files

Copy adjustments.

  • Loading branch information...
1 parent 4f0f121 commit 97cb8f6894a460fb584c319c74fd3a7e20945eac @jcoglan jcoglan committed Nov 2, 2009
Showing with 46 additions and 37 deletions.
  1. +30 −26 README.rdoc
  2. +2 −2 lib/helium/deployer.rb
  3. +13 −8 lib/helium/jake.rb
  4. +1 −1 lib/helium/views/index.erb
View
@@ -3,9 +3,9 @@
* http://github.com/othermedia/helium
Helium is a Ruby application for running a Git-backed JavaScript package distribution
-system and CDN server. It comes with a web frontend that allows Git-hosted projects
-to be downloaded, built and served from a single domain, allowing any number of other
-sites to use the projects and receive automatic updates when new versions are deployed.
+system. It comes with a web frontend that allows Git-hosted projects to be downloaded,
+built and served from a single domain, allowing any number of other sites to use the
+projects and receive automatic updates when new versions are deployed.
Helium is free software, released under the GPL licence. Please see the
<tt>LICENCE</tt> file for details.
@@ -16,20 +16,18 @@ Helium is free software, released under the GPL licence. Please see the
The deployer is designed to allow JavaScript packages to be easily shared between client
websites without the need to copy-paste code from project to project. It allows you to
run a centralized server on which JavaScript code is deployed from Git repositories,
-allowing you to easily push code updates to any sites using the hosted scripts. Client
+letting you easily push code updates to any sites using the hosted scripts. Client
sites are able to specify which branch or tag of a package they wish to use, and code
dependencies are transparently handled so that each site loads only the code it needs.
The system is based around the JS.Class package manager (http://jsclass.jcoglan.com/packages.html),
which provides a pure-JavaScript dependency manager for on-demand loading of JavaScript
-objects. It requires only two files to be loaded initially: the JS.Class package loader
-and a list of package dependency data. Our deployer programmatically generates this
-package listing from metadata stored in Git repositories, so that client projects using
-this system do not have to maintain the list themselves. The only code required in each
-client project is then:
-
- <!-- Step 1. Load JS.Class and the package listing -->
- <script src="http://js.example.com/js/helium.js" type="text/javascript"></script>
+objects. Helium programmatically generates a package listing from metadata stored in Git
+repositories, so that client projects using this system do not have to maintain the list
+themselves. The only code required in each client project is this:
+
+ <!-- Step 1. Load JS.Class package manager and the package listing -->
+ <script src="http://helium.example.com/js/helium.js" type="text/javascript"></script>
<!-- Step 2. Declare which branches to use -->
<script type="text/javascript">
@@ -43,9 +41,9 @@ the central server on demand. See the above-linked JS.Class documentation for mo
== Requirements
-Before deploying this app, you will need Ruby, Rubygems, Passenger (mod_rack), and Git
+Before deploying this app, you will need Ruby, RubyGems, Passenger (mod_rack), and Git
installed on your webserver. Helium's web frontend assumes you will be using Rack to
-serve the application. You will also need these gems, though Rubygems should install
+serve the application. You will also need these gems, though RubyGems should install
these for you:
sudo gem install hoe grit jake packr oyster sinatra rack
@@ -75,15 +73,18 @@ This will give you the following files:
helium-app/
public/
style.css etc.
- access.yml
config.ru
custom.js
deploy.yml
-The <tt>access.yml</tt> lists IP addresses from which users may make config changes to the
-app; by default it lists <tt>0.0.0.0</tt>, <tt>127.0.0.1</tt> and <tt>localhost</tt>.
-The files <tt>deploy.yml</tt> and <tt>custom.js</tt> are editable through the web frontend;
-attempts to change these files from IPs not listed in <tt>access.yml</tt> will be blocked.
+The files <tt>deploy.yml</tt> and <tt>custom.js</tt> are editable through the web frontend,
+and must be writable by the web server. You can restrict write access to certain IP addresses
+using the configure block in <tt>config.ru</tt>, by default this is:
+
+ Helium::Web.configure do |config|
+ config.allow_ips ['0.0.0.0', '127.0.0.1']
+ end
+
=== Apache setup
@@ -100,7 +101,7 @@ Apache will need read/write access to these directories.
== Usage
For the rest of this article, we'll assume the deployment app is running at
-http://js.example.com/js, and the app is stored in the directory <tt>helium-app</tt>
+http://helium.example.com, and the app is stored in the directory <tt>helium-app</tt>
as described above.
=== JavaScript project setup
@@ -111,7 +112,9 @@ root directory. We use Jake (http://github.com/jcoglan/jake) to build checked-ou
and extract dependency data. Even if your project doesn't need a complex build process, it
must still declare the objects it provides and requires so it can be deployed using the
package manager. Each package must provide +provides+ and (optionally) +requires+ fields
-in its metadata. For example, here's a <tt>jake.yml</tt> file for the +Panel+ package:
+in its metadata. For example, here's a <tt>jake.yml</tt> file for a +Panel+ package, which
+provides the +panel+ function and +Panel+ and +PanelOverlay+ classes, and depends on
+<tt>JS.Class</tt>, <tt>Ojay</tt>, <tt>Ojay.HTML</tt> and <tt>Ojay.ContentOverlay</tt>:
---
source_directory: .
@@ -124,6 +127,7 @@ in its metadata. For example, here's a <tt>jake.yml</tt> file for the +Panel+ pa
private: true
packages:
+
panel:
files:
- panel
@@ -187,13 +191,13 @@ Our deployment system performs the following steps on every project registered:
=== Using the deployment app
-On first accessing http://js.example.com, there will be no JavaScript projects
+On first accessing http://helium.example.com, there will be no JavaScript projects
listed. To add projects, we need to edit a YAML file listing projects and their Git
URIs. To support the client-side package manager, the deploy system must at least have
the JS.Class project registered. Projects are listed as key-value pairs by project name
and Git URI.
-Go to http://js.example.com/config and enter the following projects:
+Go to http://helium.example.com/config and enter the following projects:
---
js.class:
@@ -207,7 +211,7 @@ Go to http://js.example.com/config and enter the following projects:
After clicking 'Save', these projects should be listed in the sidebar. Check all three,
and hit 'Deploy' to import them all into the deploy system. After a few seconds you should
see a log output telling you which projects and branches were built. There should also
-now be a JavaScript file at http://js.example.com/js/helium.js that lists the files
+now be a JavaScript file at http://helium.example.com/js/helium.js that lists the files
available on the server.
=== Client-side package management
@@ -217,7 +221,7 @@ at http://jsclass.jcoglan.com/packages.html). This provides a dependency manager
simple way to load JavaScript objects on demand. To set it up, you just need the following
in the head of your HTML pages:
- <script src="http://js.example.com/js/helium.js" type="text/javascript"></script>
+ <script src="http://helium.example.com/js/helium.js" type="text/javascript"></script>
<script type="text/javascript">
Helium.use('yui', '2.7.0');
@@ -233,7 +237,7 @@ nonstandard location. By default it is set to:
Helium.PATH = 'http://{ your domain }/js';
-Note that the above only loads two small scripts -- the <tt>Helium.use()</tt> calls do not
+Note that the above only loads one external script -- the <tt>Helium.use()</tt> calls do not
load any extra code, they just tell the system which version of each project to use if and
when we need to load them.
View
@@ -35,8 +35,8 @@ def projects
@projects
end
- # Runs all the deploy actions. If given a project name, only checkout out and builds
- # the given project, otherwise build all projects in `deploy.yml`.
+ # Runs all the deploy actions. If given a project name, only checks out and builds
+ # the given project, otherwise builds all projects in `deploy.yml`.
def run!(project = nil)
return deploy!(project) if project
projects.each { |project, url| deploy!(project, false) }
View
@@ -1,3 +1,8 @@
+# This file is loaded by Jake for projects created using the Helium command
+# line tools. It copies build files into the test directory and generates a
+# JS.Packages file for the project so that the user can test that their
+# dependencies are correctly configured.
+
module Helium
module JakeBuildHelper
@@ -11,14 +16,6 @@ module JakeBuildHelper
TARGET_DIR = File.directory?(PUBLIC_DIR) ? PUBLIC_DIR : TEST_DIR
LIB_DIR = File.join(TARGET_DIR, LIB)
- def self.list(array)
- (array || []).map { |s| s.inspect } * ', '
- end
-
- def self.short_path(path)
- path.sub(PROJECT_DIR, '.')
- end
-
PACKAGES = ERB.new(<<-EOS, nil, '-')
// This file is automatically generated when you run `jake`. You should
// keep it out of your version control system.
@@ -36,6 +33,14 @@ def self.short_path(path)
}});
EOS
+ def self.list(array)
+ (array || []).map { |s| s.inspect } * ', '
+ end
+
+ def self.short_path(path)
+ path.sub(PROJECT_DIR, '.')
+ end
+
files = {}
update = lambda do |build, package, build_type, path|
@@ -4,7 +4,7 @@
and lets you load objects from these libraries on demand. It uses
<a href="http://github.com/jcoglan/jake">Jake</a> to build each library and extract
dependency data, and <a href="http://jsclass.jcoglan.com/packages.html">JS.Packages</a>
-to resolve dependencies and load files; the
+to resolve dependencies and load files at runtime. The
<a href="/<%= Helium::WEB_ROOT %>/<%= Helium::PACKAGES %>">package manifest</a> is
generated using data extracted during the build process.</p>

0 comments on commit 97cb8f6

Please sign in to comment.