ChiliProject is not maintained anymore. Please be advised that there will be no more updates.
We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.
rails3-git-mbox.diff
b/Gemfile | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
source "https://rubygems.org" |
3 | 3 | |
4 |
gem "rails", "2.3.18"
|
|
4 |
gem "rails", "~> 3.0.0"
|
|
5 | 5 | |
6 | 6 |
gem "json", "~> 1.7.7" |
7 | 7 |
gem "coderay", "~> 1.0.0" |
8 |
gem "i18n", "~> 0.4.2" |
|
9 | 8 |
gem "rubytree", "~> 0.5.2", :require => 'tree' |
10 | 9 |
gem "rdoc", ">= 2.4.2" |
11 | 10 |
gem "liquid", "~> 2.3.0" |
... | ... | |
13 | 12 |
gem 'gravatarify', '~> 3.0.0' |
14 | 13 |
# Needed only on RUBY_VERSION = 1.8, ruby 1.9+ compatible interpreters should bring their csv |
15 | 14 |
gem "fastercsv", "~> 1.5.0", :platforms => [:ruby_18, :jruby, :mingw_18] |
16 |
gem "tzinfo", "~> 0.3.31" # Fixes #903. Not required for Rails >= 3.2 |
|
17 | 15 | |
18 | 16 |
group :test do |
19 | 17 |
gem 'shoulda', '~> 2.10.3' |
b/Rakefile | ||
---|---|---|
1 | 1 |
# Add your own tasks in files placed in lib/tasks ending in .rake, |
2 | 2 |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. |
3 | 3 | |
4 |
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
|
4 |
require File.expand_path('../config/application', __FILE__)
|
|
5 | 5 | |
6 |
require 'rake' |
|
7 |
require 'rake/testtask' |
|
8 |
require 'rdoc/task' |
|
9 | ||
10 |
require 'tasks/rails' |
|
11 |
# Load rake tasks from plugins in chiliproject_plugins |
|
12 |
Dir["#{RAILS_ROOT}/vendor/chiliproject_plugins/*/lib/tasks/**/*.rake"].sort.each { |ext| load ext } |
|
6 |
ChiliProject::Application.load_tasks |
b/config.ru | ||
---|---|---|
1 |
#-- encoding: UTF-8 |
|
2 |
#-- copyright |
|
3 |
# ChiliProject is a project management system. |
|
4 |
# |
|
5 |
# Copyright (C) 2010-2012 the ChiliProject Team |
|
6 |
# |
|
7 |
# This program is free software; you can redistribute it and/or |
|
8 |
# modify it under the terms of the GNU General Public License |
|
9 |
# as published by the Free Software Foundation; either version 2 |
|
10 |
# of the License, or (at your option) any later version. |
|
11 |
# |
|
12 |
# See doc/COPYRIGHT.rdoc for more details. |
|
13 |
#++ |
|
14 | ||
15 |
# This file is used by Rack-based servers to start the application. |
|
16 | ||
17 |
require ::File.expand_path('../config/environment', __FILE__) |
|
18 |
run ChiliProject::Application |
b/config/additional_environment.rb.example | ||
---|---|---|
1 | 1 |
# Copy this file to additional_environment.rb and add any statements |
2 |
# that need to be passed to the Rails::Initializer. `config` is
|
|
2 |
# that need to be passed to the ChiliProject::Application. `config` is
|
|
3 | 3 |
# available in this context. |
4 | 4 |
# |
5 | 5 |
# Example: |
b/config/application.rb | ||
---|---|---|
1 |
require File.expand_path('../boot', __FILE__) |
|
2 | ||
3 |
require 'rails/all' |
|
4 | ||
5 |
if defined?(Bundler) |
|
6 |
# If you precompile assets before deploying to production, use this line |
|
7 |
Bundler.require(*Rails.groups(:assets => %w(development test))) |
|
8 |
# If you want your assets lazily compiled in production, use this line |
|
9 |
# Bundler.require(:default, :assets, Rails.env) |
|
10 |
end |
|
11 | ||
12 |
module ChiliProject |
|
13 |
class Application < Rails::Application |
|
14 |
# Settings in config/environments/* take precedence over those specified here. |
|
15 |
# Application configuration should go into files in config/initializers |
|
16 |
# -- all .rb files in that directory are automatically loaded. |
|
17 | ||
18 |
# Custom directories with classes and modules you want to be autoloadable. |
|
19 |
config.autoload_paths += %W[#{config.root}/lib #{config.root}/app/drops] |
|
20 | ||
21 |
# Only load the plugins named here, in the order given (default is alphabetical). |
|
22 |
# :all can be used as a placeholder for all plugins not explicitly named. |
|
23 |
# config.plugins = [ :exception_notification, :ssl_requirement, :all ] |
|
24 | ||
25 |
# Activate observers that should always be running. |
|
26 |
config.active_record.observers = :journal_observer, :message_observer, :issue_observer, :news_observer, :document_observer, :comment_observer |
|
27 |
config.active_record.store_full_sti_class = true |
|
28 | ||
29 |
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. |
|
30 |
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. |
|
31 |
# config.time_zone = 'Central Time (US & Canada)' |
|
32 |
config.active_record.default_timezone = :local |
|
33 | ||
34 |
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. |
|
35 |
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] |
|
36 |
config.i18n.default_locale = :en |
|
37 | ||
38 |
# Configure the default encoding used in templates for Ruby 1.9. |
|
39 |
config.encoding = "utf-8" |
|
40 | ||
41 |
# Configure sensitive parameters which will be filtered from the log file. |
|
42 |
config.filter_parameters += [:password] |
|
43 | ||
44 |
# Enable escaping HTML in JSON. |
|
45 |
config.active_support.escape_html_entities_in_json = true |
|
46 | ||
47 |
# Use SQL instead of Active Record's schema dumper when creating the database. |
|
48 |
# This is necessary if your schema can't be completely dumped by the schema dumper, |
|
49 |
# like if you have constraints or database-specific column types |
|
50 |
# config.active_record.schema_format = :sql |
|
51 | ||
52 |
# Enforce whitelist mode for mass assignment. |
|
53 |
# This will create an empty whitelist of attributes available for mass-assignment for all models |
|
54 |
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible |
|
55 |
# parameters by using an attr_accessible or attr_protected declaration. |
|
56 |
config.active_record.whitelist_attributes = true |
|
57 | ||
58 |
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) |
|
59 |
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) |
|
60 |
end |
|
61 |
end |
|
62 |
end |
b/config/boot.rb | ||
---|---|---|
12 | 12 |
# See doc/COPYRIGHT.rdoc for more details. |
13 | 13 |
#++ |
14 | 14 | |
15 |
# Don't change this file! |
|
16 |
# Configure your app in config/environment.rb and config/environments/*.rb |
|
15 |
require 'rubygems' |
|
17 | 16 | |
18 |
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) |
|
17 |
# Set up gems listed in the Gemfile. |
|
18 |
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) |
|
19 | 19 | |
20 |
module Rails |
|
21 |
class << self |
|
22 |
def boot! |
|
23 |
unless booted? |
|
24 |
preinitialize |
|
25 |
pick_boot.run |
|
26 |
end |
|
27 |
end |
|
28 | ||
29 |
def booted? |
|
30 |
defined? Rails::Initializer |
|
31 |
end |
|
32 | ||
33 |
def pick_boot |
|
34 |
(vendor_rails? ? VendorBoot : GemBoot).new |
|
35 |
end |
|
36 | ||
37 |
def vendor_rails? |
|
38 |
File.exist?("#{RAILS_ROOT}/vendor/rails") |
|
39 |
end |
|
40 | ||
41 |
def preinitialize |
|
42 |
load(preinitializer_path) if File.exist?(preinitializer_path) |
|
43 |
end |
|
44 | ||
45 |
def preinitializer_path |
|
46 |
"#{RAILS_ROOT}/config/preinitializer.rb" |
|
47 |
end |
|
48 |
end |
|
49 | ||
50 |
class Boot |
|
51 |
def run |
|
52 |
load_initializer |
|
53 | ||
54 |
# This block was added for bundler support while following setup |
|
55 |
# instructions from http://gembundler.com/rails23.html |
|
56 |
Rails::Initializer.class_eval do |
|
57 |
def load_gems |
|
58 |
@bundler_loaded ||= Bundler.require :default, Rails.env |
|
59 |
end |
|
60 |
end |
|
61 | ||
62 |
Rails::Initializer.run(:set_load_path) |
|
63 |
end |
|
64 |
end |
|
65 | ||
66 |
class VendorBoot < Boot |
|
67 |
def load_initializer |
|
68 |
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" |
|
69 |
Rails::Initializer.run(:install_gem_spec_stubs) |
|
70 |
Rails::GemDependency.add_frozen_gem_path |
|
71 |
end |
|
72 |
end |
|
73 | ||
74 |
class GemBoot < Boot |
|
75 |
def load_initializer |
|
76 |
self.class.load_rubygems |
|
77 |
load_rails_gem |
|
78 |
require 'initializer' |
|
79 |
end |
|
80 | ||
81 |
def load_rails_gem |
|
82 |
if version = self.class.gem_version |
|
83 |
gem 'rails', version |
|
84 |
else |
|
85 |
gem 'rails' |
|
86 |
end |
|
87 |
rescue Gem::LoadError => load_error |
|
88 |
if load_error.message =~ /Could not find RubyGem rails/ |
|
89 |
STDERR.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) |
|
90 |
exit 1 |
|
91 |
else |
|
92 |
raise |
|
93 |
end |
|
94 |
end |
|
95 | ||
96 |
class << self |
|
97 |
def rubygems_version |
|
98 |
Gem::RubyGemsVersion rescue nil |
|
99 |
end |
|
100 | ||
101 |
def gem_version |
|
102 |
if defined? RAILS_GEM_VERSION |
|
103 |
RAILS_GEM_VERSION |
|
104 |
elsif ENV.include?('RAILS_GEM_VERSION') |
|
105 |
ENV['RAILS_GEM_VERSION'] |
|
106 |
else |
|
107 |
parse_gem_version(read_environment_rb) |
|
108 |
end |
|
109 |
end |
|
110 | ||
111 |
def load_rubygems |
|
112 |
min_version = '1.3.2' |
|
113 |
require 'rubygems' |
|
114 |
unless rubygems_version >= min_version |
|
115 |
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) |
|
116 |
exit 1 |
|
117 |
end |
|
118 | ||
119 |
rescue LoadError |
|
120 |
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) |
|
121 |
exit 1 |
|
122 |
end |
|
123 | ||
124 |
def parse_gem_version(text) |
|
125 |
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ |
|
126 |
end |
|
127 | ||
128 |
private |
|
129 |
def read_environment_rb |
|
130 |
File.read("#{RAILS_ROOT}/config/environment.rb") |
|
131 |
end |
|
132 |
end |
|
133 |
end |
|
134 |
end |
|
135 | ||
136 |
# All that for this: |
|
137 |
Rails.boot! |
|
20 |
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) |
b/config/environment.rb | ||
---|---|---|
12 | 12 |
# See doc/COPYRIGHT.rdoc for more details. |
13 | 13 |
#++ |
14 | 14 | |
15 |
# Be sure to restart your web server when you modify this file. |
|
16 | ||
17 |
# Uncomment below to force Rails into production mode when |
|
18 |
# you don't control web/app server and can't set it the proper way |
|
19 |
# ENV['RAILS_ENV'] ||= 'production' |
|
20 | ||
21 |
# use RACK_ENV if we are running as a simple rack app |
|
22 |
ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] if ENV['RACK_ENV'] |
|
23 | ||
24 |
# this is replaced by config.encoding = "utf-8" in rails3 |
|
25 |
if RUBY_VERSION >= '1.9' |
|
26 |
Encoding.default_external = 'UTF-8' |
|
27 |
Encoding.default_internal = 'UTF-8' |
|
28 |
else |
|
29 |
$KCODE='UTF-8' |
|
30 |
end |
|
31 | ||
32 |
# Bootstrap the Rails environment, frameworks, and default configuration |
|
33 |
require File.join(File.dirname(__FILE__), 'boot') |
|
34 | ||
35 |
# Load Engine plugin if available |
|
36 |
begin |
|
37 |
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') |
|
38 |
rescue LoadError |
|
39 |
# Not available |
|
40 |
end |
|
41 | ||
42 |
Rails::Initializer.run do |config| |
|
43 |
# Settings in config/environments/* take precedence those specified here |
|
44 | ||
45 |
# Skip frameworks you're not going to use |
|
46 |
# config.frameworks -= [ :action_web_service, :action_mailer ] |
|
47 | ||
48 |
# Add additional load paths for sweepers |
|
49 |
config.autoload_paths += %W( #{RAILS_ROOT}/app/sweepers ) |
|
50 | ||
51 |
# Force all environments to use the same logger level |
|
52 |
# (by default production uses :info, the others :debug) |
|
53 |
# config.log_level = :debug |
|
54 | ||
55 |
# Liquid drops |
|
56 |
config.autoload_paths += %W( #{RAILS_ROOT}/app/drops ) |
|
57 | ||
58 |
# Enable page/fragment caching by setting a file-based store |
|
59 |
# (remember to create the caching directory and make it readable to the application) |
|
60 |
# config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache" |
|
61 | ||
62 |
# Activate observers that should always be running |
|
63 |
# config.active_record.observers = :cacher, :garbage_collector |
|
64 |
config.active_record.observers = :journal_observer, :message_observer, :issue_observer, :news_observer, :document_observer, :comment_observer |
|
65 | ||
66 |
# Make Active Record use UTC-base instead of local time |
|
67 |
# config.active_record.default_timezone = :utc |
|
68 | ||
69 |
# Use Active Record's schema dumper instead of SQL when creating the test database |
|
70 |
# (enables use of different database adapters for development and test environments) |
|
71 |
# config.active_record.schema_format = :ruby |
|
72 | ||
73 |
# Deliveries are disabled by default. Do NOT modify this section. |
|
74 |
# Define your email configuration in configuration.yml instead. |
|
75 |
# It will automatically turn deliveries on |
|
76 |
config.action_mailer.perform_deliveries = false |
|
77 | ||
78 |
# Insert vendor/chiliproject_plugins at the top of the plugin load paths |
|
79 |
config.plugin_paths.insert(0, File.join(Rails.root, "vendor", "chiliproject_plugins")) |
|
80 | ||
81 |
# Use redmine's custom plugin locater |
|
82 |
require File.join(RAILS_ROOT, "lib/redmine_plugin_locator") |
|
83 |
config.plugin_locators << RedminePluginLocator |
|
84 | ||
85 |
# Load any local configuration that is kept out of source control |
|
86 |
# (e.g. patches). |
|
87 |
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) |
|
88 |
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) |
|
89 |
end |
|
90 |
end |
|
15 |
require File.expand_path('../application', __FILE__) |
|
16 |
ChiliProject::Application.initialize! |
b/config/environments/development.rb | ||
---|---|---|
12 | 12 |
# See doc/COPYRIGHT.rdoc for more details. |
13 | 13 |
#++ |
14 | 14 | |
15 |
# Settings specified here will take precedence over those in config/environment.rb |
|
15 |
ChiliProject::Application.configure do |
|
16 |
# Settings specified here will take precedence over those in config/application.rb |
|
16 | 17 | |
17 |
# In the development environment your application's code is reloaded on |
|
18 |
# every request. This slows down response time but is perfect for development
|
|
19 |
# since you don't have to restart the webserver when you make code changes.
|
|
20 |
config.cache_classes = false |
|
18 |
# In the development environment your application's code is reloaded on
|
|
19 |
# every request. This slows down response time but is perfect for development
|
|
20 |
# since you don't have to restart the web server when you make code changes.
|
|
21 |
config.cache_classes = false
|
|
21 | 22 | |
22 |
# Log error messages when you accidentally call methods on nil. |
|
23 |
config.whiny_nils = true |
|
23 |
# Log error messages when you accidentally call methods on nil.
|
|
24 |
config.whiny_nils = true
|
|
24 | 25 | |
25 |
# Show full error reports and disable caching |
|
26 |
config.action_controller.consider_all_requests_local = true |
|
27 |
config.action_view.debug_rjs = true |
|
28 |
config.action_controller.perform_caching = false |
|
26 |
# Show full error reports and disable caching |
|
27 |
config.consider_all_requests_local = true |
|
28 |
config.action_controller.perform_caching = false |
|
29 | 29 | |
30 |
# Don't care if the mailer can't send |
|
31 |
config.action_mailer.raise_delivery_errors = false |
|
30 |
# Don't care if the mailer can't send |
|
31 |
config.action_mailer.raise_delivery_errors = false |
|
32 | ||
33 |
# Print deprecation notices to the Rails logger |
|
34 |
config.active_support.deprecation = :log |
|
35 | ||
36 |
# Only use best-standards-support built into browsers |
|
37 |
config.action_dispatch.best_standards_support = :builtin |
|
38 | ||
39 |
# Raise exception on mass assignment protection for Active Record models |
|
40 |
config.active_record.mass_assignment_sanitizer = :strict |
|
41 | ||
42 |
# Log the query plan for queries taking more than this (works |
|
43 |
# with SQLite, MySQL, and PostgreSQL) |
|
44 |
config.active_record.auto_explain_threshold_in_seconds = 0.5 |
|
45 | ||
46 |
# Do not compress assets |
|
47 |
config.assets.compress = false |
|
48 | ||
49 |
# Expands the lines which load the assets |
|
50 |
config.assets.debug = true |
|
51 |
end |
b/config/environments/production.rb | ||
---|---|---|
12 | 12 |
# See doc/COPYRIGHT.rdoc for more details. |
13 | 13 |
#++ |
14 | 14 | |
15 |
# Settings specified here will take precedence over those in config/environment.rb |
|
15 |
ChiliProject::Application.configure do |
|
16 |
# Settings specified here will take precedence over those in config/application.rb |
|
16 | 17 | |
17 |
# The production environment is meant for finished, "live" apps. |
|
18 |
# Code is not reloaded between requests |
|
19 |
config.cache_classes = true |
|
18 |
# Code is not reloaded between requests |
|
19 |
config.cache_classes = true |
|
20 | 20 | |
21 |
##### |
|
22 |
# Customize the default logger (http://ruby-doc.org/core/classes/Logger.html) |
|
23 |
# |
|
24 |
# Use a different logger for distributed setups |
|
25 |
# config.logger = SyslogLogger.new |
|
26 |
# |
|
27 |
# Rotate logs bigger than 1MB, keeps no more than 7 rotated logs around. |
|
28 |
# When setting a new Logger, make sure to set it's log level too. |
|
29 |
# |
|
30 |
# config.logger = Logger.new(config.log_path, 7, 1048576) |
|
31 |
# config.logger.level = Logger::INFO |
|
21 |
# Full error reports are disabled and caching is turned on |
|
22 |
config.consider_all_requests_local = false |
|
23 |
config.action_controller.perform_caching = true |
|
24 | ||
25 |
# Keep Rails's static asset server enabled |
|
26 |
# Apache or nginx should already do this but to keep it save for people with |
|
27 |
# strange setups and for testing we keep it enabled |
|
28 |
config.serve_static_assets = true |
|
29 | ||
30 |
# Compress JavaScripts and CSS |
|
31 |
config.assets.compress = true |
|
32 | ||
33 |
# Don't fallback to assets pipeline if a precompiled asset is missed |
|
34 |
config.assets.compile = false |
|
35 | ||
36 |
# Generate digests for assets URLs |
|
37 |
config.assets.digest = true |
|
38 | ||
39 |
# Defaults to nil and saved in location specified by config.assets.prefix |
|
40 |
# config.assets.manifest = YOUR_PATH |
|
41 | ||
42 |
# Specifies the header that your server uses for sending files |
|
43 |
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache |
|
44 |
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx |
|
45 | ||
46 |
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. |
|
47 |
# config.force_ssl = true |
|
48 | ||
49 |
# See everything in the log (default is :info) |
|
50 |
# config.log_level = :debug |
|
51 | ||
52 |
# Prepend all log lines with the following tags |
|
53 |
# config.log_tags = [ :subdomain, :uuid ] |
|
54 | ||
55 |
# Use a different logger for distributed setups |
|
56 |
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) |
|
57 | ||
58 |
# Use a different cache store in production |
|
59 |
# config.cache_store = :mem_cache_store |
|
60 | ||
61 |
# Enable serving of images, stylesheets, and JavaScripts from an asset server |
|
62 |
# config.action_controller.asset_host = "http://assets.example.com" |
|
63 | ||
64 |
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) |
|
65 |
# config.assets.precompile += %w( search.js ) |
|
66 | ||
67 |
# Disable delivery errors, bad email addresses will be ignored |
|
68 |
config.action_mailer.raise_delivery_errors = false |
|
32 | 69 | |
33 |
# Full error reports are disabled and caching is turned on |
|
34 |
config.action_controller.consider_all_requests_local = false |
|
35 |
config.action_controller.perform_caching = true |
|
70 |
# Enable threaded mode |
|
71 |
config.threadsafe! |
|
36 | 72 | |
37 |
# Enable serving of images, stylesheets, and javascripts from an asset server |
|
38 |
# config.action_controller.asset_host = "http://assets.example.com" |
|
73 |
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to |
|
74 |
# the I18n.default_locale when a translation can not be found) |
|
75 |
config.i18n.fallbacks = true |
|
39 | 76 | |
40 |
# Disable delivery errors if you bad email addresses should just be ignored |
|
41 |
config.action_mailer.raise_delivery_errors = false |
|
77 |
# Send deprecation notices to registered listeners |
|
78 |
config.active_support.deprecation = :notify |
|
42 | 79 | |
43 |
# No email in production log |
|
44 |
config.action_mailer.logger = nil |
|
80 |
# Log the query plan for queries taking more than this (works |
|
81 |
# with SQLite, MySQL, and PostgreSQL) |
|
82 |
# config.active_record.auto_explain_threshold_in_seconds = 0.5 |
|
83 |
end |
b/config/environments/test.rb | ||
---|---|---|
12 | 12 |
# See doc/COPYRIGHT.rdoc for more details. |
13 | 13 |
#++ |
14 | 14 | |
15 |
# Settings specified here will take precedence over those in config/environment.rb |
|
15 |
ChiliProject::Application.configure do |
|
16 |
# Settings specified here will take precedence over those in config/application.rb |
|
16 | 17 | |
17 |
# The test environment is used exclusively to run your application's |
|
18 |
# test suite. You never need to work with it otherwise. Remember that
|
|
19 |
# your test database is "scratch space" for the test suite and is wiped |
|
20 |
# and recreated between test runs. Don't rely on the data there!
|
|
21 |
config.cache_classes = true |
|
18 |
# The test environment is used exclusively to run your application's
|
|
19 |
# test suite. You never need to work with it otherwise. Remember that
|
|
20 |
# your test database is "scratch space" for the test suite and is wiped
|
|
21 |
# and recreated between test runs. Don't rely on the data there!
|
|
22 |
config.cache_classes = true
|
|
22 | 23 | |
23 |
# Log error messages when you accidentally call methods on nil. |
|
24 |
config.whiny_nils = true |
|
24 |
# Configure static asset server for tests with Cache-Control for performance |
|
25 |
config.serve_static_assets = true |
|
26 |
config.static_cache_control = "public, max-age=3600" |
|
25 | 27 | |
26 |
# Show full error reports and disable caching |
|
27 |
config.action_controller.consider_all_requests_local = true |
|
28 |
config.action_controller.perform_caching = false |
|
28 |
# Log error messages when you accidentally call methods on nil |
|
29 |
config.whiny_nils = true |
|
29 | 30 | |
30 |
config.action_mailer.perform_deliveries = true |
|
31 |
config.action_mailer.delivery_method = :test |
|
31 |
# Show full error reports and disable caching |
|
32 |
config.consider_all_requests_local = true |
|
33 |
config.action_controller.perform_caching = false |
|
32 | 34 | |
33 |
config.action_controller.session = { |
|
34 |
:key => "_test_session", |
|
35 |
:secret => "some secret phrase for the tests." |
|
36 |
} |
|
35 |
# Raise exceptions instead of rendering exception templates |
|
36 |
config.action_dispatch.show_exceptions = false |
|
37 | 37 | |
38 |
# Skip protect_from_forgery in requests http://m.onkey.org/2007/9/28/csrf-protection-for-your-existing-rails-application |
|
39 |
config.action_controller.allow_forgery_protection = false |
|
38 |
# Disable request forgery protection in test environment |
|
39 |
config.action_controller.allow_forgery_protection = false |
|
40 | ||
41 |
# Tell Action Mailer not to deliver emails to the real world. |
|
42 |
# The :test delivery method accumulates sent emails in the |
|
43 |
# ActionMailer::Base.deliveries array. |
|
44 |
config.action_mailer.delivery_method = :test |
|
45 | ||
46 |
# Raise exception on mass assignment protection for Active Record models |
|
47 |
config.active_record.mass_assignment_sanitizer = :strict |
|
48 | ||
49 |
# Print deprecation notices to the stderr |
|
50 |
config.active_support.deprecation = :stderr |
|
51 |
end |
b/config/initializers/30-redmine.rb | ||
---|---|---|
12 | 12 |
# See doc/COPYRIGHT.rdoc for more details. |
13 | 13 |
#++ |
14 | 14 | |
15 |
I18n.default_locale = 'en' |
|
16 | 15 |
# Adds fallback to default locale for untranslated strings |
17 | 16 |
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) |
18 | 17 |
b/config/initializers/inflections.rb | ||
---|---|---|
22 | 22 |
# inflect.irregular 'person', 'people' |
23 | 23 |
# inflect.uncountable %w( fish sheep ) |
24 | 24 |
# end |
25 |
# |
|
26 |
# These inflection rules are supported but not enabled by default: |
|
27 |
# ActiveSupport::Inflector.inflections do |inflect| |
|
28 |
# inflect.acronym 'RESTful' |
|
29 |
# end |
/dev/null | ||
---|---|---|
1 |
#-- encoding: UTF-8 |
|
2 |
#-- copyright |
|
3 |
# ChiliProject is a project management system. |
|
4 |
# |
|
5 |
# Copyright (C) 2010-2013 the ChiliProject Team |
|
6 |
# |
|
7 |
# This program is free software; you can redistribute it and/or |
|
8 |
# modify it under the terms of the GNU General Public License |
|
9 |
# as published by the Free Software Foundation; either version 2 |
|
10 |
# of the License, or (at your option) any later version. |
|
11 |
# |
|
12 |
# See doc/COPYRIGHT.rdoc for more details. |
|
13 |
#++ |
|
14 | ||
15 |
# Be sure to restart your server when you modify this file. |
|
16 | ||
17 |
# These settings change the behavior of Rails 2 apps and will be defaults |
|
18 |
# for Rails 3. You can remove this initializer when Rails 3 is released. |
|
19 | ||
20 |
if defined?(ActiveRecord) |
|
21 |
# Include Active Record class name as root for JSON serialized output. |
|
22 |
ActiveRecord::Base.include_root_in_json = true |
|
23 | ||
24 |
# Store the full class name (including module namespace) in STI type column. |
|
25 |
ActiveRecord::Base.store_full_sti_class = true |
|
26 |
end |
|
27 | ||
28 |
ActionController::Routing.generate_best_match = true |
|
29 | ||
30 |
# Use ISO 8601 format for JSON serialized times and dates. |
|
31 |
ActiveSupport.use_standard_json_time_format = true |
|
32 | ||
33 |
# Don't escape HTML entities in JSON, leave that for the #json_escape helper. |
|
34 |
# if you're including raw json in an HTML page. |
|
35 |
ActiveSupport.escape_html_entities_in_json = false |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/breakpointer' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/console' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/dbconsole' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/destroy' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/generate' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../../config/boot', __FILE__) |
|
4 |
require 'commands/performance/benchmarker' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../../config/boot', __FILE__) |
|
4 |
require 'commands/performance/profiler' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/performance/request' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/plugin' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/process/inspector' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/process/reaper' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/process/spawner' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/process/spinner' |
b/script/rails | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. |
|
3 | ||
4 |
APP_PATH = File.expand_path('../../config/application', __FILE__) |
|
5 |
require File.expand_path('../../config/boot', __FILE__) |
|
6 |
require 'rails/commands' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/runner' |
/dev/null | ||
---|---|---|
1 |
#!/usr/bin/env ruby |
|
2 |
#-- encoding: UTF-8 |
|
3 |
require File.expand_path('../../config/boot', __FILE__) |
|
4 |
require 'commands/server' |
|
5 |
- |
/dev/null | ||
---|---|---|
1 |
.DS_Store |
|
2 |
test_app |
|
3 |
doc |
/dev/null | ||
---|---|---|
1 |
= EDGE |
|
2 | ||
3 |
* Samuel Williams (http://www.oriontransfer.co.nz/): |
|
4 |
Thanks to Tekin for his patches. |
|
5 |
Updated migrations system to tie in more closely with the current rails mechanism. |
|
6 |
Rake task for updating database schema info |
|
7 |
rake db:migrate:upgrade_plugin_migrations |
|
8 |
Please see http://engines.lighthouseapp.com/projects/10178-engines-plugin/tickets/17 for more information. |
|
9 | ||
10 |
* Refactored the view loading to work with changes in Edge Rails |
|
11 | ||
12 |
* Fixed integration of plugin migrations with the new, default timestamped migrations in Edge Rails |
|
13 | ||
14 |
* Refactored tests into the plugin itself - the plugin can now generate its own test_app harness and run tests within it. |
|
15 | ||
16 | ||
17 |
= 2.0.0 - (ANOTHER) MASSIVE INTERNAL REFACTORING |
|
18 | ||
19 |
* Engines now conforms to the new plugin loading mechanism, delegating plugin load order and lots of other things to Rails itself. |
|
20 | ||
21 | ||
22 | ||
23 |
= 1.2.2 |
|
24 | ||
25 |
* Added the ability to code mix different types of files, cleaning up the existing code-mixing implementation slightly (Ticket #271) |
|
26 | ||
27 | ||
28 |
= 1.2.1 |
|
29 | ||
30 |
* Added documentation to clarify some of the issues with Rails unloading classes that aren't required using "require_dependency" (Ticket #266) |
|
31 | ||
32 |
* Fixed a bug where test_help was being loaded when it wasn't needed, and was actually causing problems (Ticket #265) |
|
33 | ||
34 | ||
35 |
= 1.2.0 - MASSIVE INTERNAL REFACTORING |
|
36 | ||
37 |
* !!!Support for Rails < 1.2 has been dropped!!!; if you are using Rails =< 1.1.6, please use Engines 1.1.6, available from http://svn.rails-engines.org/engines/tags/rel_1.1.6 |
|
38 | ||
39 |
* Engines are dead! Long live plugins! There is now no meaningful notion of an engine - all plugins can take advantage of the more powerful features that the engines plugin provides by including app directories, etc. |
|
40 | ||
41 |
* Init_engine.rb is no longer used; please use the plugin-standard init.rb instead. |
|
42 | ||
43 |
* Engines.start is no longer required; please use the config.plugins array provided by Rails instead |
|
44 | ||
45 |
* To get the most benefit from Engines, set config.plugins to ["engines", "*"] to load the engines plugin first, and then all other plugins in their normal order after. |
|
46 | ||
47 |
* Access all loaded plugins via the new Rails.plugins array, and by name using Rails.plugins[:plugin_name]. |
|
48 | ||
49 |
* Access plugin metadata loaded automatically from about.yml: Rails.plugins[:name].about. Plugin#version is provided directly, for easy access. |
|
50 | ||
51 |
* Module.config is has been removed - use mattr_accessor instead, and initialize your default values via the init.rb mechanism. |
|
52 | ||
53 |
* Public asset helpers have been rewritten; instead of engine_stylesheet, now use stylesheet_link_tag :name, :plugin => "plugin_name" |
|
54 | ||
55 |
* Plugin migrations have been reworked to integrate into the main migration stream. Please run script/generate plugin_migration to create plugin migrations in your main application. |
|
56 | ||
57 |
* The fixture method for loading fixtures against any class has been removed; instead, engines will now provide a mechanism for loading fixtures from all plugins, by mirroring fixtures into a common location. |
|
58 | ||
59 |
* All references to engines have been removed; For example, any rake tasks which applied to engines now apply to all plugins. The default Rails rake tasks for plugins are overridden where necessary. |
|
60 | ||
61 |
* Layouts can now be shared via plugins - inspiration gratefully taken from PluginAWeek's plugin_routing :) |
|
62 | ||
63 |
* Actual routing from plugins is now possible, by including routes.rb in your plugin directory and using the from_plugin method in config/routes.rb (Ticket #182) |
|
64 | ||
65 |
* Controllers are no longer loaded twice if they're not present in the normal app/ directory (Ticket #177) |
|
66 | ||
67 |
* The preferred location for javascripts/stylesheets/etc is now 'assets' rather than 'public' |
|
68 | ||
69 |
* Ensure that plugins started before routing have their controllers appropriately added to config.controller_paths (Ticket #258) |
|
70 | ||
71 |
* Removed Engines.version - it's not longer relevant, now we're loading version information from about.yml files. |
|
72 | ||
73 |
* Added a huge amount of documentation to all new modules. |
|
74 | ||
75 |
* Added new warning message if installation of engines 1.2.x is attempted in a Rails 1.1.x application |
|
76 | ||
77 |
* Added details of the removal of the config method to UPGRADING |
|
78 | ||
79 |
* Removed the plugins:info rake task in favour of adding information to script/about via the Rails::Info module (Ticket #261) |
|
80 | ||
81 |
* Improved handling of testing and documentation tasks for plugins |
|
82 | ||
83 | ||
84 | ||
85 |
= 1.1.4 |
|
86 | ||
87 |
* Fixed creation of multipart emails (Ticket #190) |
|
88 | ||
89 |
* Added a temporary fix to the code-mixing issue. In your engine's test/test_helper.rb, please add the following lines: |
|
90 | ||
91 |
# Ensure that the code mixing and view loading from the application is disabled |
|
92 |
Engines.disable_app_views_loading = true |
|
93 |
Engines.disable_app_code_mixing = true |
|
94 | ||
95 |
which will prevent code mixing for controllers and helpers, and loading views from the application. One thing to remember is to load any controllers/helpers using 'require_or_load' in your tests, to ensure that the engine behaviour is respected (Ticket #135) |
|
96 | ||
97 |
* Added tasks to easily test engines individually (Ticket #120) |
|
98 | ||
99 |
* Fixture extensions will now fail with an exception if the corresponding class cannot be loaded (Ticket #138) |
|
100 | ||
101 |
* Patch for new routing/controller loading in Rails 1.1.6. The routing code is now replaced with the contents of config.controller_paths, along with controller paths from any started engines (Ticket #196) |
|
102 | ||
103 |
* Rails' Configuration instance is now stored, and available from all engines and plugins. |
|
104 | ||
105 | ||
106 | ||
107 |
= 1.1.3 |
|
108 | ||
109 |
* Fixed README to show 'models' rather than 'model' class (Ticket #167) |
|
110 |
* Fixed dependency loading to work with Rails 1.1.4 (Ticket #180) |
|
111 | ||
112 | ||
113 | ||
114 |
= 1.1.2 |
|
115 | ||
116 |
* Added better fix to version checking (Ticket #130, jdell@gbdev.com). |
|
117 | ||
118 |
* Fixed generated init_engine.rb so that VERSION module doesn't cause probems (Ticket #131, japgolly@gmail.com) |
|
119 | ||
120 |
* Fixed error with Rails 1.0 when trying to ignore the engine_schema_info table (Ticket #132, snowblink@gmail.com) |
|
121 | ||
122 |
* Re-added old style rake tasks (Ticket #133) |
|
123 | ||
124 |
* No longer adding all subdirectories of <engine>/app or <engine>/lib, as this can cause issues when files are grouped in modules (Ticket #149, kasatani@gmail.com) |
|
125 | ||
126 |
* Fixed engine precidence ordering for Rails 1.1 (Ticket #146) |
|
127 | ||
128 |
* Added new Engines.each method to assist in processing the engines in the desired order (Ticket #146) |
|
129 | ||
130 |
* Fixed annoying error message at appears when starting the console in development mode (Ticket #134) |
|
131 | ||
132 |
* Engines is now super-careful about loading the correct version of Rails from vendor (Ticket #154) |
|
133 | ||
134 | ||
135 | ||
136 |
= 1.1.1 |
|
137 | ||
138 |
* Fixed migration rake task failing when given a specific version (Ticket #115) |
|
139 | ||
140 |
* Added new rake task "test:engines" which will test engines (and other plugins) but ensure that the test database is cloned from development beforehand (Ticket #125) |
|
141 | ||
142 |
* Fixed issue where 'engine_schema_info' table was included in schema dumps (Ticket #87) |
|
143 | ||
144 |
* Fixed multi-part emails (Ticket #121) |
|
145 | ||
146 |
* Added an 'install.rb' file to new engines created by the bundled generator, which installs the engines plugin automatically if it doesn't already exist (Ticket #122) |
|
147 | ||
148 |
* Added a default VERSION module to generated engines (Ticket #123) |
|
149 | ||
150 |
* Refactored copying of engine's public files to a method of an Engine instance. You can now call Engines.get(:engine_name).copy_public_files (Ticket #108) |
|
151 | ||
152 |
* Changed engine generator templates from .rb files to .erb files (Ticket #106) |
|
153 | ||
154 |
* Fixed the test_helper.erb file to use the correct testing extensions and not load any schema - the schema will be cloned automatically via rake test:engines |
|
155 | ||
156 |
* Fixed problem when running with Rails 1.1.1 where version wasn't determined correctly (Ticket #129) |
|
157 | ||
158 |
* Fixed bug preventing engines from loading when both Rails 1.1.0 and 1.1.1 gems are installed and in use. |
|
159 | ||
160 |
* Updated version (d'oh!) |
|
161 | ||
162 | ||
163 | ||
164 |
= 1.1.0 |
|
165 | ||
166 |
* Improved regexp matching for Rails 1.0 engines with peculiar paths |
|
167 | ||
168 |
* Engine instance objects can be accessed via Engines[:name], an alias for Engines.get(:name) (Ticket #99) |
|
169 | ||
170 |
* init_engine.rb is now processed as the final step in the Engine.start process, so it can access files within the lib directory, which is now in the $LOAD_PATH at that point. (Ticket #99) |
|
171 | ||
172 |
* Clarified MIT license (Ticket #98) |
|
173 | ||
174 |
* Updated Rake tasks to integrate smoothly with Rails 1.1 namespaces |
|
175 | ||
176 |
* Changed the version to "1.1.0 (svn)" |
|
177 | ||
178 |
* Added more information about using the plugin with Edge Rails to the README |
|
179 | ||
180 |
* moved extensions into lib/engines/ directory to enable use of Engines module in extension code. |
|
181 | ||
182 |
* Added conditional require_or_load method which attempts to detect the current Rails version. To use the Edge Rails version of the loading mechanism, add the line: |
|
183 | ||
184 |
* Engines.config :edge, true |
|
185 | ||
186 |
* to your environment.rb file. |
|
187 | ||
188 |
* Merged changes from /branches/edge and /branches/rb_1.0 into /trunk |
|
189 | ||
190 |
* engine_schema_info now respects the prefix/suffixes set for ActiveRecord::Base (Ticket #67) |
|
191 | ||
192 |
* added ActiveRecord::Base.wrapped_table_name(name) method to assist in determining the correct table name |
|
193 | ||
194 | ||
195 | ||
196 |
= 1.0.6 |
|
197 | ||
198 |
* Added ability to determine version information for engines: rake engine_info |
|
199 | ||
200 |
* Added a custom logger for the Engines module, to stop pollution of the Rails logs. |
|
201 | ||
202 |
* Added some more tests (in particular, see rails_engines/applications/engines_test). |
|
203 | ||
204 |
* Another attempt at solving Ticket #53 - controllers and helpers should now be loadable from modules, and if a full path (including RAILS_ROOT/ENGINES_ROOT) is given, it should be safely stripped from the require filename such that corresponding files can be located in any active engines. In other words, controller/helper overloading should now completely work, even if the controllers/helpers are in modules. |
|
205 | ||
206 |
* Added (finally) patch from Ticket #22 - ActionMailer helpers should now load |
|
207 | ||
208 |
* Removed support for Engines.start :engine, :engine_name => 'whatever'. It was pointless. |
|
209 | ||
210 |
* Fixed engine name referencing; engine_stylesheet/engine_javascript can now happily use shorthand engine names (i.e. :test == :test_engine) (Ticket #45) |
|
211 | ||
212 |
* Fixed minor documentation error ('Engine.start' ==> 'Engines.start') (Ticket #57) |
|
213 | ||
214 |
* Fixed double inclusion of RAILS_ROOT in engine_migrate rake task (Ticket #61) |
|
215 | ||
216 |
* Added ability to force config values even if given as a hash (Ticket #62) |
|
217 | ||
218 | ||
219 | ||
220 |
= 1.0.5 |
|
221 | ||
222 |
* Fixed bug stopping fixtures from loading with PostgreSQL |
|
223 | ||
224 | ||
225 | ||
226 |
= 1.0.4 |
|
227 | ||
228 |
* Another attempt at loading controllers within modules (Ticket #56) |
|
229 | ||
230 | ||
231 | ||
232 |
= 1.0.3 |
|
233 | ||
234 |
* Fixed serious dependency bug stopping controllers being loaded (Ticket #56) |
|
235 | ||
236 | ||
237 | ||
238 |
= 1.0.2 |
|
239 | ||
240 |
* Fixed bug with overloading controllers in modules from /app directory |
|
241 | ||
242 |
* Fixed exception thrown when public files couldn't be created; exception is now logged (Ticket #52) |
|
243 | ||
244 |
* Fixed problem with generated test_helper.rb file via File.expand_path (Ticket #50) |
|
245 | ||
246 | ||
247 | ||
248 |
= 1.0.1 |
|
249 | ||
250 |
* Added engine generator for creation of new engines |
|
251 | ||
252 |
* Fixed 'Engine' typo in README |
|
253 | ||
254 |
* Fixed bug in fixtures extensions |
|
255 | ||
256 |
* Fixed /lib path management bug |
|
257 | ||
258 |
* Added method to determine public directory location from Engine object |
|
259 | ||
260 |
* Fixed bug in the error message in get_engine_dir() |
|
261 | ||
262 |
* Added proper component loading |
|
263 | ||
264 |
* Added preliminary tests for the config() methods module |
|
265 | ||
266 | ||
267 | ||
268 |
= pre-v170 |
|
269 | ||
270 |
* Fixed copyright notices to point to DHH, rather than me. |
|
271 | ||
272 |
* Moved extension require statements into lib/engines.rb, so the will be loaded if another module/file calls require 'engines |
|
273 | ||
274 |
* Added a CHANGELOG file (this file) |
/dev/null | ||
---|---|---|
1 |
Copyright (c) 2008 James Adam |
|
2 | ||
3 |
The MIT License |
|
4 | ||
5 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6 |
of this software and associated documentation files (the "Software"), to deal |
|
7 |
in the Software without restriction, including without limitation the rights |
|
8 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 |
copies of the Software, and to permit persons to whom the Software is |
|
10 |
furnished to do so, subject to the following conditions: |
|
11 | ||
12 |
The above copyright notice and this permission notice shall be included in |
|
13 |
all copies or substantial portions of the Software. |
|
14 | ||
15 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
21 |
THE SOFTWARE. |
/dev/null | ||
---|---|---|
1 |
The engines plugin enhances Rails' own plugin framework, making it simple to share controllers, helpers, models, public assets, routes and migrations in plugins. |
|
2 | ||
3 |
For more information, see http://rails-engines.org |
|
4 | ||
5 |
= Using the plugin |
|
6 | ||
7 |
Once you've installed the engines plugin, you'll need to add a single line to the top of config/environment.rb: |
|
8 | ||
9 |
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') |
|
10 |
|
|
11 |
You should add this line just below the require for Rails' own boot.rb file. This will enabled the enhanced plugin loading mechanism automatically for you (i.e. you don't need to set config.plugin_loader manually). |
|
12 | ||
13 |
With that aside, you're now ready to start using more powerful plugins in your application. Read on to find out more about what the engines plugin enables. |
|
14 | ||
15 | ||
16 |
== Better plugins |
|
17 | ||
18 |
In addition to the regular set of plugin-supported files (lib, init.rb, tasks, generators, tests), plugins can carry the following when the engines plugin is also installed. |
|
19 | ||
20 | ||
21 |
=== Controllers, Helpers, and Views |
|
22 | ||
23 |
Include these files in an <tt>app</tt> directory just like you would in a normal Rails application. If you need to override a method, view or partial, create the corresponding file in your main <tt>app</tt> directory and it will be used instead. |
|
24 | ||
25 |
* Controllers & Helpers: See Engines::RailsExtensions::Dependencies for more information. |
|
26 |
* Views: now handled almost entirely by ActionView itself (see Engines::Plugin#add_plugin_view_paths for more information) |
|
27 | ||
28 |
=== Models |
|
29 | ||
30 |
Model code can similarly be placed in an <tt>app/models/</tt> directory. Unfortunately, it's not possible to automatically override methods within a model; if your application needs to change the way a model behaves, consider creating a subclass, or replacing the model entirely within your application's <tt>app/models/</tt> directory. See Engines::RailsExtensions::Dependencies for more information. |
|
31 | ||
32 |
IMPORTANT NOTE: when you load code from within plugins, it is typically not handled well by Rails in terms of unloading and reloading changes. Look here for more information - http://rails-engines.org/development/common-issues-when-overloading-code-from-plugins/ |
|
33 | ||
34 |
=== Routes |
|
35 | ||
36 |
Include your route declarations in a <tt>routes.rb</tt> file at the root of your plugins, e.g.: |
|
37 | ||
38 |
connect "/my/url", :controller => "some_controller" |
|
39 |
my_named_route "do_stuff", :controller => "blah", :action => "stuff" |
|
40 |
# etc. |
|
41 |
|
|
42 |
You can then load these files into your application by declaring their inclusion in the application's <tt>config/routes.rb</tt>: |
|
43 | ||
44 |
map.from_plugin :plugin_name |
|
45 | ||
46 |
See Engines::RailsExtensions::Routing for more information. |
|
47 |
|
|
48 |
=== Migrations |
|
49 | ||
50 |
Migrations record the changes in your database as your application evolves. With engines 1.2, migrations from plugins can also join in this evolution as first-class entities. To add migrations to a plugin, include a <tt>db/migrate/</tt> folder and add migrations there as normal. These migrations can then be integrated into the main flow of database evolution by running the plugin_migration generator: |