Sha256: 354df356efb9826886a05dbd18dee05aacda266ea30ecceaa2baa9a920e0eff3

Contents?: true

Size: 698 Bytes

Versions: 2

Compression:

Stored size: 698 Bytes

Contents

module Hanzo
  class Deploy < Base

  protected

    def initialize_variables
      @env = extract_argument(1)
    end

    def initialize_cli
      initialize_help and return if @env.nil?

      deploy
      run_migrations
    end

    def initialize_help
      @options.banner = "Usage: hanzo deploy ENVIRONMENT"
    end

    def deploy
      branch = ask("-----> Branch to deploy in #{@env}: ") { |q| q.default = "HEAD" }

      `git push -f #{@env} #{branch}:master`
    end

    def run_migrations
      if Dir.exists?('db/migrate')
        migration = agree("-----> Run migrations? ")
        `bundle exec heroku run rake db:migrate --remote #{@env}` if migration
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanzo-0.1.2 lib/hanzo/modules/deploy.rb
hanzo-0.1.0 lib/hanzo/modules/deploy.rb