Sha256: 1d05456dba3e366e2e540a23f0262bc84d5b2326ab8004e9e6b1179dd9ec2976

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

module DPL
  class Provider
    class Openshift < Provider
      requires 'rhc'

      def api
        @api ||= ::RHC::Rest::Client.new(:user => option(:user), :password => option(:password), :server => 'openshift.redhat.com')
      end

      def user
        @user ||= api.user.login
      end

      def app
        @app ||= api.find_application(option(:domain), option(:app))
      end

      def check_auth
        log "authenticated as %s" % user
      end

      def check_app
        log "found app #{app.name}"
      end

      def setup_key(file, type = nil)
        specified_type, content, comment = File.read(file).split
        api.add_key(option(:key_name), content, type || specified_type)
      end

      def remove_key
        api.delete_key(option(:key_name))
      end

      def push_app
        if app.deployment_branch
          context.shell "rhc app configure #{app.name} --deployment-branch #{app.deployment_branch}"
          context.shell "git push #{app.git_url} -f #{app.deployment_branch}"
        else
          context.shell "git push #{app.git_url} -f"
        end
      end

      def restart
        app.restart
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dpl-1.6.1.travis.449.1 lib/dpl/provider/openshift.rb
dpl-1.6.1.travis.447.1 lib/dpl/provider/openshift.rb
dpl-1.6.0 lib/dpl/provider/openshift.rb
dpl-1.5.11.travis.445.1 lib/dpl/provider/openshift.rb
dpl-1.5.11.travis.437.1 lib/dpl/provider/openshift.rb
dpl-1.5.11.travis.436.1 lib/dpl/provider/openshift.rb
dpl-1.5.11.travis.435.1 lib/dpl/provider/openshift.rb
dpl-1.5.11.travis.432.1 lib/dpl/provider/openshift.rb