knife-tidy 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -2
- data/lib/chef/knife/tidy_backup_clean.rb +17 -3
- data/lib/knife-tidy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a70a4795b84f11eff9639e474e9517b260137d11
|
4
|
+
data.tar.gz: 98fbf0c01305a8813471f5524400f973db06be34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84caa9803916b69388488d6f101aa41379d8ad30714a8c5275c42e3af1ac279d2ab7b68868fdd33647ff914b898b7097086711def57e378b2dafae15e79bd40f
|
7
|
+
data.tar.gz: 37262614ee1db11e62eb29039fd84963e5f70cd4bb695cfb2adc1630bda1712721588e1e92a36110119b2bacde777ea04a0c54e027076e06367ab7f312458740
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.
|
4
|
-
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.
|
3
|
+
## [0.3.2](https://github.com/chef-customers/knife-tidy/tree/0.3.2) (2017-09-14)
|
4
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.1...0.3.2)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- fixed name mismatch in metadata.json [\#22](https://github.com/chef-customers/knife-tidy/pull/22) ([jeremymv2](https://github.com/jeremymv2))
|
9
|
+
|
10
|
+
## [0.3.1](https://github.com/chef-customers/knife-tidy/tree/0.3.1) (2017-09-14)
|
11
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.0...0.3.1)
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- generate a metadata.rb if needed [\#21](https://github.com/chef-customers/knife-tidy/pull/21) ([jeremymv2](https://github.com/jeremymv2))
|
16
|
+
- newline for action needed messages [\#20](https://github.com/chef-customers/knife-tidy/pull/20) ([jeremymv2](https://github.com/jeremymv2))
|
17
|
+
|
18
|
+
## [0.3.0](https://github.com/chef-customers/knife-tidy/tree/0.3.0) (2017-09-14)
|
19
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.2.4...0.3.0)
|
5
20
|
|
6
21
|
**Closed issues:**
|
7
22
|
|
@@ -95,10 +95,24 @@ class Chef
|
|
95
95
|
def fix_cookbook_names(org)
|
96
96
|
for_each_cookbook_path(org) do |cookbook_path|
|
97
97
|
rb_path = ::File.join(cookbook_path, 'metadata.rb')
|
98
|
-
|
98
|
+
json_path = ::File.join(cookbook_path, 'metadata.json')
|
99
|
+
# next unless ::File.exist?(rb_path)
|
99
100
|
cookbook_name = tidy.cookbook_name_from_path(cookbook_path)
|
100
|
-
|
101
|
-
|
101
|
+
if ::File.exist?(rb_path)
|
102
|
+
lines = ::File.readlines(rb_path).select { |line| line =~ /^name.*['"]#{cookbook_name}['"]/ }
|
103
|
+
add_cookbook_name_to_metadata(cookbook_name, rb_path) if lines.empty?
|
104
|
+
else
|
105
|
+
if ::File.exist?(json_path)
|
106
|
+
metadata = FFI_Yajl::Parser.parse(::File.read(json_path), symbolize_names: false)
|
107
|
+
if metadata['name'] != cookbook_name
|
108
|
+
metadata['name'] = cookbook_name
|
109
|
+
puts "REPAIRING: Correcting `name` in #{json_path}`"
|
110
|
+
::File.open(json_path, 'w') do |f|
|
111
|
+
f.write(Chef::JSONCompat.to_json_pretty(metadata))
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
102
116
|
end
|
103
117
|
end
|
104
118
|
|
data/lib/knife-tidy/version.rb
CHANGED