Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to heroku-buildpack-ruby v50 #1

Merged
merged 51 commits into from
Feb 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
01f1998
fix typo in comments
schneems Oct 29, 2012
9563b5a
Merge pull request #45 from schneems/schneems/typo
schneems Oct 29, 2012
6157037
Update README.md
catsby Nov 1, 2012
28aca4c
Merge pull request #46 from ctshryock/master
hone Nov 1, 2012
accd548
ruby 2.0.0 doesn't need a build ruby
hone Nov 1, 2012
56345f9
update changelog
hone Nov 1, 2012
4c97ef4
update to Bundler 1.2.2
hone Nov 26, 2012
d51b081
update changelog
hone Nov 26, 2012
77d76b2
upgrade to bundler 1.3.0.pre.2
hone Dec 10, 2012
9d9da01
update changelog
hone Dec 13, 2012
81835ba
update the buildpack version :(
hone Dec 14, 2012
8fecbd8
update changelog
hone Dec 14, 2012
b075d5d
bump version to v44
hone Dec 15, 2012
753588a
enable invoke dynamic on JRuby by default
hone Dec 15, 2012
23b0646
remove setting config vars in release
hone Dec 14, 2012
8e2d331
bump to v45
hone Dec 15, 2012
686be88
update changelog
hone Dec 15, 2012
05a579b
override $GEM_PATH in .profile.d/ruby.sh
hone Dec 15, 2012
f659a40
update changelog
hone Dec 15, 2012
fd81270
install bundler binstubs into a different dir
hone Dec 15, 2012
7832dbc
symlink bundler binstubs in bin/ for backwards compatability
hone Dec 18, 2012
f8b18c8
rbx2 doesn't need a build ruby
hone Dec 18, 2012
e9c0f1c
ruby naming scheme doesn't start with ruby engine
hone Dec 18, 2012
1749a0f
bump to v46
hone Dec 18, 2012
26dfef8
Rails3.use?: use String#include? instead of =~
wuputah Dec 18, 2012
b2cd9df
fix building ruby-build rubies
hone Dec 18, 2012
5dbf4c0
update to bundler 1.3.0.pre.5
hone Jan 10, 2013
9e82cda
update changelog
hone Jan 10, 2013
29a896d
print warning when removing windows generated Gemfile.lock
cjolly Jan 16, 2013
dfffb48
bump to v47
hone Jan 18, 2013
ba1f811
display the ruby version change to the user
hone Jan 18, 2013
924df79
update changelog
hone Jan 18, 2013
0422bc8
Merge pull request #62 from cjolly/cjolly-log-windows-gemfile-lock-re…
hone Jan 22, 2013
8137a21
Merge pull request #54 from heroku/rails3-detect-file-encoding
hone Jan 22, 2013
066d4a1
temporarily disable deploys due to rubygems.org compromise
hone Jan 30, 2013
4c8d376
Merge branch 'disable_deploy'
hone Jan 30, 2013
4531e5a
update error message to link to status
hone Jan 30, 2013
d9c61d4
update copy
hone Jan 30, 2013
5bbfb24
update changelog
hone Jan 30, 2013
58ce8b8
v48
hone Jan 30, 2013
e69301b
use bundle install local
hone Jan 30, 2013
dfd66de
add error messaging when can't deploy due to gems not being in the cache
hone Jan 30, 2013
c46e0f9
need ruby_version_cache to exist before reading it
hone Jan 30, 2013
3bcd325
update the changelog
hone Jan 30, 2013
0616ff6
v49
hone Jan 30, 2013
56bf7ef
Revert "use bundle install local"
hone Jan 31, 2013
cc81c84
Revert "add error messaging when can't deploy due to gems not being i…
hone Jan 31, 2013
d837af2
update changelog
hone Jan 31, 2013
5240491
v50
hone Jan 31, 2013
32a84d8
remove DisableDeploys from the detect list
hone Jan 31, 2013
0a0798e
Merge branch 'master' of git://github.com/heroku/heroku-buildpack-rub…
DouweM Feb 5, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,65 @@
## v50

Features:

* Restore ruby deploys back to normal

## v49 (1/30/2013)

Features:

* Re-enable ruby deploys for apps just using the heroku cache
* Display ruby version change when busting the cache

## v48 (1/30/2013)

Features:

* Update deploy error message copy to link to status incident.

## v47 (1/30/2013)

Features:

* Disable ruby deploys due to rubygems.org compromise

## v46 (1/10/2013)

Features:

* Upgrade Bundler to 1.3.0.pre.5
* bundler binstubs now go in vendor/bundle/bin

## v45 (12/14/2012)

Features:

* Stop setting env vars in bin/release now that login-shell is released
* Enable Invoke Dynamic on JRuby by default
* GEM_PATH is now updated on each push

## v44 (12/14/2012)

Faulty Release

## v43 (12/13/2012)

Features:

* Upgrade Bundler to 1.3.0.pre.2

## v42 (11/26/2012)

Features:

* Upgrade Bundler to 1.2.2 to fix Ruby 2.0.0/YAML issues

## v41 (11/1/2012)

Features:

* Enable ruby 2.0.0 support for testing

## v40 (10/14/2012) ## v40 (10/14/2012)


Features: Features:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Example Usage:
$ ls $ ls
Gemfile Gemfile.lock Gemfile Gemfile.lock


$ heroku create --stack cedar --buildpack http://github.com/heroku/heroku-buildpack-ruby.git $ heroku create --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git


$ git push heroku master $ git push heroku master
... ...
Expand Down Expand Up @@ -47,7 +47,7 @@ Example Usage:
$ ls config/environment.rb $ ls config/environment.rb
config/environment.rb config/environment.rb


$ heroku create --stack cedar --buildpack http://github.com/heroku/heroku-buildpack-ruby.git $ heroku create --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git


$ git push heroku master $ git push heroku master
... ...
Expand Down Expand Up @@ -81,7 +81,7 @@ Example Usage:
$ ls config/application.rb $ ls config/application.rb
config/application.rb config/application.rb


$ heroku create --stack cedar --buildpack http://github.com/heroku/heroku-buildpack-ruby.git $ heroku create --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git


$ git push heroku master $ git push heroku master
-----> Heroku receiving push -----> Heroku receiving push
Expand Down
5 changes: 3 additions & 2 deletions Rakefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def install_gem(gem, version)
end end


def build_ruby_command(name, output, prefix, usr_dir, tmpdir, rubygems = nil) def build_ruby_command(name, output, prefix, usr_dir, tmpdir, rubygems = nil)
vulcan_prefix = "/app/vendor/#{output}"
build_command = [ build_command = [
# need to move libyaml/libffi to dirs we can see # need to move libyaml/libffi to dirs we can see
"mv #{usr_dir} /tmp", "mv #{usr_dir} /tmp",
Expand All @@ -65,7 +66,7 @@ def build_ruby_command(name, output, prefix, usr_dir, tmpdir, rubygems = nil)
build_command << "mv #{prefix} /app/vendor/#{output}" if prefix != "/app/vendor/#{output}" build_command << "mv #{prefix} /app/vendor/#{output}" if prefix != "/app/vendor/#{output}"
build_command = build_command.join(" && ") build_command = build_command.join(" && ")


sh "vulcan build -v -o #{output}.tgz --prefix #{prefix} --source #{name} --command=\"#{build_command}\"" sh "vulcan build -v -o #{output}.tgz --prefix #{vulcan_prefix} --source #{name} --command=\"#{build_command}\""
s3_upload(tmpdir, output) s3_upload(tmpdir, output)
end end


Expand Down Expand Up @@ -178,7 +179,7 @@ task "ruby:install", :version do |t, args|
# build ruby # build ruby
if major_ruby == "1.8" if major_ruby == "1.8"
output = "ruby-build-#{version}" output = "ruby-build-#{version}"
prefix = "/app/vendor/ruby-build-#{version}" prefix = "/tmp/ruby-#{version}"
build_ruby_command(full_name, output, prefix, usr_dir, tmpdir, rubygems) build_ruby_command(full_name, output, prefix, usr_dir, tmpdir, rubygems)
end end
end end
Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ def self.detect(*args)
require "language_pack/rack" require "language_pack/rack"
require "language_pack/rails2" require "language_pack/rails2"
require "language_pack/rails3" require "language_pack/rails3"

require "language_pack/disable_deploys"
3 changes: 1 addition & 2 deletions lib/language_pack/base.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def release


{ {
"addons" => default_addons, "addons" => default_addons,
"config_vars" => default_config_vars,
"default_process_types" => default_process_types "default_process_types" => default_process_types
}.to_yaml }.to_yaml
end end
Expand Down Expand Up @@ -153,7 +152,7 @@ def run_stdout(command)
%x{ #{command} 2>/dev/null } %x{ #{command} 2>/dev/null }
end end


# run a shell command and stream the ouput # run a shell command and stream the output
# @param [String] command to be run # @param [String] command to be run
def pipe(command) def pipe(command)
output = "" output = ""
Expand Down
17 changes: 17 additions & 0 deletions lib/language_pack/disable_deploys.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,17 @@
require "language_pack"
require "language_pack/base"

class LanguagePack::DisableDeploys < LanguagePack::Base
def self.use?
File.exist?("Gemfile")
end

def name
"Ruby/DisableDeploys"
end

def compile
error "Ruby deploys have been temporarily disabled due to a Rubygems.org security breach.\nPlease see https://status.heroku.com/incidents/489 for more info and a workaround if you need to deploy."
end
end

2 changes: 1 addition & 1 deletion lib/language_pack/rails3.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class LanguagePack::Rails3 < LanguagePack::Rails2
def self.use? def self.use?
super && super &&
File.exists?("config/application.rb") && File.exists?("config/application.rb") &&
File.read("config/application.rb") =~ /Rails::Application/ File.read("config/application.rb").include?("Rails::Application")
end end


def name def name
Expand Down
29 changes: 21 additions & 8 deletions lib/language_pack/ruby.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@


# base Ruby Language Pack. This is for any base ruby app. # base Ruby Language Pack. This is for any base ruby app.
class LanguagePack::Ruby < LanguagePack::Base class LanguagePack::Ruby < LanguagePack::Base
BUILDPACK_VERSION = "v40" BUILDPACK_VERSION = "v50"
LIBYAML_VERSION = "0.1.4" LIBYAML_VERSION = "0.1.4"
LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}"
BUNDLER_VERSION = "1.2.1" BUNDLER_VERSION = "1.3.0.pre.5"
BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}"
NODE_VERSION = "0.4.7" NODE_VERSION = "0.4.7"
NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}" NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}"
Expand Down Expand Up @@ -141,7 +141,7 @@ def bootstrap_bundler(&block)
# determine if we're using rbx # determine if we're using rbx
# @return [Boolean] true if we are and false if we aren't # @return [Boolean] true if we are and false if we aren't
def ruby_version_rbx? def ruby_version_rbx?
ruby_version ? ruby_version.match(/^rbx-/) : false ruby_version ? ruby_version.match(/rbx-/) : false
end end


# determine if we're using jruby # determine if we're using jruby
Expand All @@ -159,7 +159,7 @@ def default_java_opts
# default JRUBY_OPTS # default JRUBY_OPTS
# return [String] string of JRUBY_OPTS # return [String] string of JRUBY_OPTS
def default_jruby_opts def default_jruby_opts
"-Xcompile.invokedynamic=false" "-Xcompile.invokedynamic=true"
end end


# list the available valid ruby versions # list the available valid ruby versions
Expand Down Expand Up @@ -191,7 +191,7 @@ def setup_language_pack_environment


# sets up the profile.d script for this buildpack # sets up the profile.d script for this buildpack
def setup_profiled def setup_profiled
set_env_default "GEM_PATH", "$HOME/#{slug_vendor_base}" set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH"
set_env_default "LANG", "en_US.UTF-8" set_env_default "LANG", "en_US.UTF-8"
set_env_override "PATH", "$HOME/bin:$HOME/#{slug_vendor_base}/bin:$PATH" set_env_override "PATH", "$HOME/bin:$HOME/#{slug_vendor_base}/bin:$PATH"


Expand All @@ -204,7 +204,7 @@ def setup_profiled
# determines if a build ruby is required # determines if a build ruby is required
# @return [Boolean] true if a build ruby is required # @return [Boolean] true if a build ruby is required
def build_ruby? def build_ruby?
@build_ruby ||= !ruby_version_jruby? && ruby_version != "ruby-1.9.3" @build_ruby ||= !ruby_version_rbx? && !ruby_version_jruby? && !%w{ruby-1.9.3 ruby-2.0.0}.include?(ruby_version)
end end


# install the vendored ruby # install the vendored ruby
Expand Down Expand Up @@ -362,13 +362,17 @@ def remove_vendor_bundle
def build_bundler def build_bundler
log("bundle") do log("bundle") do
bundle_without = ENV["BUNDLE_WITHOUT"] || "development:test" bundle_without = ENV["BUNDLE_WITHOUT"] || "development:test"
bundle_command = "bundle install --without #{bundle_without} --path vendor/bundle --binstubs bin/" bundle_command = "bundle install --without #{bundle_without} --path vendor/bundle --binstubs vendor/bundle/bin"


unless File.exist?("Gemfile.lock") unless File.exist?("Gemfile.lock")
error "Gemfile.lock is required. Please run \"bundle install\" locally\nand commit your Gemfile.lock." error "Gemfile.lock is required. Please run \"bundle install\" locally\nand commit your Gemfile.lock."
end end


if has_windows_gemfile_lock? if has_windows_gemfile_lock?
topic "WARNING: Removing `Gemfile.lock` because it was generated on Windows."
puts "Bundler will do a full resolve so native gems are handled properly."
puts "This may result in unexpected gem versions being used in your app."

log("bundle", "has_windows_gemfile_lock") log("bundle", "has_windows_gemfile_lock")
File.unlink("Gemfile.lock") File.unlink("Gemfile.lock")
else else
Expand Down Expand Up @@ -408,6 +412,13 @@ def build_bundler


# Keep gem cache out of the slug # Keep gem cache out of the slug
FileUtils.rm_rf("#{slug_vendor_base}/cache") FileUtils.rm_rf("#{slug_vendor_base}/cache")

# symlink binstubs
bin_dir = "bin"
FileUtils.mkdir_p bin_dir
Dir["#{slug_vendor_base}/bin/*"].each do |bin|
run("ln -s ../#{bin} #{bin_dir}") unless File.exist?("#{bin_dir}/#{bin}")
end
else else
log "bundle", :status => "failure" log "bundle", :status => "failure"
error_message = "Failed to install gems via Bundler." error_message = "Failed to install gems via Bundler."
Expand Down Expand Up @@ -597,8 +608,10 @@ def load_bundler_cache
elsif !File.exists?(buildpack_version_cache) && File.exists?(ruby_version_cache) elsif !File.exists?(buildpack_version_cache) && File.exists?(ruby_version_cache)
puts "Broken cache detected. Purging build cache." puts "Broken cache detected. Purging build cache."
purge_bundler_cache purge_bundler_cache
elsif cache_exists?(bundler_cache) && !(File.exists?(ruby_version_cache) && full_ruby_version == File.read(ruby_version_cache).chomp) elsif cache_exists?(bundler_cache) && File.exists?(ruby_version_cache) && full_ruby_version != File.read(ruby_version_cache).chomp
puts "Ruby version change detected. Clearing bundler cache." puts "Ruby version change detected. Clearing bundler cache."
puts "Old: #{File.read(ruby_version_cache).chomp}"
puts "New: #{full_ruby_version}"
purge_bundler_cache purge_bundler_cache
end end


Expand Down