module DeploYML::Frameworks::Rails

Provides methods for deploying Rails projects.

Public Instance Methods

migrate(shell) click to toggle source

Migrates the database using the `db:autoupgrade` if [DataMapper](datamapper.org) is being used, or the typical `db:migrate` task.

@param [LocalShell, RemoteShell] shell

The shell to execute commands in.
# File lib/deployml/frameworks/rails.rb, line 27
def migrate(shell)
  case @orm
  when :datamapper
    shell.status "Running DataMapper auto-upgrades ..."
    shell.ruby 'rake', 'db:autoupgrade', "RAILS_ENV=#{@environment}"
  else
    shell.status "Running ActiveRecord migrations ..."
    shell.ruby 'rake', 'db:migrate', "RAILS_ENV=#{@environment}"
  end

  shell.status "Database migrated."
end
rake(task,*arguments) click to toggle source

Overrides the default `rake` method to add a `RAILS_ENV` environment variable.

@see {Environment#rake}

Calls superclass method
# File lib/deployml/frameworks/rails.rb, line 13
def rake(task,*arguments)
  arguments += ["RAILS_ENV=#{@environment}"]

  super(task,*arguments)
end