cookbook-release 0.4.2 → 0.4.3

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
- YTQzZWMzNGFjMmFiOWViYzY3NjBmNDFkNDNlMmNmODNmNGExOGI2NQ==
4
+ MTRmMzIxZmY5MjlmZjQ4MjQyMDI2YzcxZTcyNjFmNWZmMDZiN2Q2OQ==
5
5
  data.tar.gz: !binary |-
6
- MTI4ZjA0M2Y1Yzc1YjgwZjJlN2VmMWEyNmRjMDNmZTViMDQxOTUzNA==
6
+ YjAxYjA3YTM0MGU5MDBjYmYxZjg3Y2MwZDgxOTRhNGI4NWQyOTcxMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTMwOGEyYzZmYjczYjkwODhkODdlYTI5OWVjOGZkZTRlMDMzZDc4M2UwNTQw
10
- NGNhOGQwYTQwZjAyMjMwYjM0YWVkMmE4NmJiMTJkMjM1YjA0OGY3YTAyMzc4
11
- YmQ0ODBmY2E0NjY3YzVjM2UyYzJlMTMwMDhjN2MzZDQ3ZmY2YzI=
9
+ MzliNjE0NzM1NjFlNWQwNWE3YjU3NjhmZDY0NjU1OGEyNTA3MzZlNjU4ZmM5
10
+ OTAyMGVkNDMyYWE0YTI1NzBkYTVkZTIzMzYwM2Y5ZmIyYjlmZWE2Yzg4MDZj
11
+ ZjY3OTYyYThkOGZkOGMwZjY2YTM4MmViYjMxYWU5M2Q4ODdmNzU=
12
12
  data.tar.gz: !binary |-
13
- MzgzMGZmNDdlN2U0ZmQ4ZjA5MTQ5OGNiM2EzZDM1NTFlMjliNjUxMzZiNDll
14
- YWI0NGRkOTg4MzJlYTdiYmRhOWRkNDFiYTBhM2Q4M2EwYTVjYTRmMTJjNWNl
15
- NjAxYjkxZDI0YTE4OWU5NGIxYTY2NDA3NmUzZTMyMDI4NGJiNGQ=
13
+ MTA3Y2VlYzNmYWFhMjU5NzMxODIyYmUxZTgwMzJmZDIwOWZkNWFkZWJmOTI5
14
+ MzUyODkwMGI3YzY3ZDdhZDBiMTcyZTE3Y2NlNzhiMmJjNTc4ZmVjZDFhMWMy
15
+ NTVjMjdkNmVmMTk5MmYyOTliYWI4ZWE0M2JkMTVkN2Q5NjQ4OTY=
data/README.md CHANGED
@@ -8,7 +8,27 @@ Helper to release cookbooks. This motivation is to publish new version at each c
8
8
 
9
9
  This helper will create tags, push them and publish to supermarket.
10
10
 
11
- Usage
11
+ Daily use
12
+ ---------
13
+
14
+ cookbook-release reads commit messages since last release and suggest a new version accordingly.
15
+
16
+ The following table describes the word used to detect patch/minor/major version changes:
17
+
18
+ | Version change | Words |
19
+ |----------------|-------------------------------------------|
20
+ | Patch | _fix_, _bugfix_, _[Patch]_ |
21
+ | Major | _breaking_, _[Major]_ |
22
+ | Minor | Default case if none of the above matches |
23
+
24
+ Those words are detected in the commit subject only (not in the fully message).
25
+
26
+ Examples of messages:
27
+ - [Breaking] Remove all migration code
28
+ - Fix migration code for old centos versions
29
+
30
+
31
+ One-time setup
12
32
  -----
13
33
 
14
34
  Include cookbook-release into your `Gemfile`.
@@ -6,7 +6,7 @@ require 'English'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'cookbook-release'
9
- spec.version = '0.4.2'
9
+ spec.version = '0.4.3'
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'
@@ -7,11 +7,22 @@ class Commit
7
7
  end
8
8
 
9
9
  def major?
10
- !!(self[:subject] =~ /breaking/i)
10
+ [
11
+ /breaking/i,
12
+ /\[major\]/i
13
+ ].any? do |r|
14
+ self[:subject] =~ r
15
+ end
11
16
  end
12
17
 
13
18
  def patch?
14
- !!(self[:subject] =~ /\bfix\b/i) || !!(self[:subject] =~ /\bbugfix\b/i)
19
+ [
20
+ /\bfix\b/i,
21
+ /\bbugfix\b/i,
22
+ /\[patch\]/i
23
+ ].any? do |r|
24
+ self[:subject] =~ r
25
+ end
15
26
  end
16
27
 
17
28
  def minor?
@@ -19,7 +19,8 @@ class GitUtilities
19
19
  end
20
20
 
21
21
  def reset_command(new_version)
22
- "git reset --hard HEAD^ && git tag -d #{new_version}"
22
+ remote = choose_remote
23
+ "git tag -d #{new_version} ; git push #{remote} :#{new_version}"
23
24
  end
24
25
 
25
26
  def clean_index?
@@ -42,7 +43,12 @@ class GitUtilities
42
43
  "--match \"#{@tag_prefix}[0-9]\.[0-9]*\.[0-9]*\""
43
44
  ].join(" "), @shellout_opts)
44
45
  tag.run_command
45
- tag.stdout.split('-').first.to_version
46
+ last = tag.stdout.split('-').first
47
+ unless last
48
+ $stderr.puts "No last release found, defaulting to 0.1.0"
49
+ last = '0.1.0'
50
+ end
51
+ last.to_version
46
52
  end
47
53
 
48
54
  # This string is used to split one-line git commit summary
@@ -51,7 +57,7 @@ class GitUtilities
51
57
 
52
58
  def compute_changelog(since)
53
59
  # TODO use whole commit message instead of title only
54
- log_cmd = Mixlib::ShellOut.new("git log --pretty='format:%an <%ae>#{MAGIC_SEP}%s#{MAGIC_SEP}%h' #{since}..HEAD", @shellout_opts)
60
+ log_cmd = Mixlib::ShellOut.new("git log --pretty=\"format:%an <%ae>#{MAGIC_SEP}%s#{MAGIC_SEP}%h\" #{since}..HEAD", @shellout_opts)
55
61
  log_cmd.run_command
56
62
  log = log_cmd.stdout
57
63
  log.split("\n").map do |entry|
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: 0.4.2
4
+ version: 0.4.3
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-04-27 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic