Skip to content

Commit 265d624

Browse files
committed
publish passing master builds to s3
1 parent e6b6ae8 commit 265d624

8 files changed

Lines changed: 64 additions & 2642 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ vendor
22
.rvmrc
33
.DS_Store
44
lib/handlebars/compiler/parser.js
5-
dist/*.min.js
5+
dist
66
node_modules
77
*.sublime-project
88
*.sublime-workspace

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
after_success: bundle exec rake publish
3+
env:
4+
global:
5+
- S3_BUCKET_NAME=builds.handlebarsjs.com
6+
- secure: ! 'PJaukuvkBBsSDOqbIcNSSMgb96VVEaIt/eq9GPjXPeFbSd3hXgwhwVE62Lrq
7+
8+
tJO8BaUfX+PzpiQjEl4D5/KBmvlFZ057Hqmy0zmPOT5mDZfJe8Ja5zyvTMb+
9+
10+
KkCWN/tjAp8kawHojE04pn6jIpPdwXFnAYwPhaHbATFrmdt9fdg='
11+
- secure: ! 'mBcGL2tnmiRujJdV/4fxrVd8E8wn6AW9IQKVcMv8tvOc7i5dOzZ39rpBKLuT
12+
13+
MRXDtMV1LyLiuKYb1pHj1IyeadEahcLYFfGygF4LG7Yzp4NWHtRzQ7Q8LXaJ
14+
15+
V7dXDboYCFkn2a8/Rtx1YSVh/sCONf5UoRC+MUIqrj4UiHN9r3s='

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ source "http://rubygems.org"
33
gem "rake"
44
gem "therubyracer", ">= 0.9.8", "< 0.11"
55
gem "rspec"
6+
gem "aws-sdk"

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
GEM
22
remote: http://rubygems.org/
33
specs:
4+
aws-sdk (1.10.0)
5+
json (~> 1.4)
6+
nokogiri (>= 1.4.4)
7+
uuidtools (~> 2.1)
48
diff-lcs (1.1.3)
9+
json (1.8.0)
510
libv8 (3.3.10.4)
11+
nokogiri (1.5.9)
612
rake (10.0.3)
713
rspec (2.12.0)
814
rspec-core (~> 2.12.0)
@@ -14,11 +20,13 @@ GEM
1420
rspec-mocks (2.12.1)
1521
therubyracer (0.10.2)
1622
libv8 (~> 3.3.10)
23+
uuidtools (2.1.4)
1724

1825
PLATFORMS
1926
ruby
2027

2128
DEPENDENCIES
29+
aws-sdk
2230
rake
2331
rspec
2432
therubyracer (>= 0.9.8, < 0.11)

README.markdown

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Build Status](https://travis-ci.org/wycats/handlebars.js.png?branch=master)](https://travis-ci.org/wycats/handlebars.js)
22

3+
34
Handlebars.js
45
=============
56

@@ -11,13 +12,23 @@ keep the view and the code separated like we all know they should be.
1112
Checkout the official Handlebars docs site at
1213
[http://www.handlebarsjs.com](http://www.handlebarsjs.com).
1314

14-
1515
Installing
1616
----------
1717
Installing Handlebars is easy. Simply download the package [from the
1818
official site](http://handlebarsjs.com/) and add it to your web pages
1919
(you should usually use the most recent version).
2020

21+
Alternatively, if you prefer having the latest version of handlebars from
22+
the 'master' branch, passing builds of the 'master' branch are automatically
23+
published to S3. You may download the latest passing master build by grabbing
24+
a `handlebars-latest.js` file from the [builds page][builds-page]. When the
25+
build is published, it is also available as a `handlebars-gitSHA.js` file on
26+
the builds page if you need a version to refer to others.
27+
`handlebars-runtime.js` builds are also available.
28+
29+
**Note**: The S3 builds page is provided as a convenience for the community,
30+
but you should not use it for hosting Handlebars in production.
31+
2132
Usage
2233
-----
2334
In general, the syntax of Handlebars.js templates is a superset
@@ -389,3 +400,4 @@ License
389400
-------
390401
Handlebars.js is released under the MIT license.
391402

403+
[builds-page]: http://builds.handlebarsjs.com.s3.amazonaws.com/index.html

Rakefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,29 @@ task :bench => "vendor" do
134134

135135
system "node bench/handlebars.js"
136136
end
137+
138+
task :publish do
139+
access_key_id = ENV['S3_ACCESS_KEY_ID']
140+
secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
141+
bucket_name = ENV['S3_BUCKET_NAME']
142+
rev = `git rev-list HEAD -n 1`.to_s.strip
143+
master_rev = `git rev-list origin/master -n 1`.to_s.strip
144+
upload = true if rev == master_rev
145+
upload = upload && access_key_id && secret_access_key && bucket_name
146+
if upload
147+
require 'aws-sdk'
148+
root = File.expand_path(File.dirname(__FILE__)) + '/dist/'
149+
s3 = AWS::S3.new(access_key_id: access_key_id,secret_access_key: secret_access_key)
150+
bucket = s3.buckets[bucket_name]
151+
files = ['handlebars.js', 'handlebars.runtime.js'].map { |file| root + file }
152+
files.each do |file|
153+
basename = Pathname.new(file).basename.sub_ext('')
154+
s3_objs = ["#{basename}-latest.js", "#{basename}-#{rev}.js"].map do |file|
155+
bucket.objects[file]
156+
end
157+
s3_objs.each { |obj| obj.write(Pathname.new(file)) }
158+
end
159+
else
160+
puts "Not uploading any files to S3!"
161+
end
162+
end

0 commit comments

Comments
 (0)