Sha256: 63a3789e6c5f3a98338b53c67f92ce51a219bc5801467d6f7d657f7d855c1da6

Contents?: true

Size: 1.56 KB

Versions: 40

Compression:

Stored size: 1.56 KB

Contents

module DPL
  class Provider
    class Anynines < Provider
      # NOTE: Much of this class is duplicated from CloudFoundry.
      # This is by design. By duplicating a manageable amount of
      # code here, we prevent this provider and its gem `dpl-anynines`
      # from having a dependency on `dpl-cloudfoundry`.
      # Having less dependency is desirable when we install this gem
      # from source.

      def initial_go_tools_install
        context.shell 'test $(uname) = "Linux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
      end

      def check_auth
        initial_go_tools_install
        context.shell "./cf api https://api.aws.ie.a9s.eu"
        context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o #{option(:organization)} -s #{option(:space)}"
      end

      def check_app
        if options[:manifest]
          error 'Application must have a manifest.yml for unattended deployment' unless File.exists? options[:manifest]
        end
      end

      def needs_key?
        false
      end

      def push_app
        error 'Failed to push app' unless context.shell("./cf push#{app_name}#{manifest}")

      ensure
        context.shell "./cf logout"
      end

      def cleanup
      end

      def uncleanup
      end

      def app_name
        options[:app_name].nil? ? "" : " '#{options[:app_name]}'"
      end

      def manifest
        options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
      end

    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
dpl-anynines-1.10.17.travis.6637.6 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.16 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.16.travis.6625.6 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.16.travis.6619.6 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.16.travis.5961.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.15 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.15.travis.5877.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.14 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.13 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.13.travis.4159.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.13.travis.4141.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.13.travis.4040.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.13.travis.4033.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.12 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.12.travis.4032.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.12.travis.3794.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.12.travis.3506.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.11.travis.3504.5 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.11 lib/dpl/provider/anynines.rb
dpl-anynines-1.10.11.travis.3499.5 lib/dpl/provider/anynines.rb