1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Generate script/rails only if --full is given

This commit is contained in:
Stefan Sprenger 2011-05-27 13:44:10 +02:00
parent 5f00592466
commit e38d3752c3
3 changed files with 7 additions and 5 deletions

View file

@ -126,6 +126,8 @@ task :default => :test
end
def script(force = false)
return unless full?
directory "script", :force => force do |content|
"#{shebang}\n" + content
end

View file

@ -12,7 +12,6 @@ DEFAULT_PLUGIN_FILES = %w(
lib
lib/bukkits.rb
lib/tasks/bukkits_tasks.rake
script/rails
test/bukkits_test.rb
test/test_helper.rb
test/dummy
@ -150,6 +149,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
assert_file "config/routes.rb", /Rails.application.routes.draw do/
assert_file "lib/bukkits/engine.rb", /module Bukkits\n class Engine < ::Rails::Engine\n end\nend/
assert_file "lib/bukkits.rb", /require "bukkits\/engine"/
assert_file "script/rails"
end
def test_being_quiet_while_creating_dummy_application
@ -178,7 +178,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
end
def test_usage_of_engine_commands
run_generator
run_generator [destination_root, "--full"]
assert_file "script/rails", /ENGINE_PATH = File.expand_path\('..\/..\/lib\/bukkits\/engine', __FILE__\)/
assert_file "script/rails", /ENGINE_ROOT = File.expand_path\('..\/..', __FILE__\)/
assert_file "script/rails", /require 'rails\/all'/
@ -186,7 +186,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
end
def test_shebang
run_generator
run_generator [destination_root, "--full"]
assert_file "script/rails", /#!\/usr\/bin\/env ruby/
end

View file

@ -67,12 +67,12 @@ module SharedGeneratorTests
end
def test_shebang_is_added_to_rails_file
run_generator [destination_root, "--ruby", "foo/bar/baz"]
run_generator [destination_root, "--ruby", "foo/bar/baz", "--full"]
assert_file "script/rails", /#!foo\/bar\/baz/
end
def test_shebang_when_is_the_same_as_default_use_env
run_generator [destination_root, "--ruby", Thor::Util.ruby_command]
run_generator [destination_root, "--ruby", Thor::Util.ruby_command, "--full"]
assert_file "script/rails", /#!\/usr\/bin\/env/
end