diff options
Diffstat (limited to 'railties/lib')
4 files changed, 35 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index a7462f39ba..575f4bb106 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -68,7 +68,32 @@ module Rails end in_root do - append_file "Gemfile", "gem #{parts.join(", ")}\n", :verbose => false + str = "gem #{parts.join(", ")}\n" + str = " " + str if @in_group + append_file "Gemfile", str, :verbose => false + end + end + + # Wraps gem entries inside a group. + # + # ==== Example + # + # gem_group :development, :test do + # gem "rspec-rails" + # end + # + def gem_group(*names, &block) + name = names.map(&:inspect).join(", ") + log :gemfile, "group #{name}" + + in_root do + append_file "Gemfile", "\ngroup #{name} do\n", :force => true + + @in_group = true + instance_eval &block + @in_group = false + + append_file "Gemfile", "end\n", :force => true end end @@ -119,8 +144,8 @@ module Rails if commands.is_a?(Symbol) run "git #{commands}" else - commands.each do |command, options| - run "git #{command} #{options}" + commands.each do |cmd, options| + run "git #{cmd} #{options}" end end end diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index c83e7ddf80..910cd16950 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -10,6 +10,9 @@ source 'http://rubygems.org' <%= assets_gemfile_entry %> <%= javascript_gemfile_entry %> +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + # Use unicorn as the web server # gem 'unicorn' diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb index ee85b70bb5..7319fb79f6 100644 --- a/railties/lib/rails/generators/test_case.rb +++ b/railties/lib/rails/generators/test_case.rb @@ -81,7 +81,7 @@ module Rails # # assert_file "app/controller/products_controller.rb" do |controller| # assert_instance_method :index, content do |index| - # assert_match /Product\.all/, index + # assert_match(/Product\.all/, index) # end # end # @@ -148,7 +148,7 @@ module Rails # # assert_migration "db/migrate/create_products.rb" do |migration| # assert_class_method :up, migration do |up| - # assert_match /create_table/, up + # assert_match(/create_table/, up) # end # end # @@ -161,7 +161,7 @@ module Rails # # assert_file "app/controller/products_controller.rb" do |controller| # assert_instance_method :index, content do |index| - # assert_match /Product\.all/, index + # assert_match(/Product\.all/, index) # end # end # diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml index d4138ca2f5..5c8780aa64 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml @@ -1,4 +1,4 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html <% unless attributes.empty? -%> one: |