From 057d8b2b42e8d1c293d60cb7a6e3db26a6bdf872 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Tue, 18 Feb 2014 13:24:42 +1100 Subject: [PATCH] Add some Ruby 2.1 specific Gems, get people to upgrade bundler --- Gemfile | 35 +++++++++++++++++++++++++++++++++++ Gemfile.lock | 4 ++++ 2 files changed, 39 insertions(+) diff --git a/Gemfile b/Gemfile index c69a84cc54f..b363fa10cb5 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,39 @@ if rails_master? Bundler::SharedHelpers.default_lockfile = Pathname.new("#{Bundler::SharedHelpers.default_gemfile}_master.lock") end +# Monkey patch bundler to support mri_21 +unless Bundler::Dependency::PLATFORM_MAP.include? :mri_21 + STDERR.puts + STDERR.puts "WARNING: --------------------------------------------------------------------------" + STDERR.puts "You are running an old version of bundler, please update by running: gem install bundler" + STDERR.puts + map = Bundler::Dependency::PLATFORM_MAP.dup + map[:mri_21] = Gem::Platform::RUBY + map.freeze + Bundler::Dependency.send(:remove_const, "PLATFORM_MAP") + Bundler::Dependency.const_set("PLATFORM_MAP", map) + + Bundler::Dsl.send(:remove_const, "VALID_PLATFORMS") + Bundler::Dsl.const_set("VALID_PLATFORMS", map.keys.freeze) + class ::Bundler::CurrentRuby + def on_21? + RUBY_VERSION =~ /^2\.1/ + end + def mri_21? + mri? && on_21? + end + end + class ::Bundler::Dependency + private + def on_21? + RUBY_VERSION =~ /^2\.1/ + end + def mri_21? + mri? && on_21? + end + end +end + # Bundler::Dsl.evaluate already called with an incorrect lockfile ... fix it class Bundler::Dsl # A bit messy, this can be called multiple times by bundler, avoid blowing the stack @@ -180,6 +213,8 @@ gem 'rbtrace', require: false, platform: :mri # required for feed importing and embedding gem 'ruby-readability', require: false gem 'simple-rss', require: false +gem 'gctools', require: false, platform: :mri_21 +gem 'stackprof', require: false, platform: :mri_21 # perftools only works on 1.9 atm group :profile do diff --git a/Gemfile.lock b/Gemfile.lock index 5fdb463e4be..c22437eebb4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -115,6 +115,7 @@ GEM ruby-hmac formatador (0.2.4) fspath (2.0.5) + gctools (0.2.3) given_core (3.1.1) sorcerer (>= 0.3.7) guess_html_encoding (0.0.9) @@ -349,6 +350,7 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) + stackprof (0.2.5) temple (0.6.7) therubyracer (0.12.1) libv8 (~> 3.16.14.0) @@ -404,6 +406,7 @@ DEPENDENCIES fastimage flamegraph fog (= 1.18.0) + gctools handlebars-source (~> 1.1.2) highline hiredis @@ -462,6 +465,7 @@ DEPENDENCIES sinatra slim spork-rails + stackprof therubyracer thin timecop