dpl-cloud_foundry 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ae68baabb12aaf3f802a4f0d49f049aa0f60e94c
4
+ data.tar.gz: b8c95821ed78892e45c979806598742f60141123
5
+ SHA512:
6
+ metadata.gz: 1f09cb210b71c8adc5e925ec89a1903f731b35531a9e941afd7fb2f0a7ed308bcef5dfc04ece5a8d037b7258d2c9e277f5de766814e88c6e2e74a4278c434c58
7
+ data.tar.gz: f54c175e1931be81f05c7ab6784d18b248c8d3be0146f3c271e12241e96fffdbbee991570b4799633ba7fb77a29faafc6b289ad622d4732f1711458baf947b48
@@ -0,0 +1,3 @@
1
+ require './gemspec_helper'
2
+
3
+ gemspec_for 'bluemix_cloud_foundry'
@@ -0,0 +1,3 @@
1
+ require './gemspec_helper'
2
+
3
+ gemspec_for 'cloud_foundry'
@@ -0,0 +1,62 @@
1
+ module DPL
2
+ class Provider
3
+ class BluemixCloudFoundry < Provider
4
+
5
+ # NOTE: Much of this class is duplicated from CloudFoundry.
6
+ # This is by design. By duplicating a manageable amount of
7
+ # code here, we prevent this provider and its gem `dpl-bluemix_cloud_foundry`
8
+ # from having a dependency on `dpl-cloudfoundry`.
9
+ # Having less dependency is desirable when we install this gem
10
+ # from source.
11
+
12
+ REGIONS = Hash.new {"api.ng.bluemix.net"}.update(
13
+ "eu-gb" => "api.eu-gb.bluemix.net",
14
+ "eu-de" => "api.eu-de.bluemix.net",
15
+ "au-syd" => "api.au-syd.bluemix.net"
16
+ )
17
+
18
+ def initial_go_tools_install
19
+ context.shell 'test x$TRAVIS_OS_NAME = "xlinux" && 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'
20
+ end
21
+
22
+ def check_auth
23
+ set_api
24
+ initial_go_tools_install
25
+ context.shell "./cf api #{option(:api)} #{'--skip-ssl-validation' if options[:skip_ssl_validation]}"
26
+ context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o #{option(:organization)} -s #{option(:space)}"
27
+ end
28
+
29
+ def check_app
30
+ if options[:manifest]
31
+ error 'Application must have a manifest.yml for unattended deployment' unless File.exists? options[:manifest]
32
+ end
33
+ end
34
+
35
+ def needs_key?
36
+ false
37
+ end
38
+
39
+ def push_app
40
+ error 'Failed to push app' unless context.shell("./cf push#{manifest}")
41
+
42
+ ensure
43
+ context.shell "./cf logout"
44
+ end
45
+
46
+ def cleanup
47
+ end
48
+
49
+ def uncleanup
50
+ end
51
+
52
+ def manifest
53
+ options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
54
+ end
55
+
56
+ def set_api
57
+ region = options[:region] || "ng"
58
+ options[:api] = options[:api] || REGIONS[region]
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,43 @@
1
+ module DPL
2
+ class Provider
3
+ class CloudFoundry < Provider
4
+
5
+ def initial_go_tools_install
6
+ context.shell 'test x$TRAVIS_OS_NAME = "xlinux" && 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'
7
+ end
8
+
9
+ def check_auth
10
+ initial_go_tools_install
11
+ context.shell "./cf api #{option(:api)} #{'--skip-ssl-validation' if options[:skip_ssl_validation]}"
12
+ context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o #{option(:organization)} -s #{option(:space)}"
13
+ end
14
+
15
+ def check_app
16
+ if options[:manifest]
17
+ error 'Application must have a manifest.yml for unattended deployment' unless File.exists? options[:manifest]
18
+ end
19
+ end
20
+
21
+ def needs_key?
22
+ false
23
+ end
24
+
25
+ def push_app
26
+ error 'Failed to push app' unless context.shell("./cf push#{manifest}")
27
+
28
+ ensure
29
+ context.shell "./cf logout"
30
+ end
31
+
32
+ def cleanup
33
+ end
34
+
35
+ def uncleanup
36
+ end
37
+
38
+ def manifest
39
+ options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+ require 'dpl/provider/bluemix_cloud_foundry'
3
+
4
+ describe DPL::Provider::BluemixCloudFoundry do
5
+ subject :provider do
6
+ described_class.new(DummyContext.new, region: 'eu-gb', username: 'Moonpie',
7
+ password: 'myexceptionallyaveragepassword',
8
+ organization: 'myotherorg',
9
+ space: 'inner',
10
+ manifest: 'worker-manifest.yml',
11
+ skip_ssl_validation: true)
12
+ end
13
+
14
+ describe "#check_auth" do
15
+ example do
16
+ expect(provider.context).to receive(:shell).with('test x$TRAVIS_OS_NAME = "xlinux" && 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')
17
+ expect(provider.context).to receive(:shell).with('./cf api api.eu-gb.bluemix.net --skip-ssl-validation')
18
+ expect(provider.context).to receive(:shell).with('./cf login -u Moonpie -p myexceptionallyaveragepassword -o myotherorg -s inner')
19
+ provider.check_auth
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+ require 'dpl/provider/cloud_foundry'
3
+
4
+ describe DPL::Provider::CloudFoundry do
5
+ subject :provider do
6
+ described_class.new(DummyContext.new, api: 'api.run.awesome.io', username: 'mallomar',
7
+ password: 'myreallyawesomepassword',
8
+ organization: 'myorg',
9
+ space: 'outer',
10
+ manifest: 'worker-manifest.yml',
11
+ skip_ssl_validation: true)
12
+ end
13
+
14
+ describe "#check_auth" do
15
+ example do
16
+ expect(provider.context).to receive(:shell).with('test x$TRAVIS_OS_NAME = "xlinux" && 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')
17
+ expect(provider.context).to receive(:shell).with('./cf api api.run.awesome.io --skip-ssl-validation')
18
+ expect(provider.context).to receive(:shell).with('./cf login -u mallomar -p myreallyawesomepassword -o myorg -s outer')
19
+ provider.check_auth
20
+ end
21
+ end
22
+
23
+ describe "#check_app" do
24
+ context 'when the manifest file exists' do
25
+ example do
26
+ File.stub(:exists?).with('worker-manifest.yml').and_return(true)
27
+ expect{provider.check_app}.not_to raise_error
28
+ end
29
+ end
30
+
31
+ context 'when the manifest file exists' do
32
+ example do
33
+ File.stub(:exists?).with('worker-manifest.yml').and_return(false)
34
+ expect{provider.check_app}.to raise_error('Application must have a manifest.yml for unattended deployment')
35
+ end
36
+ end
37
+ end
38
+
39
+ describe "#needs_key?" do
40
+ example do
41
+ expect(provider.needs_key?).to eq(false)
42
+ end
43
+ end
44
+
45
+ describe "#push_app" do
46
+ before do
47
+ allow(provider.context).to receive(:shell).and_return(true)
48
+ end
49
+
50
+ example "With manifest" do
51
+ expect(provider.context).to receive(:shell).with('./cf push -f worker-manifest.yml')
52
+ expect(provider.context).to receive(:shell).with('./cf logout')
53
+ provider.push_app
54
+ end
55
+
56
+ example "Without manifest" do
57
+ provider.options.update(:manifest => nil)
58
+ expect(provider.context).to receive(:shell).with('./cf push')
59
+ expect(provider.context).to receive(:shell).with('./cf logout')
60
+ provider.push_app
61
+ end
62
+
63
+ example 'Failed to push' do
64
+ allow(provider.context).to receive(:shell).and_return(false)
65
+
66
+ expect(provider.context).to receive(:shell).with('./cf push -f worker-manifest.yml')
67
+ expect(provider.context).to receive(:shell).with('./cf logout')
68
+ expect{provider.push_app}.to raise_error(DPL::Error, 'Failed to push app')
69
+ end
70
+ end
71
+ end
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dpl-cloud_foundry
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Konstantin Haase
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dpl
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.9.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-its
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json_pure
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tins
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: highline
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: deploy tool abstraction for clients
126
+ email: konstantin.mailinglists@googlemail.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - dpl-bluemix_cloud_foundry.gemspec
132
+ - dpl-cloud_foundry.gemspec
133
+ - lib/dpl/provider/bluemix_cloud_foundry.rb
134
+ - lib/dpl/provider/cloud_foundry.rb
135
+ - spec/provider/bluemix_cloud_foundry_spec.rb
136
+ - spec/provider/cloud_foundry_spec.rb
137
+ homepage: https://github.com/travis-ci/dpl
138
+ licenses:
139
+ - MIT
140
+ metadata: {}
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '2.2'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 2.6.13
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: deploy tool
161
+ test_files:
162
+ - spec/provider/bluemix_cloud_foundry_spec.rb
163
+ - spec/provider/cloud_foundry_spec.rb