knife-digital_ocean 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.rspec +2 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Guardfile +1 -16
  6. data/README.md +112 -2
  7. data/knife-digital_ocean.gemspec +3 -0
  8. data/lib/chef/knife/digital_ocean_account_info.rb +45 -0
  9. data/lib/chef/knife/digital_ocean_domain_create.rb +55 -0
  10. data/lib/chef/knife/digital_ocean_domain_destroy.rb +43 -0
  11. data/lib/chef/knife/digital_ocean_domain_list.rb +44 -0
  12. data/lib/chef/knife/digital_ocean_domain_record_create.rb +78 -0
  13. data/lib/chef/knife/digital_ocean_domain_record_destroy.rb +54 -0
  14. data/lib/chef/knife/digital_ocean_domain_record_edit.rb +88 -0
  15. data/lib/chef/knife/digital_ocean_domain_record_list.rb +56 -0
  16. data/lib/chef/knife/digital_ocean_droplet_destroy.rb +29 -3
  17. data/lib/chef/knife/digital_ocean_sshkey_create.rb +54 -0
  18. data/lib/chef/knife/digital_ocean_sshkey_destroy.rb +43 -0
  19. data/lib/knife-digital_ocean/version.rb +1 -1
  20. data/spec/fixtures/vcr_cassettes/accountinfo.yml +65 -0
  21. data/spec/fixtures/vcr_cassettes/domainlist.yml +69 -0
  22. data/spec/fixtures/vcr_cassettes/public_images.yml +164 -0
  23. data/spec/lib/chef/knife/digital_ocean_account_info_spec.rb +37 -0
  24. data/spec/lib/chef/knife/digital_ocean_domain_create_spec.rb +5 -0
  25. data/spec/lib/chef/knife/digital_ocean_domain_destroy_spec.rb +5 -0
  26. data/spec/lib/chef/knife/digital_ocean_domain_list_spec.rb +38 -0
  27. data/spec/lib/chef/knife/digital_ocean_domain_record_create_spec.rb +5 -0
  28. data/spec/lib/chef/knife/digital_ocean_domain_record_destroy_spec.rb +5 -0
  29. data/spec/lib/chef/knife/digital_ocean_domain_record_edit_spec.rb +5 -0
  30. data/spec/lib/chef/knife/digital_ocean_domain_record_list_spec.rb +5 -0
  31. data/spec/lib/chef/knife/digital_ocean_image_list_spec.rb +14 -1
  32. data/spec/lib/chef/knife/digital_ocean_sshkey_create_spec.rb +5 -0
  33. data/spec/lib/chef/knife/digital_ocean_sshkey_destroy_spec.rb +5 -0
  34. data/spec/spec_helper.rb +26 -4
  35. metadata +83 -3
@@ -0,0 +1,164 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/v2/images?page=1&per_page=20
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Authorization:
13
+ - Bearer FAKE_ACCESS_TOKEN
14
+ User-Agent:
15
+ - Faraday v0.9.0
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - cloudflare-nginx
27
+ Date:
28
+ - Wed, 12 Nov 2014 02:36:21 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Set-Cookie:
36
+ - __cfduid=d41e3b2b3bff32e8c0294b974f8fcd3c41415759776; expires=Thu, 12-Nov-15
37
+ 02:36:16 GMT; path=/; domain=.digitalocean.com; HttpOnly
38
+ Status:
39
+ - 200 OK
40
+ X-Frame-Options:
41
+ - SAMEORIGIN
42
+ X-Xss-Protection:
43
+ - 1; mode=block
44
+ X-Content-Type-Options:
45
+ - nosniff
46
+ Ratelimit-Limit:
47
+ - '1200'
48
+ Ratelimit-Remaining:
49
+ - '1189'
50
+ Ratelimit-Reset:
51
+ - '1415762163'
52
+ Cache-Control:
53
+ - max-age=0, private, must-revalidate
54
+ X-Request-Id:
55
+ - 5747b85c-24b4-41d8-857b-73aff3f3efb1
56
+ X-Runtime:
57
+ - '5.466363'
58
+ Cf-Ray:
59
+ - 187f5748d30d0ec7-EWR
60
+ body:
61
+ encoding: UTF-8
62
+ string: '{"images":[{"id":7753256,"name":"test-snapshot","distribution":"Debian","slug":null,"public":false,"regions":["nyc3","nyc3"],"created_at":"2014-11-10T02:30:17Z","min_size":"512mb"},{"id":7816452,"name":"CoreOS
63
+ (alpha) 494.0.0","distribution":"CoreOS","slug":"coreos-alpha","public":true,"regions":["sfo1","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-11-11T15:54:16Z","min_size":"512mb"},{"id":7111572,"name":"14.10
64
+ x32","distribution":"Ubuntu","slug":"ubuntu-14-10-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-23T14:30:12Z","min_size":"512mb"},{"id":6882384,"name":"444.5.0
65
+ (beta)","distribution":"CoreOS","slug":"coreos-beta","public":true,"regions":["sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-16T17:43:33Z","min_size":"512mb"},{"id":6886342,"name":"444.5.0
66
+ (stable)","distribution":"CoreOS","slug":"coreos-stable","public":true,"regions":["sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-16T20:36:29Z","min_size":"512mb"},{"id":6370882,"name":"20
67
+ x64","distribution":"Fedora","slug":"fedora-20-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T15:29:01Z","min_size":"512mb"},{"id":6370885,"name":"20
68
+ x32","distribution":"Fedora","slug":"fedora-20-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T15:29:18Z","min_size":"512mb"},{"id":6370968,"name":"19
69
+ x64","distribution":"Fedora","slug":"fedora-19-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T15:33:05Z","min_size":"512mb"},{"id":6370969,"name":"19
70
+ x32","distribution":"Fedora","slug":"fedora-19-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T15:33:39Z","min_size":"512mb"},{"id":6372105,"name":"6.5
71
+ x32","distribution":"CentOS","slug":"centos-6-5-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T16:28:33Z","min_size":"512mb"},{"id":6372108,"name":"6.5
72
+ x64","distribution":"CentOS","slug":"centos-6-5-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T16:28:43Z","min_size":"512mb"},{"id":6372321,"name":"5.10
73
+ x64","distribution":"CentOS","slug":"centos-5-8-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T16:40:18Z","min_size":"512mb"},{"id":6372425,"name":"5.10
74
+ x32","distribution":"CentOS","slug":"centos-5-8-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T16:45:29Z","min_size":"512mb"},{"id":6372526,"name":"7.0
75
+ x64","distribution":"Debian","slug":"debian-7-0-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T16:52:46Z","min_size":"512mb"},{"id":6372528,"name":"7.0
76
+ x32","distribution":"Debian","slug":"debian-7-0-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T16:53:06Z","min_size":"512mb"},{"id":6372581,"name":"6.0
77
+ x64","distribution":"Debian","slug":"debian-6-0-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T16:56:00Z","min_size":"512mb"},{"id":6372662,"name":"6.0
78
+ x32","distribution":"Debian","slug":"debian-6-0-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T17:00:21Z","min_size":"512mb"},{"id":6374124,"name":"10.04
79
+ x64","distribution":"Ubuntu","slug":"ubuntu-10-04-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T18:16:06Z","min_size":"512mb"},{"id":6374125,"name":"10.04
80
+ x32","distribution":"Ubuntu","slug":"ubuntu-10-04-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T18:16:15Z","min_size":"512mb"},{"id":6374128,"name":"12.04.5
81
+ x64","distribution":"Ubuntu","slug":"ubuntu-12-04-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T18:16:53Z","min_size":"512mb"}],"links":{"pages":{"last":"https://api.digitalocean.com/v2/images?page=2&per_page=20","next":"https://api.digitalocean.com/v2/images?page=2&per_page=20"}},"meta":{"total":39}}'
82
+ http_version:
83
+ recorded_at: Wed, 12 Nov 2014 02:36:21 GMT
84
+ - request:
85
+ method: get
86
+ uri: https://api.digitalocean.com/v2/images?page=2&per_page=20
87
+ body:
88
+ encoding: US-ASCII
89
+ string: ''
90
+ headers:
91
+ Content-Type:
92
+ - application/json
93
+ Authorization:
94
+ - Bearer FAKE_ACCESS_TOKEN
95
+ User-Agent:
96
+ - Faraday v0.9.0
97
+ Accept-Encoding:
98
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
99
+ Accept:
100
+ - "*/*"
101
+ response:
102
+ status:
103
+ code: 200
104
+ message: OK
105
+ headers:
106
+ Server:
107
+ - cloudflare-nginx
108
+ Date:
109
+ - Wed, 12 Nov 2014 02:36:27 GMT
110
+ Content-Type:
111
+ - application/json; charset=utf-8
112
+ Transfer-Encoding:
113
+ - chunked
114
+ Connection:
115
+ - keep-alive
116
+ Set-Cookie:
117
+ - __cfduid=d2d1df025a03b2f4e5a67e0259e6283891415759782; expires=Thu, 12-Nov-15
118
+ 02:36:22 GMT; path=/; domain=.digitalocean.com; HttpOnly
119
+ Status:
120
+ - 200 OK
121
+ X-Frame-Options:
122
+ - SAMEORIGIN
123
+ X-Xss-Protection:
124
+ - 1; mode=block
125
+ X-Content-Type-Options:
126
+ - nosniff
127
+ Ratelimit-Limit:
128
+ - '1200'
129
+ Ratelimit-Remaining:
130
+ - '1188'
131
+ Ratelimit-Reset:
132
+ - '1415762163'
133
+ Cache-Control:
134
+ - max-age=0, private, must-revalidate
135
+ X-Request-Id:
136
+ - 2ff5b0e6-f6dd-40b1-9509-682ea289c3c7
137
+ X-Runtime:
138
+ - '5.014537'
139
+ Cf-Ray:
140
+ - 187f576dd2e40ecd-EWR
141
+ body:
142
+ encoding: UTF-8
143
+ string: '{"images":[{"id":6374130,"name":"12.04.5 x32","distribution":"Ubuntu","slug":"ubuntu-12-04-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-09-26T18:17:23Z","min_size":"512mb"},{"id":6918735,"name":"14.04
144
+ x32","distribution":"Ubuntu","slug":"ubuntu-14-04-x32","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-17T20:13:41Z","min_size":"512mb"},{"id":6918990,"name":"14.04
145
+ x64","distribution":"Ubuntu","slug":"ubuntu-14-04-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-17T20:24:33Z","min_size":"512mb"},{"id":7053293,"name":"7.0
146
+ x64","distribution":"CentOS","slug":"centos-7-0-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-21T21:51:45Z","min_size":"512mb"},{"id":7111343,"name":"14.10
147
+ x64","distribution":"Ubuntu","slug":"ubuntu-14-10-x64","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-23T14:21:38Z","min_size":"512mb"},{"id":6376601,"name":"Ruby
148
+ on Rails on 14.04 (Nginx + Unicorn)","distribution":"Ubuntu","slug":"ruby-on-rails","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc1"],"created_at":"2014-09-26T20:20:24Z","min_size":"512mb"},{"id":6423475,"name":"WordPress
149
+ on 14.04","distribution":"Ubuntu","slug":"wordpress","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc1"],"created_at":"2014-09-28T21:34:48Z","min_size":"512mb"},{"id":6734697,"name":"Django
150
+ on 14.04","distribution":"Ubuntu","slug":"django","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-10T18:34:55Z","min_size":"512mb"},{"id":6884371,"name":"Magento
151
+ 1.9.0.1 on 14.04","distribution":"Ubuntu","slug":"magento","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-16T19:14:18Z","min_size":"512mb"},{"id":7284647,"name":"Ghost
152
+ 0.5.3 on 14.04","distribution":"Ubuntu","slug":"ghost","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-28T19:34:10Z","min_size":"512mb"},{"id":7354580,"name":"Docker
153
+ 1.3.1 on 14.04","distribution":"Ubuntu","slug":"docker","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-30T18:12:32Z","min_size":"512mb"},{"id":7518201,"name":"GitLab
154
+ 7.4.3 CE on 14.04","distribution":"Ubuntu","slug":"gitlab","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-11-03T23:32:54Z","min_size":"512mb"},{"id":6732690,"name":"LEMP
155
+ on 14.04","distribution":"Ubuntu","slug":"lemp","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-10T16:31:45Z","min_size":"512mb"},{"id":6732691,"name":"LAMP
156
+ on 14.04","distribution":"Ubuntu","slug":"lamp","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-10T16:31:57Z","min_size":"512mb"},{"id":6734341,"name":"node-v0.10.32
157
+ on 14.04","distribution":"Ubuntu","slug":"node","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-10T18:13:34Z","min_size":"512mb"},{"id":6738037,"name":"Dokku
158
+ v0.2.3 on 14.04 (w/ Docker 1.2.0)","distribution":"Ubuntu","slug":"dokku","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-10T22:20:30Z","min_size":"512mb"},{"id":6798184,"name":"MEAN
159
+ on 14.04","distribution":"Ubuntu","slug":"mean","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-13T15:13:39Z","min_size":"512mb"},{"id":6854006,"name":"Drupal
160
+ 7.32 on 14.04","distribution":"Ubuntu","slug":"drupal","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","nyc3"],"created_at":"2014-10-15T21:17:06Z","min_size":"512mb"},{"id":7572830,"name":"Redmine
161
+ on 14.04","distribution":"Ubuntu","slug":"redmine","public":true,"regions":["nyc1","ams1","sfo1","nyc2","ams2","sgp1","lon1","nyc3","ams3","ams3"],"created_at":"2014-11-05T09:12:04Z","min_size":"512mb"}],"links":{"pages":{"first":"https://api.digitalocean.com/v2/images?page=1&per_page=20","prev":"https://api.digitalocean.com/v2/images?page=1&per_page=20"}},"meta":{"total":39}}'
162
+ http_version:
163
+ recorded_at: Wed, 12 Nov 2014 02:36:27 GMT
164
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanAccountInfo do
4
+
5
+ subject { Chef::Knife::DigitalOceanAccountInfo.new }
6
+
7
+ let(:access_token) { ENV['DIGITALOCEAN_ACCESS_TOKEN'] }
8
+
9
+ before :each do
10
+ Chef::Knife::DigitalOceanAccountInfo.load_deps
11
+ Chef::Config['knife']['digital_ocean_access_token'] = access_token
12
+ allow(subject).to receive(:puts)
13
+ end
14
+
15
+ describe "#run" do
16
+ it "should validate the Digital Ocean config keys exist" do
17
+ VCR.use_cassette('accountinfo') do
18
+ expect(subject).to receive(:validate!)
19
+ subject.run
20
+ end
21
+ end
22
+
23
+ it "should output the column headers" do
24
+ VCR.use_cassette('accountinfo') do
25
+ expect(subject).to receive(:puts).with(/^UUID\s+Email\s+Droplet Limit\s+Email Verified\n/)
26
+ subject.run
27
+ end
28
+ end
29
+
30
+ it "should output a list of the available Digital Ocean account info" do
31
+ VCR.use_cassette('accountinfo') do
32
+ expect(subject).to receive(:puts).with(/\b49e2e737d3a7407a042bb7e88f4da8629166f2b9\s+greg@gregf.org\s+20\s+true\s+\n/)
33
+ subject.run
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanDomainCreate do
4
+ pending
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanDomainDestroy do
4
+ pending
5
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanDomainList do
4
+
5
+ subject { Chef::Knife::DigitalOceanDomainList.new }
6
+
7
+ let(:access_token) { ENV['DIGITALOCEAN_ACCESS_TOKEN'] }
8
+
9
+ before :each do
10
+ Chef::Knife::DigitalOceanImageList.load_deps
11
+ Chef::Config['knife']['digital_ocean_access_token'] = access_token
12
+ Chef::Config['knife']['public_images'] = true
13
+ allow(subject).to receive(:puts)
14
+ end
15
+
16
+ describe "#run" do
17
+ it "should validate the Digital Ocean config keys exist" do
18
+ VCR.use_cassette('domainlist') do
19
+ expect(subject).to receive(:validate!)
20
+ subject.run
21
+ end
22
+ end
23
+
24
+ it "should output the column headers" do
25
+ VCR.use_cassette('domainlist') do
26
+ expect(subject).to receive(:puts).with(/^Name\s+TTL/)
27
+ subject.run
28
+ end
29
+ end
30
+
31
+ it "should output a list of the available Digital Ocean domains" do
32
+ VCR.use_cassette('domainlist') do
33
+ expect(subject).to receive(:puts).with(/\bgregf.org\s+1800\n/)
34
+ subject.run
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanDomainRecordCreate do
4
+ pending
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanDomainRecordDestroy do
4
+ pending
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanDomainRecordEdit do
4
+ pending
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanDomainRecordList do
4
+ pending
5
+ end
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
+
4
+
3
5
  describe Chef::Knife::DigitalOceanImageList do
4
6
 
5
7
  subject { Chef::Knife::DigitalOceanImageList.new }
@@ -9,7 +11,6 @@ describe Chef::Knife::DigitalOceanImageList do
9
11
  before :each do
10
12
  Chef::Knife::DigitalOceanImageList.load_deps
11
13
  Chef::Config['knife']['digital_ocean_access_token'] = access_token
12
- Chef::Config['knife']['public_images'] = true
13
14
  allow(subject).to receive(:puts)
14
15
  end
15
16
 
@@ -35,4 +36,16 @@ describe Chef::Knife::DigitalOceanImageList do
35
36
  end
36
37
  end
37
38
  end
39
+
40
+ context "public images" do
41
+ describe "#run" do
42
+ it "should output a list of the available Digital Ocean Images" do
43
+ VCR.use_cassette('public_images') do
44
+ subject.config[:public_images] = true
45
+ expect(subject).to receive(:puts).with(/\b6886342\s+CoreOS\s+444.5.0 \(stable\)\s+coreos-stable/)
46
+ subject.run
47
+ end
48
+ end
49
+ end
50
+ end
38
51
  end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanSshkeyCreate do
4
+ pending
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Knife::DigitalOceanSshkeyDestroy do
4
+ pending
5
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,11 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'chef', 'knife'))
2
2
  require 'droplet_kit'
3
3
  require 'hashie'
4
4
  require 'vcr'
5
-
5
+ require 'rspec'
6
6
  require 'chef/knife'
7
+ require 'coveralls'
8
+
7
9
  require 'chef/knife/digital_ocean_droplet_create'
8
10
  require 'chef/knife/digital_ocean_droplet_destroy'
9
11
  require 'chef/knife/digital_ocean_droplet_list'
@@ -11,11 +13,31 @@ require 'chef/knife/digital_ocean_image_list'
11
13
  require 'chef/knife/digital_ocean_region_list'
12
14
  require 'chef/knife/digital_ocean_size_list'
13
15
  require 'chef/knife/digital_ocean_sshkey_list'
14
-
15
- Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
16
+ require 'chef/knife/digital_ocean_sshkey_create'
17
+ require 'chef/knife/digital_ocean_sshkey_destroy'
18
+ require 'chef/knife/digital_ocean_domain_list'
19
+ require 'chef/knife/digital_ocean_domain_create'
20
+ require 'chef/knife/digital_ocean_domain_destroy'
21
+ require 'chef/knife/digital_ocean_domain_record_list'
22
+ require 'chef/knife/digital_ocean_domain_record_create'
23
+ require 'chef/knife/digital_ocean_domain_record_edit'
24
+ require 'chef/knife/digital_ocean_domain_record_destroy'
25
+ require 'chef/knife/digital_ocean_account_info'
16
26
 
17
27
  VCR.configure do |c|
18
28
  c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
19
29
  c.hook_into :webmock
20
30
  c.filter_sensitive_data('FAKE_ACCESS_TOKEN') { ENV['DIGITALOCEAN_ACCESS_TOKEN'] }
21
31
  end
32
+
33
+ # Clear config between each example
34
+ # to avoid dependencies between examples
35
+ RSpec.configure do |c|
36
+ c.before(:each) do
37
+ Chef::Config.reset
38
+ Chef::Config[:knife] ={}
39
+ end
40
+ end
41
+
42
+ Coveralls.wear!
43
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-digital_ocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roland Moriz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-10 00:00:00.000000000 Z
12
+ date: 2014-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -123,6 +123,48 @@ dependencies:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: '2.9'
126
+ - !ruby/object:Gem::Dependency
127
+ name: guard
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '2.8'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '2.8'
140
+ - !ruby/object:Gem::Dependency
141
+ name: guard-rspec
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '4.3'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '4.3'
154
+ - !ruby/object:Gem::Dependency
155
+ name: coveralls
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
126
168
  description: A plugin for chef's knife to manage instances of DigitalOcean servers
127
169
  email:
128
170
  - roland@moriz.de
@@ -131,7 +173,9 @@ executables: []
131
173
  extensions: []
132
174
  extra_rdoc_files: []
133
175
  files:
176
+ - ".coveralls.yml"
134
177
  - ".gitignore"
178
+ - ".rspec"
135
179
  - ".travis.yml"
136
180
  - CHANGELOG.md
137
181
  - Gemfile
@@ -140,27 +184,50 @@ files:
140
184
  - README.md
141
185
  - Rakefile
142
186
  - knife-digital_ocean.gemspec
187
+ - lib/chef/knife/digital_ocean_account_info.rb
143
188
  - lib/chef/knife/digital_ocean_base.rb
189
+ - lib/chef/knife/digital_ocean_domain_create.rb
190
+ - lib/chef/knife/digital_ocean_domain_destroy.rb
191
+ - lib/chef/knife/digital_ocean_domain_list.rb
192
+ - lib/chef/knife/digital_ocean_domain_record_create.rb
193
+ - lib/chef/knife/digital_ocean_domain_record_destroy.rb
194
+ - lib/chef/knife/digital_ocean_domain_record_edit.rb
195
+ - lib/chef/knife/digital_ocean_domain_record_list.rb
144
196
  - lib/chef/knife/digital_ocean_droplet_create.rb
145
197
  - lib/chef/knife/digital_ocean_droplet_destroy.rb
146
198
  - lib/chef/knife/digital_ocean_droplet_list.rb
147
199
  - lib/chef/knife/digital_ocean_image_list.rb
148
200
  - lib/chef/knife/digital_ocean_region_list.rb
149
201
  - lib/chef/knife/digital_ocean_size_list.rb
202
+ - lib/chef/knife/digital_ocean_sshkey_create.rb
203
+ - lib/chef/knife/digital_ocean_sshkey_destroy.rb
150
204
  - lib/chef/knife/digital_ocean_sshkey_list.rb
151
205
  - lib/knife-digital_ocean.rb
152
206
  - lib/knife-digital_ocean/version.rb
207
+ - spec/fixtures/vcr_cassettes/accountinfo.yml
208
+ - spec/fixtures/vcr_cassettes/domainlist.yml
153
209
  - spec/fixtures/vcr_cassettes/droplet.yml
154
210
  - spec/fixtures/vcr_cassettes/image.yml
211
+ - spec/fixtures/vcr_cassettes/public_images.yml
155
212
  - spec/fixtures/vcr_cassettes/region.yml
156
213
  - spec/fixtures/vcr_cassettes/sizes.yml
157
214
  - spec/fixtures/vcr_cassettes/sshkey.yml
215
+ - spec/lib/chef/knife/digital_ocean_account_info_spec.rb
216
+ - spec/lib/chef/knife/digital_ocean_domain_create_spec.rb
217
+ - spec/lib/chef/knife/digital_ocean_domain_destroy_spec.rb
218
+ - spec/lib/chef/knife/digital_ocean_domain_list_spec.rb
219
+ - spec/lib/chef/knife/digital_ocean_domain_record_create_spec.rb
220
+ - spec/lib/chef/knife/digital_ocean_domain_record_destroy_spec.rb
221
+ - spec/lib/chef/knife/digital_ocean_domain_record_edit_spec.rb
222
+ - spec/lib/chef/knife/digital_ocean_domain_record_list_spec.rb
158
223
  - spec/lib/chef/knife/digital_ocean_droplet_create_spec.rb
159
224
  - spec/lib/chef/knife/digital_ocean_droplet_destroy_spec.rb
160
225
  - spec/lib/chef/knife/digital_ocean_droplet_list_spec.rb
161
226
  - spec/lib/chef/knife/digital_ocean_image_list_spec.rb
162
227
  - spec/lib/chef/knife/digital_ocean_region_list_spec.rb
163
228
  - spec/lib/chef/knife/digital_ocean_size_list_spec.rb
229
+ - spec/lib/chef/knife/digital_ocean_sshkey_create_spec.rb
230
+ - spec/lib/chef/knife/digital_ocean_sshkey_destroy_spec.rb
164
231
  - spec/lib/chef/knife/digital_ocean_sshkey_list_spec.rb
165
232
  - spec/lib/knife-digital_ocean/version_spec.rb
166
233
  - spec/spec_helper.rb
@@ -184,22 +251,35 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
251
  version: '0'
185
252
  requirements: []
186
253
  rubyforge_project:
187
- rubygems_version: 2.4.2
254
+ rubygems_version: 2.4.4
188
255
  signing_key:
189
256
  specification_version: 4
190
257
  summary: A plugin for chef's knife to manage instances of DigitalOcean servers
191
258
  test_files:
259
+ - spec/fixtures/vcr_cassettes/accountinfo.yml
260
+ - spec/fixtures/vcr_cassettes/domainlist.yml
192
261
  - spec/fixtures/vcr_cassettes/droplet.yml
193
262
  - spec/fixtures/vcr_cassettes/image.yml
263
+ - spec/fixtures/vcr_cassettes/public_images.yml
194
264
  - spec/fixtures/vcr_cassettes/region.yml
195
265
  - spec/fixtures/vcr_cassettes/sizes.yml
196
266
  - spec/fixtures/vcr_cassettes/sshkey.yml
267
+ - spec/lib/chef/knife/digital_ocean_account_info_spec.rb
268
+ - spec/lib/chef/knife/digital_ocean_domain_create_spec.rb
269
+ - spec/lib/chef/knife/digital_ocean_domain_destroy_spec.rb
270
+ - spec/lib/chef/knife/digital_ocean_domain_list_spec.rb
271
+ - spec/lib/chef/knife/digital_ocean_domain_record_create_spec.rb
272
+ - spec/lib/chef/knife/digital_ocean_domain_record_destroy_spec.rb
273
+ - spec/lib/chef/knife/digital_ocean_domain_record_edit_spec.rb
274
+ - spec/lib/chef/knife/digital_ocean_domain_record_list_spec.rb
197
275
  - spec/lib/chef/knife/digital_ocean_droplet_create_spec.rb
198
276
  - spec/lib/chef/knife/digital_ocean_droplet_destroy_spec.rb
199
277
  - spec/lib/chef/knife/digital_ocean_droplet_list_spec.rb
200
278
  - spec/lib/chef/knife/digital_ocean_image_list_spec.rb
201
279
  - spec/lib/chef/knife/digital_ocean_region_list_spec.rb
202
280
  - spec/lib/chef/knife/digital_ocean_size_list_spec.rb
281
+ - spec/lib/chef/knife/digital_ocean_sshkey_create_spec.rb
282
+ - spec/lib/chef/knife/digital_ocean_sshkey_destroy_spec.rb
203
283
  - spec/lib/chef/knife/digital_ocean_sshkey_list_spec.rb
204
284
  - spec/lib/knife-digital_ocean/version_spec.rb
205
285
  - spec/spec_helper.rb