bosh-deployer 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'cancun', path: '../cancun'
5
+ gem 'bosh_cli'
6
6
 
7
7
 
8
8
 
data/Gemfile.lock CHANGED
@@ -1,53 +1,114 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bosh-deployer (0.2.2)
4
+ bosh-deployer (0.0.4)
5
+ cancun
5
6
  readwritesettings
6
7
  redcard
7
8
  thor (~> 0.18)
8
9
 
9
- PATH
10
- remote: ../cancun
10
+ GEM
11
+ remote: https://rubygems.org/
11
12
  specs:
12
- cancun (0.2.1)
13
+ aws-sdk (1.44.0)
14
+ json (~> 1.4)
15
+ nokogiri (>= 1.4.4)
16
+ blobstore_client (1.2710.0)
17
+ aws-sdk (= 1.44.0)
18
+ bosh_common (~> 1.2710.0)
19
+ fog (~> 1.14.0)
20
+ httpclient (= 2.4.0)
21
+ multi_json (~> 1.1)
22
+ ruby-atmos-pure (~> 1.0.5)
23
+ bosh-template (1.2710.0)
24
+ semi_semantic (~> 1.1.0)
25
+ bosh_cli (1.2710.0)
26
+ blobstore_client (~> 1.2710.0)
27
+ bosh-template (~> 1.2710.0)
28
+ bosh_common (~> 1.2710.0)
29
+ highline (~> 1.6.2)
30
+ httpclient (= 2.4.0)
31
+ json_pure (~> 1.7)
32
+ minitar (~> 0.5.4)
33
+ net-scp (~> 1.1.0)
34
+ net-ssh (>= 2.2.1)
35
+ net-ssh-gateway (~> 1.2.0)
36
+ netaddr (~> 1.5.0)
37
+ progressbar (~> 0.9.0)
38
+ terminal-table (~> 1.4.3)
39
+ bosh_common (1.2710.0)
40
+ semi_semantic (~> 1.1.0)
41
+ builder (3.2.2)
42
+ cancun (0.2.2)
13
43
  highline
14
44
  highline-color
15
45
  sourcify
16
-
17
- GEM
18
- remote: https://rubygems.org/
19
- specs:
20
46
  diff-lcs (1.2.5)
47
+ excon (0.25.3)
21
48
  file-tail (1.0.12)
22
49
  tins (~> 0.5)
50
+ fog (1.14.0)
51
+ builder
52
+ excon (~> 0.25.0)
53
+ formatador (~> 0.2.0)
54
+ mime-types
55
+ multi_json (~> 1.0)
56
+ net-scp (~> 1.1)
57
+ net-ssh (>= 2.1.3)
58
+ nokogiri (~> 1.5)
59
+ ruby-hmac
60
+ formatador (0.2.5)
23
61
  highline (1.6.21)
24
- highline-color (0.0.2)
62
+ highline-color (0.0.3)
63
+ httpclient (2.4.0)
64
+ json (1.8.1)
65
+ json_pure (1.8.1)
66
+ log4r (1.1.10)
67
+ mime-types (2.3)
68
+ mini_portile (0.6.0)
69
+ minitar (0.5.4)
70
+ multi_json (1.10.1)
71
+ net-scp (1.1.2)
72
+ net-ssh (>= 2.6.5)
73
+ net-ssh (2.9.1)
74
+ net-ssh-gateway (1.2.0)
75
+ net-ssh (>= 2.6.5)
76
+ netaddr (1.5.0)
77
+ nokogiri (1.6.3.1)
78
+ mini_portile (= 0.6.0)
79
+ progressbar (0.9.2)
25
80
  rake (10.3.2)
26
81
  readwritesettings (3.0.1)
27
82
  redcard (1.1.0)
28
- rspec (3.0.0)
29
- rspec-core (~> 3.0.0)
30
- rspec-expectations (~> 3.0.0)
31
- rspec-mocks (~> 3.0.0)
32
- rspec-core (3.0.4)
33
- rspec-support (~> 3.0.0)
34
- rspec-expectations (3.0.4)
83
+ rspec (3.1.0)
84
+ rspec-core (~> 3.1.0)
85
+ rspec-expectations (~> 3.1.0)
86
+ rspec-mocks (~> 3.1.0)
87
+ rspec-core (3.1.4)
88
+ rspec-support (~> 3.1.0)
89
+ rspec-expectations (3.1.1)
35
90
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.0.0)
37
- rspec-mocks (3.0.4)
38
- rspec-support (~> 3.0.0)
39
- rspec-support (3.0.4)
91
+ rspec-support (~> 3.1.0)
92
+ rspec-mocks (3.1.1)
93
+ rspec-support (~> 3.1.0)
94
+ rspec-support (3.1.0)
95
+ ruby-atmos-pure (1.0.5)
96
+ log4r (>= 1.1.9)
97
+ ruby-hmac (>= 0.4.0)
98
+ ruby-hmac (0.4.0)
40
99
  ruby2ruby (2.1.2)
41
100
  ruby_parser (~> 3.1)
42
101
  sexp_processor (~> 4.0)
43
102
  ruby_parser (3.6.2)
44
103
  sexp_processor (~> 4.1)
104
+ semi_semantic (1.1.0)
45
105
  sexp_processor (4.4.4)
46
106
  sourcify (0.5.0)
47
107
  file-tail (>= 1.0.5)
48
108
  ruby2ruby (>= 1.2.5)
49
109
  ruby_parser (>= 2.0.5)
50
110
  sexp_processor (>= 3.0.5)
111
+ terminal-table (1.4.5)
51
112
  thor (0.19.1)
52
113
  tins (0.13.2)
53
114
 
@@ -56,6 +117,6 @@ PLATFORMS
56
117
 
57
118
  DEPENDENCIES
58
119
  bosh-deployer!
59
- cancun!
120
+ bosh_cli
60
121
  rake
61
122
  rspec
@@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
28
28
  gem.add_dependency "thor", "~> 0.18"
29
29
  gem.add_dependency "redcard"
30
30
  gem.add_dependency 'readwritesettings'
31
+ gem.add_dependency "cancun"
31
32
  gem.add_development_dependency "rake"
32
- gem.add_development_dependency "cancun"
33
33
  gem.add_development_dependency "rspec"
34
34
  end
data/lib/bosh-deployer.rb CHANGED
@@ -10,7 +10,3 @@ end
10
10
  require "bosh-deployer/version"
11
11
  require "bosh-deployer/stemcell"
12
12
  require "bosh-deployer/bosh_stub"
13
-
14
- # require "bosh-bootstrap/network"
15
- # require "bosh-bootstrap/key_pair"
16
- # require "bosh-bootstrap/microbosh"
@@ -1,4 +1,5 @@
1
1
  require 'erb'
2
+ require 'cancun'
2
3
  require 'cancun/highline'
3
4
  require 'readwritesettings'
4
5
 
@@ -14,10 +15,15 @@ class Bosh::Deployer::BoshStub
14
15
  end
15
16
 
16
17
  def generate
18
+ if File.exists?(filename) and !agree "#{filename} already exists, do you want to overwrite it?"
19
+ say 'Stub generation cancelled!'
20
+ return
21
+ end
17
22
  say_bold 'Provide the following information for your bosh configuration:'
18
23
  stub = template.result(binding)
19
24
  say "Saving stub at #{filename}"
20
25
  File.open(filename, 'w') { |f| f.write(stub) }
26
+
21
27
  end
22
28
 
23
29
  def static_ip_from
@@ -4,9 +4,11 @@ module Bosh; module Deployer; module Cli; module Commands; end; end; end; end
4
4
 
5
5
  class Bosh::Deployer::Cli::Commands::ProvisionStemcells
6
6
  attr_reader :manifest_path
7
-
8
- def perform(manifest_path =default_manifest_path )
7
+ def initialize(manifest_path =default_manifest_path )
9
8
  @manifest_path = manifest_path
9
+ end
10
+
11
+ def perform
10
12
  puts "Downloading #{stemcell.tar_filename} from bosh-jenkins-atifacts ..."
11
13
  stemcell.download
12
14
  puts 'uploading stemcell ...'
@@ -10,5 +10,12 @@ module Bosh::Deployer
10
10
  deploy_cmd = Bosh::Deployer::Cli::Commands::ProvisionStemcells.new
11
11
  deploy_cmd.perform(manifest_path)
12
12
  end
13
+
14
+ desc "generate_stub <NAME>", "Generates stub for bosh or cloudfoundry"
15
+ def generate_stub(name)
16
+ cmd = Bosh::Deployer::Cli::Commands::GenerateStub.new(
17
+ name, 'cookbooks/ci_infrastructure_cf/files/default/stubs')
18
+ cmd.perform
19
+ end
13
20
  end
14
21
  end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Deployer
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -59,6 +59,9 @@ describe Bosh::Deployer::BoshStub do
59
59
  describe 'when .bootstrap/settings.yml exist' do
60
60
  before do
61
61
  `rm -rf tmp ; mkdir tmp`
62
+ allow(File).to receive(:exists?).and_call_original
63
+ allow(File).to receive(:exists?)
64
+ .with('~/.bootstrap/settings.yml').and_return(true)
62
65
  allow_any_instance_of(ReadWriteSettings)
63
66
  .to receive(:open).and_call_original
64
67
  allow_any_instance_of(ReadWriteSettings)
@@ -71,7 +74,7 @@ describe Bosh::Deployer::BoshStub do
71
74
  execute do
72
75
  bosh_stub.generate
73
76
  end.and_type *args
74
-
77
+ sleep 1 #TODO: develop wait for cmd after and type
75
78
  equal_yaml('spec/fixtures/stubs/bosh.yml', 'tmp/bosh.yml')
76
79
  end
77
80
  end
@@ -92,5 +95,22 @@ describe Bosh::Deployer::BoshStub do
92
95
  equal_yaml('spec/fixtures/stubs/bosh.yml', 'tmp/bosh.yml')
93
96
  end
94
97
  end
98
+
99
+ describe 'when stub already exists' do
100
+ before do
101
+ `rm -rf tmp ; mkdir tmp`
102
+ `echo 'something' > tmp/bosh.yml`
103
+ end
104
+
105
+ let(:args){ %w{ n } }
106
+
107
+ it 'should not change stub if user does not want to edit it' do
108
+ execute do
109
+ bosh_stub.generate
110
+ end.and_type *args
111
+ expect(output).to include('Stub generation cancelled!')
112
+ end
113
+ end
95
114
  end
115
+
96
116
  end
@@ -2,7 +2,7 @@ require "bosh-deployer/cli/commands/provision_stemcells"
2
2
  require "bosh-deployer/stemcell"
3
3
 
4
4
  describe Bosh::Deployer::Cli::Commands::ProvisionStemcells do
5
- let(:cmd) { described_class.new }
5
+ let(:cmd) { described_class.new(manifest_path) }
6
6
  let(:stemcell) { double.as_null_object }
7
7
 
8
8
  before do
@@ -12,7 +12,7 @@ describe Bosh::Deployer::Cli::Commands::ProvisionStemcells do
12
12
  end
13
13
 
14
14
  describe '#perform' do
15
- let(:perform_provision_stemcells){ cmd.perform(manifest_path) }
15
+ let(:perform_provision_stemcells){ cmd.perform }
16
16
 
17
17
  describe 'when filename is provided' do
18
18
  [{
@@ -66,7 +66,6 @@ describe Bosh::Deployer::Cli::Commands::ProvisionStemcells do
66
66
  end
67
67
 
68
68
  it 'should raise error with missing arguments' do
69
-
70
69
  end
71
70
  end
72
71
  end
@@ -0,0 +1,29 @@
1
+ require 'bosh-deployer'
2
+ require 'bosh-deployer/thor_cli'
3
+ require 'bosh-deployer/cli/commands/generate_stub'
4
+ require 'bosh-deployer/cli/commands/provision_stemcells'
5
+
6
+ describe Bosh::Deployer::ThorCli do
7
+ let(:cli){ described_class.new }
8
+
9
+ describe 'generate_stub' do
10
+ let(:cmd){ double.as_null_object }
11
+
12
+ it 'should called generate stub with the correct commands' do
13
+ expect(Bosh::Deployer::Cli::Commands::GenerateStub)
14
+ .to receive(:new).with('bosh',anything).and_return(cmd)
15
+ cli.generate_stub('bosh')
16
+ end
17
+ end
18
+
19
+ describe 'provision_stemcells' do
20
+ let(:cmd){ double.as_null_object }
21
+
22
+ it 'should called generate stub with the correct commands' do
23
+ allow(Bosh::Deployer::Cli::Commands::ProvisionStemcells)
24
+ .to receive(:new).and_return(cmd)
25
+ expect(cmd).to receive(:perform)
26
+ cli.provision_stemcells
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Alan Moran
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-09-18 00:00:00.000000000 Z
12
+ date: 2014-09-19 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,74 +30,84 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: redcard
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: readwritesettings
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
- name: rake
63
+ name: cancun
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
- type: :development
70
+ type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
- name: cancun
79
+ name: rake
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: rspec
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
- description: ' CLI plugin for bosh to perform different deploying tasks'
110
+ description: ! ' CLI plugin for bosh to perform different deploying tasks'
98
111
  email:
99
112
  - bonzofenix@gmail.com
100
113
  executables:
@@ -130,30 +143,32 @@ files:
130
143
  - spec/fixtures/stubs/bosh.yml
131
144
  - spec/fixtures/stubs/cloudfoundry.stub.yml
132
145
  - spec/stemcell_spec.rb
146
+ - spec/thor_cli_spec.rb
133
147
  - stubs/bosh.yml.erb
134
148
  homepage: https://github.com/bonzofenix/bosh-deployer
135
149
  licenses: []
136
- metadata: {}
137
150
  post_install_message:
138
151
  rdoc_options: []
139
152
  require_paths:
140
153
  - lib
141
154
  required_ruby_version: !ruby/object:Gem::Requirement
155
+ none: false
142
156
  requirements:
143
- - - '>='
157
+ - - ! '>='
144
158
  - !ruby/object:Gem::Version
145
159
  version: '1.9'
146
160
  required_rubygems_version: !ruby/object:Gem::Requirement
161
+ none: false
147
162
  requirements:
148
- - - '>='
163
+ - - ! '>='
149
164
  - !ruby/object:Gem::Version
150
165
  version: '0'
151
166
  requirements: []
152
167
  rubyforge_project:
153
- rubygems_version: 2.0.3
168
+ rubygems_version: 1.8.23.2
154
169
  signing_key:
155
- specification_version: 4
156
- summary: 'bosh-deployer can: - downloads and upload stemcells specifies on a manifest
170
+ specification_version: 3
171
+ summary: ! 'bosh-deployer can: - downloads and upload stemcells specifies on a manifest
157
172
  pending: - deploy Bosh - deploy CF'
158
173
  test_files:
159
174
  - spec/bosh_stub_spec.rb
@@ -166,3 +181,4 @@ test_files:
166
181
  - spec/fixtures/stubs/bosh.yml
167
182
  - spec/fixtures/stubs/cloudfoundry.stub.yml
168
183
  - spec/stemcell_spec.rb
184
+ - spec/thor_cli_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 0f23d785521e58b46f24e09480694af1e7cc5a72
4
- data.tar.gz: 1b8d153523965f11c94e44ea3815a19a9039f6e4
5
- SHA512:
6
- metadata.gz: 74c62b59ad4d1e12d69738c0456bca66cae516ceda3157e017960ea4a69705f256059b1b64930f481e2931b5a7eebbc318babe30819230e87acba19b775c60c8
7
- data.tar.gz: 808c6c521726d44c7f61658f54cab64fbcfd2ab35850cadb79a9147319b83fcdc7f1d51c1c0898a52f4a623c41d7312e2aacf211c55460384fdae5584dd9bd5f