railties 4.1.0 → 4.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +229 -197
  3. data/RDOC_MAIN.rdoc +1 -1
  4. data/README.rdoc +6 -2
  5. data/lib/rails/all.rb +1 -0
  6. data/lib/rails/api/task.rb +7 -0
  7. data/lib/rails/app_rails_loader.rb +5 -3
  8. data/lib/rails/application/bootstrap.rb +15 -1
  9. data/lib/rails/application/configuration.rb +65 -8
  10. data/lib/rails/application/default_middleware_stack.rb +6 -2
  11. data/lib/rails/application/finisher.rb +0 -2
  12. data/lib/rails/application.rb +119 -24
  13. data/lib/rails/backtrace_cleaner.rb +9 -4
  14. data/lib/rails/code_statistics.rb +3 -4
  15. data/lib/rails/commands/commands_tasks.rb +2 -7
  16. data/lib/rails/commands/console.rb +24 -12
  17. data/lib/rails/commands/dbconsole.rb +20 -5
  18. data/lib/rails/commands/destroy.rb +2 -0
  19. data/lib/rails/commands/generate.rb +2 -0
  20. data/lib/rails/commands/plugin.rb +1 -1
  21. data/lib/rails/commands/server.rb +32 -21
  22. data/lib/rails/configuration.rb +2 -2
  23. data/lib/rails/engine/configuration.rb +1 -1
  24. data/lib/rails/engine.rb +15 -12
  25. data/lib/rails/gem_version.rb +2 -2
  26. data/lib/rails/generators/actions/create_migration.rb +4 -3
  27. data/lib/rails/generators/actions.rb +33 -12
  28. data/lib/rails/generators/app_base.rb +63 -55
  29. data/lib/rails/generators/base.rb +2 -2
  30. data/lib/rails/generators/erb/mailer/mailer_generator.rb +25 -2
  31. data/lib/rails/generators/erb/mailer/templates/layout.html.erb +5 -0
  32. data/lib/rails/generators/erb/mailer/templates/layout.text.erb +1 -0
  33. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +1 -6
  34. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +1 -1
  35. data/lib/rails/generators/erb/scaffold/templates/index.html.erb +3 -1
  36. data/lib/rails/generators/erb/scaffold/templates/new.html.erb +1 -1
  37. data/lib/rails/generators/generated_attribute.rb +28 -4
  38. data/lib/rails/generators/model_helpers.rb +28 -0
  39. data/lib/rails/generators/named_base.rb +10 -1
  40. data/lib/rails/generators/rails/app/app_generator.rb +34 -2
  41. data/lib/rails/generators/rails/app/templates/Gemfile +22 -7
  42. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +2 -2
  43. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +1 -1
  44. data/lib/rails/generators/rails/app/templates/bin/rails +1 -1
  45. data/lib/rails/generators/rails/app/templates/bin/setup +28 -0
  46. data/lib/rails/generators/rails/app/templates/config/application.rb +8 -1
  47. data/lib/rails/generators/rails/app/templates/config/boot.rb +1 -2
  48. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +1 -3
  49. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
  50. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +4 -0
  51. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +14 -20
  52. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -2
  53. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +11 -0
  54. data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +1 -1
  55. data/lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb +10 -0
  56. data/lib/rails/generators/rails/app/templates/config.ru +1 -1
  57. data/lib/rails/generators/rails/app/templates/gitignore +4 -1
  58. data/lib/rails/generators/rails/app/templates/test/test_helper.rb +0 -3
  59. data/lib/rails/generators/rails/controller/USAGE +0 -1
  60. data/lib/rails/generators/rails/controller/controller_generator.rb +8 -4
  61. data/lib/rails/generators/rails/helper/USAGE +0 -4
  62. data/lib/rails/generators/rails/model/USAGE +12 -3
  63. data/lib/rails/generators/rails/model/model_generator.rb +4 -0
  64. data/lib/rails/generators/rails/plugin/plugin_generator.rb +23 -1
  65. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec +3 -3
  66. data/lib/rails/generators/rails/plugin/templates/Gemfile +14 -6
  67. data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE +1 -1
  68. data/lib/rails/generators/rails/plugin/templates/Rakefile +4 -0
  69. data/lib/rails/generators/rails/plugin/templates/app/controllers/%name%/application_controller.rb.tt +1 -0
  70. data/lib/rails/generators/rails/plugin/templates/rails/application.rb +1 -1
  71. data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +2 -2
  72. data/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +1 -1
  73. data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb +0 -4
  74. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +13 -3
  75. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +4 -2
  76. data/lib/rails/generators/rails/scaffold/USAGE +7 -1
  77. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +1 -0
  78. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +1 -1
  79. data/lib/rails/generators/resource_helpers.rb +2 -11
  80. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +6 -0
  81. data/lib/rails/generators/test_unit/helper/helper_generator.rb +1 -5
  82. data/lib/rails/generators/test_unit/job/job_generator.rb +13 -0
  83. data/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb +9 -0
  84. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +9 -0
  85. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +4 -1
  86. data/lib/rails/generators/testing/assertions.rb +3 -1
  87. data/lib/rails/generators/testing/behaviour.rb +18 -1
  88. data/lib/rails/generators.rb +66 -15
  89. data/lib/rails/info.rb +8 -24
  90. data/lib/rails/info_controller.rb +1 -1
  91. data/lib/rails/mailers_controller.rb +20 -14
  92. data/lib/rails/paths.rb +3 -3
  93. data/lib/rails/rack/log_tailer.rb +4 -0
  94. data/lib/rails/rack/logger.rb +1 -1
  95. data/lib/rails/rack.rb +1 -1
  96. data/lib/rails/railtie.rb +3 -3
  97. data/lib/rails/ruby_version_check.rb +1 -1
  98. data/lib/rails/source_annotation_extractor.rb +25 -19
  99. data/lib/rails/tasks/framework.rake +2 -2
  100. data/lib/rails/tasks/statistics.rake +9 -2
  101. data/lib/rails/tasks.rb +3 -2
  102. data/lib/rails/templates/rails/mailers/email.html.erb +22 -4
  103. data/lib/rails/templates/rails/mailers/index.html.erb +2 -2
  104. data/lib/rails/templates/rails/mailers/mailer.html.erb +1 -1
  105. data/lib/rails/templates/rails/welcome/index.html.erb +23 -7
  106. data/lib/rails/test_help.rb +1 -0
  107. data/lib/rails/test_unit/sub_test_task.rb +2 -2
  108. data/lib/rails/test_unit/testing.rake +23 -5
  109. data/lib/rails.rb +7 -1
  110. metadata +17 -12
  111. data/lib/rails/commands/update.rb +0 -9
  112. data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +0 -6
  113. data/lib/rails/rubyprof_ext.rb +0 -35
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <body>
3
+ <%%= yield %>
4
+ </body>
5
+ </html>
@@ -0,0 +1 @@
1
+ <%%= yield %>
@@ -17,17 +17,12 @@
17
17
  <%%= f.label :password %><br>
18
18
  <%%= f.password_field :password %>
19
19
  </div>
20
- <div>
20
+ <div class="field">
21
21
  <%%= f.label :password_confirmation %><br>
22
22
  <%%= f.password_field :password_confirmation %>
23
23
  <% else -%>
24
- <%- if attribute.reference? -%>
25
24
  <%%= f.label :<%= attribute.column_name %> %><br>
26
25
  <%%= f.<%= attribute.field_type %> :<%= attribute.column_name %> %>
27
- <%- else -%>
28
- <%%= f.label :<%= attribute.name %> %><br>
29
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
30
- <%- end -%>
31
26
  <% end -%>
32
27
  </div>
33
28
  <% end -%>
@@ -1,4 +1,4 @@
1
- <h1>Editing <%= singular_table_name %></h1>
1
+ <h1>Editing <%= singular_table_name.titleize %></h1>
2
2
 
3
3
  <%%= render 'form' %>
4
4
 
@@ -1,4 +1,6 @@
1
- <h1>Listing <%= plural_table_name %></h1>
1
+ <p id="notice"><%%= notice %></p>
2
+
3
+ <h1>Listing <%= plural_table_name.titleize %></h1>
2
4
 
3
5
  <table>
4
6
  <thead>
@@ -1,4 +1,4 @@
1
- <h1>New <%= singular_table_name %></h1>
1
+ <h1>New <%= singular_table_name.titleize %></h1>
2
2
 
3
3
  <%%= render 'form' %>
4
4
 
@@ -44,8 +44,11 @@ module Rails
44
44
  return $1, limit: $2.to_i
45
45
  when /decimal\{(\d+)[,.-](\d+)\}/
46
46
  return :decimal, precision: $1.to_i, scale: $2.to_i
47
- when /(references|belongs_to)\{polymorphic\}/
48
- return $1, polymorphic: true
47
+ when /(references|belongs_to)\{(.+)\}/
48
+ type = $1
49
+ provided_options = $2.split(/[,.-]/)
50
+ options = Hash[provided_options.map { |opt| [opt.to_sym, true] }]
51
+ return type, options
49
52
  else
50
53
  return type, {}
51
54
  end
@@ -94,6 +97,10 @@ module Rails
94
97
  name.sub(/_id$/, '').pluralize
95
98
  end
96
99
 
100
+ def singular_name
101
+ name.sub(/_id$/, '').singularize
102
+ end
103
+
97
104
  def human_name
98
105
  name.humanize
99
106
  end
@@ -119,7 +126,11 @@ module Rails
119
126
  end
120
127
 
121
128
  def polymorphic?
122
- self.attr_options.has_key?(:polymorphic)
129
+ self.attr_options[:polymorphic]
130
+ end
131
+
132
+ def required?
133
+ self.attr_options[:required]
123
134
  end
124
135
 
125
136
  def has_index?
@@ -135,12 +146,25 @@ module Rails
135
146
  end
136
147
 
137
148
  def inject_options
138
- "".tap { |s| @attr_options.each { |k,v| s << ", #{k}: #{v.inspect}" } }
149
+ "".tap { |s| options_for_migration.each { |k,v| s << ", #{k}: #{v.inspect}" } }
139
150
  end
140
151
 
141
152
  def inject_index_options
142
153
  has_uniq_index? ? ", unique: true" : ""
143
154
  end
155
+
156
+ def options_for_migration
157
+ @attr_options.dup.tap do |options|
158
+ if required?
159
+ options.delete(:required)
160
+ options[:null] = false
161
+ end
162
+
163
+ if reference? && !polymorphic?
164
+ options[:foreign_key] = true
165
+ end
166
+ end
167
+ end
144
168
  end
145
169
  end
146
170
  end
@@ -0,0 +1,28 @@
1
+ require 'rails/generators/active_model'
2
+
3
+ module Rails
4
+ module Generators
5
+ module ModelHelpers # :nodoc:
6
+ PLURAL_MODEL_NAME_WARN_MESSAGE = "[WARNING] The model name '%s' was recognized as a plural, using the singular '%s' instead. " \
7
+ "Override with --force-plural or setup custom inflection rules for this noun before running the generator."
8
+ mattr_accessor :skip_warn
9
+
10
+ def self.included(base) #:nodoc:
11
+ base.class_option :force_plural, type: :boolean, default: false, desc: 'Forces the use of the given model name'
12
+ end
13
+
14
+ def initialize(args, *_options)
15
+ super
16
+ if name == name.pluralize && name.singularize != name.pluralize && !options[:force_plural]
17
+ singular = name.singularize
18
+ unless ModelHelpers.skip_warn
19
+ say PLURAL_MODEL_NAME_WARN_MESSAGE % [name, singular]
20
+ ModelHelpers.skip_warn = true
21
+ end
22
+ name.replace singular
23
+ assign_names!(name)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -30,7 +30,12 @@ module Rails
30
30
 
31
31
  protected
32
32
  attr_reader :file_name
33
- alias :singular_name :file_name
33
+
34
+ # FIXME: We are avoiding to use alias because a bug on thor that make
35
+ # this method public and add it to the task list.
36
+ def singular_name
37
+ file_name
38
+ end
34
39
 
35
40
  # Wrap block with namespace of current application
36
41
  # if namespace exists and is not skipped
@@ -174,6 +179,10 @@ module Rails
174
179
  !defined?(ActiveRecord::Base) || ActiveRecord::Base.pluralize_table_names
175
180
  end
176
181
 
182
+ def mountable_engine?
183
+ defined?(ENGINE_ROOT) && namespaced?
184
+ end
185
+
177
186
  # Add a class collisions name to be checked on class initialization. You
178
187
  # can supply a hash with a :prefix or :suffix to be tested.
179
188
  #
@@ -50,7 +50,7 @@ module Rails
50
50
  end
51
51
 
52
52
  def gitignore
53
- copy_file "gitignore", ".gitignore"
53
+ template "gitignore", ".gitignore"
54
54
  end
55
55
 
56
56
  def app
@@ -86,6 +86,21 @@ module Rails
86
86
  end
87
87
  end
88
88
 
89
+ def config_when_updating
90
+ cookie_serializer_config_exist = File.exist?('config/initializers/cookies_serializer.rb')
91
+ to_time_preserves_timezone_config_exist = File.exist?('config/initializers/to_time_preserves_timezone.rb')
92
+
93
+ config
94
+
95
+ unless cookie_serializer_config_exist
96
+ gsub_file 'config/initializers/cookies_serializer.rb', /json/, 'marshal'
97
+ end
98
+
99
+ unless to_time_preserves_timezone_config_exist
100
+ remove_file 'config/initializers/to_time_preserves_timezone.rb'
101
+ end
102
+ end
103
+
89
104
  def database_yml
90
105
  template "config/databases/#{options[:database]}.yml", "config/database.yml"
91
106
  end
@@ -188,6 +203,11 @@ module Rails
188
203
  build(:config)
189
204
  end
190
205
 
206
+ def update_config_files
207
+ build(:config_when_updating)
208
+ end
209
+ remove_task :update_config_files
210
+
191
211
  def create_boot_file
192
212
  template "config/boot.rb"
193
213
  end
@@ -231,6 +251,12 @@ module Rails
231
251
  end
232
252
  end
233
253
 
254
+ def delete_assets_initializer_skipping_sprockets
255
+ if options[:skip_sprockets]
256
+ remove_file 'config/initializers/assets.rb'
257
+ end
258
+ end
259
+
234
260
  def finish_template
235
261
  build(:leftovers)
236
262
  end
@@ -238,6 +264,12 @@ module Rails
238
264
  public_task :apply_rails_template, :run_bundle
239
265
  public_task :generate_spring_binstubs
240
266
 
267
+ def run_after_bundle_callbacks
268
+ @after_bundle_callbacks.each do |callback|
269
+ callback.call
270
+ end
271
+ end
272
+
241
273
  protected
242
274
 
243
275
  def self.banner
@@ -313,7 +345,7 @@ module Rails
313
345
  #
314
346
  # This class should be called before the AppGenerator is required and started
315
347
  # since it configures and mutates ARGV correctly.
316
- class ARGVScrubber # :nodoc
348
+ class ARGVScrubber # :nodoc:
317
349
  def initialize(argv = ARGV)
318
350
  @argv = argv
319
351
  end
@@ -1,6 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- <% max_width = gemfile_entries.map { |g| g.name.length }.max -%>
4
3
  <% gemfile_entries.each do |gem| -%>
5
4
  <% if gem.comment -%>
6
5
 
@@ -8,7 +7,7 @@ source 'https://rubygems.org'
8
7
  <% end -%>
9
8
  <%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%>
10
9
  <% if gem.options.any? -%>
11
- ,<%= gem.padding(max_width) %><%= gem.options.map { |k,v|
10
+ , <%= gem.options.map { |k,v|
12
11
  "#{k}: #{v.inspect}" }.join(', ') %>
13
12
  <% end -%>
14
13
  <% end -%>
@@ -16,18 +15,34 @@ source 'https://rubygems.org'
16
15
  # Use ActiveModel has_secure_password
17
16
  # gem 'bcrypt', '~> 3.1.7'
18
17
 
19
- # Use unicorn as the app server
18
+ # Use Unicorn as the app server
20
19
  # gem 'unicorn'
21
20
 
22
21
  # Use Capistrano for deployment
23
22
  # gem 'capistrano-rails', group: :development
24
23
 
25
24
  <% unless defined?(JRUBY_VERSION) -%>
26
- # Use debugger
27
- # gem 'debugger', group: [:development, :test]
25
+ group :development, :test do
26
+ <%- if RUBY_VERSION < '2.0.0' -%>
27
+ # Call 'debugger' anywhere in the code to stop execution and get a debugger console
28
+ gem 'debugger'
29
+ <%- else -%>
30
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
31
+ gem 'byebug'
32
+ <%- end -%>
33
+ end
34
+
35
+ group :development do
36
+ # Access an IRB console on exception pages or by using <%%= console %> in views
37
+ gem 'web-console', '~> 2.0'
38
+ <%- if spring_install? %>
39
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
40
+ gem 'spring'
41
+ <% end -%>
42
+ end
28
43
  <% end -%>
29
44
 
30
- <% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince/) -%>
45
+ <% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince|java/) -%>
31
46
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
32
- gem 'tzinfo-data', platforms: [:mingw, :mswin]
47
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
33
48
  <% end -%>
@@ -2,12 +2,12 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
8
  // compiled file.
9
9
  //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
13
  <% unless options[:skip_javascript] -%>
@@ -3,7 +3,7 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
9
  * compiled file so the styles you add here take precedence over styles defined in any styles
@@ -1,3 +1,3 @@
1
- APP_PATH = File.expand_path('../../config/application', __FILE__)
1
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
2
2
  require_relative '../config/boot'
3
3
  require 'rails/commands'
@@ -0,0 +1,28 @@
1
+ require 'pathname'
2
+
3
+ # path to your application root.
4
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
5
+
6
+ Dir.chdir APP_ROOT do
7
+ # This script is a starting point to setup your application.
8
+ # Add necessary setup steps to this file:
9
+
10
+ puts "== Installing dependencies =="
11
+ system "gem install bundler --conservative"
12
+ system "bundle check || bundle install"
13
+
14
+ # puts "\n== Copying sample files =="
15
+ # unless File.exist?("config/database.yml")
16
+ # system "cp config/database.yml.sample config/database.yml"
17
+ # end
18
+
19
+ puts "\n== Preparing database =="
20
+ system "bin/rake db:setup"
21
+
22
+ puts "\n== Removing old logs and tempfiles =="
23
+ system "rm -f log/*"
24
+ system "rm -rf tmp/cache"
25
+
26
+ puts "\n== Restarting application server =="
27
+ system "touch tmp/restart.txt"
28
+ end
@@ -3,12 +3,14 @@ require File.expand_path('../boot', __FILE__)
3
3
  <% if include_all_railties? -%>
4
4
  require 'rails/all'
5
5
  <% else -%>
6
+ require "rails"
6
7
  # Pick the frameworks you want:
7
8
  require "active_model/railtie"
9
+ require "active_job/railtie"
8
10
  <%= comment_if :skip_active_record %>require "active_record/railtie"
9
11
  require "action_controller/railtie"
10
12
  require "action_mailer/railtie"
11
- <%= comment_if :skip_action_view %>require "action_view/railtie"
13
+ require "action_view/railtie"
12
14
  <%= comment_if :skip_sprockets %>require "sprockets/railtie"
13
15
  <%= comment_if :skip_test_unit %>require "rails/test_unit/railtie"
14
16
  <% end -%>
@@ -30,5 +32,10 @@ module <%= app_const_base %>
30
32
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
33
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
34
  # config.i18n.default_locale = :de
35
+ <%- unless options.skip_active_record? -%>
36
+
37
+ # Do not swallow errors in after_commit/after_rollback callbacks.
38
+ config.active_record.raise_in_transactional_callbacks = true
39
+ <%- end -%>
33
40
  end
34
41
  end
@@ -1,4 +1,3 @@
1
- # Set up gems listed in the Gemfile.
2
1
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
2
 
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,7 +1,7 @@
1
1
  # IBM Dataservers
2
2
  #
3
3
  # Home Page
4
- # http://rubyforge.org/projects/rubyibm/
4
+ # https://github.com/dparnell/ibm_db
5
5
  #
6
6
  # To install the ibm_db gem:
7
7
  #
@@ -31,8 +31,6 @@
31
31
  # Configure Using Gemfile
32
32
  # gem 'ibm_db'
33
33
  #
34
- # For more details on the installation and the connection parameters below,
35
- # please refer to the latest documents at http://rubyforge.org/docman/?group_id=2361
36
34
  #
37
35
  default: &default
38
36
  adapter: ibm_db
@@ -1,7 +1,7 @@
1
1
  # Oracle/OCI 8i, 9, 10g
2
2
  #
3
3
  # Requires Ruby/OCI8:
4
- # http://rubyforge.org/projects/ruby-oci8/
4
+ # https://github.com/kubo/ruby-oci8
5
5
  #
6
6
  # Specify your database using any valid connection syntax, such as a
7
7
  # tnsnames.ora service name, or an SQL connect string of the form:
@@ -30,6 +30,10 @@ Rails.application.configure do
30
30
  # number of complex assets.
31
31
  config.assets.debug = true
32
32
 
33
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
34
+ # yet still be able to expire them through the digest params.
35
+ config.assets.digest = true
36
+
33
37
  # Adds additional error checking when serving assets at runtime.
34
38
  # Checks for improperly declared sprockets dependencies.
35
39
  # Raises helpful error messages.
@@ -16,11 +16,13 @@ Rails.application.configure do
16
16
 
17
17
  # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
18
  # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
20
21
  # config.action_dispatch.rack_cache = true
21
22
 
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
26
 
25
27
  <%- unless options.skip_sprockets? -%>
26
28
  # Compress JavaScripts and CSS.
@@ -30,22 +32,23 @@ Rails.application.configure do
30
32
  # Do not fallback to assets pipeline if a precompiled asset is missed.
31
33
  config.assets.compile = false
32
34
 
33
- # Generate digests for assets URLs.
35
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
36
+ # yet still be able to expire them through the digest params.
34
37
  config.assets.digest = true
35
38
 
36
- # Version of your assets, change this if you want to expire all your assets.
37
- config.assets.version = '1.0'
39
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
38
40
  <%- end -%>
39
41
 
40
42
  # Specifies the header that your server uses for sending files.
41
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
42
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
43
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
44
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43
45
 
44
46
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
47
  # config.force_ssl = true
46
48
 
47
- # Set to :debug to see everything in the log.
48
- config.log_level = :info
49
+ # Use the lowest log level to ensure availability of diagnostic information
50
+ # when problems arise.
51
+ config.log_level = :debug
49
52
 
50
53
  # Prepend all log lines with the following tags.
51
54
  # config.log_tags = [ :subdomain, :uuid ]
@@ -57,13 +60,7 @@ Rails.application.configure do
57
60
  # config.cache_store = :mem_cache_store
58
61
 
59
62
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
60
- # config.action_controller.asset_host = "http://assets.example.com"
61
-
62
- <%- unless options.skip_sprockets? -%>
63
- # Precompile additional assets.
64
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
65
- # config.assets.precompile += %w( search.js )
66
- <%- end -%>
63
+ # config.action_controller.asset_host = 'http://assets.example.com'
67
64
 
68
65
  # Ignore bad email addresses and do not raise email delivery errors.
69
66
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -76,9 +73,6 @@ Rails.application.configure do
76
73
  # Send deprecation notices to registered listeners.
77
74
  config.active_support.deprecation = :notify
78
75
 
79
- # Disable automatic flushing of the log to improve performance.
80
- # config.autoflush_log = false
81
-
82
76
  # Use default logging formatter so that PID and timestamp are not suppressed.
83
77
  config.log_formatter = ::Logger::Formatter.new
84
78
  <%- unless options.skip_active_record? -%>
@@ -12,8 +12,8 @@ Rails.application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
17
  config.static_cache_control = 'public, max-age=3600'
18
18
 
19
19
  # Show full error reports and disable caching.
@@ -31,6 +31,9 @@ Rails.application.configure do
31
31
  # ActionMailer::Base.deliveries array.
32
32
  config.action_mailer.delivery_method = :test
33
33
 
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
34
37
  # Print deprecation notices to the stderr.
35
38
  config.active_support.deprecation = :stderr
36
39
 
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Preserve the timezone of the receiver when calling to `to_time`.
4
+ # Ruby 2.4 will change the behavior of `to_time` to preserve the timezone
5
+ # when converting to an instance of `Time` instead of the previous behavior
6
+ # of converting to the local system timezone.
7
+ #
8
+ # Rails 5.0 introduced this config option so that apps made with earlier
9
+ # versions of Rails are not affected when upgrading.
10
+ ActiveSupport.to_time_preserves_timezone = true
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Rails.application
@@ -7,10 +7,13 @@
7
7
  # Ignore bundler config.
8
8
  /.bundle
9
9
 
10
+ <% if sqlite3? -%>
10
11
  # Ignore the default SQLite database.
11
12
  /db/*.sqlite3
12
13
  /db/*.sqlite3-journal
13
14
 
15
+ <% end -%>
14
16
  # Ignore all logfiles and tempfiles.
15
- /log/*.log
17
+ /log/*
18
+ !/log/.keep
16
19
  /tmp
@@ -5,9 +5,6 @@ require 'rails/test_help'
5
5
  class ActiveSupport::TestCase
6
6
  <% unless options[:skip_active_record] -%>
7
7
  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
8
- #
9
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
10
- # -- they do not yet inherit this setting
11
8
  fixtures :all
12
9
 
13
10
  <% end -%>
@@ -16,4 +16,3 @@ Example:
16
16
  Test: test/controllers/credit_cards_controller_test.rb
17
17
  Views: app/views/credit_cards/debit.html.erb [...]
18
18
  Helper: app/helpers/credit_cards_helper.rb
19
- Test: test/helpers/credit_cards_helper_test.rb
@@ -2,6 +2,8 @@ module Rails
2
2
  module Generators
3
3
  class ControllerGenerator < NamedBase # :nodoc:
4
4
  argument :actions, type: :array, default: [], banner: "action action"
5
+ class_option :skip_routes, type: :boolean, desc: "Don't add routes to config/routes.rb."
6
+
5
7
  check_class_collision suffix: "Controller"
6
8
 
7
9
  def create_controller_files
@@ -9,8 +11,10 @@ module Rails
9
11
  end
10
12
 
11
13
  def add_routes
12
- actions.reverse.each do |action|
13
- route generate_routing_code(action)
14
+ unless options[:skip_routes]
15
+ actions.reverse_each do |action|
16
+ route generate_routing_code(action)
17
+ end
14
18
  end
15
19
  end
16
20
 
@@ -27,11 +31,11 @@ module Rails
27
31
  # end
28
32
  # end
29
33
  def generate_routing_code(action)
30
- depth = class_path.length
34
+ depth = regular_class_path.length
31
35
  # Create 'namespace' ladder
32
36
  # namespace :foo do
33
37
  # namespace :bar do
34
- namespace_ladder = class_path.each_with_index.map do |ns, i|
38
+ namespace_ladder = regular_class_path.each_with_index.map do |ns, i|
35
39
  indent("namespace :#{ns} do\n", i * 2)
36
40
  end.join
37
41
 
@@ -5,13 +5,9 @@ Description:
5
5
  To create a helper within a module, specify the helper name as a
6
6
  path like 'parent_module/helper_name'.
7
7
 
8
- This generates a helper class in app/helpers and invokes the configured
9
- test framework.
10
-
11
8
  Example:
12
9
  `rails generate helper CreditCard`
13
10
 
14
11
  Credit card helper.
15
12
  Helper: app/helpers/credit_card_helper.rb
16
- Test: test/helpers/credit_card_helper_test.rb
17
13