aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/Rakefile4
-rw-r--r--railties/bin/envcon30
2 files changed, 32 insertions, 2 deletions
diff --git a/railties/Rakefile b/railties/Rakefile
index b294cb1feb..92a1bfc765 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -110,8 +110,8 @@ task :copy_dispatches do
cp "dispatches/dispatch.servlet", "#{PKG_DESTINATION}/public/dispatch.servlet"
- cp "dispatches/start_server", "#{PKG_DESTINATION}/start_server"
- chmod 0755, "#{PKG_DESTINATION}/start_server"
+ cp "bin/envcon", "#{PKG_DESTINATION}/script/envcon"
+ chmod 0755, "#{PKG_DESTINATION}/script/envcon"
end
task :copy_html_files do
diff --git a/railties/bin/envcon b/railties/bin/envcon
new file mode 100644
index 0000000000..707d34b985
--- /dev/null
+++ b/railties/bin/envcon
@@ -0,0 +1,30 @@
+#!/usr/local/bin/ruby
+
+if ARGV[0]
+ ENV['RAILS_ENV'] = ARGV[0]
+ puts "Loading environment..."
+ exec "irb -r config/environment.rb -r irb/completion --noinspect"
+else
+ puts <<-HELP
+
+NAME
+ envcon - interact with the domain model through a environment console (on IRB)
+
+SYNOPSIS
+ envcon [environment]
+
+DESCRIPTION
+ Starts an environment console using IRB that lets you manipulate and interrogate
+ the domain model or even trigger controller actions. The database connection and
+ configuration available to the web application is already setup.
+
+ Tab completion is available to see classes and methods on individual objects.
+
+EXAMPLE
+ envcon production
+
+ This will initialize the production environment (as setup in config/database.yml
+ and config/environments/production.rb). You would now be ready to start requiring
+ models using require_dependency.
+HELP
+end \ No newline at end of file