Permalink
Browse files

Refactor generators a little bit.

Signed-off-by: Yehuda Katz <wycats@mobile-166-129-219-135.mycingular.net>
  • Loading branch information...
1 parent 216e8c6 commit 51fe6d05e73a4e0f8481f4e441f4ca886d65a69c @josevalim josevalim committed with Yehuda Katz Nov 7, 2009
View
3 railties/lib/rails/commands/destroy.rb
@@ -1,3 +1,6 @@
+require 'rails/generators'
+Rails::Generators.configure!
+
if ARGV.size == 0
Rails::Generators.help
exit
View
3 railties/lib/rails/commands/generate.rb
@@ -1,3 +1,6 @@
+require 'rails/generators'
+Rails::Generators.configure!
+
if ARGV.size == 0
Rails::Generators.help
exit
View
6 railties/lib/rails/generators/rails/app/app_generator.rb
@@ -123,8 +123,10 @@ def create_prototype_files
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
View
1 ...ators/rails/app/templates/script/about.tt → ...nerators/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'
View
1 ...ors/rails/app/templates/script/console.tt → ...rators/rails/app/templates/script/console
@@ -1,3 +1,2 @@
-<%= shebang %>
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/console'
View
1 ...s/rails/app/templates/script/dbconsole.tt → ...tors/rails/app/templates/script/dbconsole
@@ -1,3 +1,2 @@
-<%= shebang %>
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/dbconsole'
View
3 ...ors/rails/app/templates/script/destroy.tt → ...rators/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'
View
3 ...rs/rails/app/templates/script/generate.tt → ...ators/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'
View
1 ...mplates/script/performance/benchmarker.tt → .../templates/script/performance/benchmarker
@@ -1,3 +1,2 @@
-<%= shebang %>
require File.expand_path('../../../config/environment', __FILE__)
require 'rails/commands/performance/benchmarker'
View
1 .../templates/script/performance/profiler.tt → ...app/templates/script/performance/profiler
@@ -1,3 +1,2 @@
-<%= shebang %>
require File.expand_path('../../../config/environment', __FILE__)
require 'rails/commands/performance/profiler'
View
1 ...tors/rails/app/templates/script/plugin.tt → ...erators/rails/app/templates/script/plugin
@@ -1,3 +1,2 @@
-<%= shebang %>
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/plugin'
View
1 ...tors/rails/app/templates/script/runner.tt → ...erators/rails/app/templates/script/runner
@@ -1,3 +1,2 @@
-<%= shebang %>
require File.expand_path('../../config/environment', __FILE__)
require 'rails/commands/runner'
View
1 ...tors/rails/app/templates/script/server.tt → ...erators/rails/app/templates/script/server
@@ -1,3 +1,2 @@
-<%= shebang %>
require File.expand_path('../../config/application', __FILE__)
require 'rails/commands/server'

0 comments on commit 51fe6d0

Please sign in to comment.