rails 2.1.2 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (221) hide show
  1. data/CHANGELOG +27 -3
  2. data/Rakefile +70 -10
  3. data/bin/about +0 -0
  4. data/bin/console +0 -0
  5. data/bin/destroy +0 -0
  6. data/bin/generate +0 -0
  7. data/bin/performance/benchmarker +0 -0
  8. data/bin/performance/profiler +0 -0
  9. data/bin/performance/request +0 -0
  10. data/bin/plugin +0 -0
  11. data/bin/process/inspector +0 -0
  12. data/bin/process/reaper +0 -0
  13. data/bin/process/spawner +0 -0
  14. data/bin/runner +0 -0
  15. data/bin/server +0 -0
  16. data/config.ru +17 -0
  17. data/configs/apache.conf +0 -0
  18. data/configs/databases/ibm_db.yml +62 -0
  19. data/configs/databases/mysql.yml +3 -0
  20. data/configs/databases/postgresql.yml +3 -0
  21. data/configs/databases/sqlite2.yml +3 -0
  22. data/configs/databases/sqlite3.yml +3 -0
  23. data/configs/locales/en.yml +5 -0
  24. data/dispatches/dispatch.fcgi +1 -1
  25. data/dispatches/dispatch.rb +2 -2
  26. data/dispatches/gateway.cgi +2 -2
  27. data/doc/README_FOR_APP +5 -2
  28. data/doc/guides/html/2_2_release_notes.html +1185 -0
  29. data/doc/guides/html/actioncontroller_basics.html +1270 -0
  30. data/doc/guides/html/activerecord_validations_callbacks.html +749 -0
  31. data/doc/guides/html/association_basics.html +2585 -0
  32. data/doc/guides/html/authors.html +240 -0
  33. data/doc/guides/html/benchmarking_and_profiling.html +1018 -0
  34. data/doc/guides/html/caching_with_rails.html +583 -0
  35. data/doc/guides/html/command_line.html +434 -0
  36. data/doc/guides/html/configuring.html +438 -0
  37. data/doc/guides/html/creating_plugins.html +1594 -0
  38. data/doc/guides/html/debugging_rails_applications.html +1175 -0
  39. data/doc/guides/html/finders.html +1090 -0
  40. data/doc/guides/html/form_helpers.html +638 -0
  41. data/doc/guides/html/getting_started_with_rails.html +2066 -0
  42. data/doc/guides/html/index.html +349 -0
  43. data/doc/guides/html/layouts_and_rendering.html +1406 -0
  44. data/doc/guides/html/migrations.html +921 -0
  45. data/doc/guides/html/routing_outside_in.html +2213 -0
  46. data/doc/guides/html/security.html +1346 -0
  47. data/doc/guides/html/testing_rails_applications.html +1859 -0
  48. data/doc/guides/source/2_2_release_notes.txt +435 -0
  49. data/doc/guides/source/actioncontroller_basics/changelog.txt +5 -0
  50. data/doc/guides/source/actioncontroller_basics/cookies.txt +34 -0
  51. data/doc/guides/source/actioncontroller_basics/csrf.txt +32 -0
  52. data/doc/guides/source/actioncontroller_basics/filters.txt +119 -0
  53. data/doc/guides/source/actioncontroller_basics/http_auth.txt +24 -0
  54. data/doc/guides/source/actioncontroller_basics/index.txt +40 -0
  55. data/doc/guides/source/actioncontroller_basics/introduction.txt +9 -0
  56. data/doc/guides/source/actioncontroller_basics/methods.txt +39 -0
  57. data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +14 -0
  58. data/doc/guides/source/actioncontroller_basics/params.txt +93 -0
  59. data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +43 -0
  60. data/doc/guides/source/actioncontroller_basics/rescue.txt +67 -0
  61. data/doc/guides/source/actioncontroller_basics/session.txt +187 -0
  62. data/doc/guides/source/actioncontroller_basics/streaming.txt +91 -0
  63. data/doc/guides/source/actioncontroller_basics/verification.txt +40 -0
  64. data/doc/guides/source/active_record_basics.txt +181 -0
  65. data/doc/guides/source/activerecord_validations_callbacks.txt +404 -0
  66. data/doc/guides/source/association_basics.txt +1840 -0
  67. data/doc/guides/source/authors.txt +39 -0
  68. data/doc/guides/source/benchmarking_and_profiling/appendix.txt +95 -0
  69. data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +105 -0
  70. data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +185 -0
  71. data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +27 -0
  72. data/doc/guides/source/benchmarking_and_profiling/index.txt +242 -0
  73. data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +179 -0
  74. data/doc/guides/source/benchmarking_and_profiling/statistics.txt +57 -0
  75. data/doc/guides/source/caching_with_rails.txt +367 -0
  76. data/doc/guides/source/command_line.txt +147 -0
  77. data/doc/guides/source/configuring.txt +225 -0
  78. data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +191 -0
  79. data/doc/guides/source/creating_plugins/appendix.txt +46 -0
  80. data/doc/guides/source/creating_plugins/controllers.txt +59 -0
  81. data/doc/guides/source/creating_plugins/core_ext.txt +123 -0
  82. data/doc/guides/source/creating_plugins/custom_route.txt +69 -0
  83. data/doc/guides/source/creating_plugins/gem.txt +1 -0
  84. data/doc/guides/source/creating_plugins/generator_method.txt +89 -0
  85. data/doc/guides/source/creating_plugins/helpers.txt +51 -0
  86. data/doc/guides/source/creating_plugins/index.txt +52 -0
  87. data/doc/guides/source/creating_plugins/migration_generator.txt +156 -0
  88. data/doc/guides/source/creating_plugins/models.txt +76 -0
  89. data/doc/guides/source/creating_plugins/odds_and_ends.txt +69 -0
  90. data/doc/guides/source/creating_plugins/test_setup.txt +230 -0
  91. data/doc/guides/source/debugging_rails_applications.txt +733 -0
  92. data/doc/guides/source/finders.txt +668 -0
  93. data/doc/guides/source/form_helpers.txt +345 -0
  94. data/doc/guides/source/getting_started_with_rails.txt +1256 -0
  95. data/doc/guides/source/images/belongs_to.png +0 -0
  96. data/doc/guides/source/images/bullet.gif +0 -0
  97. data/doc/guides/source/images/csrf.png +0 -0
  98. data/doc/guides/source/images/habtm.png +0 -0
  99. data/doc/guides/source/images/has_many.png +0 -0
  100. data/doc/guides/source/images/has_many_through.png +0 -0
  101. data/doc/guides/source/images/has_one.png +0 -0
  102. data/doc/guides/source/images/has_one_through.png +0 -0
  103. data/doc/guides/source/images/header_backdrop.png +0 -0
  104. data/doc/guides/source/images/icons/README +5 -0
  105. data/doc/guides/source/images/icons/callouts/1.png +0 -0
  106. data/doc/guides/source/images/icons/callouts/10.png +0 -0
  107. data/doc/guides/source/images/icons/callouts/11.png +0 -0
  108. data/doc/guides/source/images/icons/callouts/12.png +0 -0
  109. data/doc/guides/source/images/icons/callouts/13.png +0 -0
  110. data/doc/guides/source/images/icons/callouts/14.png +0 -0
  111. data/doc/guides/source/images/icons/callouts/15.png +0 -0
  112. data/doc/guides/source/images/icons/callouts/2.png +0 -0
  113. data/doc/guides/source/images/icons/callouts/3.png +0 -0
  114. data/doc/guides/source/images/icons/callouts/4.png +0 -0
  115. data/doc/guides/source/images/icons/callouts/5.png +0 -0
  116. data/doc/guides/source/images/icons/callouts/6.png +0 -0
  117. data/doc/guides/source/images/icons/callouts/7.png +0 -0
  118. data/doc/guides/source/images/icons/callouts/8.png +0 -0
  119. data/doc/guides/source/images/icons/callouts/9.png +0 -0
  120. data/doc/guides/source/images/icons/caution.png +0 -0
  121. data/doc/guides/source/images/icons/example.png +0 -0
  122. data/doc/guides/source/images/icons/home.png +0 -0
  123. data/doc/guides/source/images/icons/important.png +0 -0
  124. data/doc/guides/source/images/icons/next.png +0 -0
  125. data/doc/guides/source/images/icons/note.png +0 -0
  126. data/doc/guides/source/images/icons/prev.png +0 -0
  127. data/doc/guides/source/images/icons/tip.png +0 -0
  128. data/doc/guides/source/images/icons/up.png +0 -0
  129. data/doc/guides/source/images/icons/warning.png +0 -0
  130. data/doc/guides/source/images/polymorphic.png +0 -0
  131. data/doc/guides/source/images/rails_logo_remix.gif +0 -0
  132. data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
  133. data/doc/guides/source/images/session_fixation.png +0 -0
  134. data/doc/guides/source/index.txt +118 -0
  135. data/doc/guides/source/layouts_and_rendering.txt +982 -0
  136. data/doc/guides/source/migrations/anatomy_of_a_migration.txt +85 -0
  137. data/doc/guides/source/migrations/changelog.txt +5 -0
  138. data/doc/guides/source/migrations/creating_a_migration.txt +109 -0
  139. data/doc/guides/source/migrations/foreign_keys.txt +8 -0
  140. data/doc/guides/source/migrations/index.txt +22 -0
  141. data/doc/guides/source/migrations/rakeing_around.txt +111 -0
  142. data/doc/guides/source/migrations/scheming.txt +47 -0
  143. data/doc/guides/source/migrations/using_models_in_migrations.txt +46 -0
  144. data/doc/guides/source/migrations/writing_a_migration.txt +159 -0
  145. data/doc/guides/source/routing_outside_in.txt +986 -0
  146. data/doc/guides/source/security.txt +984 -0
  147. data/doc/guides/source/stylesheets/base.css +358 -0
  148. data/doc/guides/source/stylesheets/forms.css +35 -0
  149. data/doc/guides/source/stylesheets/more.css +82 -0
  150. data/doc/guides/source/templates/guides.html.erb +97 -0
  151. data/doc/guides/source/templates/inline.css +165 -0
  152. data/doc/guides/source/testing_rails_applications.txt +995 -0
  153. data/environments/boot.rb +2 -2
  154. data/environments/environment.rb +9 -1
  155. data/environments/production.rb +3 -1
  156. data/helpers/performance_test.rb +9 -0
  157. data/html/500.html +4 -1
  158. data/html/javascripts/controls.js +72 -72
  159. data/html/javascripts/dragdrop.js +165 -164
  160. data/html/javascripts/effects.js +173 -165
  161. data/html/javascripts/prototype.js +362 -267
  162. data/lib/commands/console.rb +13 -0
  163. data/lib/commands/dbconsole.rb +2 -2
  164. data/lib/commands/ncgi/listener +2 -2
  165. data/lib/commands/ncgi/tracker +2 -2
  166. data/lib/commands/plugin.rb +41 -24
  167. data/lib/commands/process/spawner.rb +4 -4
  168. data/lib/commands/runner.rb +1 -1
  169. data/lib/commands/server.rb +11 -1
  170. data/lib/commands/servers/thin.rb +25 -0
  171. data/lib/fcgi_handler.rb +1 -3
  172. data/lib/initializer.rb +162 -39
  173. data/lib/performance_test_help.rb +5 -0
  174. data/lib/rails/gem_builder.rb +3 -3
  175. data/lib/rails/gem_dependency.rb +155 -33
  176. data/lib/rails/mongrel_server/commands.rb +1 -1
  177. data/lib/rails/plugin.rb +10 -2
  178. data/lib/rails/rack.rb +6 -0
  179. data/lib/rails/rack/logger.rb +28 -0
  180. data/lib/rails/rack/static.rb +35 -0
  181. data/lib/rails/vendor_gem_source_index.rb +140 -0
  182. data/lib/rails/version.rb +1 -1
  183. data/lib/rails_generator/commands.rb +10 -16
  184. data/lib/rails_generator/generated_attribute.rb +4 -0
  185. data/lib/rails_generator/generators/applications/app/app_generator.rb +9 -3
  186. data/lib/rails_generator/generators/components/controller/controller_generator.rb +1 -1
  187. data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +1 -1
  188. data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +1 -1
  189. data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +2 -2
  190. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +1 -1
  191. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +2 -3
  192. data/lib/rails_generator/generators/components/model/model_generator.rb +1 -1
  193. data/lib/rails_generator/generators/components/model/templates/model.rb +3 -0
  194. data/lib/rails_generator/generators/components/model/templates/unit_test.rb +1 -1
  195. data/lib/rails_generator/generators/components/observer/observer_generator.rb +1 -1
  196. data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +1 -1
  197. data/lib/rails_generator/generators/components/performance_test/USAGE +8 -0
  198. data/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb +16 -0
  199. data/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb +9 -0
  200. data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +11 -11
  201. data/lib/rails_generator/generators/components/plugin/templates/Rakefile +1 -0
  202. data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +3 -0
  203. data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +4 -4
  204. data/lib/rails_generator/generators/components/resource/resource_generator.rb +2 -2
  205. data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +1 -1
  206. data/lib/rails_generator/generators/components/scaffold/USAGE +9 -5
  207. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +10 -3
  208. data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +7 -7
  209. data/lib/rails_generator/scripts.rb +1 -1
  210. data/lib/rails_generator/scripts/destroy.rb +6 -7
  211. data/lib/rails_generator/secret_key_generator.rb +5 -147
  212. data/lib/tasks/annotations.rake +8 -11
  213. data/lib/tasks/databases.rake +42 -15
  214. data/lib/tasks/documentation.rake +15 -0
  215. data/lib/tasks/framework.rake +5 -1
  216. data/lib/tasks/gems.rake +24 -8
  217. data/lib/tasks/misc.rake +3 -4
  218. data/lib/tasks/testing.rake +25 -4
  219. data/lib/test_help.rb +1 -2
  220. data/lib/webrick_server.rb +2 -11
  221. metadata +165 -9
@@ -1,11 +1,13 @@
1
1
  irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
2
2
 
3
3
  require 'optparse'
4
+
4
5
  options = { :sandbox => false, :irb => irb }
5
6
  OptionParser.new do |opt|
6
7
  opt.banner = "Usage: console [environment] [options]"
7
8
  opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
8
9
  opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
10
+ opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
9
11
  opt.parse!(ARGV)
10
12
  end
11
13
 
@@ -15,6 +17,17 @@ libs << " -r console_app"
15
17
  libs << " -r console_sandbox" if options[:sandbox]
16
18
  libs << " -r console_with_helpers"
17
19
 
20
+ if options[:debugger]
21
+ begin
22
+ require 'ruby-debug'
23
+ libs << " -r ruby-debug"
24
+ puts "=> Debugger enabled"
25
+ rescue Exception
26
+ puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'"
27
+ exit
28
+ end
29
+ end
30
+
18
31
  ENV['RAILS_ENV'] = case ARGV.first
19
32
  when "p"; "production"
20
33
  when "d"; "development"
@@ -6,7 +6,7 @@ include_password = false
6
6
 
7
7
  OptionParser.new do |opt|
8
8
  opt.banner = "Usage: dbconsole [options] [environment]"
9
- opt.on("-p", "--include-password", "Automatically provide the database from database.yml") do |v|
9
+ opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v|
10
10
  include_password = true
11
11
  end
12
12
  opt.parse!(ARGV)
@@ -47,7 +47,7 @@ when "mysql"
47
47
 
48
48
  args << config['database']
49
49
 
50
- exec(find_cmd('mysql5', 'mysql'), *args)
50
+ exec(find_cmd('mysql', 'mysql5'), *args)
51
51
 
52
52
  when "postgresql"
53
53
  ENV['PGUSER'] = config["username"] if config["username"]
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'stringio'
4
4
  require 'fileutils'
@@ -83,4 +83,4 @@ end
83
83
  socket_path = ARGV.shift
84
84
  timeout = (ARGV.shift || 90).to_i
85
85
 
86
- Listener.new(timeout, socket_path)
86
+ Listener.new(timeout, socket_path)
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'drb'
4
4
  require 'thread'
@@ -66,4 +66,4 @@ end
66
66
  socket_path = ARGV.shift
67
67
  instances = ARGV.shift.to_i
68
68
  t = Tracker.new(instances, socket_path)
69
- t.background(ARGV.first ? ARGV.shift.to_i : 90)
69
+ t.background(ARGV.first ? ARGV.shift.to_i : 90)
@@ -43,6 +43,16 @@
43
43
  # plugin is pulled via `svn checkout` or `svn export` but looks
44
44
  # exactly the same.
45
45
  #
46
+ # Specifying revisions:
47
+ #
48
+ # * Subversion revision is a single integer.
49
+ #
50
+ # * Git revision format:
51
+ # - full - 'refs/tags/1.8.0' or 'refs/heads/experimental'
52
+ # - short: 'experimental' (equivalent to 'refs/heads/experimental')
53
+ # 'tag 1.8.0' (equivalent to 'refs/tags/1.8.0')
54
+ #
55
+ #
46
56
  # This is Free Software, copyright 2005 by Ryan Tomayko (rtomayko@gmail.com)
47
57
  # and is licensed MIT: (http://www.opensource.org/licenses/mit-license.php)
48
58
 
@@ -175,7 +185,7 @@ class Plugin
175
185
  method ||= rails_env.best_install_method?
176
186
  if :http == method
177
187
  method = :export if svn_url?
178
- method = :clone if git_url?
188
+ method = :git if git_url?
179
189
  end
180
190
 
181
191
  uninstall if installed? and options[:force]
@@ -255,8 +265,25 @@ class Plugin
255
265
  end
256
266
  end
257
267
 
258
- def install_using_clone(options = {})
259
- git_command :clone, options
268
+ def install_using_git(options = {})
269
+ root = rails_env.root
270
+ install_path = mkdir_p "#{root}/vendor/plugins/#{name}"
271
+ Dir.chdir install_path do
272
+ init_cmd = "git init"
273
+ init_cmd += " -q" if options[:quiet] and not $verbose
274
+ puts init_cmd if $verbose
275
+ system(init_cmd)
276
+ base_cmd = "git pull --depth 1 #{uri}"
277
+ base_cmd += " -q" if options[:quiet] and not $verbose
278
+ base_cmd += " #{options[:revision]}" if options[:revision]
279
+ puts base_cmd if $verbose
280
+ if system(base_cmd)
281
+ puts "removing: .git" if $verbose
282
+ rm_rf ".git"
283
+ else
284
+ rm_rf install_path
285
+ end
286
+ end
260
287
  end
261
288
 
262
289
  def svn_command(cmd, options = {})
@@ -268,16 +295,6 @@ class Plugin
268
295
  puts base_cmd if $verbose
269
296
  system(base_cmd)
270
297
  end
271
-
272
- def git_command(cmd, options = {})
273
- root = rails_env.root
274
- mkdir_p "#{root}/vendor/plugins"
275
- base_cmd = "git #{cmd} --depth 1 #{uri} \"#{root}/vendor/plugins/#{name}\""
276
- puts base_cmd if $verbose
277
- puts "removing: #{root}/vendor/plugins/#{name}/.git"
278
- system(base_cmd)
279
- rm_rf "#{root}/vendor/plugins/#{name}/.git"
280
- end
281
298
 
282
299
  def guess_name(url)
283
300
  @name = File.basename(url)
@@ -444,11 +461,11 @@ module Commands
444
461
 
445
462
  o.on("-r", "--root=DIR", String,
446
463
  "Set an explicit rails app directory.",
447
- "Default: #{@rails_root}") { |@rails_root| self.environment = RailsEnvironment.new(@rails_root) }
464
+ "Default: #{@rails_root}") { |rails_root| @rails_root = rails_root; self.environment = RailsEnvironment.new(@rails_root) }
448
465
  o.on("-s", "--source=URL1,URL2", Array,
449
- "Use the specified plugin repositories instead of the defaults.") { |@sources|}
466
+ "Use the specified plugin repositories instead of the defaults.") { |sources| @sources = sources}
450
467
 
451
- o.on("-v", "--verbose", "Turn on verbose output.") { |$verbose| }
468
+ o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose }
452
469
  o.on("-h", "--help", "Show this help message.") { puts o; exit }
453
470
 
454
471
  o.separator ""
@@ -535,12 +552,12 @@ module Commands
535
552
  o.separator "Options:"
536
553
  o.separator ""
537
554
  o.on( "-s", "--source=URL1,URL2", Array,
538
- "Use the specified plugin repositories.") {|@sources|}
555
+ "Use the specified plugin repositories.") {|sources| @sources = sources}
539
556
  o.on( "--local",
540
- "List locally installed plugins.") {|@local| @remote = false}
557
+ "List locally installed plugins.") {|local| @local, @remote = local, false}
541
558
  o.on( "--remote",
542
559
  "List remotely available plugins. This is the default behavior",
543
- "unless --local is provided.") {|@remote|}
560
+ "unless --local is provided.") {|remote| @remote = remote}
544
561
  end
545
562
  end
546
563
 
@@ -581,7 +598,7 @@ module Commands
581
598
  o.separator "Options:"
582
599
  o.separator ""
583
600
  o.on( "-c", "--check",
584
- "Report status of repository.") { |@sources|}
601
+ "Report status of repository.") { |sources| @sources = sources}
585
602
  end
586
603
  end
587
604
 
@@ -672,7 +689,7 @@ module Commands
672
689
  o.separator "Options:"
673
690
  o.separator ""
674
691
  o.on( "-l", "--list",
675
- "List but don't prompt or add discovered repositories.") { |@list| @prompt = !@list }
692
+ "List but don't prompt or add discovered repositories.") { |list| @list, @prompt = list, !@list }
676
693
  o.on( "-n", "--no-prompt",
677
694
  "Add all new repositories without prompting.") { |v| @prompt = !v }
678
695
  end
@@ -756,8 +773,8 @@ module Commands
756
773
  "Suppresses the output from installation.",
757
774
  "Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true }
758
775
  o.on( "-r REVISION", "--revision REVISION",
759
- "Checks out the given revision from subversion.",
760
- "Ignored if subversion is not used.") { |v| @options[:revision] = v }
776
+ "Checks out the given revision from subversion or git.",
777
+ "Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
761
778
  o.on( "-f", "--force",
762
779
  "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
763
780
  o.separator ""
@@ -884,7 +901,7 @@ class RecursiveHTTPFetcher
884
901
  def initialize(urls_to_fetch, level = 1, cwd = ".")
885
902
  @level = level
886
903
  @cwd = cwd
887
- @urls_to_fetch = urls_to_fetch.to_a
904
+ @urls_to_fetch = RUBY_VERSION >= '1.9' ? urls_to_fetch.lines : urls_to_fetch.to_a
888
905
  @quiet = false
889
906
  end
890
907
 
@@ -66,9 +66,9 @@ class MongrelSpawner < Spawner
66
66
  "-l #{OPTIONS[:rails_root]}/log/mongrel.log"
67
67
 
68
68
  # Add prefix functionality to spawner's call to mongrel_rails
69
- # Digging through monrel's project subversion server, the earliest
69
+ # Digging through mongrel's project subversion server, the earliest
70
70
  # Tag that has prefix implemented in the bin/mongrel_rails file
71
- # is 0.3.15 which also happens to be the earilest tag listed.
71
+ # is 0.3.15 which also happens to be the earliest tag listed.
72
72
  # References: http://mongrel.rubyforge.org/svn/tags
73
73
  if Mongrel::Const::MONGREL_VERSION.to_f >=0.3 && !OPTIONS[:prefix].nil?
74
74
  cmd = cmd + " --prefix #{OPTIONS[:prefix]}"
@@ -181,10 +181,10 @@ ARGV.options do |opts|
181
181
 
182
182
  opts.on(" Options:")
183
183
 
184
- opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |OPTIONS[:port]| }
184
+ opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v }
185
185
 
186
186
  if spawner_class.can_bind_to_custom_address?
187
- opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |OPTIONS[:address]| }
187
+ opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |v| OPTIONS[:address] = v }
188
188
  end
189
189
 
190
190
  opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v }
@@ -42,7 +42,7 @@ if code_or_file.nil?
42
42
  $stderr.puts "Run '#{$0} -h' for help."
43
43
  exit 1
44
44
  elsif File.exist?(code_or_file)
45
- eval(File.read(code_or_file))
45
+ eval(File.read(code_or_file), nil, code_or_file)
46
46
  else
47
47
  eval(code_or_file)
48
48
  end
@@ -13,12 +13,20 @@ rescue Exception
13
13
  # Mongrel not available
14
14
  end
15
15
 
16
+ begin
17
+ require_library_or_gem 'thin'
18
+ rescue Exception
19
+ # Thin not available
20
+ end
21
+
16
22
  server = case ARGV.first
17
- when "lighttpd", "mongrel", "new_mongrel", "webrick"
23
+ when "lighttpd", "mongrel", "new_mongrel", "webrick", "thin"
18
24
  ARGV.shift
19
25
  else
20
26
  if defined?(Mongrel)
21
27
  "mongrel"
28
+ elsif defined?(Thin)
29
+ "thin"
22
30
  elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
23
31
  "lighttpd"
24
32
  else
@@ -33,6 +41,8 @@ case server
33
41
  puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
34
42
  when "mongrel", "new_mongrel"
35
43
  puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)"
44
+ when "thin"
45
+ puts "=> Booting Thin (use 'script/server webrick' to force WEBrick)"
36
46
  end
37
47
 
38
48
  %w(cache pids sessions sockets).each { |dir_to_make| FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) }
@@ -0,0 +1,25 @@
1
+ require 'rbconfig'
2
+ require 'commands/servers/base'
3
+ require 'thin'
4
+
5
+
6
+ options = ARGV.clone
7
+ options.insert(0,'start') unless Thin::Runner.commands.include?(options[0])
8
+
9
+ thin = Thin::Runner.new(options)
10
+
11
+ puts "=> Rails #{Rails.version} application starting on http://#{thin.options[:address]}:#{thin.options[:port]}"
12
+ puts "=> Ctrl-C to shutdown server"
13
+
14
+ log = Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath
15
+ open(log, (File::WRONLY | File::APPEND | File::CREAT)) unless File.exist? log
16
+ tail_thread = tail(log)
17
+ trap(:INT) { exit }
18
+
19
+ begin
20
+ thin.run!
21
+ ensure
22
+ tail_thread.kill if tail_thread
23
+ puts 'Exiting'
24
+ end
25
+
@@ -18,7 +18,6 @@ class RailsFCGIHandler
18
18
  attr_accessor :log_file_path
19
19
  attr_accessor :gc_request_period
20
20
 
21
-
22
21
  # Initialize and run the FastCGI instance, passing arguments through to new.
23
22
  def self.process!(*args, &block)
24
23
  new(*args, &block).process!
@@ -68,7 +67,6 @@ class RailsFCGIHandler
68
67
  end
69
68
  end
70
69
 
71
-
72
70
  protected
73
71
  def process_each_request(provider)
74
72
  cgi = nil
@@ -197,7 +195,7 @@ class RailsFCGIHandler
197
195
  # close resources as they won't be closed by
198
196
  # the OS when using exec
199
197
  logger.close rescue nil
200
- RAILS_DEFAULT_LOGGER.close rescue nil
198
+ Rails.logger.close rescue nil
201
199
 
202
200
  exec(command_line)
203
201
  end
@@ -8,6 +8,7 @@ require 'rails/version'
8
8
  require 'rails/plugin/locator'
9
9
  require 'rails/plugin/loader'
10
10
  require 'rails/gem_dependency'
11
+ require 'rails/rack'
11
12
 
12
13
 
13
14
  RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
@@ -18,15 +19,27 @@ module Rails
18
19
  def configuration
19
20
  @@configuration
20
21
  end
21
-
22
+
22
23
  def configuration=(configuration)
23
24
  @@configuration = configuration
24
25
  end
25
-
26
+
27
+ def initialized?
28
+ @initialized || false
29
+ end
30
+
31
+ def initialized=(initialized)
32
+ @initialized ||= initialized
33
+ end
34
+
26
35
  def logger
27
- RAILS_DEFAULT_LOGGER
36
+ if defined?(RAILS_DEFAULT_LOGGER)
37
+ RAILS_DEFAULT_LOGGER
38
+ else
39
+ nil
40
+ end
28
41
  end
29
-
42
+
30
43
  def root
31
44
  if defined?(RAILS_ROOT)
32
45
  RAILS_ROOT
@@ -34,12 +47,14 @@ module Rails
34
47
  nil
35
48
  end
36
49
  end
37
-
50
+
38
51
  def env
39
- require 'active_support/string_inquirer'
40
- ActiveSupport::StringInquirer.new(RAILS_ENV)
52
+ @_env ||= begin
53
+ require 'active_support/string_inquirer'
54
+ ActiveSupport::StringInquirer.new(RAILS_ENV)
55
+ end
41
56
  end
42
-
57
+
43
58
  def cache
44
59
  RAILS_CACHE
45
60
  end
@@ -56,7 +71,7 @@ module Rails
56
71
  @@public_path = path
57
72
  end
58
73
  end
59
-
74
+
60
75
  # The Initializer is responsible for processing the Rails configuration, such
61
76
  # as setting the $LOAD_PATH, requiring the right frameworks, initializing
62
77
  # logging, and more. It can be run either as a single command that'll just
@@ -90,7 +105,7 @@ module Rails
90
105
  # Rails::Initializer.run(:set_load_path)
91
106
  #
92
107
  # This is useful if you only want the load path initialized, without
93
- # incuring the overhead of completely loading the entire environment.
108
+ # incurring the overhead of completely loading the entire environment.
94
109
  def self.run(command = :process, configuration = Configuration.new)
95
110
  yield configuration if block_given?
96
111
  initializer = new configuration
@@ -129,12 +144,15 @@ module Rails
129
144
  initialize_logger
130
145
  initialize_framework_logging
131
146
 
132
- initialize_framework_views
133
147
  initialize_dependency_mechanism
134
148
  initialize_whiny_nils
135
149
  initialize_temporary_session_directory
150
+
136
151
  initialize_time_zone
152
+ initialize_i18n
153
+
137
154
  initialize_framework_settings
155
+ initialize_framework_views
138
156
 
139
157
  add_support_load_paths
140
158
 
@@ -145,7 +163,7 @@ module Rails
145
163
  add_gem_load_paths
146
164
  load_gems
147
165
  check_gem_dependencies
148
-
166
+
149
167
  load_application_initializers
150
168
 
151
169
  # the framework is now fully initialized
@@ -158,8 +176,19 @@ module Rails
158
176
  initialize_routing
159
177
 
160
178
  # Observers are loaded after plugins in case Observers or observed models are modified by plugins.
161
-
162
179
  load_observers
180
+
181
+ # Load view path cache
182
+ load_view_paths
183
+
184
+ # Load application classes
185
+ load_application_classes
186
+
187
+ # Disable dependency loading during request cycle
188
+ disable_dependency_loading
189
+
190
+ # Flag initialized
191
+ Rails.initialized = true
163
192
  end
164
193
 
165
194
  # Check for valid Ruby version
@@ -188,6 +217,7 @@ module Rails
188
217
  Gem.loaded_specs[stub] = Gem::Specification.new do |s|
189
218
  s.name = stub
190
219
  s.version = Rails::VERSION::STRING
220
+ s.loaded_from = ""
191
221
  end
192
222
  end
193
223
  end
@@ -240,6 +270,7 @@ module Rails
240
270
  end
241
271
 
242
272
  def add_gem_load_paths
273
+ Rails::GemDependency.add_frozen_gem_path
243
274
  unless @configuration.gems.empty?
244
275
  require "rubygems"
245
276
  @configuration.gems.each { |gem| gem.add_load_paths }
@@ -302,12 +333,12 @@ Run `rake gems:install` to install the missing gems.
302
333
  silence_warnings do
303
334
  return if @environment_loaded
304
335
  @environment_loaded = true
305
-
336
+
306
337
  config = configuration
307
338
  constants = self.class.constants
308
-
339
+
309
340
  eval(IO.read(configuration.environment_path), binding, configuration.environment_path)
310
-
341
+
311
342
  (self.class.constants - constants).each do |const|
312
343
  Object.const_set(const, self.class.const_get(const))
313
344
  end
@@ -320,6 +351,26 @@ Run `rake gems:install` to install the missing gems.
320
351
  end
321
352
  end
322
353
 
354
+ def load_view_paths
355
+ if configuration.frameworks.include?(:action_view)
356
+ ActionView::PathSet::Path.eager_load_templates! if configuration.cache_classes
357
+ ActionController::Base.view_paths.load if configuration.frameworks.include?(:action_controller)
358
+ ActionMailer::Base.template_root.load if configuration.frameworks.include?(:action_mailer)
359
+ end
360
+ end
361
+
362
+ # Eager load application classes
363
+ def load_application_classes
364
+ if configuration.cache_classes
365
+ configuration.eager_load_paths.each do |load_path|
366
+ matcher = /\A#{Regexp.escape(load_path)}(.*)\.rb\Z/
367
+ Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
368
+ require_dependency file.sub(matcher, '\1')
369
+ end
370
+ end
371
+ end
372
+ end
373
+
323
374
  # For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
324
375
  # multibyte safe operations. Plugin authors supporting other encodings
325
376
  # should override this behaviour and set the relevant +default_charset+
@@ -364,7 +415,7 @@ Run `rake gems:install` to install the missing gems.
364
415
  # +STDERR+, with a log level of +WARN+.
365
416
  def initialize_logger
366
417
  # if the environment has explicitly defined a logger, use it
367
- return if defined?(RAILS_DEFAULT_LOGGER)
418
+ return if Rails.logger
368
419
 
369
420
  unless logger = configuration.logger
370
421
  begin
@@ -372,7 +423,6 @@ Run `rake gems:install` to install the missing gems.
372
423
  logger.level = ActiveSupport::BufferedLogger.const_get(configuration.log_level.to_s.upcase)
373
424
  if configuration.environment == "production"
374
425
  logger.auto_flushing = false
375
- logger.set_non_blocking_io
376
426
  end
377
427
  rescue StandardError => e
378
428
  logger = ActiveSupport::BufferedLogger.new(STDERR)
@@ -393,10 +443,11 @@ Run `rake gems:install` to install the missing gems.
393
443
  # RAILS_DEFAULT_LOGGER.
394
444
  def initialize_framework_logging
395
445
  for framework in ([ :active_record, :action_controller, :action_mailer ] & configuration.frameworks)
396
- framework.to_s.camelize.constantize.const_get("Base").logger ||= RAILS_DEFAULT_LOGGER
446
+ framework.to_s.camelize.constantize.const_get("Base").logger ||= Rails.logger
397
447
  end
398
-
399
- RAILS_CACHE.logger ||= RAILS_DEFAULT_LOGGER
448
+
449
+ ActiveSupport::Dependencies.logger ||= Rails.logger
450
+ Rails.cache.logger ||= Rails.logger
400
451
  end
401
452
 
402
453
  # Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
@@ -404,8 +455,11 @@ Run `rake gems:install` to install the missing gems.
404
455
  # paths have already been set, it is not changed, otherwise it is
405
456
  # set to use Configuration#view_path.
406
457
  def initialize_framework_views
407
- ActionMailer::Base.template_root ||= configuration.view_path if configuration.frameworks.include?(:action_mailer)
408
- ActionController::Base.view_paths = [configuration.view_path] if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.empty?
458
+ if configuration.frameworks.include?(:action_view)
459
+ view_path = ActionView::PathSet::Path.new(configuration.view_path, false)
460
+ ActionMailer::Base.template_root ||= view_path if configuration.frameworks.include?(:action_mailer)
461
+ ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.empty?
462
+ end
409
463
  end
410
464
 
411
465
  # If Action Controller is not one of the loaded frameworks (Configuration#frameworks)
@@ -441,7 +495,7 @@ Run `rake gems:install` to install the missing gems.
441
495
  # If assigned value cannot be matched to a TimeZone, an exception will be raised.
442
496
  def initialize_time_zone
443
497
  if configuration.time_zone
444
- zone_default = Time.send!(:get_zone, configuration.time_zone)
498
+ zone_default = Time.__send__(:get_zone, configuration.time_zone)
445
499
  unless zone_default
446
500
  raise %{Value assigned to config.time_zone not recognized. Run "rake -D time" for a list of tasks for finding appropriate time zone names.}
447
501
  end
@@ -453,6 +507,18 @@ Run `rake gems:install` to install the missing gems.
453
507
  end
454
508
  end
455
509
 
510
+ # Set the i18n configuration from config.i18n but special-case for the load_path which should be
511
+ # appended to what's already set instead of overwritten.
512
+ def initialize_i18n
513
+ configuration.i18n.each do |setting, value|
514
+ if setting == :load_path
515
+ I18n.load_path += value
516
+ else
517
+ I18n.send("#{setting}=", value)
518
+ end
519
+ end
520
+ end
521
+
456
522
  # Initializes framework-specific settings for each of the loaded frameworks
457
523
  # (Configuration#frameworks). The available settings map to the accessors
458
524
  # on each of the corresponding Base classes.
@@ -490,9 +556,14 @@ Run `rake gems:install` to install the missing gems.
490
556
  return unless configuration.frameworks.include?(:action_controller)
491
557
  require 'dispatcher' unless defined?(::Dispatcher)
492
558
  Dispatcher.define_dispatcher_callbacks(configuration.cache_classes)
493
- Dispatcher.new(RAILS_DEFAULT_LOGGER).send :run_callbacks, :prepare_dispatch
559
+ Dispatcher.new(Rails.logger).send :run_callbacks, :prepare_dispatch
494
560
  end
495
561
 
562
+ def disable_dependency_loading
563
+ if configuration.cache_classes && !configuration.dependency_loading
564
+ ActiveSupport::Dependencies.unhook!
565
+ end
566
+ end
496
567
  end
497
568
 
498
569
  # The Configuration class holds all the parameters for the Initializer and
@@ -520,7 +591,7 @@ Run `rake gems:install` to install the missing gems.
520
591
  # A stub for setting options on ActiveRecord::Base.
521
592
  attr_accessor :active_record
522
593
 
523
- # A stub for setting options on ActiveRecord::Base.
594
+ # A stub for setting options on ActiveResource::Base.
524
595
  attr_accessor :active_resource
525
596
 
526
597
  # A stub for setting options on ActiveSupport.
@@ -537,7 +608,7 @@ Run `rake gems:install` to install the missing gems.
537
608
  # The path to the database configuration file to use. (Defaults to
538
609
  # <tt>config/database.yml</tt>.)
539
610
  attr_accessor :database_configuration_file
540
-
611
+
541
612
  # The path to the routes configuration file to use. (Defaults to
542
613
  # <tt>config/routes.rb</tt>.)
543
614
  attr_accessor :routes_configuration_file
@@ -556,6 +627,11 @@ Run `rake gems:install` to install the missing gems.
556
627
  # All elements of this array must also be in +load_paths+.
557
628
  attr_accessor :load_once_paths
558
629
 
630
+ # An array of paths from which Rails will eager load on boot if cache
631
+ # classes is enabled. All elements of this array must also be in
632
+ # +load_paths+.
633
+ attr_accessor :eager_load_paths
634
+
559
635
  # The log level to use for the default Rails logger. In production mode,
560
636
  # this defaults to <tt>:info</tt>. In development mode, it defaults to
561
637
  # <tt>:debug</tt>.
@@ -603,7 +679,7 @@ Run `rake gems:install` to install the missing gems.
603
679
  # a sub class would have access to fine grained modification of the loading behavior. See
604
680
  # the implementation of Rails::Plugin::Loader for more details.
605
681
  attr_accessor :plugin_loader
606
-
682
+
607
683
  # Enables or disables plugin reloading. You can get around this setting per plugin.
608
684
  # If <tt>reload_plugins?</tt> is false, add this to your plugin's <tt>init.rb</tt>
609
685
  # to make it reloadable:
@@ -622,6 +698,17 @@ Run `rake gems:install` to install the missing gems.
622
698
  !!@reload_plugins
623
699
  end
624
700
 
701
+ # Enables or disables dependency loading during the request cycle. Setting
702
+ # <tt>dependency_loading</tt> to true will allow new classes to be loaded
703
+ # during a request. Setting it to false will disable this behavior.
704
+ #
705
+ # Those who want to run in a threaded environment should disable this
706
+ # option and eager load or require all there classes on initialization.
707
+ #
708
+ # If <tt>cache_classes</tt> is disabled, dependency loaded will always be
709
+ # on.
710
+ attr_accessor :dependency_loading
711
+
625
712
  # An array of gems that this rails application depends on. Rails will automatically load
626
713
  # these gems during installation, and allow you to install any missing gems with:
627
714
  #
@@ -644,7 +731,7 @@ Run `rake gems:install` to install the missing gems.
644
731
  def gem(name, options = {})
645
732
  @gems << Rails::GemDependency.new(name, options)
646
733
  end
647
-
734
+
648
735
  # Deprecated options:
649
736
  def breakpoint_server(_ = nil)
650
737
  $stderr.puts %(
@@ -660,6 +747,9 @@ Run `rake gems:install` to install the missing gems.
660
747
  # timezone to <tt>:utc</tt>.
661
748
  attr_accessor :time_zone
662
749
 
750
+ # Accessor for i18n settings.
751
+ attr_accessor :i18n
752
+
663
753
  # Create a new Configuration instance, initialized with the default
664
754
  # values.
665
755
  def initialize
@@ -668,11 +758,13 @@ Run `rake gems:install` to install the missing gems.
668
758
  self.frameworks = default_frameworks
669
759
  self.load_paths = default_load_paths
670
760
  self.load_once_paths = default_load_once_paths
761
+ self.eager_load_paths = default_eager_load_paths
671
762
  self.log_path = default_log_path
672
763
  self.log_level = default_log_level
673
764
  self.view_path = default_view_path
674
765
  self.controller_paths = default_controller_paths
675
766
  self.cache_classes = default_cache_classes
767
+ self.dependency_loading = default_dependency_loading
676
768
  self.whiny_nils = default_whiny_nils
677
769
  self.plugins = default_plugins
678
770
  self.plugin_paths = default_plugin_paths
@@ -681,6 +773,7 @@ Run `rake gems:install` to install the missing gems.
681
773
  self.database_configuration_file = default_database_configuration_file
682
774
  self.routes_configuration_file = default_routes_configuration_file
683
775
  self.gems = default_gems
776
+ self.i18n = default_i18n
684
777
 
685
778
  for framework in default_frameworks
686
779
  self.send("#{framework}=", Rails::OrderedOptions.new)
@@ -703,11 +796,21 @@ Run `rake gems:install` to install the missing gems.
703
796
  else
704
797
  Pathname.new(::RAILS_ROOT).realpath.to_s
705
798
  end
706
-
799
+
707
800
  Object.const_set(:RELATIVE_RAILS_ROOT, ::RAILS_ROOT.dup) unless defined?(::RELATIVE_RAILS_ROOT)
708
801
  ::RAILS_ROOT.replace @root_path
709
802
  end
710
803
 
804
+ # Enable threaded mode. Allows concurrent requests to controller actions and
805
+ # multiple database connections. Also disables automatic dependency loading
806
+ # after boot
807
+ def threadsafe!
808
+ self.cache_classes = true
809
+ self.dependency_loading = false
810
+ self.action_controller.allow_concurrency = true
811
+ self
812
+ end
813
+
711
814
  # Loads and returns the contents of the #database_configuration_file. The
712
815
  # contents of the file are processed via ERB before being sent through
713
816
  # YAML::load.
@@ -745,7 +848,7 @@ Run `rake gems:install` to install the missing gems.
745
848
  #
746
849
  # See Dispatcher#to_prepare.
747
850
  def to_prepare(&callback)
748
- after_initialize do
851
+ after_initialize do
749
852
  require 'dispatcher' unless defined?(::Dispatcher)
750
853
  Dispatcher.to_prepare(&callback)
751
854
  end
@@ -759,11 +862,11 @@ Run `rake gems:install` to install the missing gems.
759
862
  def framework_paths
760
863
  paths = %w(railties railties/lib activesupport/lib)
761
864
  paths << 'actionpack/lib' if frameworks.include? :action_controller or frameworks.include? :action_view
762
-
865
+
763
866
  [:active_record, :action_mailer, :active_resource, :action_web_service].each do |framework|
764
867
  paths << "#{framework.to_s.gsub('_', '')}/lib" if frameworks.include? framework
765
868
  end
766
-
869
+
767
870
  paths.map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
768
871
  end
769
872
 
@@ -778,7 +881,7 @@ Run `rake gems:install` to install the missing gems.
778
881
 
779
882
  def default_load_paths
780
883
  paths = []
781
-
884
+
782
885
  # Add the old mock paths only if the directories exists
783
886
  paths.concat(Dir["#{root_path}/test/mocks/#{environment}"]) if File.exists?("#{root_path}/test/mocks/#{environment}")
784
887
 
@@ -809,6 +912,14 @@ Run `rake gems:install` to install the missing gems.
809
912
  []
810
913
  end
811
914
 
915
+ def default_eager_load_paths
916
+ %w(
917
+ app/models
918
+ app/controllers
919
+ app/helpers
920
+ ).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
921
+ end
922
+
812
923
  def default_log_path
813
924
  File.join(root_path, 'log', "#{environment}.log")
814
925
  end
@@ -835,12 +946,12 @@ Run `rake gems:install` to install the missing gems.
835
946
  paths
836
947
  end
837
948
 
838
- def default_dependency_mechanism
839
- :load
949
+ def default_dependency_loading
950
+ true
840
951
  end
841
952
 
842
953
  def default_cache_classes
843
- false
954
+ true
844
955
  end
845
956
 
846
957
  def default_whiny_nils
@@ -864,7 +975,7 @@ Run `rake gems:install` to install the missing gems.
864
975
  def default_plugin_loader
865
976
  Plugin::Loader
866
977
  end
867
-
978
+
868
979
  def default_cache_store
869
980
  if File.exist?("#{root_path}/tmp/cache/")
870
981
  [ :file_store, "#{root_path}/tmp/cache/" ]
@@ -872,10 +983,22 @@ Run `rake gems:install` to install the missing gems.
872
983
  :memory_store
873
984
  end
874
985
  end
875
-
986
+
876
987
  def default_gems
877
988
  []
878
989
  end
990
+
991
+ def default_i18n
992
+ i18n = Rails::OrderedOptions.new
993
+ i18n.load_path = []
994
+
995
+ if File.exist?(File.join(RAILS_ROOT, 'config', 'locales'))
996
+ i18n.load_path << Dir[File.join(RAILS_ROOT, 'config', 'locales', '*.{rb,yml}')]
997
+ i18n.load_path.flatten!
998
+ end
999
+
1000
+ i18n
1001
+ end
879
1002
  end
880
1003
  end
881
1004