A collection of useful tools used at Ten Forward Consulting
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install jefferies_tube
JefferiesTube by default installs a catchall route that will render 404 for you and supress the rollbar error. This also allows you to create super easy custom error pages.
Simple put a template in the parent app in
app/views/errors/404.haml (or html or erb, etc) and it will be rendered instead of the default Jefferies tube error.
In progress -- not sure if this is super useful.
Capture a database backup
Load most recent database backup. Can specify location of backup with
Add this line last in your Capfile (it depends on rails/migrations and cap/deploy)
cap beta ssh
Open ssh session in
cap beta rails:console
Open rails console.
cap beta rails:dbconsole
Open database console.
cap beta rails:log
Open log file. Can specify log file like so:
LOG=foobar cap beta rails:log
cap beta db:backup
Make a database backup.
cap beta db:fetch
Fetches the latest database backup. Useful for getting production data locally.
cap beta db:restore FILE=path/to/backup.dump
Nuke the server's database with one you give it. Don't do this on production for obvious reasons. Useful for putting a backup fetched from production onto a dev server.
cap beta deploy:ensure_tag
Yells at you if there is not a tag for your code.
cap beta deploy:create_tag
Creates a tag for your code and pushes it.
To enforce that you tagged the code before deploying, inside
before 'deploy', 'deploy:ensure_tag'
To automatically tag the code that is about to be released (lazy programmer solution), inside
before 'deploy', 'deploy:create_tag'
Enable/Disable Maintence Mode
cap production maintenance:enable MESSAGE="Site is down for maintenance, should be back shortly." cap production maintenance:disable
JefferiesTube has backup functionality. To use it, add something like this to your
every 1.day, at: '12am' do rake 'db:backup' end
For hourly backups:
every :hour do rake 'db:backup:hourly' end
Or for daily backups:
every :day do rake 'db:backup:daily' end
To get compass reset and box-sizing border-box to all elements:
# app/assets/stylesheets/application.sass @import jefferies_tube
When developing the apps against your local machine, it is useful to override some of the config settings to get ngrok to work.
You can create
config/environments/my.development.rb and put something like the following in it:
Rails.application.configure do config.middleware.use "SomeLocalThing" config.action_mailer.asset_host = "test.ngrok.io" # Anything else in development.rb that you don't want to commit end
If you do this, don't forget to add
my.development.rb to the gitignore file.
- Fork it ( http://github.com//jefferies_tube/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 new Pull Request