Commit 470c1be1cabe3c74987f84e3b7b2af45ad22c172

Authored by Braulio Bhavamitra
1 parent 25033623
Exists in rails5

rails5: boot console and environment's homepage

- Upgrade gems for rails 5 support
- Use scope procs for order
- Temporarily remove gems that don't support rack 2
@@ -2,23 +2,24 @@ source "https://rubygems.org" @@ -2,23 +2,24 @@ source "https://rubygems.org"
2 2
3 platform :ruby do 3 platform :ruby do
4 gem 'pg', '~> 0.17' 4 gem 'pg', '~> 0.17'
5 - gem 'rmagick', '~> 2.13' 5 + gem 'rmagick'
6 end 6 end
7 platform :jruby do 7 platform :jruby do
8 gem 'activerecord-jdbcpostgresql-adapter' 8 gem 'activerecord-jdbcpostgresql-adapter'
9 gem 'rmagick4j' 9 gem 'rmagick4j'
10 end 10 end
11 11
12 -gem 'rails', '~> 4.2.4' 12 +gem 'rails', '5.0.0.beta2'
13 gem 'fast_gettext', '~> 0.9' 13 gem 'fast_gettext', '~> 0.9'
14 -gem 'acts-as-taggable-on', '~> 3.5' 14 +gem 'acts-as-taggable-on', github: 'mbleigh/acts-as-taggable-on'
15 gem 'rails_autolink', '~> 1.1.5' 15 gem 'rails_autolink', '~> 1.1.5'
16 gem 'RedCloth', '~> 4.2' 16 gem 'RedCloth', '~> 4.2'
17 gem 'ruby-feedparser', '~> 0.7' 17 gem 'ruby-feedparser', '~> 0.7'
18 gem 'daemons', '~> 1.1' 18 gem 'daemons', '~> 1.1'
19 -gem 'unicorn', '~> 4.8' 19 +# FIXME: rails5: don't work with rack 2
  20 +#gem 'unicorn', '~> 4.8'
20 gem 'nokogiri', '~> 1.6.0' 21 gem 'nokogiri', '~> 1.6.0'
21 -gem 'will_paginate', '~> 3.0.7' 22 +gem 'will_paginate'
22 gem 'pothoven-attachment_fu', '~> 3.2.16' 23 gem 'pothoven-attachment_fu', '~> 3.2.16'
23 gem 'delayed_job' 24 gem 'delayed_job'
24 gem 'delayed_job_active_record' 25 gem 'delayed_job_active_record'
@@ -28,7 +29,6 @@ gem 'exception_notification', '~> 4.0.1' @@ -28,7 +29,6 @@ gem 'exception_notification', '~> 4.0.1'
28 gem 'gettext', '~> 3.1', :require => false 29 gem 'gettext', '~> 3.1', :require => false
29 gem 'locale', '~> 2.1' 30 gem 'locale', '~> 2.1'
30 gem 'whenever', :require => false 31 gem 'whenever', :require => false
31 -gem 'eita-jrails', '~> 0.10.0', require: 'jrails'  
32 gem 'diffy', '~> 3.0' 32 gem 'diffy', '~> 3.0'
33 gem 'slim' 33 gem 'slim'
34 gem 'activerecord-session_store', ('1.0.0.pre' if RUBY_VERSION >= '2.3.0') 34 gem 'activerecord-session_store', ('1.0.0.pre' if RUBY_VERSION >= '2.3.0')
@@ -38,7 +38,8 @@ gem 'grape', '~> 0.12' @@ -38,7 +38,8 @@ gem 'grape', '~> 0.12'
38 gem 'grape-entity', '0.4.8' 38 gem 'grape-entity', '0.4.8'
39 gem 'grape_logging' 39 gem 'grape_logging'
40 gem 'rack-cors' 40 gem 'rack-cors'
41 -gem 'rack-contrib' 41 +# FIXME: rails5: don't work with rack 2
  42 +#gem 'rack-contrib'
42 gem 'api-pagination', '>= 4.1.1' 43 gem 'api-pagination', '>= 4.1.1'
43 gem 'liquid', '~> 3.0.3' 44 gem 'liquid', '~> 3.0.3'
44 45
@@ -49,7 +50,7 @@ gem 'sprockets-rails', '~> 2.1' @@ -49,7 +50,7 @@ gem 'sprockets-rails', '~> 2.1'
49 50
50 # gems to enable rails3 behaviour 51 # gems to enable rails3 behaviour
51 gem 'protected_attributes' 52 gem 'protected_attributes'
52 -gem 'rails-observers' 53 +gem 'rails-observers', github: 'rails/rails-observers'
53 gem 'actionpack-page_caching' 54 gem 'actionpack-page_caching'
54 gem 'actionpack-action_caching' 55 gem 'actionpack-action_caching'
55 56
@@ -62,9 +63,9 @@ group :development, :test do @@ -62,9 +63,9 @@ group :development, :test do
62 end 63 end
63 64
64 group :test do 65 group :test do
65 - gem 'rspec', '~> 3.3', require: false  
66 - gem 'rspec-rails', '~> 3.2', require: false  
67 - gem 'mocha', '~> 1.1.0', :require => false 66 + gem 'rspec', require: false
  67 + gem 'rspec-rails', require: false
  68 + gem 'mocha', '~> 1.1.0', require: false
68 gem 'test-unit' if RUBY_VERSION >= '2.2.0' 69 gem 'test-unit' if RUBY_VERSION >= '2.2.0'
69 gem 'minitest' 70 gem 'minitest'
70 gem 'minitest-reporters' 71 gem 'minitest-reporters'
@@ -20,6 +20,7 @@ rails_app = Rack::Builder.new do @@ -20,6 +20,7 @@ rails_app = Rack::Builder.new do
20 end 20 end
21 21
22 run Rack::Cascade.new([ 22 run Rack::Cascade.new([
23 - Noosfero::API::API, 23 + # FIXME: rails5: missing rack-contrib, see Gemfile
  24 + #Noosfero::API::API,
24 rails_app 25 rails_app
25 ]) 26 ])
config/application.rb
@@ -99,8 +99,14 @@ module Noosfero @@ -99,8 +99,14 @@ module Noosfero
99 } 99 }
100 config.session_store :active_record_store, key: '_noosfero_session' 100 config.session_store :active_record_store, key: '_noosfero_session'
101 101
102 - config.paths['db/migrate'].concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/db/migrate")  
103 - config.i18n.load_path.concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/locales/*.{rb,yml}") 102 + root = Rails::Paths::Root.new Rails.root
  103 + #require'pry';binding.pry
  104 + Dir["{baseplugins,config/plugins}/*/db/migrate"].each do |dir|
  105 + config.paths['db/migrate'] << root.add(dir)
  106 + end
  107 + Dir["{baseplugins,config/plugins}/*/locales/*.{rb,yml}"].each do |dir|
  108 + config.i18n.load_path << root.add(dir)
  109 + end
104 110
105 config.eager_load = true 111 config.eager_load = true
106 112
lib/noosfero/plugin.rb
@@ -69,7 +69,7 @@ class Noosfero::Plugin @@ -69,7 +69,7 @@ class Noosfero::Plugin
69 controllers/myprofile 69 controllers/myprofile
70 controllers/admin 70 controllers/admin
71 ].each do |folder| 71 ].each do |folder|
72 - config.autoload_paths << File.join(dir, folder) 72 + #config.autoload_paths << File.join(dir, folder)
73 end 73 end
74 [ config.autoload_paths, $:].each do |path| 74 [ config.autoload_paths, $:].each do |path|
75 path << File.join(dir, 'models') 75 path << File.join(dir, 'models')
@@ -85,7 +85,7 @@ class Noosfero::Plugin @@ -85,7 +85,7 @@ class Noosfero::Plugin
85 end 85 end
86 86
87 # add view path 87 # add view path
88 - config.paths['app/views'].unshift File.join(dir, 'views') 88 + #config.paths['app/views'].unshift Rails::Paths::Root.new File.join(dir, 'views')
89 end 89 end
90 end 90 end
91 91