aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-20 17:36:23 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-20 17:36:23 +0000
commit2afb8a8cc0e3562d22a5ea31b934e076b5bfe8f6 (patch)
tree44275a8856952ca2bd46ff59033f41c867f5994d /railties
parent16287608bb6836924dc210a62b1c7e70a58ea94c (diff)
downloadrails-2afb8a8cc0e3562d22a5ea31b934e076b5bfe8f6.tar.gz
rails-2afb8a8cc0e3562d22a5ea31b934e076b5bfe8f6.tar.bz2
rails-2afb8a8cc0e3562d22a5ea31b934e076b5bfe8f6.zip
Added script/runner which can be used to run code inside the environment by eval'ing the first parameter
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@939 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG9
-rw-r--r--railties/Rakefile2
-rw-r--r--railties/bin/runner4
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb2
4 files changed, 14 insertions, 3 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index b52ea3b099..97dfd34ce2 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,12 +1,19 @@
*SVN*
+* Added script/runner which can be used to run code inside the environment by eval'ing the first parameter. Examples:
+
+ ./script/runner 'ReminderService.deliver'
+ ./script/runner 'Mailer.receive(STDIN.read)'
+
+ This makes it easier to do CRON and postfix scripts without actually making a script just to trigger 1 line of code.
+
* Fixed webrick_server cookie handling to allow multiple cookes to be set at once #800, #813 [dave@cherryville.org]
* Fixed the Rakefile's interaction with postgresql to:
1. Use PGPASSWORD and PGHOST in the environment to fix prompting for
passwords when connecting to a remote db and local socket connections.
- 2. Added a '-x' flag to pg_dump which stops it dumping privileges #807 [rasputnik]
+ 2. Add a '-x' flag to pg_dump which stops it dumping privileges #807 [rasputnik]
3. Quote the user name and use template0 when dumping so the functions doesn't get dumped too #855 [pburleson]
4. Use the port if available #875 [madrobby]
diff --git a/railties/Rakefile b/railties/Rakefile
index 8de10ed121..1399242205 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -21,7 +21,7 @@ TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/test )
LOG_FILES = %w( server.log development.log test.log production.log )
HTML_FILES = %w( 404.html 500.html index.html favicon.ico )
-BIN_FILES = %w( generate destroy breakpointer console server update )
+BIN_FILES = %w( generate destroy breakpointer console server update runner )
VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport actionwebservice railties )
diff --git a/railties/bin/runner b/railties/bin/runner
new file mode 100644
index 0000000000..acb18f0098
--- /dev/null
+++ b/railties/bin/runner
@@ -0,0 +1,4 @@
+#!/usr/local/bin/ruby
+
+require File.dirname(__FILE__) + '/../config/environment'
+eval(ARGV.first) \ No newline at end of file
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 b0876c1820..3916d6905f 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -47,7 +47,7 @@ class AppGenerator < Rails::Generator::Base
m.file "environments/test.rb", "config/environments/test.rb"
# Scripts
- %w(console console_sandbox.rb destroy generate server).each do |file|
+ %w(console console_sandbox.rb destroy generate server runner).each do |file|
m.file "bin/#{file}", "script/#{file}", script_options
end
if options[:gem]