cookbook-release 1.1.3 → 1.1.4

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2Y5ZDZjMzE3MjM4NjY2YTJjZDMyYWQ3NTIxYTUwOGRiYTc5MjY5Yg==
4
+ YTI3MDYzODBjYjM4MzY0YWZkODczMmI5OTEyZDZjMTRkYTgyYjZhYw==
5
5
  data.tar.gz: !binary |-
6
- NmM3YWY0YjYxZmY5ZjQwY2UyODc3MGYyYTk4YTBiNGZmZDQ2NWYyNQ==
6
+ ODZkZjMzMzE5MzM0ZTliYzAyODM4YjUyNDlkZTUzMGMxM2Y2MWY0ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODE2ZjdjYjVlMWU2OTBmOTZjNjdmNmJiOGVkMDdmNmIwYjYwZDgyNDQwMDAz
10
- YTMzYmUwMjAxNjkwZDMzN2Q2ODBiNzBlYjg5Y2Y4M2NhNDk1OTllZTQ0MjAy
11
- NzUyMjYzZTExNjdkMDgyY2IwNThhYjE1MTQ4MzBmNzY4YzdkOGM=
9
+ MTE4YTk0YTY0MjQ3M2IwNTU5NzkxYjM3NGZmZjBjMjg5NmU1ZTgyNGNiYjA3
10
+ YzIyYzZjNWU0NjAzOWYzZGIwYjBmNTNhMDg0ZjY0MGQyODhlNGI5M2E2NjE4
11
+ MmU3MGRiNjNlYmVmYzJkMGQ2NzA1NTAxMzI5Yzk2NjVjNTc5OTY=
12
12
  data.tar.gz: !binary |-
13
- ZmI1OTUxNmUxMmIxNWQzZmY2YWNjOWRjNjVhNDJmZjYxOGE5ZDRhYzBiN2Ez
14
- ZWVmNTE4ZDI2N2U3ZjdhNDE3MWQ4ZWRhODI1ZDk3OTI4YjljMWRhMDQ1MDlm
15
- MWVjMDc1ZWY3YWEwOTQzNTI1MTQ3NTNjYzBkMDA2OWEwZGQ4ZDk=
13
+ Mjk4YzFiNzI5ZjkwYmNiNDJhY2ZhZWU2Y2FkNGRhOWViOGNhYmMwMjk2NzA1
14
+ ZDcxNWU3ZjYzZTY1NDZiYzhjYWEwYjczNzQ2YjZiYTI1ZWQwZDRmYjcxY2Yw
15
+ NjhkZGQ2NzZmYzU0MzlhZDMxYzE2NGY3ZDJhNmRlNjhhNjVhZTQ=
@@ -6,7 +6,7 @@ require 'English'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'cookbook-release'
9
- spec.version = '1.1.3'
9
+ spec.version = '1.1.4'
10
10
  spec.authors = ['Grégoire Seux']
11
11
  spec.email = 'g.seux@criteo.com'
12
12
  spec.summary = 'Provide primitives (and rake tasks) to release a cookbook'
@@ -34,12 +34,20 @@ module CookbookRelease
34
34
  result.join("\n")
35
35
  end
36
36
 
37
+ def markdown
38
+ changelog.map do |c|
39
+ full_body ||= @opts[:expand_major] && c.major?
40
+ full_body ||= @opts[:expand_risky] && c.risky?
41
+ full_body ||= @opts[:expand_commit] && (c[:subject] =~ @opts[:expand_commit] || c[:body] =~ @opts[:expand_commit])
42
+ c.to_s_markdown(full_body)
43
+ end.join("\n")
44
+ end
45
+
37
46
  private
38
47
 
39
48
  def changelog
40
49
  ref = ENV['RELEASE_BRANCH'] || 'origin/master'
41
50
  @git.compute_changelog(ref)
42
51
  end
43
-
44
52
  end
45
53
  end
@@ -67,5 +67,10 @@ module CookbookRelease
67
67
  result.join("\n")
68
68
  end
69
69
 
70
+ def to_s_markdown(full)
71
+ result = "*#{self[:hash]}* _#{self[:author]}_ `#{self[:subject]}`"
72
+ result << "\n```\n#{self[:body]}\n```" if full && self[:body]
73
+ result
74
+ end
70
75
  end
71
76
  end
@@ -27,6 +27,12 @@ module CookbookRelease
27
27
  end
28
28
  puts html
29
29
  end
30
+
31
+ desc 'Display markdown changelog between branches'
32
+ task 'changelog:markdown' do
33
+ git = GitUtilities.new
34
+ puts Changelog.new(git, opts).markdown
35
+ end
30
36
  end
31
37
  end
32
38
 
@@ -17,4 +17,31 @@ describe CookbookRelease::Changelog do
17
17
  end
18
18
  end
19
19
 
20
+ describe '.md' do
21
+ it 'add formatting' do
22
+ expect(git).to receive(:compute_changelog).and_return(
23
+ [
24
+ CookbookRelease::Commit.new(
25
+ hash: '123456',
26
+ subject: 'hello',
27
+ author: 'John Doe')
28
+ ]
29
+ )
30
+ changelog = CookbookRelease::Changelog.new(git)
31
+ expect(changelog.markdown).to eq('*123456* _John Doe_ `hello`')
32
+ end
33
+ it 'expand body' do
34
+ expect(git).to receive(:compute_changelog).and_return(
35
+ [
36
+ CookbookRelease::Commit.new(
37
+ hash: '654321',
38
+ subject: '[Risky] hello',
39
+ author: 'John Doe',
40
+ body: 'Some Men Just Want to Watch the World Burn')
41
+ ]
42
+ )
43
+ changelog = CookbookRelease::Changelog.new(git, expand_risky: true)
44
+ expect(changelog.markdown).to include("\n```\nSome Men Just Want")
45
+ end
46
+ end
20
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookbook-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grégoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-04 00:00:00.000000000 Z
11
+ date: 2016-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic