aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-02-23 00:53:22 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-02-23 00:53:22 +0000
commit7bf757d8b8b124e93c035bcb7ce0259c6dc659cd (patch)
tree059c4a960236a35ef0e5a63cb4a226fb8e42e3e6 /railties
parentc6d6082562b91831cefc0aa53b74c3f4c2805e64 (diff)
downloadrails-7bf757d8b8b124e93c035bcb7ce0259c6dc659cd.tar.gz
rails-7bf757d8b8b124e93c035bcb7ce0259c6dc659cd.tar.bz2
rails-7bf757d8b8b124e93c035bcb7ce0259c6dc659cd.zip
Include two default initializers as examples
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6213 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/Rakefile9
-rw-r--r--railties/configs/initializers/inflections.rb8
-rw-r--r--railties/configs/initializers/mime_types.rb3
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb4
4 files changed, 21 insertions, 3 deletions
diff --git a/railties/Rakefile b/railties/Rakefile
index 972b5941f0..2d1721a9bd 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -197,11 +197,14 @@ task :copy_configs do
cp "configs/apache.conf", "#{PKG_DESTINATION}/public/.htaccess"
- cp "environments/boot.rb", "#{PKG_DESTINATION}/config/boot.rb"
+ cp "configs/initializers/inflections.rb", "#{PKG_DESTINATION}/configs/initializers/inflections.rb"
+ cp "configs/initializers/mime_types.rb", "#{PKG_DESTINATION}/configs/initializers/mime_types.rb"
+
+ cp "environments/boot.rb", "#{PKG_DESTINATION}/config/boot.rb"
cp "environments/environment.rb", "#{PKG_DESTINATION}/config/environment.rb"
- cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
+ cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
cp "environments/development.rb", "#{PKG_DESTINATION}/config/environments/development.rb"
- cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
+ cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
end
task :copy_binfiles do
diff --git a/railties/configs/initializers/inflections.rb b/railties/configs/initializers/inflections.rb
new file mode 100644
index 0000000000..a372f170b5
--- /dev/null
+++ b/railties/configs/initializers/inflections.rb
@@ -0,0 +1,8 @@
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end \ No newline at end of file
diff --git a/railties/configs/initializers/mime_types.rb b/railties/configs/initializers/mime_types.rb
new file mode 100644
index 0000000000..43fde08ce5
--- /dev/null
+++ b/railties/configs/initializers/mime_types.rb
@@ -0,0 +1,3 @@
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register "application/x-mobile", :mobile \ No newline at end of file
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 01fff050ed..288e1cea84 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -44,6 +44,10 @@ class AppGenerator < Rails::Generator::Base
m.template "configs/routes.rb", "config/routes.rb"
m.template "configs/apache.conf", "public/.htaccess"
+ # Initializers
+ m.template "configs/initializers/inflections.rb", "config/initializers/inflections.rb"
+ m.template "configs/initializers/mime_types.rb", "configs/initializers/mime_types.rb"
+
# Environments
m.file "environments/boot.rb", "config/boot.rb"
m.template "environments/environment.rb", "config/environment.rb", :assigns => { :freeze => options[:freeze] }