cookbook-release 1.4.0 → 1.4.1

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
- SHA256:
3
- metadata.gz: 57e2bcc2990d45377c96a8b34b77103cff548f5ca7eaed951e946f0d9303cfa3
4
- data.tar.gz: 89ddf7b79d5999cfd47d2ad6350d80801e3b6de8b2d048a8ee78516c8945585b
2
+ SHA1:
3
+ metadata.gz: ef4f876c9097c92b3f1531e562f575d0f607fec7
4
+ data.tar.gz: 80314fba7113d9b8134aeb467c0973ad3cf3734f
5
5
  SHA512:
6
- metadata.gz: 059852351bb66fd6369180260c30e59764252cd78847c40190eaca36e97375dea5fbb97e332a7518f8d57c24e7d31f41ec410a7a6d7b79ee01741dc0080f9cf2
7
- data.tar.gz: c9060e027e88bce6a27fdf280fb3684360e64e94ddd4d6b7292f5e2b3e34cc40b1952242944f5d069db9493cb1888d5343bd8520d91208069db5935451cd341e
6
+ metadata.gz: f0e4ec14d3d2759e8cd7f357d06a0e5ecdd30d6b90c8b16afdf486bb60dca6586f0de89b6dd69e66085a71f52eee9a75d57ba35d57df67f36b9d654c8102689d
7
+ data.tar.gz: be592e21c15ec5022533001a738157d2afc91857238f3b9a3ee2b5c414c4a544c1ebae3bed21c197e6ca9c53b0b71bc381ef8a4dbe2ddcf9f80275e6817c5f2e
@@ -2,7 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 2.4.0
4
4
  before_install:
5
- - rvm @global do gem uninstall bundler -a -x
6
5
  - rvm @global do gem install bundler -v 1.15.4
7
6
  deploy:
8
7
  provider: rubygems
data/README.md CHANGED
@@ -77,4 +77,4 @@ require 'cookbook-release'
77
77
  CookbookRelease::Rake::RepoTask.new
78
78
  ```
79
79
 
80
- will allow to create tasks to generate html changelog between HEAD and master branch. It aims to make some changes more visible such as [Risky] tag (or any tag used for major changes).
80
+ will allow to create tasks to generate html changelog between HEAD and master branch. It aims to make some changes more visible such as [Risky] tag (or any tag used for major changes). You may add a `sub_dir` parameter to restrict the scope of the changes to a sub-directory of the git root.
@@ -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.4.0'
9
+ spec.version = '1.4.1'
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'
@@ -13,20 +13,21 @@ module CookbookRelease
13
13
  class RepoTask < ::Rake::TaskLib
14
14
  def initialize(opts = {}, &html_block)
15
15
  desc 'Display raw changelog between branches'
16
- task 'changelog:raw' do
17
- git = GitUtilities.new
16
+ task 'changelog:raw', [:sub_dir] do |_, args|
17
+ git = GitUtilities.new('sub_dir': args['sub_dir'])
18
18
  puts Changelog.new(git, opts).raw
19
19
  end
20
20
 
21
21
  desc 'Display raw changelog between branches with risky commits on top'
22
- task 'changelog:raw_priority' do
23
- git = GitUtilities.new
22
+ task 'changelog:raw_priority', [:sub_dir] do |_, args|
23
+ git = GitUtilities.new(args)
24
+ git = GitUtilities.new('sub_dir': args['sub_dir'])
24
25
  puts Changelog.new(git, opts).raw_priority
25
26
  end
26
27
 
27
28
  desc 'Display html changelog between branches'
28
- task 'changelog:html' do
29
- git = GitUtilities.new
29
+ task 'changelog:html', [:sub_dir] do |_, args|
30
+ git = GitUtilities.new('sub_dir': args['sub_dir'])
30
31
  html = Changelog.new(git, opts).html
31
32
  if block_given?
32
33
  html = html_block.call(html)
@@ -35,8 +36,8 @@ module CookbookRelease
35
36
  end
36
37
 
37
38
  desc 'Display html changelog between branches with risky commits on top'
38
- task 'changelog:html_priority' do
39
- git = GitUtilities.new
39
+ task 'changelog:html_priority', [:sub_dir] do |_, args|
40
+ git = GitUtilities.new('sub_dir': args['sub_dir'])
40
41
  html = Changelog.new(git, opts).html_priority
41
42
  if block_given?
42
43
  html = html_block.call(html)
@@ -45,14 +46,14 @@ module CookbookRelease
45
46
  end
46
47
 
47
48
  desc 'Display markdown changelog between branches'
48
- task 'changelog:markdown' do
49
- git = GitUtilities.new
49
+ task 'changelog:markdown', [:sub_dir] do |_, args|
50
+ git = GitUtilities.new('sub_dir': args['sub_dir'])
50
51
  puts Changelog.new(git, opts).markdown
51
52
  end
52
53
 
53
54
  desc 'Display markdown changelog between branches with risky commits on top'
54
- task 'changelog:markdown_priority' do
55
- git = GitUtilities.new
55
+ task 'changelog:markdown_priority', [:sub_dir] do |_, args|
56
+ git = GitUtilities.new('sub_dir': args['sub_dir'])
56
57
  puts Changelog.new(git, opts).markdown_priority
57
58
  end
58
59
  end
@@ -12,6 +12,7 @@ module CookbookRelease
12
12
  def initialize(options={})
13
13
  @tag_prefix = options[:tag_prefix] || ''
14
14
  cwd = options[:cwd] || Dir.pwd
15
+ @sub_dir = options[:sub_dir] # if nil takes the cwd
15
16
  @shellout_opts = {
16
17
  cwd: cwd
17
18
  }
@@ -63,7 +64,7 @@ module CookbookRelease
63
64
  end
64
65
 
65
66
  def compute_changelog(since, short_sha = true)
66
- @g.log(500).between(since, 'HEAD').map do |commit|
67
+ @g.log(500).object(@sub_dir).between(since, 'HEAD').map do |commit|
67
68
  message = commit.message.lines.map(&:chomp).compact.delete_if(&:empty?)
68
69
  Commit.new(
69
70
  author: commit.author.name,
@@ -123,12 +123,31 @@ git tag 12.34.56
123
123
  cmd.run_command
124
124
  cmd.error!
125
125
  end
126
-
127
126
  changelog = git.compute_changelog('1.0.0')
128
127
  expect(changelog.size).to eq(3)
129
128
  expect(changelog.map {|c| c[:subject]}).to contain_exactly('A commit', 'Another commit', 'A third one')
130
129
  end
131
130
 
131
+ it 'shows only sub_dir commits' do
132
+ cmds = <<-EOH
133
+ git commit --allow-empty -m "subject" -m "body" -m "line2"
134
+ git commit --allow-empty -m "without body"
135
+ mkdir -p subbie
136
+ echo "hello" > subbie/there
137
+ git add subbie/there
138
+ git commit -m "hello there"
139
+ EOH
140
+ sub_git = CookbookRelease::GitUtilities.new(sub_dir: 'subbie')
141
+ cmds.split("\n").each do |cmd|
142
+ cmd = Mixlib::ShellOut.new(cmd)
143
+ cmd.run_command
144
+ cmd.error!
145
+ end
146
+
147
+ changelog = sub_git.compute_changelog('1.0.0')
148
+ expect(changelog.size).to eq(1)
149
+ end
150
+
132
151
  it 'parse correctly commits' do
133
152
  cmds = <<-EOH
134
153
  git commit --allow-empty -m "subject" -m "body" -m "line2"
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.4.0
4
+ version: 1.4.1
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: 2017-11-02 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 2.7.0
184
+ rubygems_version: 2.6.13
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: Provide primitives (and rake tasks) to release a cookbook