knife-changelog 0.5.13 → 0.5.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42b8ebdc6c1d371430a8d3c9d9623fd42a5e24f3
4
- data.tar.gz: c09025a1ea5804c850431e08fb7a221d3f4dad4c
3
+ metadata.gz: 9ba116e510147c69ec799adfddd749fdbc5e86a9
4
+ data.tar.gz: e52264b4ccfc9d0c3c32e4cf4ab7b085962a098c
5
5
  SHA512:
6
- metadata.gz: 4bdf31349f11854ddad60c1deeb1c28c091ebc055b22c530bd2aceddcf63aa56176ca224f39de0633b8c40ae7531235c789cc7822ce6b00ab0e2903c18cec111
7
- data.tar.gz: 11731016efb77bd4645c34bfc614cd97e6e84b016ddaf1a444ebc20397fc6a2432adc65608326eddb7b077e363a85f29df47b10beedd8e92276dce1044fc018a
6
+ metadata.gz: a4f3393f8359ee5b9c77f1c41b779b8672750fa670a26e54d09f48e4eeb9e4ace8b8b409a8fc6bbb9ae808c849f7268789664e5ed933192a10d0def344e69a36
7
+ data.tar.gz: e6c69313c42e4c19fa712259ea06d03de976e66599eb1cabe5b52c686e001b8b4d689935c8e22f9e6e7ef3a35532b963e5780f20fbcf05502655f191b7343f12
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.1
3
+
4
+ Metrics/LineLength:
5
+ Max: 150
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.6"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "rubocop"
24
25
 
25
26
 
26
27
  spec.add_dependency 'berkshelf'
@@ -70,37 +70,36 @@ class KnifeChangelog
70
70
  end
71
71
 
72
72
  def execute(name, submodule=false)
73
- changelog = if submodule
74
- handle_submodule(name)
75
- elsif ck_dep(name).nil?
76
- handle_new_cookbook(name)
77
- else
78
- loc = ck_location(name)
79
- case loc
80
- when NilClass
81
- handle_source name, ck_dep(name)
82
- when Berkshelf::GitLocation
83
- handle_git name, loc
84
- when Berkshelf::PathLocation
85
- Chef::Log.debug "path location are always at the last version"
86
- ""
87
- else
88
- raise "Cannot handle #{loc.class} yet"
89
- end
90
- end
91
- format_changelog(name, changelog)
92
- end
93
-
94
- def format_changelog(name, changelog)
73
+ version_change, changelog = if submodule
74
+ handle_submodule(name)
75
+ elsif ck_dep(name).nil?
76
+ handle_new_cookbook(name)
77
+ else
78
+ loc = ck_location(name)
79
+ case loc
80
+ when NilClass
81
+ handle_source name, ck_dep(name)
82
+ when Berkshelf::GitLocation
83
+ handle_git name, loc
84
+ when Berkshelf::PathLocation
85
+ Chef::Log.debug "path location are always at the last version"
86
+ ["", ""]
87
+ else
88
+ raise "Cannot handle #{loc.class} yet"
89
+ end
90
+ end
91
+ format_changelog(name, version_change, changelog)
92
+ end
93
+
94
+ def format_changelog(name, version_change, changelog)
95
95
  if changelog.empty?
96
96
  nil
97
97
  else
98
- [
99
- "Changelog for #{name}",
100
- "==============#{'=' * name.size}",
101
- changelog,
102
- ''
103
- ].compact.join("\n")
98
+ full = ["Changelog for #{name}: #{version_change}"]
99
+ full << '=' * full.first.size
100
+ full << changelog
101
+ full << ''
102
+ full.compact.join("\n")
104
103
  end
105
104
  end
106
105
 
@@ -187,7 +186,8 @@ class KnifeChangelog
187
186
  Chef::Log.info "Found changelog file : " + $1
188
187
  generate_from_changelog_file($1, cur_rev, rev_parse, tmp_dir)
189
188
  end
190
- changelog || generate_from_git_history(tmp_dir, location, cur_rev, rev_parse)
189
+ changelog ||= generate_from_git_history(tmp_dir, location, cur_rev, rev_parse)
190
+ [ "#{cur_rev}->#{rev_parse}", changelog ]
191
191
  end
192
192
 
193
193
  def generate_from_changelog_file(filename, current_rev, rev_parse, tmp_dir)
@@ -215,7 +215,7 @@ class KnifeChangelog
215
215
 
216
216
  def linkify(url, changelog)
217
217
  changelog.map do |line|
218
- line.gsub(/^([a-f0-9]+) /, '[\1](%s/commit/\1) ' % [url.chomp('.git')])
218
+ line.gsub(/^([a-f0-9]+) (.*)$/, '\2 (%s/commit/\1) ' % [url.chomp('.git')])
219
219
  end
220
220
  end
221
221
 
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Changelog
3
- VERSION = "0.5.13"
3
+ VERSION = "0.5.14"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-06 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: berkshelf
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -116,6 +130,7 @@ extensions: []
116
130
  extra_rdoc_files: []
117
131
  files:
118
132
  - ".gitignore"
133
+ - ".rubocop.yml"
119
134
  - ".travis.yml"
120
135
  - Gemfile
121
136
  - LICENSE.txt