Sha256: b2900de8e043e1325f1dcc6ef0048c57d2603abdb693eaa9d44a41dc1c6d562f

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 KB

Contents

module Dpl
  module Providers
    class Gleis < Provider
      status :alpha

      description sq(<<-str)
        tbd
      str

      gem 'gleis', '~> 0.6.0'

      env :gleis

      opt '--app APP',       'Gleis application to upload to', default: :repo_name
      opt '--username NAME', 'Gleis username', required: true
      opt '--password PASS', 'Gleis password', required: true, secret: true
      opt '--key_name NAME', 'Name of the SSH deploy key pushed to Gleis', default: 'dpl_deploy_key'
      opt '--verbose'

      needs :ssh_key

      cmds login:      'gleis auth login %{username} %{password} --skip-keygen',
           logout:     'gleis auth logout',
           validate:   'gleis app status -a %{app}',
           add_key:    'gleis auth key add %{file} %{key_name}',
           remove_key: 'gleis auth key remove %{key_name}',
           git_url:    'gleis app git -a %{app} -q',
           deploy:     'git push %{push_opts} -f %{git_url} HEAD:refs/heads/master'

      errs login:      'Login failed',
           validate:   'Application not found',
           add_key:    'Adding SSH key failed',
           remove_key: 'Removing key failed',
           git_url:    'Failed to retrieve Git URL',
           deploy:     'Deploying application failed'

      attr_reader :git_url

      def login
        shell :login
      end

      def setup
        @git_url = shell :git_url, capture: true
      end

      def validate
        shell :validate
      end

      def add_key(file)
        shell :add_key, file: file
      end

      def deploy
        shell :deploy
      end

      def remove_key
        shell :remove_key
      end

      private

        def push_opts
          '-v' if verbose?
        end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dpl-2.0.0.alpha.14 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.13 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.12 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.11 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.10 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.9 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.8 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.7 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.6 lib/dpl/providers/gleis.rb
dpl-2.0.0.alpha.5 lib/dpl/providers/gleis.rb