Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into upstream_update

* 'master' of https://github.com/heroku/heroku-buildpack-ruby: (51 commits)
  bump to v134
  v134 changelog
  Use more generic flag for sensible default detect
  Enable Rails 5 to work on Heroku
  changelog for heroku/heroku-buildpack-ruby#347
  Allow opting in to default WEB_CONCURRENCY
  pass user env to bundle clean, since it should run in the same env as bundle install
  use same bundler bin for every bundler command
  control all of our test repos
  don't vendor in JVM on cedar-14 as it's now available on the stack.
  changelog for 133
  bump to v133
  bundler 1.7
  Fail fast if ENV["STACK"] is missing
  bump to v132
  update changelog [ci skip]
  special case for patchlevel rubies. fixes jruby 9.0.0.0.pre1
  Set PX ram limits to correct value: https://devcenter.heroku.com/articles/dyno-size#available-dyno-sizes
  wait on autoscaling
  Scale back JRuby heap size on PX dynos to give room for native memory allocation
  ...
  • Loading branch information
Mat Brown committed Mar 10, 2015
2 parents 98c8f6f + bac6cf0 commit 8ca89b4
Show file tree
Hide file tree
Showing 33 changed files with 496 additions and 162 deletions.
11 changes: 2 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
---
language: ruby
rvm:
- 2.0.0

before_script: bundle exec rake hatchet:setup_travis

# Run tests in parallel
script: bundle exec parallel_rspec -n 11 spec/

after_script:
- heroku keys:remove $USER@`hostname`

- heroku keys:remove $USER@`hostname`
env:
global:
- HATCHET_RETRIES=3
- IS_RUNNING_ON_TRAVIS=true
- HATCHET_DEPLOY_STRATEGY=git
- HATCHET_APP_LIMIT=80
# sets the HEROKU_API_KEY to a dummy user for Heroku deploys
- secure: QvDqQQV/Gtk1Og5s8879i+mYLdK6WtVkZMKlCWvJrztYwcRMOGsVVbXjq5EkEJCfxs4GWv7KqXfPPPLDS5Wumzkt4zXVh3ZS+rzQZ2IYC0XbKZYt2e14ZpSTgDUY20J0Ex/GG5dTulJaG9FBe452UDiqYrianE4p8h8w18JBfCs=
- secure: bM8uWN5b9hZzzHk73EN9xHCK65vuopcbwQILcuMt0A1mHB8tSH1xyMYddNrbGdfznLAVXf8UjvKvv6rvvG4O+j3GRuIWVNukoAvZxG0FC9QxYuKbDccEPPdtqGwVEfWEKQYLajsIpF8/ACyALGV+Oe/Z28WRk6Ba3FLptfulc6s=
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
## Master

## v134 (3/1/2015)

* JVM is now available on cedar-14, do not vendor in JVM based on individual gems. If customer needs a specific version they should use multibuildpack with java and ruby buildpacks.
* Set a default value of WEB_CONCURRENCY based on dyno size when `SENSIBLE_DEFAULTS` environment variable is present.
* Run `bundle clean` in the same context as `bundle install` heroku/heroku-buildpack-ruby#347
* Rails 4.2+ apps will have environment variable RAILS_SERVE_STATIC_FILES set to "enabled" by default #349
* Rails 5 apps now work on Heroku #349

## v133 (1/22/2015)

* Bump bundler to 1.7.12 which includes multiple fixes and support for block source declaration (https://github.com/bundler/bundler/blob/1-7-stable/CHANGELOG.md).

## v132 (1/21/2015)

* Support multibuildpack export file (#319)
* Auto set the JVM MAX HEAP based on dyno size for JRuby (#323)
* Use s3 based npmjs servers for node (#336)
* Support system.properties file for specifying JDK in JRuby (#305)
* Fix ruby version parsing to support JRuby 9.0.0.0.pre1 (#339)

## v131 (1/15/2015)

* Revert v130 due to lack of propper messaging around WEB_CONCURRENCY settings.

## v130 (1/15/2015)

* Auto set WEB_CONCURRENCY based on dyno size if not already set.
* Support multibuildpack export file (#319)
* Auto set the JVM MAX HEAP based on dyno size for JRuby (#323)
* Use s3 based npmjs servers for node (#336)
* Support system.properties file for specifying JDK in JRuby (#305)

## v129 (11/6/2014)

* Fix asset caching bug (#300)

## v128 (11/4/2014)

* Better cedar14 Ruby install error message

## v127 (9/18/2014)

* rbx is now stack aware
Expand Down
42 changes: 20 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
anvil-cli (0.16.1)
progress (~> 2.4.0)
rest-client (~> 1.6.7)
thor (~> 0.15.2)
anvil-cli (0.16.2)
progress (~> 2.4, >= 2.4.0)
rest-client (~> 1.6, >= 1.6.7)
thor (~> 0.15, >= 0.15.2)
diff-lcs (1.1.3)
excon (0.38.0)
heroku-api (0.3.19)
excon (0.43.0)
heroku-api (0.3.22)
excon (~> 0.38)
multi_json (~> 1.8)
heroku_hatchet (1.3.4)
heroku_hatchet (1.4.1)
activesupport (~> 4)
anvil-cli (~> 0)
excon (~> 0)
Expand All @@ -32,24 +32,22 @@ GEM
rrrretry (~> 1)
thor (~> 0)
threaded (~> 0)
i18n (0.6.11)
json (1.8.1)
mime-types (1.25.1)
minitest (5.4.0)
i18n (0.7.0)
json (1.8.2)
mime-types (2.4.3)
minitest (5.5.1)
multi_json (1.10.1)
netrc (0.7.7)
netrc (0.10.2)
parallel (0.6.5)
parallel_tests (0.13.1)
parallel
progress (2.4.0)
rake (10.0.4)
rdoc (4.1.1)
json (~> 1.4)
repl_runner (0.0.3)
activesupport
rest-client (1.6.8)
mime-types (~> 1.16)
rdoc (>= 2.4.2)
rest-client (1.7.2)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rrrretry (1.0.0)
rspec (2.2.0)
rspec-core (~> 2.2)
Expand All @@ -61,10 +59,10 @@ GEM
rspec-mocks (2.13.1)
rspec-retry (0.2.1)
rspec
thor (0.15.4)
thor (0.19.1)
thread_safe (0.3.4)
threaded (0.0.4)
tzinfo (1.2.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
Expand Down
25 changes: 19 additions & 6 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,25 @@ $:.unshift File.expand_path("../../lib", __FILE__)
require "language_pack"
require "language_pack/shell_helpers"

LanguagePack::Instrument.trace 'compile', 'app.compile' do
if pack = LanguagePack.detect(ARGV[0], ARGV[1])
LanguagePack::ShellHelpers.initialize_env(ARGV[2])
pack.topic("Compiling #{pack.name}")
pack.log("compile") do
pack.compile
begin
LanguagePack::Instrument.trace 'compile', 'app.compile' do
if pack = LanguagePack.detect(ARGV[0], ARGV[1])
LanguagePack::ShellHelpers.initialize_env(ARGV[2])
pack.topic("Compiling #{pack.name}")
pack.log("compile") do
pack.compile
end
end
end
rescue Exception => e
Kernel.puts " !"
e.message.split("\n").each do |line|
Kernel.puts " ! #{line.strip}"
end
Kernel.puts " !"
if e.is_a?(BuildpackError)
exit 1
else
raise e
end
end
17 changes: 14 additions & 3 deletions hatchet.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@
],
"ruby": [
"sharpstone/mri_187",
"sharpstone/mri_193_p484",
"sharpstone/mri_193_p547",
"sharpstone/ruby_193_jruby_173",
"sharpstone/ruby_193_jruby_176",
"sharpstone/empty-procfile"
"sharpstone/ruby_193_jruby_17161",
"sharpstone/ruby_193_jruby_17161_jdk7",
"sharpstone/ruby_193_jruby_17161_jdk8",
"sharpstone/jruby-minimal",
"sharpstone/empty-procfile",
"sharpstone/bad_ruby_version"
],
"rack": [
"sharpstone/default_ruby",
"sharpstone/mri_187_nokogiri",
"sharpstone/mri_192",
"sharpstone/mri_193",
"sharpstone/mri_200",
"sharpstone/mri_210"
"sharpstone/mri_214"
],
"rails2": [
"sharpstone/rails23_mri_187"
Expand All @@ -54,6 +59,12 @@
"rails41": [
"sharpstone/rails41_scaffold"
],
"rails42": [
"sharpstone/rails42_scaffold"
],
"rails5": [
"sharpstone/rails5"
],
"multibuildpack": [
"sharpstone/node_multi"
]
Expand Down
5 changes: 3 additions & 2 deletions lib/language_pack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ def self.detect(*args)
Instrument.instrument 'detect' do
Dir.chdir(args.first)

pack = [ NoLockfile, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass|
pack = [ NoLockfile, Rails5, Rails42, Rails41, Rails4, Rails3, Rails2, Rack, Ruby ].detect do |klass|
klass.use?
end

return pack ? pack.new(*args) : nil
end
end

end


Expand All @@ -42,4 +41,6 @@ def self.detect(*args)
require "language_pack/disable_deploys"
require "language_pack/rails4"
require "language_pack/rails41"
require "language_pack/rails42"
require "language_pack/rails5"
require "language_pack/no_lockfile"
19 changes: 17 additions & 2 deletions lib/language_pack/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class LanguagePack::Base

VENDOR_URL = ENV['BUILDPACK_VENDOR_URL'] || "https://s3.amazonaws.com/heroku-buildpack-rg"
DEFAULT_LEGACY_STACK = "cedar"
ROOT_DIR = File.expand_path("../../..", __FILE__)

attr_reader :build_path, :cache

Expand All @@ -26,7 +27,7 @@ class LanguagePack::Base
def initialize(build_path, cache_path=nil)
self.class.instrument "base.initialize" do
@build_path = build_path
@stack = ENV["STACK"]
@stack = ENV.fetch("STACK")
@cache = LanguagePack::Cache.new(cache_path) if cache_path
@metadata = LanguagePack::Metadata.new(@cache)
@bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack)
Expand Down Expand Up @@ -154,6 +155,21 @@ def set_env_override(key, val)
add_to_profiled %{export #{key}="#{val.gsub('"','\"')}"}
end

def add_to_export(string)
export = File.join(ROOT_DIR, "export")
File.open(export, "a") do |file|
file.puts string
end
end

def set_export_default(key, val)
add_to_export "export #{key}=${#{key}:-#{val}}"
end

def set_export_override(key, val)
add_to_export %{export #{key}="#{val.gsub('"','\"')}"}
end

def log_internal(*args)
message = build_log_message(args)
%x{ logger -p user.notice -t "slugc[$$]" "buildpack-ruby #{message}" }
Expand All @@ -170,4 +186,3 @@ def build_log_message(args)
end.join(" ")
end
end

13 changes: 12 additions & 1 deletion lib/language_pack/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@ def clear(path)
target.exist? && target.rmtree
end

# write cache contents
# Overwrite cache contents
# When called the cache destination will be cleared and the new contents coppied over
# This method is perferable as LanguagePack::Cache#add can cause accidental cache bloat.
#
# @param [String] path of contents to store. it will be stored using this a relative path from the cache_base.
# @param [String] relative path to store the cache contents, if nil it will assume the from path
def store(from, path = nil)
path ||= from
clear path
copy from, (@cache_base + path)
end

# Adds file to cache without clearing the destination
# Use LanguagePack::Cache#store to avoid accidental cache bloat
def add(from, path = nil)
path ||= from
copy from, (@cache_base + path)
end
Expand Down
8 changes: 5 additions & 3 deletions lib/language_pack/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

module LanguagePack
class Fetcher
class FetchError < StandardError; end

include ShellHelpers
CDN_YAML_FILE = File.expand_path("../../../config/cdn.yml", __FILE__)

Expand All @@ -14,17 +16,17 @@ def initialize(host_url, stack = nil)

def fetch(path)
curl = curl_command("-O #{@host_url.join(path)}")
run!(curl)
run!(curl, error_class: FetchError)
end

def fetch_untar(path, files_to_extract = nil)
curl = curl_command("#{@host_url.join(path)} -s -o")
run!("#{curl} - | tar zxf - #{files_to_extract}")
run!("#{curl} - | tar zxf - #{files_to_extract}", error_class: FetchError)
end

def fetch_bunzip2(path, files_to_extract = nil)
curl = curl_command("#{@host_url.join(path)} -s -o")
run!("#{curl} - | tar jxf - #{files_to_extract}")
run!("#{curl} - | tar jxf - #{files_to_extract}", error_class: FetchError)
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/helpers/bundler_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def exists?

# writes cache contents to cache store
def store
@cache.clear(@stack_dir)
@cache.store(".bundle")
@cache.store(@bundler_dir, @stack_dir)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/language_pack/helpers/bundler_wrapper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class LanguagePack::Helpers::BundlerWrapper
include LanguagePack::ShellHelpers

class GemfileParseError < StandardError
class GemfileParseError < BuildpackError
def initialize(error)
msg = "There was an error parsing your Gemfile, we cannot continue\n"
msg << error
Expand Down Expand Up @@ -89,7 +89,7 @@ def ruby_version
if output.match(/No ruby version specified/)
""
else
output.chomp.sub('(', '').sub(')', '').sub("p", " p").split.join('-')
output.chomp.sub('(', '').sub(')', '').sub(/(p\d+)/, ' \1').split.join('-')
end
end
end
Expand Down
Loading

0 comments on commit 8ca89b4

Please sign in to comment.