railties 4.0.13 → 4.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +155 -385
  3. data/README.rdoc +1 -1
  4. data/bin/rails +1 -1
  5. data/lib/rails.rb +11 -13
  6. data/lib/rails/all.rb +1 -0
  7. data/lib/rails/api/task.rb +9 -12
  8. data/lib/rails/app_rails_loader.rb +2 -2
  9. data/lib/rails/application.rb +154 -149
  10. data/lib/rails/application/configuration.rb +1 -14
  11. data/lib/rails/application/default_middleware_stack.rb +99 -0
  12. data/lib/rails/application/finisher.rb +2 -0
  13. data/lib/rails/application_controller.rb +16 -0
  14. data/lib/rails/cli.rb +1 -2
  15. data/lib/rails/commands.rb +2 -94
  16. data/lib/rails/commands/application.rb +2 -28
  17. data/lib/rails/commands/commands_tasks.rb +174 -0
  18. data/lib/rails/commands/console.rb +2 -2
  19. data/lib/rails/commands/dbconsole.rb +1 -1
  20. data/lib/rails/commands/plugin.rb +23 -0
  21. data/lib/rails/commands/runner.rb +1 -1
  22. data/lib/rails/commands/server.rb +46 -30
  23. data/lib/rails/configuration.rb +4 -1
  24. data/lib/rails/console/helpers.rb +6 -0
  25. data/lib/rails/engine.rb +29 -18
  26. data/lib/rails/engine/commands.rb +1 -1
  27. data/lib/rails/engine/railties.rb +0 -8
  28. data/lib/rails/generators.rb +4 -3
  29. data/lib/rails/generators/actions.rb +1 -1
  30. data/lib/rails/generators/active_model.rb +0 -8
  31. data/lib/rails/generators/app_base.rb +213 -74
  32. data/lib/rails/generators/base.rb +17 -16
  33. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +1 -1
  34. data/lib/rails/generators/erb/scaffold/templates/index.html.erb +1 -3
  35. data/lib/rails/generators/migration.rb +18 -26
  36. data/lib/rails/generators/named_base.rb +4 -7
  37. data/lib/rails/generators/rails/app/app_generator.rb +91 -5
  38. data/lib/rails/generators/rails/app/templates/Gemfile +20 -15
  39. data/lib/rails/generators/rails/app/templates/Rakefile +1 -1
  40. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +2 -0
  41. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +5 -3
  42. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +5 -1
  43. data/lib/rails/generators/rails/app/templates/config/application.rb +2 -0
  44. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +7 -10
  45. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +11 -31
  46. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +25 -29
  47. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +8 -10
  48. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +8 -11
  49. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +6 -3
  50. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +8 -22
  51. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +7 -9
  52. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +9 -12
  53. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +8 -8
  54. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml +7 -17
  55. data/lib/rails/generators/rails/app/templates/config/environment.rb +1 -1
  56. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +2 -5
  57. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +1 -1
  58. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -4
  59. data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +1 -1
  60. data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
  61. data/lib/rails/generators/rails/app/templates/config/{initializers/secret_token.rb.tt → secrets.yml} +10 -2
  62. data/lib/rails/generators/rails/app/templates/public/404.html +20 -11
  63. data/lib/rails/generators/rails/app/templates/public/422.html +20 -11
  64. data/lib/rails/generators/rails/app/templates/public/500.html +19 -10
  65. data/lib/rails/generators/rails/controller/USAGE +1 -0
  66. data/lib/rails/generators/rails/controller/controller_generator.rb +35 -1
  67. data/lib/rails/generators/rails/generator/USAGE +1 -0
  68. data/lib/rails/generators/rails/generator/generator_generator.rb +2 -0
  69. data/lib/rails/generators/rails/model/USAGE +5 -5
  70. data/lib/rails/generators/rails/{plugin_new → plugin}/USAGE +0 -0
  71. data/lib/rails/generators/rails/{plugin_new/plugin_new_generator.rb → plugin/plugin_generator.rb} +10 -4
  72. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/%name%.gemspec +1 -0
  73. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/Gemfile +16 -1
  74. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/MIT-LICENSE +0 -0
  75. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/README.rdoc +0 -0
  76. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/Rakefile +0 -0
  77. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/app/controllers/%name%/application_controller.rb.tt +0 -0
  78. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/app/helpers/%name%/application_helper.rb.tt +0 -0
  79. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/app/mailers/.empty_directory +0 -0
  80. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/app/models/.empty_directory +0 -0
  81. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/app/views/layouts/%name%/application.html.erb.tt +0 -0
  82. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/bin/rails.tt +0 -4
  83. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/config/routes.rb +0 -0
  84. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/gitignore +0 -0
  85. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/lib/%name%.rb +0 -0
  86. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/lib/%name%/engine.rb +0 -0
  87. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/lib/%name%/version.rb +0 -0
  88. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/lib/tasks/%name%_tasks.rake +0 -0
  89. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/rails/application.rb +1 -0
  90. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/rails/boot.rb +0 -0
  91. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/rails/javascripts.js +0 -0
  92. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/rails/routes.rb +0 -0
  93. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/rails/stylesheets.css +5 -3
  94. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/test/%name%_test.rb +0 -0
  95. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/test/integration/navigation_test.rb +0 -0
  96. data/lib/rails/generators/rails/{plugin_new → plugin}/templates/test/test_helper.rb +0 -0
  97. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +1 -1
  98. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +2 -2
  99. data/lib/rails/generators/resource_helpers.rb +20 -5
  100. data/lib/rails/generators/test_unit/generator/generator_generator.rb +26 -0
  101. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb +16 -0
  102. data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +8 -1
  103. data/lib/rails/generators/test_unit/mailer/templates/preview.rb +11 -0
  104. data/lib/rails/generators/testing/assertions.rb +1 -1
  105. data/lib/rails/generators/testing/behaviour.rb +3 -13
  106. data/lib/rails/info.rb +5 -3
  107. data/lib/rails/info_controller.rb +5 -15
  108. data/lib/rails/mailers_controller.rb +73 -0
  109. data/lib/rails/paths.rb +13 -18
  110. data/lib/rails/rack/debugger.rb +2 -2
  111. data/lib/rails/rack/logger.rb +1 -1
  112. data/lib/rails/railtie.rb +38 -2
  113. data/lib/rails/source_annotation_extractor.rb +2 -2
  114. data/lib/rails/tasks.rb +0 -2
  115. data/lib/rails/tasks/documentation.rake +0 -5
  116. data/lib/rails/tasks/engine.rake +1 -1
  117. data/lib/rails/tasks/framework.rake +2 -12
  118. data/lib/rails/templates/layouts/application.html.erb +2 -2
  119. data/lib/rails/templates/rails/mailers/email.html.erb +98 -0
  120. data/lib/rails/templates/rails/mailers/index.html.erb +8 -0
  121. data/lib/rails/templates/rails/mailers/mailer.html.erb +6 -0
  122. data/lib/rails/test_help.rb +4 -1
  123. data/lib/rails/test_unit/sub_test_task.rb +44 -3
  124. data/lib/rails/test_unit/testing.rake +9 -111
  125. data/lib/rails/version.rb +3 -3
  126. data/lib/rails/welcome_controller.rb +4 -3
  127. metadata +99 -76
  128. data/lib/rails/commands/plugin_new.rb +0 -9
  129. data/lib/rails/generators/actions/create_migration.rb +0 -68
@@ -7,8 +7,6 @@ rescue LoadError
7
7
  exit
8
8
  end
9
9
 
10
- require 'rails/generators/actions'
11
-
12
10
  module Rails
13
11
  module Generators
14
12
  class Error < Thor::Error # :nodoc:
@@ -168,15 +166,15 @@ module Rails
168
166
  as_hook = options.delete(:as) || generator_name
169
167
 
170
168
  names.each do |name|
171
- defaults = if options[:type] == :boolean
172
- { }
173
- elsif [true, false].include?(default_value_for_option(name, options))
174
- { banner: "" }
175
- else
176
- { desc: "#{name.to_s.humanize} to be invoked", banner: "NAME" }
177
- end
178
-
179
169
  unless class_options.key?(name)
170
+ defaults = if options[:type] == :boolean
171
+ { }
172
+ elsif [true, false].include?(default_value_for_option(name, options))
173
+ { banner: "" }
174
+ else
175
+ { desc: "#{name.to_s.humanize} to be invoked", banner: "NAME" }
176
+ end
177
+
180
178
  class_option(name, defaults.merge!(options))
181
179
  end
182
180
 
@@ -255,12 +253,7 @@ module Rails
255
253
  # Split the class from its module nesting
256
254
  nesting = class_name.split('::')
257
255
  last_name = nesting.pop
258
-
259
- # Extract the last Module in the nesting
260
- last = nesting.inject(Object) do |last_module, nest|
261
- break unless last_module.const_defined?(nest, false)
262
- last_module.const_get(nest)
263
- end
256
+ last = extract_last_module(nesting)
264
257
 
265
258
  if last && last.const_defined?(last_name.camelize, false)
266
259
  raise Error, "The name '#{class_name}' is either already used in your application " <<
@@ -270,6 +263,14 @@ module Rails
270
263
  end
271
264
  end
272
265
 
266
+ # Takes in an array of nested modules and extracts the last module
267
+ def extract_last_module(nesting)
268
+ nesting.inject(Object) do |last_module, nest|
269
+ break unless last_module.const_defined?(nest, false)
270
+ last_module.const_get(nest)
271
+ end
272
+ end
273
+
273
274
  # Use Rails default banner.
274
275
  def self.banner
275
276
  "rails generate #{namespace.sub(/^rails:/,'')} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]".gsub(/\s+/, ' ')
@@ -17,7 +17,7 @@
17
17
  <%%= f.label :password %><br>
18
18
  <%%= f.password_field :password %>
19
19
  </div>
20
- <div class="field">
20
+ <div>
21
21
  <%%= f.label :password_confirmation %><br>
22
22
  <%%= f.password_field :password_confirmation %>
23
23
  <% else -%>
@@ -6,9 +6,7 @@
6
6
  <% attributes.reject(&:password_digest?).each do |attribute| -%>
7
7
  <th><%= attribute.human_name %></th>
8
8
  <% end -%>
9
- <th></th>
10
- <th></th>
11
- <th></th>
9
+ <th colspan="3"></th>
12
10
  </tr>
13
11
  </thead>
14
12
 
@@ -1,4 +1,4 @@
1
- require 'rails/generators/actions/create_migration'
1
+ require 'active_support/concern'
2
2
 
3
3
  module Rails
4
4
  module Generators
@@ -6,12 +6,9 @@ module Rails
6
6
  # [0-9]*_name format and can be used by another frameworks (like Sequel)
7
7
  # just by implementing the next migration version method.
8
8
  module Migration
9
+ extend ActiveSupport::Concern
9
10
  attr_reader :migration_number, :migration_file_name, :migration_class_name
10
11
 
11
- def self.included(base) #:nodoc:
12
- base.extend ClassMethods
13
- end
14
-
15
12
  module ClassMethods
16
13
  def migration_lookup_at(dirname) #:nodoc:
17
14
  Dir.glob("#{dirname}/[0-9]*_*.rb")
@@ -32,19 +29,6 @@ module Rails
32
29
  end
33
30
  end
34
31
 
35
- def create_migration(destination, data, config = {}, &block)
36
- action Rails::Generators::Actions::CreateMigration.new(self, destination, block || data.to_s, config)
37
- end
38
-
39
- def set_migration_assigns!(destination)
40
- destination = File.expand_path(destination, self.destination_root)
41
-
42
- migration_dir = File.dirname(destination)
43
- @migration_number = self.class.next_migration_number(migration_dir)
44
- @migration_file_name = File.basename(destination, '.rb')
45
- @migration_class_name = @migration_file_name.camelize
46
- end
47
-
48
32
  # Creates a migration template at the given destination. The difference
49
33
  # to the default template method is that the migration version is appended
50
34
  # to the destination file name.
@@ -53,18 +37,26 @@ module Rails
53
37
  # available as instance variables in the template to be rendered.
54
38
  #
55
39
  # migration_template "migration.rb", "db/migrate/add_foo_to_bar.rb"
56
- def migration_template(source, destination, config = {})
57
- source = File.expand_path(find_in_source_paths(source.to_s))
40
+ def migration_template(source, destination=nil, config={})
41
+ destination = File.expand_path(destination || source, self.destination_root)
58
42
 
59
- set_migration_assigns!(destination)
60
- context = instance_eval('binding')
43
+ migration_dir = File.dirname(destination)
44
+ @migration_number = self.class.next_migration_number(migration_dir)
45
+ @migration_file_name = File.basename(destination).sub(/\.rb$/, '')
46
+ @migration_class_name = @migration_file_name.camelize
61
47
 
62
- dir, base = File.split(destination)
63
- numbered_destination = File.join(dir, ["%migration_number%", base].join('_'))
48
+ destination = self.class.migration_exists?(migration_dir, @migration_file_name)
64
49
 
65
- create_migration numbered_destination, nil, config do
66
- ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)
50
+ if !(destination && options[:skip]) && behavior == :invoke
51
+ if destination && options.force?
52
+ remove_file(destination)
53
+ elsif destination
54
+ raise Error, "Another migration is already named #{@migration_file_name}: #{destination}. Use --force to remove the old migration file and replace it."
55
+ end
56
+ destination = File.join(migration_dir, "#{@migration_number}_#{@migration_file_name}.rb")
67
57
  end
58
+
59
+ template(source, destination, config)
68
60
  end
69
61
  end
70
62
  end
@@ -18,6 +18,8 @@ module Rails
18
18
  parse_attributes! if respond_to?(:attributes)
19
19
  end
20
20
 
21
+ # Defines the template that would be used for the migration file.
22
+ # The arguments include the source template file, the migration filename etc.
21
23
  no_tasks do
22
24
  def template(source, *args, &block)
23
25
  inside_template do
@@ -28,12 +30,7 @@ module Rails
28
30
 
29
31
  protected
30
32
  attr_reader :file_name
31
-
32
- # FIXME: We are avoiding to use alias because a bug on thor that make
33
- # this method public and add it to the task list.
34
- def singular_name
35
- file_name
36
- end
33
+ alias :singular_name :file_name
37
34
 
38
35
  # Wrap block with namespace of current application
39
36
  # if namespace exists and is not skipped
@@ -93,7 +90,7 @@ module Rails
93
90
  end
94
91
 
95
92
  def namespaced_path
96
- @namespaced_path ||= namespace.name.split("::").map {|m| m.underscore }[0]
93
+ @namespaced_path ||= namespace.name.split("::").first.underscore
97
94
  end
98
95
 
99
96
  def class_name
@@ -78,6 +78,7 @@ module Rails
78
78
  template "routes.rb"
79
79
  template "application.rb"
80
80
  template "environment.rb"
81
+ template "secrets.yml"
81
82
 
82
83
  directory "environments"
83
84
  directory "initializers"
@@ -129,7 +130,9 @@ module Rails
129
130
  end
130
131
 
131
132
  def vendor_javascripts
132
- empty_directory_with_keep_file 'vendor/assets/javascripts'
133
+ unless options[:skip_javascript]
134
+ empty_directory_with_keep_file 'vendor/assets/javascripts'
135
+ end
133
136
  end
134
137
 
135
138
  def vendor_stylesheets
@@ -151,15 +154,19 @@ module Rails
151
154
  desc: "Show Rails version number and quit"
152
155
 
153
156
  def initialize(*args)
154
- raise Error, "Options should be given after the application name. For details run: rails --help" if args[0].blank?
155
-
156
157
  super
157
158
 
159
+ unless app_path
160
+ raise Error, "Application name should be provided in arguments. For details run: rails --help"
161
+ end
162
+
158
163
  if !options[:skip_active_record] && !DATABASES.include?(options[:database])
159
164
  raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
160
165
  end
161
166
  end
162
167
 
168
+ public_task :set_default_accessors!
169
+ public_task :apply_rails_template
163
170
  public_task :create_root
164
171
 
165
172
  def create_root_files
@@ -223,7 +230,15 @@ module Rails
223
230
  build(:leftovers)
224
231
  end
225
232
 
226
- public_task :apply_rails_template, :run_bundle
233
+ def delete_js_folder_skipping_javascript
234
+ if options[:skip_javascript]
235
+ remove_dir 'app/assets/javascripts'
236
+ end
237
+ end
238
+
239
+ public_task :run_bundle
240
+ public_task :replay_template
241
+ public_task :generate_spring_binstubs
227
242
 
228
243
  protected
229
244
 
@@ -237,7 +252,7 @@ module Rails
237
252
  end
238
253
 
239
254
  def app_name
240
- @app_name ||= (defined_app_const_base? ? defined_app_name : File.basename(destination_root)).tr(".", "_")
255
+ @app_name ||= (defined_app_const_base? ? defined_app_name : File.basename(destination_root)).tr('\\', '').tr(". ", "_")
241
256
  end
242
257
 
243
258
  def defined_app_name
@@ -292,5 +307,76 @@ module Rails
292
307
  defined?(::AppBuilder) ? ::AppBuilder : Rails::AppBuilder
293
308
  end
294
309
  end
310
+
311
+ # This class handles preparation of the arguments before the AppGenerator is
312
+ # called. The class provides version or help information if they were
313
+ # requested, and also constructs the railsrc file (used for extra configuration
314
+ # options).
315
+ #
316
+ # This class should be called before the AppGenerator is required and started
317
+ # since it configures and mutates ARGV correctly.
318
+ class ARGVScrubber # :nodoc
319
+ def initialize(argv = ARGV)
320
+ @argv = argv
321
+ end
322
+
323
+ def prepare!
324
+ handle_version_request!(@argv.first)
325
+ handle_invalid_command!(@argv.first, @argv) do
326
+ handle_rails_rc!(@argv.drop(1))
327
+ end
328
+ end
329
+
330
+ def self.default_rc_file
331
+ File.expand_path('~/.railsrc')
332
+ end
333
+
334
+ private
335
+
336
+ def handle_version_request!(argument)
337
+ if ['--version', '-v'].include?(argument)
338
+ require 'rails/version'
339
+ puts "Rails #{Rails::VERSION::STRING}"
340
+ exit(0)
341
+ end
342
+ end
343
+
344
+ def handle_invalid_command!(argument, argv)
345
+ if argument == "new"
346
+ yield
347
+ else
348
+ ['--help'] + argv.drop(1)
349
+ end
350
+ end
351
+
352
+ def handle_rails_rc!(argv)
353
+ if argv.find { |arg| arg == '--no-rc' }
354
+ argv.reject { |arg| arg == '--no-rc' }
355
+ else
356
+ railsrc(argv) { |rc_argv, rc| insert_railsrc_into_argv!(rc_argv, rc) }
357
+ end
358
+ end
359
+
360
+ def railsrc(argv)
361
+ if (customrc = argv.index{ |x| x.include?("--rc=") })
362
+ fname = File.expand_path(argv[customrc].gsub(/--rc=/, ""))
363
+ yield(argv.take(customrc) + argv.drop(customrc + 1), fname)
364
+ else
365
+ yield argv, self.class.default_rc_file
366
+ end
367
+ end
368
+
369
+ def read_rc_file(railsrc)
370
+ extra_args = File.readlines(railsrc).flat_map(&:split)
371
+ puts "Using #{extra_args.join(" ")} from #{railsrc}"
372
+ extra_args
373
+ end
374
+
375
+ def insert_railsrc_into_argv!(argv, railsrc)
376
+ return argv unless File.exist?(railsrc)
377
+ extra_args = read_rc_file railsrc
378
+ argv.take(1) + extra_args + argv.drop(1)
379
+ end
380
+ end
295
381
  end
296
382
  end
@@ -1,30 +1,35 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- <%= rails_gemfile_entry -%>
3
+ <% max_width = gemfile_entries.map { |g| g.name.length }.max -%>
4
+ <% gemfile_entries.each do |gem| -%>
5
+ <% if gem.comment -%>
4
6
 
5
- <%= database_gemfile_entry -%>
6
-
7
- <%= assets_gemfile_entry %>
8
- <%= javascript_gemfile_entry -%>
9
-
10
- # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
11
- gem 'jbuilder', '~> 1.2'
12
-
13
- group :doc do
14
- # bundle exec rake doc:rails generates the API under doc/api.
15
- gem 'sdoc', require: false
16
- end
7
+ # <%= gem.comment %>
8
+ <% end -%>
9
+ <%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<% if gem.version -%>
10
+ , '<%= gem.version %>'
11
+ <% elsif gem.options.any? -%>
12
+ ,<%= gem.padding(max_width) %><%= gem.options.map { |k,v|
13
+ "#{k}: #{v.inspect}" }.join(', ') %>
14
+ <% else %>
15
+ <% end -%>
16
+ <% end -%>
17
17
 
18
18
  # Use ActiveModel has_secure_password
19
- # gem 'bcrypt', '~> 3.1.7'
19
+ # gem 'bcrypt-ruby', '~> 3.1.2'
20
20
 
21
21
  # Use unicorn as the app server
22
22
  # gem 'unicorn'
23
23
 
24
24
  # Use Capistrano for deployment
25
- # gem 'capistrano', group: :development
25
+ # gem 'capistrano-rails', group: :development
26
26
 
27
27
  <% unless defined?(JRUBY_VERSION) -%>
28
28
  # Use debugger
29
29
  # gem 'debugger', group: [:development, :test]
30
30
  <% end -%>
31
+
32
+ <% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince/) -%>
33
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
34
+ gem 'tzinfo-data', platforms: [:mingw, :mswin]
35
+ <% end -%>
@@ -3,4 +3,4 @@
3
3
 
4
4
  require File.expand_path('../config/application', __FILE__)
5
5
 
6
- <%= app_const %>.load_tasks
6
+ Rails.application.load_tasks
@@ -13,6 +13,8 @@
13
13
  <% unless options[:skip_javascript] -%>
14
14
  //= require <%= options[:javascript] %>
15
15
  //= require <%= options[:javascript] %>_ujs
16
+ <% if gemfile_entries.any? { |m| m.name == "turbolinks" } -%>
16
17
  //= require turbolinks
17
18
  <% end -%>
19
+ <% end -%>
18
20
  //= require_tree .
@@ -5,9 +5,11 @@
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
6
  * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
7
  *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
10
12
  *
11
- *= require_self
12
13
  *= require_tree .
14
+ *= require_self
13
15
  */
@@ -4,10 +4,14 @@
4
4
  <title><%= camelized %></title>
5
5
  <%- if options[:skip_javascript] -%>
6
6
  <%%= stylesheet_link_tag "application", media: "all" %>
7
- <%%= javascript_include_tag "application" %>
8
7
  <%- else -%>
8
+ <%- if gemfile_entries.any? { |m| m.name == "turbolinks" } -%>
9
9
  <%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
10
10
  <%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
11
+ <%- else -%>
12
+ <%%= stylesheet_link_tag "application", media: "all" %>
13
+ <%%= javascript_include_tag "application" %>
14
+ <%- end -%>
11
15
  <%- end -%>
12
16
  <%%= csrf_meta_tags %>
13
17
  </head>
@@ -4,9 +4,11 @@ require File.expand_path('../boot', __FILE__)
4
4
  require 'rails/all'
5
5
  <% else -%>
6
6
  # Pick the frameworks you want:
7
+ require "active_model/railtie"
7
8
  <%= comment_if :skip_active_record %>require "active_record/railtie"
8
9
  require "action_controller/railtie"
9
10
  require "action_mailer/railtie"
11
+ <%= comment_if :skip_action_view %>require "action_view/railtie"
10
12
  <%= comment_if :skip_sprockets %>require "sprockets/railtie"
11
13
  <%= comment_if :skip_test_unit %>require "rails/test_unit/railtie"
12
14
  <% end -%>
@@ -6,26 +6,23 @@
6
6
  # Configure Using Gemfile
7
7
  # gem 'ruby-frontbase'
8
8
  #
9
- development:
9
+ default: &default
10
10
  adapter: frontbase
11
11
  host: localhost
12
- database: <%= app_name %>_development
13
12
  username: <%= app_name %>
14
13
  password: ''
15
14
 
15
+ development:
16
+ <<: *default
17
+ database: <%= app_name %>_development
18
+
16
19
  # Warning: The database defined as "test" will be erased and
17
20
  # re-generated from your development database when you run "rake".
18
21
  # Do not set this db to the same as development or production.
19
22
  test:
20
- adapter: frontbase
21
- host: localhost
23
+ <<: *default
22
24
  database: <%= app_name %>_test
23
- username: <%= app_name %>
24
- password: ''
25
25
 
26
26
  production:
27
- adapter: frontbase
28
- host: localhost
27
+ <<: *default
29
28
  database: <%= app_name %>_production
30
- username: <%= app_name %>
31
- password: ''