diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-22 17:37:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-22 17:37:16 +0000 |
commit | 2d1866d966d94c688f9cb87c5bf3f096dffac844 (patch) | |
tree | 7a733c1cc51448ab69b3f892285305dbfb0ae15e /config | |
parent | a6ec78a4dc658e3517ed682792016b6530458696 (diff) | |
download | redmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.tar.gz redmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.zip |
Merged rails-4.1 branch (#14534).
git-svn-id: http://svn.redmine.org/redmine/trunk@13482 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 9 | ||||
-rw-r--r-- | config/boot.rb | 2 | ||||
-rw-r--r-- | config/database.yml.example | 3 | ||||
-rw-r--r-- | config/environment.rb | 6 | ||||
-rw-r--r-- | config/environments/development.rb | 18 | ||||
-rw-r--r-- | config/environments/production.rb | 34 | ||||
-rw-r--r-- | config/environments/test.rb | 17 | ||||
-rw-r--r-- | config/environments/test_pgsql.rb | 1 | ||||
-rw-r--r-- | config/environments/test_sqlite3.rb | 1 | ||||
-rw-r--r-- | config/initializers/10-patches.rb | 53 | ||||
-rw-r--r-- | config/initializers/30-redmine.rb | 8 | ||||
-rw-r--r-- | config/locales/ja.yml | 10 | ||||
-rw-r--r-- | config/locales/zh-TW.yml | 2 | ||||
-rw-r--r-- | config/preinitializer.rb | 20 | ||||
-rw-r--r-- | config/routes.rb | 16 |
15 files changed, 67 insertions, 133 deletions
diff --git a/config/application.rb b/config/application.rb index 58d949a48..b05c5287e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,12 +2,7 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end +Bundler.require(*Rails.groups) module RedmineApp class Application < Rails::Application @@ -33,7 +28,7 @@ module RedmineApp # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de - I18n.enforce_available_locales = false + I18n.enforce_available_locales = true # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" diff --git a/config/boot.rb b/config/boot.rb index 4489e5868..359673666 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,5 +1,3 @@ -require 'rubygems' - # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) diff --git a/config/database.yml.example b/config/database.yml.example index 5bcf17bd6..57bc51605 100644 --- a/config/database.yml.example +++ b/config/database.yml.example @@ -1,5 +1,4 @@ -# Default setup is given for MySQL with ruby1.9. If you're running Redmine -# with MySQL and ruby1.8, replace the adapter name with `mysql`. +# Default setup is given for MySQL with ruby1.9. # Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end. # Line indentation must be 2 spaces (no tabs). diff --git a/config/environment.rb b/config/environment.rb index 1d9a39669..705e4ecd7 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,4 +1,4 @@ -# Load the rails application +# Load the Rails application require File.expand_path('../application', __FILE__) # Make sure there's no plugin in vendor/plugin before starting @@ -10,5 +10,5 @@ if Dir.glob(File.join(vendor_plugins_dir, "*")).any? exit 1 end -# Initialize the rails application -RedmineApp::Application.initialize! +# Initialize the Rails application +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index bd66a784e..f7b15e140 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,19 +1,21 @@ -# Settings specified here will take precedence over those in config/application.rb -RedmineApp::Application.configure do +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb + # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. - config.cache_classes = false + config.cache_classes = false - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + # Do not eager load code on boot. + config.eager_load = false # Show full error reports and disable caching - #config.action_controller.consider_all_requests_local = true - config.action_controller.perform_caching = false + config.consider_all_requests_local = true + config.action_controller.perform_caching = false - # Don't care if the mailer can't send + # Disable delivery errors config.action_mailer.raise_delivery_errors = false + # Print deprecation notices to stderr and the Rails logger. config.active_support.deprecation = [:stderr, :log] end diff --git a/config/environments/production.rb b/config/environments/production.rb index ecb4cf902..85cd3890c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,33 +1,25 @@ -# Settings specified here will take precedence over those in config/application.rb -RedmineApp::Application.configure do - # The production environment is meant for finished, "live" apps. - # Code is not reloaded between requests +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests. config.cache_classes = true - ##### - # Customize the default logger - # http://www.ruby-doc.org/stdlib-1.8.7/libdoc/logger/rdoc/Logger.html - # - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - # - # Rotate logs bigger than 1MB, keeps no more than 7 rotated logs around. - # When setting a new Logger, make sure to set it's log level too. - # - # config.logger = Logger.new(config.log_path, 7, 1048576) - # config.logger.level = Logger::INFO + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true - # Full error reports are disabled and caching is turned on + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable serving of images, stylesheets, and javascripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Disable delivery errors if you bad email addresses should just be ignored + # Disable delivery errors config.action_mailer.raise_delivery_errors = false # No email in production log config.action_mailer.logger = nil + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log end diff --git a/config/environments/test.rb b/config/environments/test.rb index f3d0ee9b8..249910443 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,16 +1,19 @@ -# Settings specified here will take precedence over those in config/application.rb -RedmineApp::Application.configure do +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = true - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false # Show full error reports and disable caching - #config.action_controller.consider_all_requests_local = true + config.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_mailer.perform_deliveries = true @@ -20,10 +23,10 @@ RedmineApp::Application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Skip protect_from_forgery in requests - # http://m.onkey.org/2007/9/28/csrf-protection-for-your-existing-rails-application + # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + # Print deprecation notices to stderr and the Rails logger. config.active_support.deprecation = [:stderr, :log] config.secret_token = 'a secret token for running the tests' diff --git a/config/environments/test_pgsql.rb b/config/environments/test_pgsql.rb index 45cb09bdd..258914d20 100644 --- a/config/environments/test_pgsql.rb +++ b/config/environments/test_pgsql.rb @@ -1 +1,2 @@ +# Same as test.rb instance_eval File.read(File.join(File.dirname(__FILE__), 'test.rb')) diff --git a/config/environments/test_sqlite3.rb b/config/environments/test_sqlite3.rb index 45cb09bdd..258914d20 100644 --- a/config/environments/test_sqlite3.rb +++ b/config/environments/test_sqlite3.rb @@ -1 +1,2 @@ +# Same as test.rb instance_eval File.read(File.join(File.dirname(__FILE__), 'test.rb')) diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 8df4cdec5..ff74c308c 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -54,56 +54,23 @@ module ActionView end end -# Do not HTML escape text templates -module ActionView - class Template - module Handlers - class ERB - def call(template) - if template.source.encoding_aware? - # First, convert to BINARY, so in case the encoding is - # wrong, we can still find an encoding tag - # (<%# encoding %>) inside the String using a regular - # expression - template_source = template.source.dup.force_encoding("BINARY") - - erb = template_source.gsub(ENCODING_TAG, '') - encoding = $2 - - erb.force_encoding valid_encoding(template.source.dup, encoding) - - # Always make sure we return a String in the default_internal - erb.encode! - else - erb = template.source.dup - end - - self.class.erb_implementation.new( - erb, - :trim => (self.class.erb_trim_mode == "-"), - :escape => template.identifier =~ /\.text/ # only escape HTML templates - ).src - end - end - end - end -end - ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ''.html_safe } # HTML5: <option value=""></option> is invalid, use <option value=""> </option> instead module ActionView module Helpers - class InstanceTag - private - def add_options_with_non_empty_blank_option(option_tags, options, value = nil) - if options[:include_blank] == true - options = options.dup - options[:include_blank] = ' '.html_safe + module Tags + class Base + private + def add_options_with_non_empty_blank_option(option_tags, options, value = nil) + if options[:include_blank] == true + options = options.dup + options[:include_blank] = ' '.html_safe + end + add_options_without_non_empty_blank_option(option_tags, options, value) end - add_options_without_non_empty_blank_option(option_tags, options, value) + alias_method_chain :add_options, :non_empty_blank_option end - alias_method_chain :add_options, :non_empty_blank_option end module FormTagHelper diff --git a/config/initializers/30-redmine.rb b/config/initializers/30-redmine.rb index f0fc4d4c6..a736902c9 100644 --- a/config/initializers/30-redmine.rb +++ b/config/initializers/30-redmine.rb @@ -1,5 +1,7 @@ I18n.default_locale = 'en' I18n.backend = Redmine::I18n::Backend.new +# Forces I18n to load available locales from the backend +I18n.config.available_locales = nil require 'redmine' @@ -20,9 +22,3 @@ Redmine::Plugin.load unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false Redmine::Plugin.mirror_assets end - -Rails.application.config.to_prepare do - Redmine::FieldFormat::RecordList.subclasses.each do |klass| - klass.instance.reset_target_class - end -end
\ No newline at end of file diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 5d9c3f843..05ba0d6ff 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -249,8 +249,8 @@ ja: field_is_for_all: 全プロジェクト向け field_possible_values: 選択肢 field_regexp: 正規表現 - field_min_length: 最短長 - field_max_length: 最大長 + field_min_length: 最小値 + field_max_length: 最大値 field_value: 値 field_category: カテゴリ field_title: タイトル @@ -305,7 +305,7 @@ ja: field_activity: 活動 field_spent_on: 日付 field_identifier: 識別子 - field_is_filter: フィルタとして使用 + field_is_filter: フィルタとして使う field_issue_to: 関連するチケット field_delay: 遅延 field_assignable: このロールにチケットを割り当て可能 @@ -314,7 +314,7 @@ ja: field_column_names: 項目 field_time_entries: 時間を記録 field_time_zone: タイムゾーン - field_searchable: 検索対象 + field_searchable: 検索条件に設定可能とする field_default_value: デフォルト値 field_comments_sorting: コメントの表示順 field_parent_title: 親ページ @@ -541,7 +541,7 @@ ja: label_subproject_plural: サブプロジェクト label_subproject_new: 新しいサブプロジェクト label_and_its_subprojects: "%{value} とサブプロジェクト" - label_min_max_length: 最短 - 最大長 + label_min_max_length: 最小値 - 最大値の長さ label_list: リストから選択 label_date: 日付 label_integer: 整数 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 1a0002a93..d6e02156e 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -997,7 +997,6 @@ label_only: 僅於 label_drop_down_list: 下拉式清單 label_checkboxes: 核取方塊 - label_radio_buttons: 選項按鈕 label_link_values_to: 連結欄位值至此網址 label_custom_field_select_type: 請選擇連結此自訂欄位的物件類型 label_check_for_updates: 檢查更新 @@ -1196,3 +1195,4 @@ description_date_from: 輸入起始日期 description_date_to: 輸入結束日期 text_repository_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。<br />一旦儲存之後, 代碼便無法再次被更改。' + label_radio_buttons: radio buttons diff --git a/config/preinitializer.rb b/config/preinitializer.rb deleted file mode 100644 index 90f789c6d..000000000 --- a/config/preinitializer.rb +++ /dev/null @@ -1,20 +0,0 @@ -begin - require "rubygems" - require "bundler" -rescue LoadError - $stderr.puts "Redmine requires Bundler. Please install it with `gem install bundler`." - exit 1 -end - -if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.0.21") - $stderr.puts "Redmine requires Bundler 1.0.21 (you're using #{Bundler::VERSION}).\nPlease install a newer version with `gem install bundler`." - exit 1 -end - -begin - ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) - Bundler.setup -rescue Bundler::GemNotFound - $stderr.puts "Some gems may need to be installed or updated.\nPlease run `bundle install --without development test`." - exit 1 -end diff --git a/config/routes.rb b/config/routes.rb index bb2c5bb12..a988eb311 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -RedmineApp::Application.routes.draw do +Rails.application.routes.draw do root :to => 'welcome#index', :as => 'home' match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] @@ -25,10 +25,10 @@ RedmineApp::Application.routes.draw do match 'account/activate', :to => 'account#activate', :via => :get get 'account/activation_email', :to => 'account#activation_email', :as => 'activation_email' - match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put] - match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] - match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] - match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] + match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put, :patch] + match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put, :patch] + match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put, :patch] + match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put, :patch] match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] @@ -74,7 +74,7 @@ RedmineApp::Application.routes.draw do match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post resources :users - match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' + match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => [:put, :patch], :as => 'user_membership' match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' @@ -113,7 +113,7 @@ RedmineApp::Application.routes.draw do get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue' resources :issues, :only => [:index, :new, :create] # issue form update - match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form' + match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :patch, :post], :as => 'issue_form' resources :files, :only => [:index, :new, :create] @@ -151,7 +151,7 @@ RedmineApp::Application.routes.draw do post 'rename' get 'history' get 'diff' - match 'preview', :via => [:post, :put] + match 'preview', :via => [:post, :put, :patch] post 'protect' post 'add_attachment' end |