Sha256: f04b6ad7c3a9548fe227060a1d1a1c83679aba1fd5432f87bfd77ca13ec42132

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

module DeploYML
  module Frameworks
    #
    # Provides methods for deploying Rails projects.
    #
    module Rails
      #
      # Overrides the default `rake` method to add a `RAILS_ENV`
      # environment variable.
      #
      # @see {Environment#rake}
      #
      def rake(task,*arguments)
        arguments += ["RAILS_ENV=#{@environment}"]

        super(task,*arguments)
      end

      #
      # Migrates the database using the `db:autoupgrade` if
      # [DataMapper](http://datamapper.org) is being used, or the typical
      # `db:migrate` task.
      #
      # @param [LocalShell, RemoteShell] shell
      #   The shell to execute commands in.
      #
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deployml-0.5.4 lib/deployml/frameworks/rails.rb
deployml-0.5.2 lib/deployml/frameworks/rails.rb