-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathbuild-source-gem
executable file
·72 lines (55 loc) · 1.6 KB
/
build-source-gem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
set -e
set -x
VERSION="$1"
mkdir -p tmp/
pushd tmp/
if [ ! -d "coffeescript/" ]; then
git clone "https://github.com/jashkenas/coffeescript"
fi
pushd coffeescript/
git checkout "$VERSION"
npm install
mkdir -p lib/coffee_script
MINIFY=false ./bin/cake build:browser
mv docs/v1/browser-compiler/coffee-script.js lib/coffee_script/coffee-script.js
cat << ERUBY > lib/coffee_script/source.rb
module CoffeeScript
module Source
def self.bundled_path
File.expand_path("../coffee-script.js", __FILE__)
end
end
end
ERUBY
cat << ERUBY > coffee-script-source.gemspec
require 'rubygems'
require 'json'
version = JSON.parse(File.read('package.json'))["version"]
date = Time.at(`git show HEAD --format=%at | head -n1`)
warn "#{version} at #{date}"
gemspec = Gem::Specification.new do |s|
s.name = 'coffee-script-source'
s.version = version
s.date = date
s.homepage = "http://coffeescript.org"
s.summary = "The CoffeeScript Compiler"
s.description = <<-EOS
CoffeeScript is a little language that compiles into JavaScript.
Underneath all of those embarrassing braces and semicolons,
JavaScript has always had a gorgeous object model at its heart.
CoffeeScript is an attempt to expose the good parts of JavaScript
in a simple way.
EOS
s.files = [
'lib/coffee_script/coffee-script.js',
'lib/coffee_script/source.rb'
]
s.authors = ['Jeremy Ashkenas']
s.email = 'jashkenas@gmail.com'
s.rubyforge_project = 'coffee-script-source'
s.license = "MIT"
end
ERUBY
gem build coffee-script-source.gemspec
mv *.gem ../