Merged r6098 from trunk.

Added Project#enable_module! and Project#disable_module!

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@6104 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Baptiste Barth
2011-06-20 19:39:59 +00:00
parent df37e5cfab
commit 16ba6bcb77
18 changed files with 131 additions and 60 deletions
@@ -14,7 +14,7 @@ class RedminePluginControllerGenerator < ControllerGenerator
end
def destination_root
File.join(RAILS_ROOT, plugin_path)
File.join(Rails.root, plugin_path)
end
def manifest
@@ -14,7 +14,7 @@ class RedminePluginModelGenerator < ModelGenerator
end
def destination_root
File.join(RAILS_ROOT, plugin_path)
File.join(Rails.root, plugin_path)
end
def manifest
+3 -3
View File
@@ -56,11 +56,11 @@ module Redmine
def month_name(month)
::I18n.t('date.month_names')[month]
end
def valid_languages
@@valid_languages ||= Dir.glob(File.join(RAILS_ROOT, 'config', 'locales', '*.yml')).collect {|f| File.basename(f).split('.').first}.collect(&:to_sym)
@@valid_languages ||= Dir.glob(File.join(Rails.root, 'config', 'locales', '*.yml')).collect {|f| File.basename(f).split('.').first}.collect(&:to_sym)
end
def find_language(lang)
@@languages_lookup = valid_languages.inject({}) {|k, v| k[v.to_s.downcase] = v; k }
@@languages_lookup[lang.to_s.downcase]
+5 -5
View File
@@ -1,16 +1,16 @@
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
# Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -69,7 +69,7 @@ module Redmine #:nodoc:
p.name(id.to_s.humanize) if p.name.nil?
# Adds plugin locales if any
# YAML translation files should be found under <plugin>/config/locales/
::I18n.load_path += Dir.glob(File.join(RAILS_ROOT, 'vendor', 'plugins', id.to_s, 'config', 'locales', '*.yml'))
::I18n.load_path += Dir.glob(File.join(Rails.root, 'vendor', 'plugins', id.to_s, 'config', 'locales', '*.yml'))
registered_plugins[id] = p
end
+1 -1
View File
@@ -204,7 +204,7 @@ module Redmine
end
if Rails.env == 'development'
# Capture stderr when running in dev environment
cmd = "#{cmd} 2>>#{RAILS_ROOT}/log/scm.stderr.log"
cmd = "#{cmd} 2>>#{Rails.root}/log/scm.stderr.log"
end
begin
if RUBY_VERSION < '1.9'
+1 -1
View File
@@ -14,7 +14,7 @@ module Redmine
def self.revision
revision = nil
entries_path = "#{RAILS_ROOT}/.svn/entries"
entries_path = "#{Rails.root}/.svn/entries"
if File.readable?(entries_path)
begin
f = File.open(entries_path, 'r')
+4 -4
View File
@@ -1,16 +1,16 @@
# Redmine - project management software
# Copyright (C) 2006-2009 Jean-Philippe Lang
# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -20,7 +20,7 @@ module Redmine
module MyPage
module Block
def self.additional_blocks
@@additional_blocks ||= Dir.glob("#{RAILS_ROOT}/vendor/plugins/*/app/views/my/blocks/_*.{rhtml,erb}").inject({}) do |h,file|
@@additional_blocks ||= Dir.glob("#{Rails.root}/vendor/plugins/*/app/views/my/blocks/_*.{rhtml,erb}").inject({}) do |h,file|
name = File.basename(file).split('.').first.gsub(/^_/, '')
h[name] = name.to_sym
h
+3 -2
View File
@@ -7,7 +7,7 @@ task :extract_fixtures => :environment do
ActiveRecord::Base.establish_connection
(ActiveRecord::Base.connection.tables - skip_tables).each do |table_name|
i = "000"
File.open("#{RAILS_ROOT}/#{table_name}.yml", 'w' ) do |file|
File.open("#{Rails.root}/#{table_name}.yml", 'w' ) do |file|
data = ActiveRecord::Base.connection.select_all(sql % table_name)
file.write data.inject({}) { |hash, record|
# cast extracted values
@@ -19,4 +19,5 @@ task :extract_fixtures => :environment do
}.to_yaml
end
end
end
end
+1 -1
View File
@@ -1,7 +1,7 @@
desc 'Generates a configuration file for cookie store sessions.'
file 'config/initializers/session_store.rb' do
path = File.join(RAILS_ROOT, 'config', 'initializers', 'session_store.rb')
path = File.join(Rails.root, 'config', 'initializers', 'session_store.rb')
secret = ActiveSupport::SecureRandom.hex(40)
File.open(path, 'w') do |f|
f.write <<"EOF"