diff options
author | José Valim <jose.valim@gmail.com> | 2009-11-06 23:40:18 -0200 |
---|---|---|
committer | Yehuda Katz <wycats@mobile-166-129-219-135.mycingular.net> | 2009-11-08 18:41:44 -0800 |
commit | 51fe6d05e73a4e0f8481f4e441f4ca886d65a69c (patch) | |
tree | 1fe3d51b389b8bf0e66fb790e5e5e7f3d6f59455 | |
parent | 216e8c6bfad6800f5f2a772d40cab29442efdaf5 (diff) | |
download | rails-51fe6d05e73a4e0f8481f4e441f4ca886d65a69c.tar.gz rails-51fe6d05e73a4e0f8481f4e441f4ca886d65a69c.tar.bz2 rails-51fe6d05e73a4e0f8481f4e441f4ca886d65a69c.zip |
Refactor generators a little bit.
Signed-off-by: Yehuda Katz <wycats@mobile-166-129-219-135.mycingular.net>
-rw-r--r-- | railties/lib/rails/commands/destroy.rb | 3 | ||||
-rwxr-xr-x | railties/lib/rails/commands/generate.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 6 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/about (renamed from railties/lib/rails/generators/rails/app/templates/script/about.tt) | 1 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/console (renamed from railties/lib/rails/generators/rails/app/templates/script/console.tt) | 1 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/dbconsole (renamed from railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt) | 1 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/destroy (renamed from railties/lib/rails/generators/rails/app/templates/script/destroy.tt) | 3 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/generate (renamed from railties/lib/rails/generators/rails/app/templates/script/generate.tt) | 3 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker (renamed from railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt) | 1 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/performance/profiler (renamed from railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt) | 1 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/plugin (renamed from railties/lib/rails/generators/rails/app/templates/script/plugin.tt) | 1 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/runner (renamed from railties/lib/rails/generators/rails/app/templates/script/runner.tt) | 1 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/script/server (renamed from railties/lib/rails/generators/rails/app/templates/script/server.tt) | 1 |
13 files changed, 10 insertions, 16 deletions
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 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 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 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 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 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 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 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 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 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 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' |