github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jbarnette / deeby

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 9
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (1)
    • v1.0.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Tasks to switch your database configuration for a single Rake run. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Prep for v1.0.0. 
jbarnette (author)
Fri Oct 02 12:13:20 -0700 2009
commit  207a537197f9c51d0885058395c4f9cb6e5f0cde
tree    49ec0002e5892f5d19713a99b5b56cc46a451ae7
parent  27b835bb961c8cfb83f2eadebb97362d05952bd8
deeby /
name age
history
message
file .gitignore Loading commit data...
file CHANGELOG.rdoc
file Manifest.txt
file README.rdoc
file Rakefile
directory lib/
README.rdoc

Deeby

  • github.com/jbarnette/deeby

Description

Tasks to switch your Rails database configuration for a single Rake run. Useful when you’re targeting more than one database engine.

I use this for Rails, but it should work in any framework that uses a config/database.yml file.

Examples

Create a database.[DB].yml file for each extra DB setup you might want to use. For example:

    $ ls config/database.*.yml
    config/database.pg.yml
    config/database.sqlite.yml

These files look remarkably similar to database.yml, they’re just written for a different DB engine. Deeby looks for files that match this pattern and generates prefix Rake tasks for each alternative DB file you’ve created.

For the example above, Deeby will generate tasks called db:pg and db:sqlite. These tasks swap out database.yml for the scope of the Rake run and restore it when you’re finished.

Let’s say you develop on MySQL by default, but you’re also deploying (or transitioning) to Postgres. Once you’ve written database.pg.yml, here’s how it works out:

    # runs the tests against your normal setup (MySQL)
    $ rake test

    # runs the tests against your Postgres setup
    $ rake db:pg test

…and things are back to normal afterward. Don’t forget to run db:create and db:reset (or whatever) with the prefix task when you’re setting things up initially:

    # new Postgres setup
    $ rake db:pg db:create db:reset

Installation

    $ gem install deeby

    # in your Rakefile
    require "deeby"

License

Copyright 2009 John Barnette (jbarnette@rubyforge.org)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server