knife-vcair 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ require 'active_support/concern'
2
+ require 'mixlib/shellout'
3
+ module RSpec
4
+ module KnifeUtils
5
+ extend ActiveSupport::Concern
6
+ included do
7
+ subject { knife_run }
8
+ let(:knife_run) { run command }
9
+ let(:command) { fail 'Define let(:command) in the spec' }
10
+ let(:cmd_stdout) { @op }
11
+
12
+ # Convenience method for actually running a knife command in our
13
+ # testing repository. Returns the Mixlib::Shellout object ready for
14
+ # inspection.
15
+ def run(command_line)
16
+ shell_out = Mixlib::ShellOut.new("#{command_line}")
17
+ @op = shell_out.tap(&:run_command).stdout
18
+ return shell_out
19
+ end
20
+
21
+ def knife(knife_command)
22
+ run "knife #{knife_command}"
23
+ end
24
+ end
25
+ # Convenience function for grabbing a hash of several important
26
+ # Mixlib::Shellout command configuration parameters.
27
+ def self.command_setting(shellout_command)
28
+ keys = [:cwd, :user, :group, :umask, :timeout, :valid_exit_codes, :environment]
29
+ keys.inject({}) do |hash, attr|
30
+ hash[attr] = shellout_command.send(attr)
31
+ hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,29 @@
1
+ require 'rspec'
2
+ require File.expand_path(File.dirname(__FILE__) +'../../utils/knifeutils')
3
+
4
+ RSpec::Matchers.define :have_outcome do |outcome_spec|
5
+ match do |executed_shellout_command|
6
+ valid_keys = [:status, :stdout, :stderr]
7
+ if outcome_spec.keys & valid_keys == []
8
+ throw "You did not specify values for any of #{valid_keys}!"
9
+ end
10
+ print
11
+ @status = outcome_spec[:status] ? (executed_shellout_command.exitstatus == outcome_spec[:status]) : true
12
+ @stdout = outcome_spec[:stdout] ? (executed_shellout_command.stdout =~ outcome_spec[:stdout]) : true
13
+ @stderr = outcome_spec[:stderr] ? (executed_shellout_command.stderr =~ outcome_spec[:stderr]) : true
14
+ @status && @stdout && @stderr
15
+ end
16
+ # Could just spit out `executed_shellout_command.inspect`, but I
17
+ # find the formatting suboptimal for testing error messages.
18
+ failure_message_for_should do |executed_shellout_command|
19
+ "Executed command should have matched the outcome spec #{outcome_spec.inspect}, but it didn't!\n
20
+ \tFailed Command: #{executed_shellout_command.command}\n
21
+ \tCommand Setting: #{RSpec::KnifeUtils.command_setting(executed_shellout_command).inspect}\n
22
+ \tExit Status: #{executed_shellout_command.exitstatus}\n
23
+ \tStandard Output:\n
24
+ #{executed_shellout_command.stdout}\n
25
+ \tStandard Error:\n
26
+ #{executed_shellout_command.stderr}"
27
+ end
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,257 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: knife-vcair
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.1
5
+ platform: ruby
6
+ authors:
7
+ - Matt Ray
8
+ - Chris McClimans
9
+ - Taylor Carpenter
10
+ - Wavell Watson
11
+ - eth Thomas
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2015-03-24 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: fog
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: '1.23'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: '1.23'
31
+ - !ruby/object:Gem::Dependency
32
+ name: knife-cloud
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 1.0.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 1.0.1
45
+ - !ruby/object:Gem::Dependency
46
+ name: knife-windows
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 0.8.3
52
+ type: :runtime
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 0.8.3
59
+ - !ruby/object:Gem::Dependency
60
+ name: chef
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 11.16.2
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '12'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 11.16.2
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '12'
79
+ - !ruby/object:Gem::Dependency
80
+ name: rspec
81
+ requirement: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '2.14'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '2.14'
93
+ - !ruby/object:Gem::Dependency
94
+ name: rake
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '10.1'
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '10.1'
107
+ - !ruby/object:Gem::Dependency
108
+ name: guard-rspec
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '4.2'
114
+ type: :development
115
+ prerelease: false
116
+ version_requirements: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - "~>"
119
+ - !ruby/object:Gem::Version
120
+ version: '4.2'
121
+ - !ruby/object:Gem::Dependency
122
+ name: activesupport
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ type: :development
129
+ prerelease: false
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ - !ruby/object:Gem::Dependency
136
+ name: rspec-core
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ type: :development
143
+ prerelease: false
144
+ version_requirements: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ - !ruby/object:Gem::Dependency
150
+ name: rspec-expectations
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ - !ruby/object:Gem::Dependency
164
+ name: rspec-mocks
165
+ requirement: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ type: :development
171
+ prerelease: false
172
+ version_requirements: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ - !ruby/object:Gem::Dependency
178
+ name: rspec_junit_formatter
179
+ requirement: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ type: :development
185
+ prerelease: false
186
+ version_requirements: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ description: VMware vcair support for Chef's Knife command
192
+ email:
193
+ - matt@chef.io
194
+ - wolfpack@vulk.co
195
+ - sthomas@chef.io
196
+ executables: []
197
+ extensions: []
198
+ extra_rdoc_files:
199
+ - README.md
200
+ - LICENSE
201
+ files:
202
+ - ".gitignore"
203
+ - CHANGELOG.md
204
+ - Gemfile
205
+ - Guardfile
206
+ - LICENSE
207
+ - README.md
208
+ - Rakefile
209
+ - example.env
210
+ - install-linux-vcair-example.sh
211
+ - install-winrm-vcair-example.bat
212
+ - knife-vcair.gemspec
213
+ - lib/chef/knife/cloud/vcair_server_create_options.rb
214
+ - lib/chef/knife/cloud/vcair_service.rb
215
+ - lib/chef/knife/cloud/vcair_service_options.rb
216
+ - lib/chef/knife/vcair_helpers.rb
217
+ - lib/chef/knife/vcair_image_list.rb
218
+ - lib/chef/knife/vcair_ip_list.rb
219
+ - lib/chef/knife/vcair_network_list.rb
220
+ - lib/chef/knife/vcair_server_create.rb
221
+ - lib/chef/knife/vcair_server_delete.rb
222
+ - lib/chef/knife/vcair_server_list.rb
223
+ - lib/chef/knife/vcair_server_show.rb
224
+ - lib/chef/knife/vcair_vm_delete.rb
225
+ - lib/chef/knife/vcair_vm_list.rb
226
+ - lib/knife-vcair/version.rb
227
+ - spec/integration/config/knife.rb
228
+ - spec/integration/config/validation.pem
229
+ - spec/integration/vchs_spec.rb
230
+ - spec/spec_helper.rb
231
+ - spec/unit/lib/chef/knife/vcair_server_create_spec.rb
232
+ - spec/utils/knifeutils.rb
233
+ - spec/utils/matchers.rb
234
+ homepage: https://github.com/chef-partners/knife-vcair
235
+ licenses: []
236
+ metadata: {}
237
+ post_install_message:
238
+ rdoc_options: []
239
+ require_paths:
240
+ - lib
241
+ required_ruby_version: !ruby/object:Gem::Requirement
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ required_rubygems_version: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ requirements: []
252
+ rubyforge_project:
253
+ rubygems_version: 2.2.2
254
+ signing_key:
255
+ specification_version: 4
256
+ summary: VMware vcair support for Chef's Knife command
257
+ test_files: []