diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-29 12:33:48 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-29 12:33:48 +0000 |
commit | d219d54930a68a9c5de3705d05d5d464e5e51b54 (patch) | |
tree | 4544f6d4dfa28de85ddf35032d9eccf1d4d49729 /railties/lib | |
parent | 0a0ac868453e9d8d9ee1dac6a7eb274772235b05 (diff) | |
download | rails-d219d54930a68a9c5de3705d05d5d464e5e51b54.tar.gz rails-d219d54930a68a9c5de3705d05d5d464e5e51b54.tar.bz2 rails-d219d54930a68a9c5de3705d05d5d464e5e51b54.zip |
Clean up the act of commands
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2412 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/commands.rb | 8 | ||||
-rw-r--r-- | railties/lib/commands/breakpointer | 3 | ||||
-rw-r--r-- | railties/lib/commands/breakpointer.rb | 1 | ||||
-rw-r--r-- | railties/lib/commands/console.rb | 2 | ||||
-rw-r--r-- | railties/lib/commands/destroy.rb (renamed from railties/lib/commands/destroy) | 3 | ||||
-rwxr-xr-x | railties/lib/commands/generate.rb (renamed from railties/lib/commands/generate) | 3 | ||||
-rw-r--r-- | railties/lib/commands/server.rb | 4 | ||||
-rw-r--r-- | railties/lib/commands/update.rb (renamed from railties/lib/commands/update) | 3 |
8 files changed, 12 insertions, 15 deletions
diff --git a/railties/lib/commands.rb b/railties/lib/commands.rb index 2ca8741e4c..cf7716fc83 100644 --- a/railties/lib/commands.rb +++ b/railties/lib/commands.rb @@ -1,5 +1,7 @@ -if %w( console perform process runner server ).include?(ARGV.first) - require "#{File.dirname(__FILE__)}/process/#{ARGV.shift}" +commands = Dir["#{File.dirname(__FILE__)}/commands/*.rb"].collect { |file_path| File.basename(file_path).split(".").first } + +if commands.include?(ARGV.first) + require "#{File.dirname(__FILE__)}/commands/#{ARGV.shift}" else - puts "Choose: console perform process runner server" + puts "Choose: #{commands.join(", ")}" end
\ No newline at end of file diff --git a/railties/lib/commands/breakpointer b/railties/lib/commands/breakpointer deleted file mode 100644 index 4ac3e7c3c9..0000000000 --- a/railties/lib/commands/breakpointer +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/local/bin/ruby -$LOAD_PATH << File.dirname(__FILE__) + '/../vendor/railties/lib' -require 'breakpoint_client' diff --git a/railties/lib/commands/breakpointer.rb b/railties/lib/commands/breakpointer.rb new file mode 100644 index 0000000000..cc52010c32 --- /dev/null +++ b/railties/lib/commands/breakpointer.rb @@ -0,0 +1 @@ +require 'breakpoint_client' diff --git a/railties/lib/commands/console.rb b/railties/lib/commands/console.rb index b8756ba3a1..0aed60152c 100644 --- a/railties/lib/commands/console.rb +++ b/railties/lib/commands/console.rb @@ -9,7 +9,7 @@ OptionParser.new do |opt| end libs = " -r irb/completion" -libs << " -r #{File.dirname(__FILE__)}/../config/environment" +libs << " -r #{RAILS_ROOT}/config/environment" libs << " -r console_sandbox" if options[:sandbox] ENV['RAILS_ENV'] = ARGV.first || 'development' diff --git a/railties/lib/commands/destroy b/railties/lib/commands/destroy.rb index f9d9d181a4..f4b81d6511 100644 --- a/railties/lib/commands/destroy +++ b/railties/lib/commands/destroy.rb @@ -1,5 +1,4 @@ -#!/usr/local/bin/ruby -require File.dirname(__FILE__) + '/../config/environment' +require "#{RAILS_ROOT}/config/environment" require 'rails_generator' require 'rails_generator/scripts/destroy' diff --git a/railties/lib/commands/generate b/railties/lib/commands/generate.rb index 43bcfd0cb1..3d3db3d856 100755 --- a/railties/lib/commands/generate +++ b/railties/lib/commands/generate.rb @@ -1,5 +1,4 @@ -#!/usr/local/bin/ruby -require File.dirname(__FILE__) + '/../config/environment' +require "#{RAILS_ROOT}/config/environment" require 'rails_generator' require 'rails_generator/scripts/generate' diff --git a/railties/lib/commands/server.rb b/railties/lib/commands/server.rb index 5330c050b9..d21e91f980 100644 --- a/railties/lib/commands/server.rb +++ b/railties/lib/commands/server.rb @@ -5,7 +5,7 @@ OPTIONS = { :port => 3000, :ip => "0.0.0.0", :environment => "development", - :server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"), + :server_root => File.expand_path(RAILS_ROOT + "/public/"), :server_type => WEBrick::SimpleServer, :charset => "UTF-8", :mime_types => WEBrick::HTTPUtils::DefaultMimeTypes @@ -47,7 +47,7 @@ ARGV.options do |opts| end ENV["RAILS_ENV"] = OPTIONS[:environment] -require File.dirname(__FILE__) + "/../config/environment" +require RAILS_ROOT + "/config/environment" require 'webrick_server' OPTIONS['working_directory'] = File.expand_path(RAILS_ROOT) diff --git a/railties/lib/commands/update b/railties/lib/commands/update.rb index 430d325b07..83ef833300 100644 --- a/railties/lib/commands/update +++ b/railties/lib/commands/update.rb @@ -1,5 +1,4 @@ -#!/usr/local/bin/ruby -require File.dirname(__FILE__) + '/../config/environment' +require "#{RAILS_ROOT}/config/environment" require 'rails_generator' require 'rails_generator/scripts/update' Rails::Generator::Scripts::Update.new.run(ARGV) |