From a9f34eaa0f07a56a2de674cb5ec604a722e67310 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 6 Oct 2005 02:05:36 +0000 Subject: Backed out of script/run portal idea. Muscle memory too deep git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2469 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 2 -- railties/Rakefile | 4 ++-- railties/bin/breakpointer | 3 +++ railties/bin/console | 3 +++ railties/bin/destroy | 3 +++ railties/bin/generate | 3 +++ railties/bin/perform | 3 +++ railties/bin/process | 3 +++ railties/bin/run | 3 --- railties/bin/runner | 3 +++ railties/bin/server | 3 +++ railties/lib/commands.rb | 10 ++++++++++ railties/lib/commands/perform.rb | 2 +- railties/lib/commands/process/reaper.rb | 7 +++---- .../generators/applications/app/app_generator.rb | 5 ++++- 15 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 railties/bin/breakpointer create mode 100644 railties/bin/console create mode 100644 railties/bin/destroy create mode 100644 railties/bin/generate create mode 100644 railties/bin/perform create mode 100644 railties/bin/process delete mode 100755 railties/bin/run create mode 100644 railties/bin/runner create mode 100644 railties/bin/server (limited to 'railties') diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 39fb889f52..720ac08fd9 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -2,8 +2,6 @@ * Add experimental plugin support #2335 -* Removed all the scripts in script/* and replaced it with one generic portal: script/run - * Made Rakefile aware of new .js files in script.aculo.us [Thomas Fuchs] * Make table_name and controller_name in generators honor AR::Base.pluralize_table_names. #1216 #2213 [kazuhiko@fdiary.net] diff --git a/railties/Rakefile b/railties/Rakefile index b46666e440..03ebb18de8 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -26,7 +26,7 @@ RUBY_FORGE_USER = "webster132" # end -BASE_DIRS = %w( app config/environments components db doc log lib lib/tasks public script test vendor ) +BASE_DIRS = %w( app config/environments components db doc log lib lib/tasks public script test vendor vendor/plugins ) APP_DIRS = %w( apis models controllers helpers views views/layouts ) PUBLIC_DIRS = %w( images javascripts stylesheets ) TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/test ) @@ -36,7 +36,7 @@ HTML_FILES = %w( 404.html 500.html index.html robots.txt favicon.ico javascripts/prototype.js javascripts/scriptaculous.js javascripts/effects.js javascripts/dragdrop.js javascripts/controls.js javascripts/util.js javascripts/slider.js ) -BIN_FILES = %w( run ) +BIN_FILES = %w( breakpointer console destroy generate perform process run runner server ) VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport actionwebservice railties ) diff --git a/railties/bin/breakpointer b/railties/bin/breakpointer new file mode 100644 index 0000000000..2918f8c152 --- /dev/null +++ b/railties/bin/breakpointer @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/breakpointer' \ No newline at end of file diff --git a/railties/bin/console b/railties/bin/console new file mode 100644 index 0000000000..f2143e5719 --- /dev/null +++ b/railties/bin/console @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/console' \ No newline at end of file diff --git a/railties/bin/destroy b/railties/bin/destroy new file mode 100644 index 0000000000..c2799bd20d --- /dev/null +++ b/railties/bin/destroy @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/destroy' \ No newline at end of file diff --git a/railties/bin/generate b/railties/bin/generate new file mode 100644 index 0000000000..d8a1599870 --- /dev/null +++ b/railties/bin/generate @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/generate' \ No newline at end of file diff --git a/railties/bin/perform b/railties/bin/perform new file mode 100644 index 0000000000..5eb8ab0f87 --- /dev/null +++ b/railties/bin/perform @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/perform' \ No newline at end of file diff --git a/railties/bin/process b/railties/bin/process new file mode 100644 index 0000000000..13df54f90f --- /dev/null +++ b/railties/bin/process @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/process' \ No newline at end of file diff --git a/railties/bin/run b/railties/bin/run deleted file mode 100755 index 5490bc9336..0000000000 --- a/railties/bin/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/local/bin/ruby -require File.dirname(__FILE__) + '/../config/boot' -require "commands" \ No newline at end of file diff --git a/railties/bin/runner b/railties/bin/runner new file mode 100644 index 0000000000..cd2496d6a0 --- /dev/null +++ b/railties/bin/runner @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/runner' \ No newline at end of file diff --git a/railties/bin/server b/railties/bin/server new file mode 100644 index 0000000000..59d8259788 --- /dev/null +++ b/railties/bin/server @@ -0,0 +1,3 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/boot' +require 'commands/server' \ No newline at end of file diff --git a/railties/lib/commands.rb b/railties/lib/commands.rb index cf7716fc83..841e98a0dc 100644 --- a/railties/lib/commands.rb +++ b/railties/lib/commands.rb @@ -3,5 +3,15 @@ commands = Dir["#{File.dirname(__FILE__)}/commands/*.rb"].collect { |file_path| if commands.include?(ARGV.first) require "#{File.dirname(__FILE__)}/commands/#{ARGV.shift}" else + puts <<-USAGE +The 'run' provides a unified access point for all the default Rails' commands. + +Usage: ./script/run [OPTIONS] + +Examples: + ./script/run generate controller Admin + ./script/run process reaper + +USAGE puts "Choose: #{commands.join(", ")}" end \ No newline at end of file diff --git a/railties/lib/commands/perform.rb b/railties/lib/commands/perform.rb index ae45e7e633..6c09565896 100644 --- a/railties/lib/commands/perform.rb +++ b/railties/lib/commands/perform.rb @@ -1,5 +1,5 @@ if %w( benchmarker profiler ).include?(ARGV.first) require "#{File.dirname(__FILE__)}/process/#{ARGV.shift}" else - puts "Choose either reaper, spawner, or spinner" + puts "Choose either benchmarker or profiler" end \ No newline at end of file diff --git a/railties/lib/commands/process/reaper.rb b/railties/lib/commands/process/reaper.rb index 27c05ed5ce..b5b82c310f 100644 --- a/railties/lib/commands/process/reaper.rb +++ b/railties/lib/commands/process/reaper.rb @@ -77,19 +77,18 @@ ARGV.options do |opts| opts.on <<-EOF Description: - The reaper is used to reload, gracefully exit, and forcefully exit FCGI processes + The reaper is used to restart, reload, gracefully exit, and forcefully exit FCGI processes running a Rails Dispatcher. This is commonly done when a new version of the application is available, so the existing processes can be updated to use the latest code. The reaper actions are: + * restart : Restarts the application by reloading both application and framework code * reload : Only reloads the application, but not the framework (like the development environment) * graceful: Marks all of the processes for exit after the next request * kill : Forcefully exists all processes regardless of whether they're currently serving a request - Graceful exist is the most common and default action. But since the processes won't exist until after - their next request, it's often necessary to ensure that such a request occurs right after they've been - marked. That's what nudging is for. + Restart is the most common and default action. A nudge is simply a request to a URL where the dispatcher is serving. You should perform one nudge per FCGI process you have running if they're setup in a round-robin. Be sure to do one nudge per FCGI process diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb index 1d5a864de4..4934379669 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -44,7 +44,9 @@ class AppGenerator < Rails::Generator::Base m.file "environments/test.rb", "config/environments/test.rb" # Scripts - m.file "bin/run", "script/run", script_options + %w( breakpointer console destroy generate perform process run runner server ).each do |file| + m.file "bin/#{file}", "script/#{file}", script_options + end # Dispatches m.file "dispatches/dispatch.rb", "public/dispatch.rb", script_options @@ -117,5 +119,6 @@ class AppGenerator < Rails::Generator::Base test/mocks/test test/unit vendor + vendor/plugins ) end -- cgit v1.2.3