diff --git a/railties/lib/rails/commands/destroy.rb b/railties/lib/rails/commands/destroy.rb index 15ff90f78a..f85c17bb94 100644 --- a/railties/lib/rails/commands/destroy.rb +++ b/railties/lib/rails/commands/destroy.rb @@ -1,3 +1,6 @@ +require 'rails/generators' +Rails::Generators.configure! + if ARGV.size == 0 Rails::Generators.help exit diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index 82a658e2ed..c5e3ae3529 100755 --- a/railties/lib/rails/commands/generate.rb +++ b/railties/lib/rails/commands/generate.rb @@ -1,3 +1,6 @@ +require 'rails/generators' +Rails::Generators.configure! + if ARGV.size == 0 Rails::Generators.help exit diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index e552cc4520..2bcea4bc8f 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -123,8 +123,10 @@ module Rails::Generators end def create_script_files - directory "script" - chmod "script", 0755, :verbose => false + directory "script" do |file| + prepend_file file, "#{shebang}\n", :verbose => false + chmod file, 0755, :verbose => false + end end def create_test_files diff --git a/railties/lib/rails/generators/rails/app/templates/script/about.tt b/railties/lib/rails/generators/rails/app/templates/script/about similarity index 91% rename from railties/lib/rails/generators/rails/app/templates/script/about.tt rename to railties/lib/rails/generators/rails/app/templates/script/about index 7639d4040f..93fd007649 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/about.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/about @@ -1,4 +1,3 @@ -<%= shebang %> require File.expand_path('../../config/environment', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'rails/commands/about' diff --git a/railties/lib/rails/generators/rails/app/templates/script/console.tt b/railties/lib/rails/generators/rails/app/templates/script/console similarity index 86% rename from railties/lib/rails/generators/rails/app/templates/script/console.tt rename to railties/lib/rails/generators/rails/app/templates/script/console index 1cd2eb8b53..20aa799d2f 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/console.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/console @@ -1,3 +1,2 @@ -<%= shebang %> require File.expand_path('../../config/application', __FILE__) require 'rails/commands/console' diff --git a/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt b/railties/lib/rails/generators/rails/app/templates/script/dbconsole similarity index 86% rename from railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt rename to railties/lib/rails/generators/rails/app/templates/script/dbconsole index 94beb13715..e6a1c59394 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/dbconsole @@ -1,3 +1,2 @@ -<%= shebang %> require File.expand_path('../../config/application', __FILE__) require 'rails/commands/dbconsole' diff --git a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt b/railties/lib/rails/generators/rails/app/templates/script/destroy similarity index 57% rename from railties/lib/rails/generators/rails/app/templates/script/destroy.tt rename to railties/lib/rails/generators/rails/app/templates/script/destroy index 6adc90b2c3..adfa8e8426 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/destroy @@ -1,5 +1,2 @@ -<%= shebang %> require File.expand_path('../../config/environment', __FILE__) -require 'rails/generators' -Rails::Generators.configure! require 'rails/commands/destroy' diff --git a/railties/lib/rails/generators/rails/app/templates/script/generate.tt b/railties/lib/rails/generators/rails/app/templates/script/generate similarity index 57% rename from railties/lib/rails/generators/rails/app/templates/script/generate.tt rename to railties/lib/rails/generators/rails/app/templates/script/generate index 71d47dec92..6fb8ad0395 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/generate.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/generate @@ -1,5 +1,2 @@ -<%= shebang %> require File.expand_path('../../config/environment', __FILE__) -require 'rails/generators' -Rails::Generators.configure! require 'rails/commands/generate' diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt b/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker similarity index 88% rename from railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt rename to railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker index 9ebc4c92fc..9647d8f10a 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker @@ -1,3 +1,2 @@ -<%= shebang %> require File.expand_path('../../../config/environment', __FILE__) require 'rails/commands/performance/benchmarker' diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt b/railties/lib/rails/generators/rails/app/templates/script/performance/profiler similarity index 88% rename from railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt rename to railties/lib/rails/generators/rails/app/templates/script/performance/profiler index 5f4c763f9d..a5822042d2 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/performance/profiler @@ -1,3 +1,2 @@ -<%= shebang %> require File.expand_path('../../../config/environment', __FILE__) require 'rails/commands/performance/profiler' diff --git a/railties/lib/rails/generators/rails/app/templates/script/plugin.tt b/railties/lib/rails/generators/rails/app/templates/script/plugin similarity index 86% rename from railties/lib/rails/generators/rails/app/templates/script/plugin.tt rename to railties/lib/rails/generators/rails/app/templates/script/plugin index 4a335ee33c..1f1af6c880 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/plugin.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/plugin @@ -1,3 +1,2 @@ -<%= shebang %> require File.expand_path('../../config/application', __FILE__) require 'rails/commands/plugin' diff --git a/railties/lib/rails/generators/rails/app/templates/script/runner.tt b/railties/lib/rails/generators/rails/app/templates/script/runner similarity index 86% rename from railties/lib/rails/generators/rails/app/templates/script/runner.tt rename to railties/lib/rails/generators/rails/app/templates/script/runner index 34ad7c18eb..7a70828e90 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/runner.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/runner @@ -1,3 +1,2 @@ -<%= shebang %> require File.expand_path('../../config/environment', __FILE__) require 'rails/commands/runner' diff --git a/railties/lib/rails/generators/rails/app/templates/script/server.tt b/railties/lib/rails/generators/rails/app/templates/script/server similarity index 86% rename from railties/lib/rails/generators/rails/app/templates/script/server.tt rename to railties/lib/rails/generators/rails/app/templates/script/server index 932e72ea58..a7aaee2953 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/server.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/server @@ -1,3 +1,2 @@ -<%= shebang %> require File.expand_path('../../config/application', __FILE__) require 'rails/commands/server'