knife-cookbook-cleanup 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +24 -1
- data/.rubocop.yml +33 -0
- data/.travis.yml +33 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +137 -57
- data/LICENSE.md +201 -0
- data/Rakefile +2 -0
- data/knife-cookbook-cleanup.gemspec +21 -13
- data/lib/chef/knife/cookbook_cleanup.rb +36 -20
- data/lib/knife-cookbook-cleanup/version.rb +2 -1
- metadata +28 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5634029cada3e8260d116e10293848022f59591a
|
4
|
+
data.tar.gz: 95c5f74456429e1fc96ebe3692d8fdc1dff83376
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b58938a53f84128ea50d4fc31402808d2036868b7ac12099deadcd45fc37fa15a8c9cf3e2a48d422caf2e601f9790a3848704f185bf7fa04205fcddc2fce4567
|
7
|
+
data.tar.gz: 4b06f120e37cc4c65c433273ee5d9caafc01529ef7eb8842ea08320a5a11963675e8f04cc1f5c53e094375bbadf49055af9429e598179ac219c8f080702088c1
|
data/.gitignore
CHANGED
@@ -1 +1,24 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
/.bundle/
|
3
|
+
/.yardoc
|
4
|
+
/Gemfile.lock
|
5
|
+
/_yardoc/
|
6
|
+
/coverage/
|
7
|
+
/doc/
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/tmp/
|
11
|
+
*.bundle
|
12
|
+
*.so
|
13
|
+
*.o
|
14
|
+
*.a
|
15
|
+
mkmf.log
|
16
|
+
.vagrant/*
|
17
|
+
.DS_Store
|
18
|
+
.idea/*
|
19
|
+
*.gem
|
20
|
+
|
21
|
+
|
22
|
+
# test-kitchen
|
23
|
+
.kitchen/
|
24
|
+
.kitchen.list.yml
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
MethodLength:
|
3
|
+
Max: 200
|
4
|
+
|
5
|
+
LineLength:
|
6
|
+
Max: 160
|
7
|
+
|
8
|
+
AbcSize:
|
9
|
+
Max: 100
|
10
|
+
|
11
|
+
FileName:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
PerceivedComplexity:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
CyclomaticComplexity:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
ClassLength:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
IfUnlessModifier:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
RegexpLiteral:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/Documentation:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
AllCops:
|
33
|
+
TargetRubyVersion: 2.3
|
data/.travis.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache:
|
3
|
+
- bundler
|
4
|
+
before_install:
|
5
|
+
- gem install bundler -v 1.15
|
6
|
+
|
7
|
+
install:
|
8
|
+
- bundle install
|
9
|
+
rvm:
|
10
|
+
- 2.3.1
|
11
|
+
- 2.4.1
|
12
|
+
notifications:
|
13
|
+
email:
|
14
|
+
recipients:
|
15
|
+
- me@benabrams.it
|
16
|
+
on_success: change
|
17
|
+
on_failure: always
|
18
|
+
script:
|
19
|
+
- gem build knife-cookbook-cleanup.gemspec
|
20
|
+
- gem install knife-cookbook-cleanup-*.gem
|
21
|
+
- bundle exec rubocop -D
|
22
|
+
|
23
|
+
# deploy:
|
24
|
+
# provider: rubygems
|
25
|
+
# api_key:
|
26
|
+
# secure: <encrypted rubygems deploy key>
|
27
|
+
# gem: knife-cookbook-cleanup
|
28
|
+
# on:
|
29
|
+
# tags: true
|
30
|
+
# all_branches: true
|
31
|
+
# rvm: 2.3.0
|
32
|
+
# rvm: 2.4.1
|
33
|
+
# repo: majormoses/knife-cookbook-cleanup
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Change Log
|
2
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
3
|
+
|
4
|
+
This CHANGELOG follows the format located [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
|
5
|
+
|
6
|
+
## [Unreleased]
|
7
|
+
### Added
|
8
|
+
- option `--dry-run` to echo out what it would do (@majormoses)
|
9
|
+
- option `--versions-to-keep` which allows you keep x versions, this is useful for cleaning up cookbooks but leaving the last few around for easy rollback and such (@majormoses)
|
10
|
+
- rubocop config (@majormoses)
|
11
|
+
- travis config (@majormoses)
|
12
|
+
- updated dependencies (@majormoses)
|
13
|
+
- license (@majormoses)
|
14
|
+
|
15
|
+
### Breaking Changes
|
16
|
+
- removed ruby `< 2.3.1` support (@majormoses)
|
17
|
+
|
18
|
+
## [0.1.1] - 2014-04-08
|
19
|
+
### Added
|
20
|
+
- functional version (@agoddard)
|
21
|
+
|
22
|
+
[Unreleased]: https://github.com/majormoses/knife-cookbook-cleanup/compare/v0.1.1...HEAD
|
23
|
+
[0.1.1]: https://github.com/majormoses/knife-cookbook-cleanup/compare/df026a622e4962f0a1d88e93d866bf4daae02b0e...7822c8a3790c25ab2acb56b24507728c19efd7b4
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,79 +2,155 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
knife-cookbook-cleanup (0.1.1)
|
5
|
-
chef (> 0
|
5
|
+
chef (> 12.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
ast (2.4.0)
|
13
|
+
builder (3.2.3)
|
14
|
+
chef (13.8.3)
|
15
|
+
addressable
|
16
|
+
bundler (>= 1.10)
|
17
|
+
chef-config (= 13.8.3)
|
18
|
+
chef-zero (>= 13.0)
|
12
19
|
diff-lcs (~> 1.2, >= 1.2.4)
|
13
20
|
erubis (~> 2.7)
|
21
|
+
ffi-yajl (~> 2.2)
|
14
22
|
highline (~> 1.6, >= 1.6.9)
|
15
|
-
|
16
|
-
|
17
|
-
mixlib-
|
18
|
-
mixlib-
|
19
|
-
mixlib-
|
23
|
+
iniparse (~> 1.4)
|
24
|
+
iso8601 (~> 0.9.1)
|
25
|
+
mixlib-archive (~> 0.4)
|
26
|
+
mixlib-authentication (~> 1.4)
|
27
|
+
mixlib-cli (~> 1.7)
|
20
28
|
mixlib-log (~> 1.3)
|
21
|
-
mixlib-shellout (~>
|
22
|
-
net-
|
23
|
-
net-ssh
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
mixlib-shellout (~> 2.0)
|
30
|
+
net-sftp (~> 2.1, >= 2.1.2)
|
31
|
+
net-ssh (>= 2.9, < 5.0)
|
32
|
+
net-ssh-multi (~> 1.2, >= 1.2.1)
|
33
|
+
ohai (~> 13.0)
|
34
|
+
plist (~> 3.2)
|
35
|
+
proxifier (~> 1.0)
|
36
|
+
rspec-core (~> 3.5)
|
37
|
+
rspec-expectations (~> 3.5)
|
38
|
+
rspec-mocks (~> 3.5)
|
39
|
+
rspec_junit_formatter (~> 0.2.0)
|
40
|
+
serverspec (~> 2.7)
|
41
|
+
specinfra (~> 2.10)
|
42
|
+
syslog-logger (~> 1.6)
|
43
|
+
uuidtools (~> 2.1.5)
|
44
|
+
chef-config (13.8.3)
|
45
|
+
addressable
|
46
|
+
fuzzyurl
|
47
|
+
mixlib-config (~> 2.0)
|
48
|
+
mixlib-shellout (~> 2.0)
|
49
|
+
tomlrb (~> 1.2)
|
50
|
+
chef-zero (13.1.0)
|
51
|
+
ffi-yajl (~> 2.2)
|
52
|
+
hashie (>= 2.0, < 4.0)
|
32
53
|
mixlib-log (~> 1.3)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
diff-lcs (1.2.5)
|
54
|
+
rack (~> 2.0)
|
55
|
+
uuidtools (~> 2.1)
|
56
|
+
diff-lcs (1.3)
|
37
57
|
erubis (2.7.0)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
58
|
+
ffi (1.9.23)
|
59
|
+
ffi-yajl (2.3.1)
|
60
|
+
libyajl2 (~> 1.2)
|
61
|
+
fuzzyurl (0.9.0)
|
62
|
+
hashie (3.5.7)
|
63
|
+
highline (1.7.10)
|
64
|
+
iniparse (1.4.4)
|
65
|
+
ipaddress (0.8.3)
|
66
|
+
iso8601 (0.9.1)
|
67
|
+
libyajl2 (1.2.0)
|
68
|
+
mixlib-archive (0.4.1)
|
45
69
|
mixlib-log
|
46
|
-
mixlib-
|
47
|
-
mixlib-
|
48
|
-
mixlib-
|
49
|
-
mixlib-
|
50
|
-
|
51
|
-
|
52
|
-
net-
|
70
|
+
mixlib-authentication (1.4.2)
|
71
|
+
mixlib-cli (1.7.0)
|
72
|
+
mixlib-config (2.2.5)
|
73
|
+
mixlib-log (1.7.1)
|
74
|
+
mixlib-shellout (2.3.2)
|
75
|
+
multi_json (1.13.1)
|
76
|
+
net-scp (1.2.1)
|
77
|
+
net-ssh (>= 2.6.5)
|
78
|
+
net-sftp (2.1.2)
|
53
79
|
net-ssh (>= 2.6.5)
|
54
|
-
net-ssh
|
80
|
+
net-ssh (4.2.0)
|
81
|
+
net-ssh-gateway (2.0.0)
|
82
|
+
net-ssh (>= 4.0.0)
|
83
|
+
net-ssh-multi (1.2.1)
|
55
84
|
net-ssh (>= 2.6.5)
|
56
85
|
net-ssh-gateway (>= 1.2.0)
|
57
|
-
|
86
|
+
net-telnet (0.1.1)
|
87
|
+
ohai (13.8.0)
|
88
|
+
chef-config (>= 12.5.0.alpha.1, < 14)
|
89
|
+
ffi (~> 1.9)
|
90
|
+
ffi-yajl (~> 2.2)
|
58
91
|
ipaddress
|
59
92
|
mixlib-cli
|
60
|
-
mixlib-config
|
61
|
-
mixlib-log
|
62
|
-
mixlib-shellout
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
93
|
+
mixlib-config (~> 2.0)
|
94
|
+
mixlib-log (>= 1.7.1, < 2.0)
|
95
|
+
mixlib-shellout (~> 2.0)
|
96
|
+
plist (~> 3.1)
|
97
|
+
systemu (~> 2.6.4)
|
98
|
+
wmi-lite (~> 1.0)
|
99
|
+
parallel (1.12.1)
|
100
|
+
parser (2.5.0.3)
|
101
|
+
ast (~> 2.4.0)
|
102
|
+
plist (3.4.0)
|
103
|
+
powerpack (0.1.1)
|
104
|
+
proxifier (1.0.3)
|
105
|
+
public_suffix (3.0.2)
|
106
|
+
rack (2.0.4)
|
107
|
+
rainbow (2.2.2)
|
108
|
+
rake
|
109
|
+
rake (12.3.0)
|
110
|
+
rspec (3.7.0)
|
111
|
+
rspec-core (~> 3.7.0)
|
112
|
+
rspec-expectations (~> 3.7.0)
|
113
|
+
rspec-mocks (~> 3.7.0)
|
114
|
+
rspec-core (3.7.1)
|
115
|
+
rspec-support (~> 3.7.0)
|
116
|
+
rspec-expectations (3.7.0)
|
117
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
+
rspec-support (~> 3.7.0)
|
119
|
+
rspec-its (1.2.0)
|
120
|
+
rspec-core (>= 3.0.0)
|
121
|
+
rspec-expectations (>= 3.0.0)
|
122
|
+
rspec-mocks (3.7.0)
|
123
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
124
|
+
rspec-support (~> 3.7.0)
|
125
|
+
rspec-support (3.7.1)
|
126
|
+
rspec_junit_formatter (0.2.3)
|
127
|
+
builder (< 4)
|
128
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
129
|
+
rubocop (0.51.0)
|
130
|
+
parallel (~> 1.10)
|
131
|
+
parser (>= 2.3.3.1, < 3.0)
|
132
|
+
powerpack (~> 0.1)
|
133
|
+
rainbow (>= 2.2.2, < 3.0)
|
134
|
+
ruby-progressbar (~> 1.7)
|
135
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
136
|
+
ruby-progressbar (1.9.0)
|
137
|
+
serverspec (2.41.3)
|
138
|
+
multi_json
|
139
|
+
rspec (~> 3.0)
|
140
|
+
rspec-its
|
141
|
+
specinfra (~> 2.72)
|
142
|
+
sfl (2.3)
|
143
|
+
specinfra (2.73.2)
|
144
|
+
net-scp
|
145
|
+
net-ssh (>= 2.7, < 5.0)
|
146
|
+
net-telnet
|
147
|
+
sfl
|
148
|
+
syslog-logger (1.6.8)
|
149
|
+
systemu (2.6.5)
|
150
|
+
tomlrb (1.2.6)
|
151
|
+
unicode-display_width (1.3.0)
|
152
|
+
uuidtools (2.1.5)
|
153
|
+
wmi-lite (1.0.0)
|
78
154
|
|
79
155
|
PLATFORMS
|
80
156
|
ruby
|
@@ -83,3 +159,7 @@ DEPENDENCIES
|
|
83
159
|
bundler (~> 1.6)
|
84
160
|
knife-cookbook-cleanup!
|
85
161
|
rake
|
162
|
+
rubocop (~> 0.51.0)
|
163
|
+
|
164
|
+
BUNDLED WITH
|
165
|
+
1.16.1
|
data/LICENSE.md
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/Rakefile
CHANGED
@@ -1,27 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
|
3
|
-
|
4
|
-
require
|
3
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
4
|
+
|
5
|
+
require 'knife-cookbook-cleanup/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
+
s.name = 'knife-cookbook-cleanup'
|
8
9
|
s.version = Knife::CookbookCleanup::VERSION
|
9
10
|
s.platform = Gem::Platform::RUBY
|
10
11
|
s.has_rdoc = true
|
11
|
-
s.extra_rdoc_files = [
|
12
|
-
s.authors
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
13
|
+
s.authors = [
|
14
|
+
'Anthony Goddard',
|
15
|
+
'Fletcher Nichol',
|
16
|
+
'Heavy Water Operations',
|
17
|
+
'Ben Abrams'
|
18
|
+
]
|
19
|
+
s.email = ['me@benabrams.it']
|
20
|
+
s.homepage = 'https://github.com/majormoses/knife-cookbook-cleanup'
|
21
|
+
s.summary = 'Chef Knife plugin to remove all cookbooks except the latest'
|
22
|
+
s.description = 'Deletes all cookbooks from the chef server except for x versions'
|
17
23
|
|
18
24
|
s.files = `git ls-files`.split("\n")
|
19
25
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
-
s.require_paths = [
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
27
|
+
s.require_paths = ['lib']
|
28
|
+
s.required_ruby_version = '>= 2.3.1'
|
22
29
|
|
23
|
-
s.add_dependency 'chef', '> 0
|
30
|
+
s.add_dependency 'chef', '> 12.0'
|
24
31
|
|
25
32
|
s.add_development_dependency 'bundler', '~> 1.6'
|
26
33
|
s.add_development_dependency 'rake'
|
34
|
+
s.add_development_dependency 'rubocop', '~> 0.51.0'
|
27
35
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#
|
2
4
|
# Author:: Heavy Water Operations (<support@hw-ops.com>)
|
3
5
|
# Copyright:: Copyright (c) 2014 Heavy Water Operations, LLC.
|
@@ -21,52 +23,66 @@ require 'chef/knife'
|
|
21
23
|
class Chef
|
22
24
|
class Knife
|
23
25
|
class CookbookCleanup < Knife
|
24
|
-
|
25
26
|
deps do
|
26
27
|
require 'chef/knife/bootstrap'
|
27
28
|
require 'chef/cookbook_version'
|
28
29
|
Chef::Knife::Bootstrap.load_deps
|
29
30
|
end
|
30
31
|
|
31
|
-
banner
|
32
|
+
banner 'knife cookbook cleanup'
|
33
|
+
|
34
|
+
option :versions_to_keep,
|
35
|
+
long: '--versions-to-keep VALUE',
|
36
|
+
description: 'Versions of cookbooks to keep (default 1)',
|
37
|
+
default: 1,
|
38
|
+
proc: proc(&:to_i)
|
39
|
+
|
40
|
+
option :dry_run,
|
41
|
+
long: '--dry-run',
|
42
|
+
description: 'Allows showing what would have been done without actually doing the deed',
|
43
|
+
boolean: true,
|
44
|
+
default: false
|
32
45
|
|
33
46
|
def run
|
34
47
|
all_cookbooks = rest.get_rest('/cookbooks?num_versions=all')
|
35
|
-
drop_cookbooks =
|
36
|
-
keep_cookbooks =
|
48
|
+
drop_cookbooks = {}
|
49
|
+
keep_cookbooks = {}
|
37
50
|
all_cookbooks.each do |cb|
|
38
51
|
cookbook_name = cb[0]
|
39
|
-
sorted_versions = cb[1][
|
40
|
-
keep_versions = sorted_versions.pop
|
52
|
+
sorted_versions = cb[1]['versions'].map { |v| v['version'] }.sort { |x, y| Gem::Version.new(x) <=> Gem::Version.new(y) }
|
53
|
+
keep_versions = sorted_versions.pop(config[:versions_to_keep])
|
41
54
|
dropped_versions = sorted_versions
|
42
55
|
drop_cookbooks[cookbook_name] = dropped_versions
|
43
56
|
keep_cookbooks[cookbook_name] = keep_versions
|
44
57
|
end
|
45
|
-
keep_cookbooks.delete_if { |
|
46
|
-
drop_cookbooks.delete_if { |
|
58
|
+
keep_cookbooks.delete_if { |_k, v| v.empty? }
|
59
|
+
drop_cookbooks.delete_if { |_k, v| v.empty? }
|
47
60
|
|
48
61
|
if drop_cookbooks.empty?
|
49
|
-
ui.info
|
62
|
+
ui.info 'No old cookbook versions were found'
|
50
63
|
exit 0
|
51
64
|
end
|
52
65
|
|
53
|
-
ui.msg
|
54
|
-
ui.msg
|
55
|
-
ui.msg
|
66
|
+
ui.msg ''
|
67
|
+
ui.msg 'The following cookbook versions will remain on the chef server:'
|
68
|
+
ui.msg ''
|
56
69
|
ui.msg ui.output(keep_cookbooks)
|
57
|
-
ui.msg
|
58
|
-
ui.msg
|
59
|
-
ui.msg
|
70
|
+
ui.msg ''
|
71
|
+
ui.msg 'The following cookbook versions will be deleted:'
|
72
|
+
ui.msg ''
|
60
73
|
ui.msg ui.output(drop_cookbooks)
|
61
|
-
ui.msg
|
74
|
+
ui.msg ''
|
62
75
|
unless config[:yes]
|
63
|
-
ui.confirm(
|
76
|
+
ui.confirm('Do you really want to delete these cookbooks? (Y/N) ', false)
|
64
77
|
end
|
65
|
-
|
66
78
|
drop_cookbooks.each do |cookbook, versions|
|
67
79
|
versions.each do |version|
|
68
|
-
|
69
|
-
|
80
|
+
if config[:dry_run]
|
81
|
+
ui.info("Would have deleted cookbook #{cookbook.ljust(25)} [#{version}]")
|
82
|
+
else
|
83
|
+
rest.delete_rest("cookbooks/#{cookbook}/#{version}")
|
84
|
+
ui.info("Deleted cookbook #{cookbook.ljust(25)} [#{version}]")
|
85
|
+
end
|
70
86
|
end
|
71
87
|
end
|
72
88
|
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-cookbook-cleanup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Goddard
|
8
8
|
- Fletcher Nichol
|
9
9
|
- Heavy Water Operations
|
10
|
+
- Ben Abrams
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: chef
|
@@ -18,14 +19,14 @@ dependencies:
|
|
18
19
|
requirements:
|
19
20
|
- - ">"
|
20
21
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0
|
22
|
+
version: '12.0'
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
26
|
requirements:
|
26
27
|
- - ">"
|
27
28
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0
|
29
|
+
version: '12.0'
|
29
30
|
- !ruby/object:Gem::Dependency
|
30
31
|
name: bundler
|
31
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,9 +55,23 @@ dependencies:
|
|
54
55
|
- - ">="
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: '0'
|
57
|
-
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rubocop
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.51.0
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.51.0
|
72
|
+
description: Deletes all cookbooks from the chef server except for x versions
|
58
73
|
email:
|
59
|
-
-
|
74
|
+
- me@benabrams.it
|
60
75
|
executables: []
|
61
76
|
extensions: []
|
62
77
|
extra_rdoc_files:
|
@@ -64,15 +79,19 @@ extra_rdoc_files:
|
|
64
79
|
- LICENSE
|
65
80
|
files:
|
66
81
|
- ".gitignore"
|
82
|
+
- ".rubocop.yml"
|
83
|
+
- ".travis.yml"
|
84
|
+
- CHANGELOG.md
|
67
85
|
- Gemfile
|
68
86
|
- Gemfile.lock
|
69
87
|
- LICENSE
|
88
|
+
- LICENSE.md
|
70
89
|
- README.md
|
71
90
|
- Rakefile
|
72
91
|
- knife-cookbook-cleanup.gemspec
|
73
92
|
- lib/chef/knife/cookbook_cleanup.rb
|
74
93
|
- lib/knife-cookbook-cleanup/version.rb
|
75
|
-
homepage: https://github.com/
|
94
|
+
homepage: https://github.com/majormoses/knife-cookbook-cleanup
|
76
95
|
licenses: []
|
77
96
|
metadata: {}
|
78
97
|
post_install_message:
|
@@ -83,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
102
|
requirements:
|
84
103
|
- - ">="
|
85
104
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
105
|
+
version: 2.3.1
|
87
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
107
|
requirements:
|
89
108
|
- - ">="
|
@@ -91,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
110
|
version: '0'
|
92
111
|
requirements: []
|
93
112
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.2.
|
113
|
+
rubygems_version: 2.5.2.1
|
95
114
|
signing_key:
|
96
115
|
specification_version: 4
|
97
116
|
summary: Chef Knife plugin to remove all cookbooks except the latest
|