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
Gemfile
... ... @@ -2,23 +2,24 @@ source "https://rubygems.org"
2 2  
3 3 platform :ruby do
4 4 gem 'pg', '~> 0.17'
5   - gem 'rmagick', '~> 2.13'
  5 + gem 'rmagick'
6 6 end
7 7 platform :jruby do
8 8 gem 'activerecord-jdbcpostgresql-adapter'
9 9 gem 'rmagick4j'
10 10 end
11 11  
12   -gem 'rails', '~> 4.2.4'
  12 +gem 'rails', '5.0.0.beta2'
13 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 15 gem 'rails_autolink', '~> 1.1.5'
16 16 gem 'RedCloth', '~> 4.2'
17 17 gem 'ruby-feedparser', '~> 0.7'
18 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 21 gem 'nokogiri', '~> 1.6.0'
21   -gem 'will_paginate', '~> 3.0.7'
  22 +gem 'will_paginate'
22 23 gem 'pothoven-attachment_fu', '~> 3.2.16'
23 24 gem 'delayed_job'
24 25 gem 'delayed_job_active_record'
... ... @@ -28,7 +29,6 @@ gem 'exception_notification', '~> 4.0.1'
28 29 gem 'gettext', '~> 3.1', :require => false
29 30 gem 'locale', '~> 2.1'
30 31 gem 'whenever', :require => false
31   -gem 'eita-jrails', '~> 0.10.0', require: 'jrails'
32 32 gem 'diffy', '~> 3.0'
33 33 gem 'slim'
34 34 gem 'activerecord-session_store', ('1.0.0.pre' if RUBY_VERSION >= '2.3.0')
... ... @@ -38,7 +38,8 @@ gem 'grape', '~> 0.12'
38 38 gem 'grape-entity', '0.4.8'
39 39 gem 'grape_logging'
40 40 gem 'rack-cors'
41   -gem 'rack-contrib'
  41 +# FIXME: rails5: don't work with rack 2
  42 +#gem 'rack-contrib'
42 43 gem 'api-pagination', '>= 4.1.1'
43 44 gem 'liquid', '~> 3.0.3'
44 45  
... ... @@ -49,7 +50,7 @@ gem 'sprockets-rails', '~> 2.1'
49 50  
50 51 # gems to enable rails3 behaviour
51 52 gem 'protected_attributes'
52   -gem 'rails-observers'
  53 +gem 'rails-observers', github: 'rails/rails-observers'
53 54 gem 'actionpack-page_caching'
54 55 gem 'actionpack-action_caching'
55 56  
... ... @@ -62,9 +63,9 @@ group :development, :test do
62 63 end
63 64  
64 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 69 gem 'test-unit' if RUBY_VERSION >= '2.2.0'
69 70 gem 'minitest'
70 71 gem 'minitest-reporters'
... ...
config.ru
... ... @@ -20,6 +20,7 @@ rails_app = Rack::Builder.new do
20 20 end
21 21  
22 22 run Rack::Cascade.new([
23   - Noosfero::API::API,
  23 + # FIXME: rails5: missing rack-contrib, see Gemfile
  24 + #Noosfero::API::API,
24 25 rails_app
25 26 ])
... ...
config/application.rb
... ... @@ -99,8 +99,14 @@ module Noosfero
99 99 }
100 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 111 config.eager_load = true
106 112  
... ...
lib/noosfero/plugin.rb
... ... @@ -69,7 +69,7 @@ class Noosfero::Plugin
69 69 controllers/myprofile
70 70 controllers/admin
71 71 ].each do |folder|
72   - config.autoload_paths << File.join(dir, folder)
  72 + #config.autoload_paths << File.join(dir, folder)
73 73 end
74 74 [ config.autoload_paths, $:].each do |path|
75 75 path << File.join(dir, 'models')
... ... @@ -85,7 +85,7 @@ class Noosfero::Plugin
85 85 end
86 86  
87 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 89 end
90 90 end
91 91  
... ...