Skip to content

Commit e7e0060

Browse files
committed
ok, we now dual boot rails 4 and rails 3 ... to run in rails 4 mode: RAILS4=1 bundle exec thin start
1 parent 8578132 commit e7e0060

6 files changed

Lines changed: 717 additions & 109 deletions

File tree

Gemfile

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
source 'https://rubygems.org'
22

3+
# monkey patching to support dual booting
4+
module Bundler::SharedHelpers
5+
def default_lockfile=(path)
6+
@default_lockfile = path
7+
end
8+
def default_lockfile
9+
@default_lockfile ||= Pathname.new("#{default_gemfile}.lock")
10+
end
11+
end
12+
13+
def rails4?
14+
!!ENV["RAILS4"]
15+
end
16+
17+
if rails4?
18+
Bundler::SharedHelpers.default_lockfile = Pathname.new("#{Bundler::SharedHelpers.default_gemfile}_rails4.lock")
19+
20+
# Bundler::Dsl.evaluate already called with an incorrect lockfile ... fix it
21+
class Bundler::Dsl
22+
# A bit messy, this can be called multiple times by bundler, avoid blowing the stack
23+
unless self.method_defined? :to_definition_unpatched
24+
alias_method :to_definition_unpatched, :to_definition
25+
puts "Booting in Rails 4 mode"
26+
end
27+
def to_definition(bad_lockfile, unlock)
28+
to_definition_unpatched(Bundler::SharedHelpers.default_lockfile, unlock)
29+
end
30+
end
31+
end
32+
33+
if rails4?
34+
gem 'rails', '4.0.0'
35+
gem 'redis-rails', :git => 'git://github.com/SamSaffron/redis-store.git'
36+
gem 'rails-observers'
37+
gem 'protected_attributes'
38+
gem 'actionpack-action_caching'
39+
else
40+
# we had pain with the 3.2.13 upgrade so monkey patch the security fix
41+
# next time around we hope to upgrade
42+
gem 'rails', '3.2.12'
43+
gem 'strong_parameters' # remove when we upgrade to Rails 4
44+
# we are using a custom sprockets repo to work around: https://github.com/rails/rails/issues/8099#issuecomment-16137638
45+
# REVIEW EVERY RELEASE
46+
gem 'sprockets', git: 'https://github.com/SamSaffron/sprockets.git', branch: 'rails-compat'
47+
gem 'redis-rails'
48+
end
49+
50+
gem 'redis'
51+
gem 'hiredis'
52+
gem 'em-redis'
53+
354
gem 'active_model_serializers', git: 'https://github.com/rails-api/active_model_serializers.git'
455

556
# we had issues with latest, stick to the rev till we figure this out
@@ -20,13 +71,11 @@ gem 'activerecord-postgres-hstore'
2071
gem 'active_attr' # until we get ActiveModel::Model with Rails 4
2172
gem 'airbrake', '3.1.2', require: false # errbit is broken with 3.1.3 for now
2273
gem 'clockwork', require: false
23-
gem 'em-redis'
2474
gem 'eventmachine'
2575
gem 'fast_xs'
2676
gem 'fast_xor', git: 'https://github.com/CodeMonkeySteve/fast_xor.git'
2777
gem 'fastimage'
2878
gem 'fog', require: false
29-
gem 'hiredis'
3079

3180
gem 'email_reply_parser', git: 'https://github.com/lawrencepit/email_reply_parser.git'
3281

@@ -49,12 +98,9 @@ gem 'omniauth-browserid', git: 'https://github.com/callahad/omniauth-browserid.g
4998
gem 'omniauth-cas'
5099
gem 'oj'
51100
gem 'pg'
52-
# we had pain with the 3.2.13 upgrade so monkey patch the security fix
53-
# next time around we hope to upgrade
54-
gem 'rails', '3.2.12'
55101
gem 'rake'
56-
gem 'redis'
57-
gem 'redis-rails'
102+
103+
58104
gem 'rest-client'
59105
gem 'rinku'
60106
gem 'sanitize'
@@ -64,7 +110,6 @@ gem 'sidekiq'
64110
gem 'sidekiq-failures'
65111
gem 'sinatra', require: nil
66112
gem 'slim' # required for sidekiq-web
67-
gem 'strong_parameters' # remove when we upgrade to Rails 4
68113
gem 'therubyracer', require: 'v8'
69114
gem 'thin', require: false
70115
gem 'diffy', require: false
@@ -123,9 +168,6 @@ group :development do
123168
gem 'annotate', :git => 'https://github.com/SamSaffron/annotate_models.git'
124169
end
125170

126-
# we are using a custom sprockets repo to work around: https://github.com/rails/rails/issues/8099#issuecomment-16137638
127-
# REVIEW EVERY RELEASE
128-
gem 'sprockets', git: 'https://github.com/SamSaffron/sprockets.git', branch: 'rails-compat'
129171

130172

131173
# this is an optional gem, it provides a high performance replacement

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ PATH
9393
remote: vendor/gems/simple_handlebars_rails
9494
specs:
9595
simple_handlebars_rails (0.0.1)
96-
rails (~> 3.1)
96+
rails (> 3.1)
9797

9898
GEM
9999
remote: https://rubygems.org/

0 commit comments

Comments
 (0)