-
Notifications
You must be signed in to change notification settings - Fork 49
/
build-source-gem
executable file
·94 lines (74 loc) · 2.07 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/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/
if [ "$VERSION" == "" ]
then
git fetch --tags
VERSION=$(git describe --tags)
git checkout "$VERSION"
echo "Version is empty. Using latest tag: $VERSION."
fi
git checkout "$VERSION"
npm install
mkdir -p lib/coffee_script
MINIFY=false ./bin/cake build:browser
case "$VERSION" in
1.*)
mv docs/v1/browser-compiler/coffee-script.js lib/coffee_script/coffee-script.js
;;
2.*)
mv docs/v2/browser-compiler/coffeescript.js lib/coffee_script/coffee-script.js
;;
*)
echo "NO VALID VERSION DETECTED. FAILING HARD."
exit 1
;;
esac
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.metadata["source_code_uri"] = "https://github.com/rails/ruby-coffee-script/blob/master/script/build-source-gem"
s.files = [
'lib/coffee_script/coffee-script.js',
'lib/coffee_script/source.rb'
]
s.authors = ['Jeremy Ashkenas']
s.email = '[email protected]'
s.rubyforge_project = 'coffee-script-source'
s.license = "MIT"
end
ERUBY
gem build coffee-script-source.gemspec
mv *.gem ../