Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhh committed Dec 6, 2004
1 parent 6c975dc commit 0366e6a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions railties/Rakefile
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions 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

0 comments on commit 0366e6a

Please sign in to comment.