TidyReset

Disclamer

This is written for the Thinknear organization. It is not intended and will not be supported for other projects. Use at your own risk.

Using TidyReset rake tasks

TidyReset expects there to be a heroku app called #your_app_name-#stage where stage is either 'test' or 'sandbox'.

TidyReset will purge the database, push a GIT_REF, reset dynos, reset environment variables, and restart the app server.

See what TidyReset can do

rake -T tidy

Using the gem in your Rails project

Add the gem to your Gemfile

gem 'tidy_reset'

Create a rake task that loads the TidyReset tasks.

# lib/tasks/tidy.rake
load 'tidy_reset/tasks/tidy.rake'

Configure tidy in an initializer

# config/initializers/tidy.rb
TidyReset.configure do |config| 
  config.app = 'myapp'
  config.databases = [ActiveRecord::Base.configurations[Rails.env]]
  config.database_encoding = ActiveRecord::Tasks::PostgreSQLDatabaseTasks::DEFAULT_ENCODING
end

Create default configurations for Heroku dynos size and Heroku enviornment variables. These should be named config/tidy/vars.yml and config/tidy/dynos.yml

# config/tidy/vars.yml
sandbox: 
  MY_HEROKU_VAR: some_value
test:
  MY_HEROKU_VAR: different_for_test
# config/tidy/dynos.yml
sandbox:
  web: 2
test:
  web: 1

Contributing to tidy_reset

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Releasing tidy_reset

# Using the Ruby jeweler
rake version:bump:patch
rake release REMOTE=upstream