[DRE-commits] [SCM] redmine.git branch, master-experimental, updated. debian/1.4.4+dfsg1-1-35-g042f641

Ondřej Surý ondrej at sury.org
Wed Oct 17 11:19:36 UTC 2012


The following commit has been merged in the master-experimental branch:
commit 099e221885a36743622446bbac3021d8de46cd63
Author: Ondřej Surý <ondrej at sury.org>
Date:   Mon Oct 15 21:01:50 2012 +0200

    Set the Debian variables before loading config/application.rb; Move the configuration mangling to config/application.rb

diff --git a/debian/patches/2002_FHS_through_env_vars.patch b/debian/patches/2002_FHS_through_env_vars.patch
index 96176b9..e6fd53d 100644
--- a/debian/patches/2002_FHS_through_env_vars.patch
+++ b/debian/patches/2002_FHS_through_env_vars.patch
@@ -4,15 +4,19 @@ Author: Jérémy Lal <kapouer at melix.org>
 Last-Update: 2012-01-19
 --- a/app/models/attachment.rb
 +++ b/app/models/attachment.rb
-@@ -45,7 +45,7 @@ class Attachment < ActiveRecord::Base
+@@ -45,10 +45,10 @@ class Attachment < ActiveRecord::Base
                                                          "LEFT JOIN #{Project.table_name} ON #{Document.table_name}.project_id = #{Project.table_name}.id"}
  
    cattr_accessor :storage_path
 -  @@storage_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files")
-+  @@storage_path = Redmine::Configuration['attachments_storage_path'] || ENV['RAILS_VAR'] ? File.join(ENV['RAILS_VAR'], 'files') : File.join(Rails.root, "files")
++  @@storage_path = Redmine::Configuration['attachments_storage_path'] || ENV['RAILS_VAR'] ? File.join(ENV['RAILS_VAR'], "files") : File.join(Rails.root, "files")
  
    cattr_accessor :thumbnails_storage_path
-   @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
+-  @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
++  @@thumbnails_storage_path = ENV['RAILS_CACHE'] ? File.join(ENV['RAILS_CACHE'], "thumbnails") : File.join(Rails.root, "tmp", "thumbnails")
+ 
+   before_save :files_to_final_location
+   after_destroy :delete_from_disk
 --- a/lib/redmine/configuration.rb
 +++ b/lib/redmine/configuration.rb
 @@ -31,7 +31,7 @@ module Redmine
@@ -44,9 +48,47 @@ Last-Update: 2012-01-19
            FileUtils.mkdir_p @@k_path_cache unless File::exist?(@@k_path_cache)
            set_language_if_valid lang
            pdf_encoding = l(:general_pdf_encoding).upcase
---- /dev/null
-+++ b/config/additional_environment.rb
-@@ -0,0 +1,20 @@
+--- a/config/application.rb
++++ b/config/application.rb
+@@ -52,6 +52,17 @@ module RedmineApp
+ 
+     config.session_store :cookie_store, :key => '_redmine_session'
+ 
++    # log path
++    config.paths['log'] = File.join(ENV['RAILS_LOG'], "#{Rails.env}.log") unless !ENV['RAILS_LOG']
++
++    config.cache_store = :file_store, ENV['RAILS_CACHE']
++
++    # Set Active Record's database.yml path
++    config.paths['config/database'] = File.join(ENV['RAILS_ETC'], 'database.yml') unless !ENV['RAILS_ETC']
++
++    # move tmp directory to RAILS_CACHE
++    config.paths['tmp'] = File.join(ENV['RAILS_CACHE'], "tmp")
++
+     if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
+       instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
+     end
+--- a/lib/plugins/rfpdf/lib/tcpdf.rb
++++ b/lib/plugins/rfpdf/lib/tcpdf.rb
+@@ -89,10 +89,10 @@ class TCPDF
+   @@k_small_ratio = 2/3.0
+   
+   cattr_accessor :k_path_cache
+-  @@k_path_cache = Rails.root.join('tmp')
++  @@k_path_cache = ENV['RAILS_CACHE'] ? ENV['RAILS_CACHE'] : Rails.root.join('tmp')
+   
+   cattr_accessor :k_path_url_cache
+-  @@k_path_url_cache = Rails.root.join('tmp')
++  @@k_path_url_cache = ENV['RAILS_CACHE'] ? ENV['RAILS_CACHE'] : Rails.root.join('tmp')
+   
+   cattr_accessor :decoder
+ 		
+diff --git a/config/environment.rb b/config/environment.rb
+index 1d9a396..956fd3c 100644
+--- a/config/environment.rb
++++ b/config/environment.rb
+@@ -1,3 +1,14 @@
++# Force Rails environment to be production
 +Rails.env ||= ActiveSupport::StringInquirer.new('production')
 +
 +# for debian package : setup proper environment variables and paths
@@ -57,13 +99,6 @@ Last-Update: 2012-01-19
 +ENV['RAILS_VAR'] ||= "/var/lib/redmine/#{ENV['X_DEBIAN_SITEID']}"
 +ENV['RAILS_CACHE'] ||= "/var/cache/redmine/#{ENV['X_DEBIAN_SITEID']}"
 +
-+# log path
-+config.paths['log'] = File.join(ENV['RAILS_LOG'], "#{Rails.env}.log") unless !ENV['RAILS_LOG']
-+
-+config.cache_store = :file_store, ENV['RAILS_CACHE']
-+
-+# Set Active Record's database.yml path
-+config.paths['config/database'] = File.join(ENV['RAILS_ETC'], 'database.yml') unless !ENV['RAILS_ETC']
-+
-+# the session store (???)
-+config.paths['tmp'] = ENV['RAILS_VAR']
+ # Load the rails application
+ require File.expand_path('../application', __FILE__)
+ 
diff --git a/debian/patches/2003_externalize_session_config.patch b/debian/patches/2003_externalize_session_config.patch
index 42c9d0c..cc8e3d4 100644
--- a/debian/patches/2003_externalize_session_config.patch
+++ b/debian/patches/2003_externalize_session_config.patch
@@ -48,24 +48,23 @@ Last-Update: 2010-01-10
 -
 -desc 'Generates a secret token for the application.'
 -task :generate_secret_token => ['config/initializers/secret_token.rb']
---- a/config/additional_environment.rb
-+++ b/config/additional_environment.rb
-@@ -15,3 +15,18 @@ config.cache_store = :file_store, ENV['R
+--- a/config/application.rb
++++ b/config/application.rb
+@@ -50,7 +50,16 @@ module RedmineApp
  
- # Set Active Record's database.yml path
- config.paths['config/database'] = File.join(ENV['RAILS_ETC'], 'database.yml') unless !ENV['RAILS_ETC']
-+
-+# loads cookie based session session and secret keys
-+# this is needed here because initializers are loaded after plugins,
-+# and some plugins initialize ActionController which requires a secret to be set.
-+# crash if file not found
-+filename = ENV['RAILS_ETC'] ? File.join(ENV['RAILS_ETC'], 'session.yml') : File.join(File.dirname(__FILE__), '..', 'session.yml')
-+sessionconfig = YAML::load_file(filename)
-+relativeUrlRoot = ENV['RAILS_RELATIVE_URL_ROOT']
-+
-+config.session_store :cookie_store, {
-+  :key => sessionconfig[Rails.env]['key'],
-+  :path => (relativeUrlRoot.blank?) ? '/' : relativeUrlRoot
-+}
+     config.action_mailer.perform_deliveries = false
+ 
+-    config.session_store :cookie_store, :key => '_redmine_session'
++    # loads cookie based session session and secret keys
++    # this is needed here because initializers are loaded after plugins,
++    # and some plugins initialize ActionController which requires a secret to be set.
++    # crash if file not found
++    filename = ENV['RAILS_ETC'] ? File.join(ENV['RAILS_ETC'], 'session.yml') : File.join(File.dirname(__FILE__), '..', 'session.yml')
++    sessionconfig = YAML::load_file(filename)
++    relativeUrlRoot = ENV['RAILS_RELATIVE_URL_ROOT']
 +
-+config.secret_token = sessionconfig[Rails.env]['secret']
++    config.session_store :cookie_store, :key => sessionconfig[Rails.env]['key'], :path => (relativeUrlRoot.blank?) ? '/' : relativeUrlRoot
++    config.secret_token = sessionconfig[Rails.env]['secret']
+ 
+     # log path
+     config.paths['log'] = File.join(ENV['RAILS_LOG'], "#{Rails.env}.log") unless !ENV['RAILS_LOG']
diff --git a/debian/patches/2009_FHS_thin_config.patch b/debian/patches/2009_FHS_thin_config.patch
index 0a90874..24a0de8 100644
--- a/debian/patches/2009_FHS_thin_config.patch
+++ b/debian/patches/2009_FHS_thin_config.patch
@@ -3,9 +3,9 @@ Description: FHS support for thin config
 Forwarded: not-needed
 Author: Jérémy Lal <kapouer at melix.org>
 Last-Update: 2010-11-01
---- a/config/additional_environment.rb
-+++ b/config/additional_environment.rb
-@@ -2,6 +2,7 @@ Rails.env ||= ActiveSupport::StringInqui
+--- a/config/environment.rb
++++ b/config/environment.rb
+@@ -3,6 +3,7 @@ Rails.env ||= ActiveSupport::StringInqui
  
  # for debian package : setup proper environment variables and paths
  # To run redmine as unprivileged user, see /usr/share/doc/redmine/README.Debian
diff --git a/debian/patches/series b/debian/patches/series
index c091472..5cb94da 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,7 +1,6 @@
 2002_FHS_through_env_vars.patch
 2003_externalize_session_config.patch
 2004_FHS_plugins_assets.patch
-2005_FHS_schema_dump.patch
 2008_force_table_encoding_mysql.patch
 2009_FHS_thin_config.patch
 2017_Gemfile_debian.patch

-- 
redmine.git



More information about the Pkg-ruby-extras-commits mailing list