Commit 8ca818fa0526eda3bb704fc73b4cbc12a51fe08f

Authored by Braulio Bhavamitra
1 parent 922b8c6f

rails4: upgrade dependencies to rails4

vendor/plugins load was removed from rails4. Now we required theses
plugins inside the Gemfile, automatically. init.rb files are loaded in
config/initializers/dependencies.rb
Gemfile
1 1 source "https://rubygems.org"
2   -gem 'rails', '~> 3.2.22'
  2 +gem 'rails', '~> 4.0'
3 3 gem 'minitest', '~> 3.2.0'
4 4 gem 'fast_gettext', '~> 0.6.8'
5 5 gem 'acts-as-taggable-on', '~> 3.4.2'
... ... @@ -24,6 +24,17 @@ gem 'eita-jrails', '~> 0.9.5', require: 'jrails'
24 24 gem 'uglifier', '>= 1.0.3'
25 25 gem 'sass-rails'
26 26  
  27 +# gems to enable rails3 behaviour
  28 +gem 'protected_attributes'
  29 +gem 'rails-observers'
  30 +gem 'actionpack-page_caching'
  31 +gem 'actionpack-action_caching'
  32 +gem 'activerecord-session_store'
  33 +
  34 +
  35 +# FIXME list here all actual dependencies (i.e. the ones in debian/control),
  36 +# with their GEM names (not the Debian package names)
  37 +
27 38 group :production do
28 39 gem 'dalli', '~> 2.7.0'
29 40 end
... ... @@ -46,6 +57,14 @@ end
46 57 # Requires custom dependencies
47 58 eval(File.read('config/Gemfile'), binding) rescue nil
48 59  
  60 +vendor = Dir.glob('vendor/{,plugins/}*') - ['vendor/plugins']
  61 +vendor.each do |dir|
  62 + plugin = File.basename dir
  63 + version = if Dir.glob("#{dir}/*.gemspec").length > 0 then '> 0.0.0' else '0.0.0' end
  64 +
  65 + gem plugin, version, path: dir
  66 +end
  67 +
49 68 # include gemfiles from enabled plugins
50 69 # plugins in baseplugins/ are not included on purpose. They should not have any
51 70 # dependencies.
... ...
config/initializers/action_tracker.rb
1 1 require 'noosfero/i18n'
  2 +require 'action_tracker_config'
2 3  
3 4 # ActionTracker plugin stuff
4 5  
... ... @@ -6,25 +7,25 @@ require 'noosfero/i18n'
6 7  
7 8 ActionTrackerConfig.verbs = {
8 9  
9   - :create_article => {
  10 + :create_article => {
10 11 :description => proc { _('published an article: %{title}') % { :title => '{{link_to(truncate(ta.get_name), ta.get_url)}}' } }
11 12 },
12 13  
13   - :new_friendship => {
  14 + :new_friendship => {
14 15 :description => proc { n_('has made 1 new friend:<br />%{name}', 'has made %{num} new friends:<br />%{name}', get_friend_name.size) % { :num => get_friend_name.size, :name => '{{ta.collect_group_with_index(:friend_name){ |n,i| link_to(image_tag(ta.get_friend_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")), ta.get_friend_url[i], :title => n)}.join}}' } },
15 16 :type => :groupable
16 17 },
17 18  
18   - :join_community => {
  19 + :join_community => {
19 20 :description => proc { n_('has joined 1 community:<br />%{name}', 'has joined %{num} communities:<br />%{name}', get_resource_name.size) % { :num => get_resource_name.size, :name => '{{ta.collect_group_with_index(:resource_name){ |n,i| link_to(image_tag(ta.get_resource_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/community-icon.png")), ta.get_resource_url[i], :title => n)}.join}}' } },
20 21 :type => :groupable
21 22 },
22 23  
23   - :add_member_in_community => {
  24 + :add_member_in_community => {
24 25 :description => proc { _('has joined the community.') },
25 26 },
26 27  
27   - :upload_image => {
  28 + :upload_image => {
28 29 :description => proc do
29 30 total = get_view_url.size
30 31 n_('uploaded 1 image', 'uploaded %d images', total) % total +
... ...
config/initializers/dependencies.rb
  1 +# third-party libraries
  2 +require 'will_paginate'
  3 +require 'will_paginate/array'
  4 +require 'nokogiri'
  5 +
  6 +# dependencies at vendor, firstly loaded on Gemfile
  7 +vendor = (Dir.glob('vendor/{,plugins/}*') - ['vendor/plugins'])
  8 +vendor.each do |dir|
  9 + init_rb = "#{Rails.root}/#{dir}/init.rb"
  10 + require init_rb if File.file? init_rb
  11 +end
  12 +
1 13 # locally-developed modules
2 14 require 'acts_as_filesystem'
3 15 require 'acts_as_having_settings'
... ... @@ -10,8 +22,3 @@ require &#39;set_profile_region_from_city_state&#39;
10 22 require 'authenticated_system'
11 23 require 'needs_profile'
12 24 require 'white_list_filter'
13   -
14   -# third-party libraries
15   -require 'will_paginate'
16   -require 'will_paginate/array'
17   -require 'nokogiri'
... ...
vendor/plugins/ruby_bosh/ruby_bosh.gemspec
... ... @@ -24,15 +24,12 @@ Gem::Specification.new do |s|
24 24 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25 25 s.add_runtime_dependency(%q<builder>, [">= 0"])
26 26 s.add_runtime_dependency(%q<adamwiggins-rest-client>, [">= 0"])
27   - s.add_runtime_dependency(%q<SystemTimer>, [">= 0"])
28 27 else
29 28 s.add_dependency(%q<builder>, [">= 0"])
30 29 s.add_dependency(%q<adamwiggins-rest-client>, [">= 0"])
31   - s.add_dependency(%q<SystemTimer>, [">= 0"])
32 30 end
33 31 else
34 32 s.add_dependency(%q<builder>, [">= 0"])
35 33 s.add_dependency(%q<adamwiggins-rest-client>, [">= 0"])
36   - s.add_dependency(%q<SystemTimer>, [">= 0"])
37 34 end
38 35 end
... ...