Rda

Description

Rda(Rails Development Assist) is combined with lots of useful rake tasks which can help you to setup your development enviroments and tools more quickly.

Features

  • Setup RVM for your rails application
  • Deploy your rails application to Nginx (rails_env is set to development by default)
  • Release your rails application

Usage

Installation

gem install rda

Or simply add rda to the Gemfile

gem 'rda'

Configuration

For configuring rda, you need to create an initializer for rda:


# config/initializers/rda.rb
Rda.configure do
  nginx_conf_paths ['/etc/nginx', '/opt/nginx/conf', '/usr/local/nginx/conf']
end

Setup RVM

rake rda:rvm:setup

First of all, this task will check whether the RVM is installed. If RVM is installed, it will create a .rvmrc for the application with the content which looks like:


if [[ -s "/path/to/rvm/environments/ruby-1.9.3-p0@app_name" ]]; then
  . "/path/to/rvm/environments/ruby-1.9.3-p0@app_name"
else
  rvm use ruby-1.9.3-p0@app_name --create
fi

If RVM is not installed this task will do nothing but exit.

Discard RVM settings

rake rda:rvm:discard

This task removes the .rvmrc from your rails application.

Setup Nginx

rake rda:nginx:setup

First this task will try to find the config files of Nginx which you have installed from the following paths:

  • /etc/nginx
  • /usr/local/nginx/conf
  • /opt/nginx/conf

You can change the default searching paths by:


Rda.configure { nginx_conf_paths ['/path/to/nginx/conf'] }

Please make sure that you have the write permission of the directory you choosed, or you can run:

sudo rake rda:nginx:setup

If there are more than one paths found, it will give you a choice to decide which one will be used. After choosing a proper path, it will try to create two directories sites-available and sites-enabled to save the configs of rails applications.

  • sites-available saves the configs of the rails applications.
  • sites-enabled saves the link to the rails applications.

Next it will set Nginx to include the configs under sites-enabled. It means that only the applications under sites-enabled will be loaded. And than it will create a config file for your application under sites-available and create a link to the config file under sites-enabled. After all, it will create a local hostname for your application in /etc/hosts.

Discard Nginx settings


rake rda:nginx:discard # Or

sudo rake rda:nginx:discard # Or

rvmsudo rake rda:nginx:discard # Using RVM

This task will clean up all the things created or configured by rda:nginx:setup.

Restart application

rake rda:app:restart

This task touches tmp/restart.txt to restart your rails application, For detail, please visit http://bit.ly/ztKA07

Release your rails application(not yet)

rake rda:app:release

License

This project rocks and uses MIT-LICENSE.