Rails::Infrastructure

Build Status

This gem provides several much needed enhancements to the rails framework

  1. Multi database support and management

  2. Environment management

  3. Version managment

  4. Path managment

  5. Server management

  6. Useful configuration module mixin

  7. Rails configuration constant

Getting Started

# Gemfile
gem 'rails-infrastructure'

Copy examples into config directory

# example layout
config/infrastructure.yml
config/infrastructure/version.yml
config/infrastructure/environment.yml
config/infrastructure/server.yml
config/infrastructure/servers/unicorn.yml.erb
...

Muli Database Support

Infrastructure::Databases

This class provides all the required functions for connecting and working with multiple databases through ActiveRecord. There several rake tasks preconfigured to replace their rails countarparts.

rake database:create[id]            # Create database if it does not exist
rake database:drop[id,force]        # Drop database if exists
rake database:migrate[id,version]   # Migrate database
rake database:reset[id,force]       # Drop, create, then migrate database
rake database:reset:seed[force]     # Reset then seed database
rake database:rollback[id,version]  # Rollback database
rake database:seed[id]              # Seed database
rake databases:create               # Create all databases that dont exist
rake databases:drop[force]          # Drop all databases that exist
rake databases:migrate[version]     # Migrate all databases
rake databases:reset[force]         # Drop, create, migrate all databases
rake databases:reset:seed[force]    # Reset then seed all databases
rake databases:rollback[version]    # Rollback all databases
rake databases:seed[force]          # Seed all databases

Environment Management

Infrastructure::Environment

rake environment:current            # display current environment
rake environment:development        # Change to development environment
rake environment:production         # Change to production environment
rake environment:test               # Change to test environment

Version Management

Infrastructure::Version

rake version:bump:major             # Bump major version
rake version:bump:minor             # Bump minor version
rake version:bump:tiny              # Bump tiny version
rake version:current                # display current version

Server Management

Infrastructure::Server

rake server:unicorn:kill            # Kill unicorn server
rake server:unicorn:restart         # Restart unicorn server
rake server:unicorn:start           # Start unicorn server
rake server:unicorn:stop            # Stop unicorn server
rake server:unicorn:tail            # Tail unicorn server log file

Path Management

Infrastructure::Path