helium 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ === 0.1.1 / 2009-11-09
2
+
3
+ * Don't place style.css etc in the local app directory, serve them from the gem
4
+ * Allow a `location` field in `deploy.yml` that changes the paths rendered in `helium.js`
5
+
6
+
1
7
  === 0.1.0 / 2009-11-02
2
8
 
3
9
  * First public release under the GPL v2
@@ -13,6 +13,9 @@ lib/helium/logger.rb
13
13
  lib/helium/trie.rb
14
14
  lib/helium/web.rb
15
15
  lib/helium/web_helpers.rb
16
+ lib/helium/public/prettify.css
17
+ lib/helium/public/prettify.js
18
+ lib/helium/public/style.css
16
19
  lib/helium/views/deploy.erb
17
20
  lib/helium/views/edit.erb
18
21
  lib/helium/views/index.erb
@@ -27,9 +30,6 @@ templates/project/test/index.html.erb
27
30
  templates/web/config.ru
28
31
  templates/web/deploy.yml
29
32
  templates/web/custom.js
30
- templates/web/public/prettify.css
31
- templates/web/public/prettify.js
32
- templates/web/public/style.css
33
33
  test/test_helium.rb
34
34
  test/deploy.yml
35
35
  test/index.html
data/README.txt CHANGED
@@ -71,8 +71,6 @@ using the <tt>he install</tt> command with the name of the directory to create:
71
71
  This will give you the following files:
72
72
 
73
73
  helium-app/
74
- public/
75
- style.css etc.
76
74
  config.ru
77
75
  custom.js
78
76
  deploy.yml
@@ -12,7 +12,7 @@ require 'oyster'
12
12
 
13
13
  module Helium
14
14
 
15
- VERSION = '0.1.0'
15
+ VERSION = '0.1.1'
16
16
 
17
17
  ROOT = File.expand_path(File.dirname(__FILE__))
18
18
  TEMPLATES = File.join(ROOT, '..', 'templates')
@@ -22,15 +22,19 @@ module Helium
22
22
  @options = options
23
23
  end
24
24
 
25
+ # Returns the deserialized contents of `deploy.yml`.
26
+ def config
27
+ @config_data ||= YAML.load(File.read(@config))
28
+ end
29
+
25
30
  # Returns a hash of projects names and their Git URLs.
26
31
  def projects
27
32
  return @projects if defined?(@projects)
28
33
 
29
- data = YAML.load(File.read(@config))
30
- raise "No configuration for JS.Class" unless js_class = data[JS_CLASS]
34
+ raise "No configuration for JS.Class" unless js_class = config[JS_CLASS]
31
35
  @jsclass_version = js_class['version']
32
36
 
33
- @projects = data['projects'] || {}
37
+ @projects = config['projects'] || {}
34
38
  @projects[JS_CLASS] = js_class['repository']
35
39
  @projects
36
40
  end
@@ -104,9 +108,9 @@ module Helium
104
108
  def run_builds!(options = nil)
105
109
  options ||= @options
106
110
 
107
- @tree = Trie.new
108
- @custom = options[:custom]
109
- @domain = options[:domain]
111
+ @tree = Trie.new
112
+ @custom = options[:custom]
113
+ @location = options[:location]
110
114
  manifest = []
111
115
 
112
116
  # Loop over checked-out projects. Skip directories with no Jake file.
@@ -0,0 +1,14 @@
1
+ /* Pretty printing styles. Used with prettify.js. */
2
+
3
+ .str{color:#d14}
4
+ .kwd{color:#000;font-weight:bold}
5
+ .com{color:#998;font-style:italic}
6
+ .typ{color:#458}
7
+ .lit{color:#099}
8
+ .pun{color:#666}
9
+ .pln{color:#000}
10
+ .tag{color:#000080}
11
+ .atn{color:#008080}
12
+ .atv{color:#008080}
13
+ .dec{color:#000;font-weight:bold}
14
+
@@ -7,7 +7,7 @@ module Helium
7
7
  class Web < Sinatra::Base
8
8
 
9
9
 
10
- ROOT_DIR = File.dirname(__FILE__)
10
+ ROOT_DIR = File.expand_path(File.dirname(__FILE__))
11
11
  require File.join(ROOT_DIR, '..', 'helium')
12
12
  require File.join(ROOT_DIR, 'web_helpers')
13
13
 
@@ -26,8 +26,7 @@ module Helium
26
26
 
27
27
  before do
28
28
  @projects = project_config
29
- @domain = env['HTTP_HOST']
30
- @location = @domain + '/' + Helium::WEB_ROOT
29
+ @location = get_location
31
30
  end
32
31
 
33
32
  ## Home page -- just loads the project list and renders.
@@ -62,7 +61,7 @@ module Helium
62
61
  deployer.cleanup!
63
62
 
64
63
  custom = File.file?(CUSTOM) ? File.read(CUSTOM) : nil
65
- files = deployer.run_builds!(:custom => custom, :domain => @domain)
64
+ files = deployer.run_builds!(:custom => custom, :location => @location)
66
65
 
67
66
  FileUtils.rm_rf(PUBLIC) if File.exists?(PUBLIC)
68
67
 
@@ -114,6 +113,11 @@ module Helium
114
113
  erb :edit
115
114
  end
116
115
 
116
+ ## Catch requests for public files and serve them from the gem
117
+ get '/*' do
118
+ send_file(File.join(ROOT_DIR, 'public', env['PATH_INFO']))
119
+ end
120
+
117
121
  end
118
122
  end
119
123
 
@@ -7,6 +7,14 @@ module Helium
7
7
  Helium::Deployer.new(File.dirname(CONFIG)).projects
8
8
  end
9
9
 
10
+ # Returns the domain and path from which script files are served.
11
+ def get_location
12
+ location = Helium::Deployer.new(File.dirname(CONFIG)).config['location'] ||
13
+ env['HTTP_HOST'] + '/' + Helium::WEB_ROOT
14
+
15
+ location.gsub(/\/*$/, '')
16
+ end
17
+
10
18
  # Returns the list of IP addresses that have write access to the app.
11
19
  def allowed_ips
12
20
  Helium::Web.config.allow_ips
@@ -1,10 +1,8 @@
1
- <% if @domain -%>
2
1
  (function() {
3
2
  var protocol = ("https:" == document.location.protocol) ? "https:" : "http:";
4
3
  window.JSCLASS_PATH = window.JSCLASS_PATH ||
5
- protocol + "//<%= @domain %>/<%= WEB_ROOT %><%= File.dirname(@js_loader.sub(static_dir, '')) %>";
4
+ protocol + "//<%= @location %><%= File.dirname(@js_loader.sub(static_dir, '')) %>";
6
5
  })();
7
- <% end -%>
8
6
 
9
7
  <%= File.read(@js_loader) %>
10
8
 
@@ -17,7 +15,7 @@
17
15
  * then use the `require()` function to load objects on demand.
18
16
  *
19
17
  * <!-- Step 1. Load JS.Class and the package listing -->
20
- * <script type="text/javascript" src="http://<%= @domain || 'js.example.com' %>/<%= WEB_ROOT %>/<%= PACKAGES_MIN %>"></script>
18
+ * <script type="text/javascript" src="http://<%= @location %>/<%= PACKAGES_MIN %>"></script>
21
19
  *
22
20
  * <!-- Step 2. Declare which branches to use -->
23
21
  * <script type="text/javascript">
@@ -73,10 +71,8 @@ JS.Packages(function() { with(this) {
73
71
 
74
72
  window.Helium = window.Helium || {};
75
73
 
76
- <% if @domain -%>
77
74
  var protocol = ("https:" == document.location.protocol) ? "https:" : "http:";
78
- Helium.PATH = protocol + "//<%= @domain %>/<%= WEB_ROOT %>";
79
- <% end -%>
75
+ Helium.PATH = protocol + "//<%= @location %>";
80
76
 
81
77
  /**
82
78
  * Helium.use(project, branch) -> undefined
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-02 00:00:00 +00:00
12
+ date: 2009-11-09 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -109,6 +109,9 @@ files:
109
109
  - lib/helium/trie.rb
110
110
  - lib/helium/web.rb
111
111
  - lib/helium/web_helpers.rb
112
+ - lib/helium/public/prettify.css
113
+ - lib/helium/public/prettify.js
114
+ - lib/helium/public/style.css
112
115
  - lib/helium/views/deploy.erb
113
116
  - lib/helium/views/edit.erb
114
117
  - lib/helium/views/index.erb
@@ -123,14 +126,13 @@ files:
123
126
  - templates/web/config.ru
124
127
  - templates/web/deploy.yml
125
128
  - templates/web/custom.js
126
- - templates/web/public/prettify.css
127
- - templates/web/public/prettify.js
128
- - templates/web/public/style.css
129
129
  - test/test_helium.rb
130
130
  - test/deploy.yml
131
131
  - test/index.html
132
132
  has_rdoc: true
133
133
  homepage: http://github.com/othermedia/helium
134
+ licenses: []
135
+
134
136
  post_install_message:
135
137
  rdoc_options:
136
138
  - --main
@@ -152,9 +154,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  requirements: []
153
155
 
154
156
  rubyforge_project: helium
155
- rubygems_version: 1.3.1
157
+ rubygems_version: 1.3.5
156
158
  signing_key:
157
- specification_version: 2
159
+ specification_version: 3
158
160
  summary: ""
159
161
  test_files:
160
162
  - test/test_helium.rb
@@ -1,6 +0,0 @@
1
- /* Defaults */
2
- .str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}
3
-
4
- /* Overrides */
5
- .str{color:#d14}.kwd{color:#000;font-weight:bold}.com{color:#998;font-style:italic}.typ{color:#458}.lit{color:#099}.pun{color:#666}.pln{color:#000}.tag{color:#000080}.atn{color:#008080}.atv{color:#008080}.dec{color:#000;font-weight:bold}
6
-