Sha256: 8aa8680ae74a8fcefced3801cf4f322709b99d4f492b34b8daf98c76176e4ab8

Contents?: true

Size: 1.15 KB

Versions: 12

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Dpl
  module Providers
    class Heroku
      class Git < Heroku
        register :'heroku:git'

        status :alpha

        full_name 'Heroku Git'

        description sq(<<-STR)
          tbd
        STR

        required :api_key, %i[username password]

        opt '--api_key KEY',   'Heroku API key', secret: true
        opt '--username USER', 'Heroku username', alias: :user
        opt '--password PASS', 'Heroku password', secret: true
        opt '--git URL', 'Heroku Git remote URL'

        needs :git, :git_http_user_agent

        cmds fetch: 'git fetch origin $TRAVIS_BRANCH --unshallow',
             push: 'git push %{remote} HEAD:refs/heads/master -f'

        def prepare
          write_netrc if write_netrc?
        end

        def deploy
          shell :fetch, assert: false
          shell :push
        end

        private

        def remote
          git || "https://git.heroku.com/#{app}.git"
        end

        def write_netrc?
          remote.start_with?('https://')
        end

        def write_netrc
          super('git.heroku.com', email, api_key || password)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
dpl-2.0.5.3 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.3.beta.1 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.2 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.2.beta.1 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.1 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.beta.2.1 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.beta.2 lib/dpl/providers/heroku/git.rb
dpl-2.0.5 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.beta.1 lib/dpl/providers/heroku/git.rb
dpl-2.0.5.beta lib/dpl/providers/heroku/git.rb
travis_dpl_test-2.0.3.beta.4.ror.1 lib/dpl/providers/heroku/git.rb
travis_dpl_test-2.0.3.beta.4.ror lib/dpl/providers/heroku/git.rb