Module: DeploYML::Frameworks::Rails

Defined in:
lib/deployml/frameworks/rails.rb

Overview

Provides methods for deploying Rails projects.

Instance Method Summary collapse

Instance Method Details

#migrate(shell) ⇒ Object

Migrates the database using the db:autoupgrade if DataMapper is being used, or the typical db:migrate task.

Parameters:



27
28
29
30
31
32
33
34
35
36
37
38
# 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) ⇒ Object

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

See Also:

  • DeploYML::Frameworks::Rails.{Environment{Environment#rake}


13
14
15
16
17
# File 'lib/deployml/frameworks/rails.rb', line 13

def rake(task,*arguments)
  arguments += ["RAILS_ENV=#{@environment}"]

  super(task,*arguments)
end