Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 200 lines (166 sloc) 6.007 kb
29971b55 » ddollar
2011-05-24 add rake task to update plugins
1 require "fileutils"
42f33252 » hone
2011-09-23 vendor plugins onto s3
2 require "tmpdir"
29971b55 » ddollar
2011-05-24 add rake task to update plugins
3
43ee356d » hone
2011-10-21 update to new s3 bucket name
4 S3_BUCKET_NAME = "heroku-buildpack-ruby"
c9e64345 » hone
2011-11-04 rake task for build ruby
5 VENDOR_URL = "https://s3.amazonaws.com/#{S3_BUCKET_NAME}"
9abebb11 » hone
2011-09-24 vendor libyaml onto s3
6
42f33252 » hone
2011-09-23 vendor plugins onto s3
7 def s3_tools_dir
8 File.expand_path("../support/s3", __FILE__)
29971b55 » ddollar
2011-05-24 add rake task to update plugins
9 end
10
1d7bfe85 » hone
2011-09-24 refactor out s3_upload logic
11 def s3_upload(tmpdir, name)
12 sh("#{s3_tools_dir}/s3 put #{S3_BUCKET_NAME} #{name}.tgz #{tmpdir}/#{name}.tgz")
13 end
14
29971b55 » ddollar
2011-05-24 add rake task to update plugins
15 def vendor_plugin(git_url)
16 name = File.basename(git_url, File.extname(git_url))
42f33252 » hone
2011-09-23 vendor plugins onto s3
17 Dir.mktmpdir("#{name}-") do |tmpdir|
18 FileUtils.rm_rf("#{tmpdir}/*")
19
20 Dir.chdir(tmpdir) do
21 sh "git clone #{git_url} ."
22 FileUtils.rm_rf("#{name}/.git")
23 sh("tar czvf #{tmpdir}/#{name}.tgz *")
1d7bfe85 » hone
2011-09-24 refactor out s3_upload logic
24 s3_upload(tmpdir, name)
42f33252 » hone
2011-09-23 vendor plugins onto s3
25 end
29971b55 » ddollar
2011-05-24 add rake task to update plugins
26 end
27 end
28
728c8966 » hone
2011-09-26 vendor gems onto s3
29 def in_gem_env(gem_home, &block)
a16dfa42 » hone
2011-06-15 rake task to install gems to be vendored
30 old_gem_home = ENV['GEM_HOME']
31 old_gem_path = ENV['GEM_PATH']
728c8966 » hone
2011-09-26 vendor gems onto s3
32 ENV['GEM_HOME'] = ENV['GEM_PATH'] = gem_home.to_s
a16dfa42 » hone
2011-06-15 rake task to install gems to be vendored
33
34 yield
35
36 ENV['GEM_HOME'] = old_gem_home
37 ENV['GEM_PATH'] = old_gem_path
38 end
39
40 def install_gem(gem, version)
728c8966 » hone
2011-09-26 vendor gems onto s3
41 name = "#{gem}-#{version}"
42 Dir.mktmpdir("#{gem}-#{version}") do |tmpdir|
43 Dir.chdir(tmpdir) do |dir|
44 FileUtils.rm_rf("#{tmpdir}/*")
a16dfa42 » hone
2011-06-15 rake task to install gems to be vendored
45
728c8966 » hone
2011-09-26 vendor gems onto s3
46 in_gem_env(tmpdir) do
434e8c9f » hone
2011-09-27 always write gem wrappers with #!/usr/bin/env ruby
47 sh("gem install #{gem} --version #{version} --no-ri --no-rdoc --env-shebang")
728c8966 » hone
2011-09-26 vendor gems onto s3
48 sh("tar czvf #{tmpdir}/#{name}.tgz *")
49 s3_upload(tmpdir, name)
50 end
51 end
a16dfa42 » hone
2011-06-15 rake task to install gems to be vendored
52 end
53 end
54
35d4533d » hone
2011-11-05 refactor building ruby code
55 def build_ruby_command(name, output, prefix, usr_dir, tmpdir)
56 build_command = [
57 # need to move libyaml/libffi to dirs we can see
58 "mv usr /tmp",
59 "./configure --disable-install-doc --prefix #{prefix}",
60 "env CPATH=/tmp/#{usr_dir}/include:\\$CPATH CPPATH=/tmp/#{usr_dir}/include:\\$CPPATH LIBRARY_PATH=/tmp/#{usr_dir}/lib:\\$LIBRARY_PATH make",
61 "make install"
62 ]
63 build_command << "mv #{prefix} /app/vendor/#{name}" if name != output
64 build_command = build_command.join(" && ")
65
66 sh "vulcan build -v -o #{output}.tgz --source #{name} --command=\"#{build_command}\""
67 s3_upload(tmpdir, output)
68 end
69
29971b55 » ddollar
2011-05-24 add rake task to update plugins
70 desc "update plugins"
71 task "plugins:update" do
72 vendor_plugin "http://github.com/ddollar/rails_log_stdout.git"
73 vendor_plugin "http://github.com/pedro/rails3_serve_static_assets.git"
a8c78ea4 » hone
2011-09-04 add rails31_enable_runtime_asset_compilation to Rakefile
74 vendor_plugin "http://github.com/hone/rails31_enable_runtime_asset_compilation.git"
29971b55 » ddollar
2011-05-24 add rake task to update plugins
75 end
a16dfa42 » hone
2011-06-15 rake task to install gems to be vendored
76
77 desc "install vendored gem"
78 task "gem:install", :gem, :version do |t, args|
79 gem = args[:gem]
80 version = args[:version]
81
82 install_gem(gem, version)
83 end
da21ad1e » hone
2011-08-23 rake task for vendoring new libyaml
84
f8745d35 » hone
2011-09-26 don't hardcode the libyaml version in the Rakefile
85 desc "install libyaml"
86 task "libyaml:install", :version do |t, args|
87 version = args[:version]
88 name = "libyaml-#{version}"
9abebb11 » hone
2011-09-24 vendor libyaml onto s3
89 Dir.mktmpdir("libyaml-") do |tmpdir|
90 Dir.chdir(tmpdir) do |dir|
91 FileUtils.rm_rf("#{tmpdir}/*")
92
f8745d35 » hone
2011-09-26 don't hardcode the libyaml version in the Rakefile
93 sh "curl http://pyyaml.org/download/libyaml/yaml-#{version}.tar.gz -s -o - | tar vzxf -"
2f310ae1 » hone
2011-11-05 make build command easier to read for libyaml
94
95 build_command = [
96 "env CFLAGS=-fPIC ./configure --enable-static --disable-shared --prefix=/app/vendor/yaml-#{version}",
97 "make",
98 "make install"
99 ].join(" && ")
100
101 sh "vulcan build -v -o #{name}.tgz --source yaml-#{version} --command=\"#{build_command}\""
1d7bfe85 » hone
2011-09-24 refactor out s3_upload logic
102 s3_upload(tmpdir, name)
9abebb11 » hone
2011-09-24 vendor libyaml onto s3
103 end
104 end
da21ad1e » hone
2011-08-23 rake task for vendoring new libyaml
105 end
0d3400c6 » hone
2011-09-24 vendor node in s3
106
643da197 » hone
2011-09-26 remove hard coding node version in Rakefile
107 desc "install node"
108 task "node:install", :version do |t, args|
109 version = args[:version]
110 name = "node-#{version}"
111 prefix = "/app/vendor/node-v#{version}"
0d3400c6 » hone
2011-09-24 vendor node in s3
112 Dir.mktmpdir("node-") do |tmpdir|
113 Dir.chdir(tmpdir) do |dir|
114 FileUtils.rm_rf("#{tmpdir}/*")
115
643da197 » hone
2011-09-26 remove hard coding node version in Rakefile
116 sh "curl http://nodejs.org/dist/node-v#{version}.tar.gz -s -o - | tar vzxf -"
00a25448 » hone
2011-11-05 make build command easier to read for node
117
118 build_command = [
119 "./configure --prefix #{prefix}",
120 "make install",
121 "mv #{prefix}/bin/node #{prefix}/.",
122 "rm -rf #{prefix}/include",
123 "rm -rf #{prefix}/lib",
124 "rm -rf #{prefix}/share",
125 "rm -rf #{prefix}/bin"
126 ].join(" && ")
127
128 sh "vulcan build -v -o #{name}.tgz --source node-v#{version} --command=\"#{build_command}\""
0d3400c6 » hone
2011-09-24 vendor node in s3
129 s3_upload(tmpdir, name)
130 end
131 end
132 end
28a874ca » hone
2011-11-02 rake task to build ruby 1.9.3
133
134 desc "install ruby"
135 task "ruby:install", :version do |t, args|
136 version = args[:version]
137 name = "ruby-#{version}"
7939f2bc » hone
2011-11-04 update ruby install task to use libyaml + libffi
138 usr_dir = "usr"
28a874ca » hone
2011-11-02 rake task to build ruby 1.9.3
139 Dir.mktmpdir("ruby-") do |tmpdir|
140 Dir.chdir(tmpdir) do |dir|
141 FileUtils.rm_rf("#{tmpdir}/*")
142
143 sh "curl http://ftp.ruby-lang.org/pub/ruby/1.9/#{name}.tar.gz -s -o - | tar vzxf -"
7939f2bc » hone
2011-11-04 update ruby install task to use libyaml + libffi
144 FileUtils.mkdir_p("#{name}/#{usr_dir}")
145 Dir.chdir("#{name}/#{usr_dir}") do
146 sh "curl #{VENDOR_URL}/libyaml-0.1.4.tgz -s -o - | tar vzxf -"
147 sh "curl #{VENDOR_URL}/libffi-3.0.10.tgz -s -o - | tar vzxf -"
148 end
d1d840fb » hone
2011-11-04 make ruby build task more readable
149
3782f19d » hone
2011-11-07 combine build/runtime ruby rake tasks
150 # runtime ruby
151 prefix = "/app/vendor/#{name}"
35d4533d » hone
2011-11-05 refactor building ruby code
152 build_ruby_command(name, name, prefix, usr_dir, tmpdir)
153
3782f19d » hone
2011-11-07 combine build/runtime ruby rake tasks
154 # build ruby
155 output = "ruby-build-#{version}"
156 prefix = "/tmp/#{name}"
35d4533d » hone
2011-11-05 refactor building ruby code
157 build_ruby_command(name, output, prefix, usr_dir, tmpdir)
c9e64345 » hone
2011-11-04 rake task for build ruby
158 end
159 end
160 end
161
0fe5f39b » hone
2011-11-08 task to generate ruby versions manifest file
162 desc "generate ruby versions manifest"
163 task "ruby:manifest" do
164 require 'rexml/document'
165 require 'yaml'
166
167 document = REXML::Document.new(`curl https://#{S3_BUCKET_NAME}.s3.amazonaws.com`)
168 rubies = document.elements.to_a("//Contents/Key").map {|node| node.text }.select {|text| text.match(/^ruby-\d+\.\d+\.\d+-p\d+/) }
169
170 Dir.mktmpdir("ruby_versions-") do |tmpdir|
171 name = 'ruby_versions.yml'
172 File.open(name, 'w') {|file| file.puts(rubies.to_yaml) }
173 sh("#{s3_tools_dir}/s3 put #{S3_BUCKET_NAME} #{name} #{name}")
174 end
175 end
176
cf2aa29e » hone
2011-11-04 rake task for installing libffi
177 desc "install libffi"
178 task "libffi:install", :version do |t, args|
179 version = args[:version]
180 name = "libffi-#{version}"
181 prefix = "/app/vendor/#{name}"
182 Dir.mktmpdir("libffi-") do |tmpdir|
183 Dir.chdir(tmpdir) do |dir|
184 FileUtils.rm_rf("#{tmpdir}/*")
185
186 sh "curl ftp://sourceware.org/pub/libffi/libffi-#{version}.tar.gz -s -o - | tar vzxf -"
4a977ddb » hone
2011-11-05 make build command easier to read for libffi
187
188 build_command = [
189 "env CFLAGS=-fPIC ./configure --enable-static --disable-shared --prefix=#{prefix}",
190 "make",
191 "make install",
192 "mv #{prefix}/lib/#{name}/include #{prefix}",
193 "rm -rf #{prefix}/lib/#{name}"
194 ].join(" && ")
195
196 sh "vulcan build -v -o #{name}.tgz --source #{name} --command=\"#{build_command}\""
cf2aa29e » hone
2011-11-04 rake task for installing libffi
197 s3_upload(tmpdir, name)
198 end
199 end
200 end
Something went wrong with that request. Please try again.