AwesomeRailsConsole
This gem was inspired by Using pry in production, jazz_hands and jazz_fingers.
The pros of AwesomeRailsConsole are:
- Less gem dependances (Require infrequent used gems only when you want it)
- Simpler prompt modification (More like the default pry prompt you're familiar with)
- No configurable options at all (You don't need to worry about configuration)
If you really want to do a lot of customization. You may consider just editing your
Gemfile
,.pryrc
andconfig/initializers/pry.rb
. Or fork this project.
Features
Show Rails env and project name in the prompt
Prevents you from accidentally changing production data to the wrong project.
Beautiful formatting with pry and awesome_print
Make it easy to read. Reduce the pain while debugging.
# Try following statements in rails console:
[:apple, :orange, :banana]
{ a: 1, b: 2, c: 3 }
1.methods
(1..100).to_a
ap (1..100).to_a, limit: 5
Print ascii table with Hirb
Helpful for exporting a set of records for documenting.
This only works in development and test mode.
extend Hirb::Console # include the `table` statement
Hirb::View.resize # resize to your terminal window size
table [1, 2, 3]
table User.last(3), markdown: true
More
This gem depends on following gems. Thus you can use all functionalities they provide.
- pry-rails
- pry-debugger / pry-byebug (depending on your ruby version)
- pry-stack_explorer
- awesome_print
- hirb
- hirb-unicode
Installation
Add this line to your application's Gemfile:
gem 'awesome_rails_console'
And then execute:
$ bundle
And restart your rails console.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
- Fork it ( https://github.com/ascendbruce/awesome_rails_console/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request