aboutsummaryrefslogtreecommitdiffstats
path: root/railties/bin/envcon
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-06 18:18:29 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-06 18:18:29 +0000
commit0366e6a614ba8922267572192a49892df8a4ec6b (patch)
treea46fccac6af9f3e486555c8e299af734540e9382 /railties/bin/envcon
parent6c975dc6432ba3edefa1b8f4a30cfba6d23ce9d4 (diff)
downloadrails-0366e6a614ba8922267572192a49892df8a4ec6b.tar.gz
rails-0366e6a614ba8922267572192a49892df8a4ec6b.tar.bz2
rails-0366e6a614ba8922267572192a49892df8a4ec6b.zip
Added an easier way of starting a IRB session on the environment
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@48 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/bin/envcon')
-rw-r--r--railties/bin/envcon30
1 files changed, 30 insertions, 0 deletions
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