helium 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/lib/helium.rb +3 -1
- data/lib/helium/deployer.rb +32 -23
- data/templates/web/custom.js +1 -0
- metadata +23 -3
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 0.1.2 / 2010-03-09
|
2
|
+
|
3
|
+
* Fix bug in custom loader function for `pageTracker`
|
4
|
+
* Improve how we map branch/tag names to commits to cope correctly with multiple refs
|
5
|
+
pointing at the same commit and always picking the latest commit for a branch
|
6
|
+
|
7
|
+
|
1
8
|
=== 0.1.1 / 2009-11-09
|
2
9
|
|
3
10
|
* Don't place style.css etc in the local app directory, serve them from the gem
|
data/lib/helium.rb
CHANGED
@@ -12,7 +12,7 @@ require 'oyster'
|
|
12
12
|
|
13
13
|
module Helium
|
14
14
|
|
15
|
-
VERSION = '0.1.
|
15
|
+
VERSION = '0.1.2'
|
16
16
|
|
17
17
|
ROOT = File.expand_path(File.dirname(__FILE__))
|
18
18
|
TEMPLATES = File.join(ROOT, '..', 'templates')
|
@@ -26,8 +26,10 @@ module Helium
|
|
26
26
|
PACKAGES_MIN = 'helium.js'
|
27
27
|
WEB_ROOT = 'js'
|
28
28
|
|
29
|
+
COMMIT = /^[0-9a-f]{40}$/
|
29
30
|
GIT = '.git'
|
30
31
|
HEAD = 'HEAD'
|
32
|
+
HEAD_LIST = 'heads.yml'
|
31
33
|
|
32
34
|
JS_CLASS = 'js.class'
|
33
35
|
LOADER_FILE = 'loader.js'
|
data/lib/helium/deployer.rb
CHANGED
@@ -71,32 +71,26 @@ module Helium
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# Exports static copies of a project from every branch and tag in its Git repository.
|
74
|
-
# Existing static copies on disk are
|
74
|
+
# Existing static copies on disk are removed. Mappings from branch/tag names to commit
|
75
|
+
# IDs are stored in heads.yml in the project directory.
|
75
76
|
def export(project)
|
76
77
|
repo_dir = repo_dir(project)
|
77
78
|
repo = Grit::Repo.new(repo_dir)
|
78
|
-
branches = repo.remotes + repo.tags
|
79
79
|
|
80
|
-
|
80
|
+
export_directory = static_dir(project)
|
81
|
+
mkdir_p(export_directory)
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
heads = head_mappings(project)
|
84
|
+
File.open(static_dir(project, HEAD_LIST), 'w') { |f| f.write(YAML.dump(heads)) }
|
85
|
+
|
86
|
+
heads.values.uniq.each do |commit|
|
86
87
|
target = static_dir(project, commit)
|
88
|
+
next if File.directory?(target)
|
87
89
|
|
88
|
-
log :export, "Exporting
|
89
|
-
rm_rf(target) if File.directory?(target)
|
90
|
+
log :export, "Exporting commit '#{ commit }' of '#{ project }' into #{ target }"
|
90
91
|
cp_r(repo_dir, target)
|
91
92
|
|
92
|
-
cd(target) {
|
93
|
-
if repo.branches.map { |b| b.name }.include?(name)
|
94
|
-
`git checkout #{ name }`
|
95
|
-
`git merge #{ branch.name }`
|
96
|
-
else
|
97
|
-
`git checkout -b #{ name } #{ branch.name }`
|
98
|
-
end
|
99
|
-
}
|
93
|
+
cd(target) { `git checkout #{commit}` }
|
100
94
|
end
|
101
95
|
end
|
102
96
|
|
@@ -111,14 +105,16 @@ module Helium
|
|
111
105
|
@tree = Trie.new
|
112
106
|
@custom = options[:custom]
|
113
107
|
@location = options[:location]
|
114
|
-
manifest
|
108
|
+
manifest = []
|
115
109
|
|
116
110
|
# Loop over checked-out projects. Skip directories with no Jake file.
|
117
111
|
Find.find(static_dir) do |path|
|
118
112
|
next unless File.directory?(path) and File.file?(join(path, JAKE_FILE))
|
119
113
|
|
120
114
|
project, commit = *path.split(SEP)[-2..-1]
|
121
|
-
|
115
|
+
heads = YAML.load(File.read(join(path, '..', HEAD_LIST)))
|
116
|
+
branches = heads.select { |(head, id)| id == commit }.map { |pair| pair.first }
|
117
|
+
|
122
118
|
Jake.clear_hooks!
|
123
119
|
|
124
120
|
# Event listener to capture file information from Jake
|
@@ -126,18 +122,21 @@ module Helium
|
|
126
122
|
if build_type == :min
|
127
123
|
@js_loader = file if File.basename(file) == LOADER_FILE and
|
128
124
|
project == JS_CLASS and
|
129
|
-
|
125
|
+
branches.include?(@jsclass_version)
|
130
126
|
|
131
127
|
file = file.sub(path, '')
|
132
128
|
manifest << join(project, commit, file)
|
133
|
-
|
134
|
-
|
129
|
+
|
130
|
+
branches.each do |branch|
|
131
|
+
@tree[[project, branch]] = commit
|
132
|
+
@tree[[project, branch, file]] = package.meta
|
133
|
+
end
|
135
134
|
end
|
136
135
|
end
|
137
136
|
jake_hook(:file_created, &hook)
|
138
137
|
jake_hook(:file_not_changed, &hook)
|
139
138
|
|
140
|
-
log :jake_build, "Building branch '#{
|
139
|
+
log :jake_build, "Building branch '#{ branches * "', '" }' of '#{ project }' from #{ join(path, JAKE_FILE) }"
|
141
140
|
|
142
141
|
begin; Jake.build!(path)
|
143
142
|
rescue; end
|
@@ -194,6 +193,16 @@ module Helium
|
|
194
193
|
end
|
195
194
|
end
|
196
195
|
|
196
|
+
# Returns a hash of branch/tag names to commit IDs for a project
|
197
|
+
def head_mappings(project)
|
198
|
+
repo = Grit::Repo.new(repo_dir(project))
|
199
|
+
(repo.remotes + repo.tags).inject({}) do |list, head|
|
200
|
+
commit = head.commit.id
|
201
|
+
list[head.name.split('/').last] = commit if commit =~ COMMIT
|
202
|
+
list
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
197
206
|
# Notifies observers by sending a log message.
|
198
207
|
def log(*args)
|
199
208
|
changed(true)
|
data/templates/web/custom.js
CHANGED
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.
|
4
|
+
version: 0.1.2
|
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:
|
12
|
+
date: 2010-03-09 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -72,6 +72,26 @@ dependencies:
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: "1.0"
|
74
74
|
version:
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rubyforge
|
77
|
+
type: :development
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 2.0.3
|
84
|
+
version:
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: gemcutter
|
87
|
+
type: :development
|
88
|
+
version_requirement:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.3.0
|
94
|
+
version:
|
75
95
|
- !ruby/object:Gem::Dependency
|
76
96
|
name: hoe
|
77
97
|
type: :development
|
@@ -80,7 +100,7 @@ dependencies:
|
|
80
100
|
requirements:
|
81
101
|
- - ">="
|
82
102
|
- !ruby/object:Gem::Version
|
83
|
-
version: 2.
|
103
|
+
version: 2.5.0
|
84
104
|
version:
|
85
105
|
description: ""
|
86
106
|
email:
|