Merge pull request #3409 from zzakcanncode/rails-42

Rails 4.2 and master support and CI
This commit is contained in:
Sam 2015-04-29 17:32:19 +10:00
commit fd7c34cfa7
5 changed files with 22 additions and 632 deletions

View file

@ -5,6 +5,7 @@ env:
- DISCOURSE_HOSTNAME=www.example.com
- RUBY_GC_MALLOC_LIMIT=50000000
matrix:
- "RAILS42=1"
- "RAILS_MASTER=1"
- "RAILS_MASTER=0"
@ -14,6 +15,7 @@ addons:
matrix:
allow_failures:
- env: "RAILS_MASTER=1"
- env: "RAILS42=1"
- rvm: rbx-2
fast_finish: true
@ -37,6 +39,9 @@ before_install:
before_script:
- bundle exec rake db:create db:migrate
bundler_args: --without development --deployment --retry=3 --jobs=3
install:
- bash -c "if [ '$RAILS42' == '1' ]; then bundle update --retry=3 --jobs=3 rails rails-observers; fi"
- bash -c "if [ '$RAILS_MASTER' == '1' ]; then bundle update --retry=3 --jobs=3 arel rails rails-observers seed-fu; fi"
- bash -c "if [ '$RAILS_MASTER' == '0' ]; then bundle install --without development --deployment --retry=3 --jobs=3; fi"
script: 'bundle exec rspec && bundle exec rake plugin:spec && bundle exec rake qunit:test'

77
Gemfile
View file

@ -2,77 +2,23 @@ source 'https://rubygems.org'
# if there is a super emergency and rubygems is playing up, try
#source 'http://production.cf.rubygems.org'
module ::Kernel
def rails_master?
ENV["RAILS_MASTER"] == '1'
end
end
if rails_master?
# monkey patching to support dual booting
module Bundler::SharedHelpers
def default_lockfile=(path)
@default_lockfile = path
def rails_42?
ENV["RAILS42"] == '1'
end
def default_lockfile
@default_lockfile ||= Pathname.new("#{default_gemfile}.lock")
end
end
Bundler::SharedHelpers.default_lockfile = Pathname.new("#{Bundler::SharedHelpers.default_gemfile}_master.lock")
# 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
unless self.method_defined? :to_definition_unpatched
alias_method :to_definition_unpatched, :to_definition
end
def to_definition(bad_lockfile, unlock)
to_definition_unpatched(Bundler::SharedHelpers.default_lockfile, unlock)
end
end
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
if rails_master?
gem 'arel', git: 'https://github.com/rails/arel.git'
gem 'rails', git: 'https://github.com/rails/rails.git'
gem 'rails-observers', git: 'https://github.com/rails/rails-observers.git'
gem 'seed-fu', git: 'https://github.com/SamSaffron/seed-fu.git', branch: 'discourse'
elsif rails_42?
gem 'rails', '~> 4.2.1'
gem 'rails-observers', git: 'https://github.com/rails/rails-observers.git'
gem 'seed-fu', '~> 2.3.5'
else
gem 'rails', '~> 4.1.10'
gem 'rails-observers'
@ -161,14 +107,7 @@ gem 'rack-protection' # security
# in production environments by default.
# allow everywhere for now cause we are allowing asset debugging in prd
group :assets do
if rails_master?
gem 'sass-rails', git: 'https://github.com/rails/sass-rails.git'
else
# later is breaking our asset compliation extensions
gem 'sass-rails', '4.0.2'
end
gem 'sass-rails', '~> 4.0.5'
gem 'uglifier'
gem 'rtlit', require: false # for css rtling
end
@ -233,8 +172,6 @@ gem 'ruby-readability', require: false
gem 'simple-rss', require: false
# TODO mri_22 should be here, but bundler was real slow to pick it up
# not even in production bundler yet, monkey patching it in feels bad
gem 'gctools', require: false, platform: :mri_21
begin

View file

@ -378,14 +378,14 @@ GEM
nokogiri (>= 1.4.4)
nokogumbo (= 1.2.0)
sass (3.2.19)
sass-rails (4.0.2)
sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0.0)
seed-fu (2.3.3)
activerecord (>= 3.1, < 4.2)
activesupport (>= 3.1, < 4.2)
seed-fu (2.3.5)
activerecord (>= 3.1, < 4.3)
activesupport (>= 3.1, < 4.3)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
@ -536,7 +536,7 @@ DEPENDENCIES
ruby-readability
sanitize
sass
sass-rails (= 4.0.2)
sass-rails (~> 4.0.5)
seed-fu (~> 2.3.3)
shoulda
sidekiq

View file

@ -1,552 +0,0 @@
GIT
remote: git://github.com/rails-api/active_model_serializers.git
revision: b6b01d0b7396f3deaa6e661cedf4bc5efe2f4525
branch: 0-8-stable
specs:
active_model_serializers (0.8.2)
activemodel (>= 3.0)
GIT
remote: https://github.com/SamSaffron/rails-observers.git
revision: 7d2222d758603a004f6599f82a7068ffeb2d7ebf
specs:
rails-observers (0.1.2)
activemodel (> 4.0)
GIT
remote: https://github.com/SamSaffron/seed-fu.git
revision: d93df3b6364ea938d87c5629bf950b0d1ffe037e
branch: discourse
specs:
seed-fu (2.3.3)
activerecord (>= 3.1)
activesupport (>= 3.1)
GIT
remote: https://github.com/rails/arel.git
revision: 98fc25991137ee09b6800578117f8c1c322680f2
specs:
arel (6.0.0)
GIT
remote: https://github.com/rails/sass-rails.git
revision: b4b5f32a2928ef203f4b442bc538a572645de8e3
specs:
sass-rails (5.0.0.beta1)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2, >= 3.2.2)
sprockets (~> 2.12)
sprockets-rails (>= 2.0, < 4.0)
PATH
remote: ../rails
specs:
actionmailer (5.0.0.alpha)
actionpack (= 5.0.0.alpha)
actionview (= 5.0.0.alpha)
activejob (= 5.0.0.alpha)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (5.0.0.alpha)
actionview (= 5.0.0.alpha)
activesupport (= 5.0.0.alpha)
rack (~> 1.6.0.beta2)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (5.0.0.alpha)
activesupport (= 5.0.0.alpha)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (5.0.0.alpha)
activesupport (= 5.0.0.alpha)
globalid (>= 0.3.0)
activemodel (5.0.0.alpha)
activesupport (= 5.0.0.alpha)
builder (~> 3.1)
activerecord (5.0.0.alpha)
activemodel (= 5.0.0.alpha)
activesupport (= 5.0.0.alpha)
arel (~> 6.0)
activesupport (5.0.0.alpha)
i18n (>= 0.7.0.beta1, < 0.8)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
rails (5.0.0.alpha)
actionmailer (= 5.0.0.alpha)
actionpack (= 5.0.0.alpha)
actionview (= 5.0.0.alpha)
activejob (= 5.0.0.alpha)
activemodel (= 5.0.0.alpha)
activerecord (= 5.0.0.alpha)
activesupport (= 5.0.0.alpha)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0.alpha)
sprockets-rails
railties (5.0.0.alpha)
actionpack (= 5.0.0.alpha)
activesupport (= 5.0.0.alpha)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
PATH
remote: vendor/gems/rails_multisite
specs:
rails_multisite (0.0.1)
GEM
remote: https://rubygems.org/
specs:
actionpack-action_caching (1.1.1)
actionpack (>= 4.0.0, < 5.0)
addressable (2.3.6)
annotate (2.6.5)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
barber (0.4.2)
ember-source
execjs
handlebars-source
better_errors (2.0.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.2.2)
celluloid (0.15.2)
timers (~> 1.1.0)
certified (1.0.0)
coderay (1.1.0)
connection_pool (2.0.0)
crass (0.2.1)
daemons (1.1.9)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
docile (1.1.5)
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
dotenv-deployment (0.0.2)
email_reply_parser-discourse (0.6)
ember-data-source (0.14)
ember-source
ember-rails (0.14.1)
active_model_serializers
barber (>= 0.4.1)
ember-data-source
ember-source
execjs (>= 1.2)
handlebars-source
jquery-rails (>= 1.0.17)
railties (>= 3.1)
ember-source (1.6.0.beta.2)
handlebars-source (~> 1.0)
erubis (2.7.0)
eventmachine (1.0.3)
excon (0.39.6)
execjs (2.2.1)
exifr (1.1.3)
fabrication (2.9.8)
fakeweb (1.3.0)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
fast_blank (0.0.2)
fast_stack (0.1.0)
rake
rake-compiler
fast_xor (1.1.3)
rake
rake-compiler
fast_xs (0.8.0)
fastimage (1.6.3)
addressable (~> 2.3, >= 2.3.5)
ffi (1.9.5)
flamegraph (0.0.9)
fast_stack
fog (1.22.1)
fog-brightbox
fog-core (~> 1.22)
fog-json
ipaddress (~> 0.5)
nokogiri (~> 1.5, >= 1.5.11)
fog-brightbox (0.5.1)
fog-core (~> 1.22)
fog-json
inflecto
fog-core (1.24.0)
builder
excon (~> 0.38)
formatador (~> 0.2)
mime-types
net-scp (~> 1.1)
net-ssh (>= 2.1.3)
fog-json (1.0.0)
multi_json (~> 1.0)
foreman (0.75.0)
dotenv (~> 0.11.1)
thor (~> 0.19.1)
formatador (0.2.5)
fspath (2.0.6)
gctools (0.2.3)
given_core (3.5.4)
sorcerer (>= 0.3.7)
globalid (0.3.0)
activesupport (>= 4.1.0)
guess_html_encoding (0.0.9)
handlebars-source (1.3.0)
hashie (3.3.1)
highline (1.6.21)
hike (1.2.3)
hiredis (0.5.2)
htmlentities (4.3.2)
i18n (0.7.0.beta1)
image_optim (0.9.1)
exifr (~> 1.1.3)
fspath (~> 2.0.5)
image_size (~> 1.1.2)
in_threads (~> 1.2.0)
progress (~> 3.0.0)
image_size (1.1.5)
in_threads (1.2.2)
inflecto (0.0.2)
ipaddress (0.8.0)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
jwt (1.0.0)
kgio (2.9.2)
librarian (0.1.2)
highline
thor (~> 0.15)
libv8 (3.16.14.7)
listen (0.7.3)
logster (0.1.6)
loofah (2.0.1)
nokogiri (>= 1.5.9)
lru_redux (0.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
memory_profiler (0.0.4)
message_bus (1.0.5)
eventmachine
rack (>= 1.1.3)
redis
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.1)
minitest (5.4.3)
mocha (1.1.0)
metaclass (~> 0.0.1)
mock_redis (0.13.2)
moneta (0.8.0)
msgpack (0.5.8)
multi_json (1.10.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
mustache (0.99.6)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
netrc (0.7.7)
nokogiri (1.6.4.1)
mini_portile (~> 0.6.0)
nokogumbo (1.1.12)
nokogiri
oauth (0.4.7)
oauth2 (1.0.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
oj (2.10.2)
omniauth (1.2.2)
hashie (>= 1.2, < 4)
rack (~> 1.0)
omniauth-facebook (2.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-github-discourse (1.1.2)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.1)
omniauth-google-oauth2 (0.2.5)
omniauth (> 1.0)
omniauth-oauth2 (~> 1.1)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
multi_json (~> 1.3)
oauth2 (~> 1.0)
omniauth (~> 1.2)
omniauth-openid (1.0.1)
omniauth (~> 1.0)
rack-openid (~> 1.3.1)
omniauth-twitter (1.0.1)
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
onebox (1.5.3)
moneta (~> 0.7)
multi_json (~> 1.7)
mustache (~> 0.99)
nokogiri (~> 1.6.1)
openid-redis-store (0.0.2)
redis
ruby-openid
pg (0.18.0.pre20141117110243)
polyglot (0.3.5)
progress (3.0.1)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-nav (0.2.4)
pry (>= 0.9.10, < 0.11.0)
pry-rails (0.3.2)
pry (>= 0.9.10)
puma (2.9.1)
rack (>= 1.1, < 2.0)
qunit-rails (0.0.7)
railties
rack (1.6.0.beta2)
rack-mini-profiler (0.9.2)
rack (>= 1.1.3)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-protection (1.5.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1)
loofah (~> 2.0)
raindrops (0.13.0)
rake (10.4.0)
rake-compiler (0.9.3)
rake
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rbtrace (0.4.5)
ffi (>= 1.0.6)
msgpack (>= 0.4.3)
trollop (>= 1.16.2)
redcarpet (3.1.2)
redis (3.1.0)
redis-namespace (1.5.1)
redis (~> 3.0, >= 3.0.4)
ref (1.0.5)
rest-client (1.7.2)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rinku (1.7.3)
rmmseg-cpp (0.2.9)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-collection_matchers (1.0.0)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-given (3.5.4)
given_core (= 3.5.4)
rspec (>= 2.12)
rspec-mocks (2.99.2)
rspec-rails (2.99.0)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-collection_matchers
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rtlit (0.0.5)
ruby-openid (2.5.0)
ruby-readability (0.7.0)
guess_html_encoding (>= 0.0.4)
nokogiri (>= 1.6.0)
sanitize (3.0.2)
crass (~> 0.2.0)
nokogiri (>= 1.4.4)
nokogumbo (= 1.1.12)
sass (3.2.19)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.2.1)
shoulda-matchers (2.7.0)
activesupport (>= 3.0.0)
sidekiq (3.2.5)
celluloid (= 0.15.2)
connection_pool (>= 2.0.0)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
simple-rss (1.3.1)
simplecov (0.9.1)
docile (~> 1.1.0)
multi_json (~> 1.0)
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
slop (3.6.0)
sorcerer (1.0.2)
spork (1.0.0rc4)
spork-rails (4.0.0)
rails (>= 3.0.0, < 5)
spork (>= 1.0rc0)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (3.0.0.beta1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (~> 2.8)
stackprof (0.2.7)
stringex (2.5.2)
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thin (1.6.2)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
rack (>= 1.0.0)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timecop (0.7.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
trollop (2.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.5.3)
execjs (>= 0.3.0)
json (>= 1.8.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.6)
unicorn (4.8.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
PLATFORMS
ruby
DEPENDENCIES
actionpack-action_caching
active_model_serializers!
annotate
arel!
barber
better_errors
binding_of_caller
certified
email_reply_parser-discourse
ember-rails
ember-source (= 1.6.0.beta.2)
eventmachine
fabrication (= 2.9.8)
fakeweb (~> 1.3.0)
fast_blank
fast_xor
fast_xs
fastimage
flamegraph
fog (= 1.22.1)
foreman
gctools
handlebars-source (= 1.3.0)
highline
hiredis
htmlentities
image_optim (= 0.9.1)
librarian (>= 0.0.25)
listen (= 0.7.3)
logster
lru_redux
mail (~> 2.5.4)
memory_profiler
message_bus
minitest
mocha
mock_redis
multi_json
mustache
nokogiri
oj
omniauth
omniauth-facebook
omniauth-github-discourse
omniauth-google-oauth2
omniauth-oauth2
omniauth-openid
omniauth-twitter
onebox
openid-redis-store
pg (= 0.18.0.pre20141117110243)
pry-nav
pry-rails
puma
qunit-rails
rack-mini-profiler
rack-protection
rails!
rails-observers!
rails_multisite!
rake
rb-fsevent
rb-inotify (~> 0.9)
rbtrace
redcarpet
redis
rest-client
rinku
rmmseg-cpp
rspec (= 2.99.0)
rspec-given
rspec-rails
rtlit
ruby-readability
sanitize
sass
sass-rails!
seed-fu!
shoulda
sidekiq
simple-rss
simplecov
sinatra
spork-rails
stackprof
stringex
therubyracer
thin
timecop
uglifier
unf
unicorn

View file

@ -117,9 +117,9 @@ module Discourse
# see: http://stackoverflow.com/questions/11894180/how-does-one-correctly-add-custom-sql-dml-in-migrations/11894420#11894420
config.active_record.schema_format = :sql
if Rails.version >= "4.2.0"
if Rails.version >= "4.2.0" && Rails.version < "5.0.0"
# Opt-into the default behavior in Rails 5
# config.active_record.raise_in_transactional_callbacks = true
config.active_record.raise_in_transactional_callbacks = false
end
# per https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet