Skip to content

Instantly share code, notes, and snippets.

@davidlee
Created March 14, 2009 10:35
Show Gist options
  • Save davidlee/79041 to your computer and use it in GitHub Desktop.
Save davidlee/79041 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# bin/console.rb
# a nice little ruby console for your Sinatra app
ENV["RACK_ENV"] ||= ( ARGV[0] || 'development' )
this_file = File.expand_path( __FILE__ )
app_file = File.expand_path( File.join( File.dirname( __FILE__), '../app' ))
cmd = "irb -r #{ this_file } -r irb/completion --simple-prompt"
if __FILE__ == $0
system( cmd )
else
require app_file
@app = App.new
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment