milestoner 0.2.0 → 0.3.0

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: c0f6d4ae3cad5d263731f769567b7ea089dd6b01
4
- data.tar.gz: 32d6f0cc922a456c84c0428450d06b9e36863652
3
+ metadata.gz: a383b5ca439d263af13d3a99df04900c5cf9af6d
4
+ data.tar.gz: 7bbeabe417fa74b1ea2de76f98ca4ad5cbc02468
5
5
  SHA512:
6
- metadata.gz: 237f10aa51dccebe908b0ccbea8de79cb33bb7dbb6e48d589a8460923a2aff576715ac86442deda9442acb03063ca26dee4eac8c99fbaec53289cd77ff33b972
7
- data.tar.gz: 059b456ca8328cb62c923ddd11df136ea022bfb99262549fedceeecb9a540d912aef8202b3c977cbe275a718d3ae0e295259b592fd43a2362dd937f80b508c63
6
+ metadata.gz: 203b4857ce7f978e63560a760ed56369853cad84405bfadb8b83e0b1f459023f495a44a0bd7b196ae4a17c14da44ab17cd6f6fe0b156b7d72047e442a28db62e
7
+ data.tar.gz: 87add04071261e77f5964cf8202a914891228af308b3f90bf65c66ea94f585c3671b903a2a488dd6c1d6e92eb63e9003ec303dcaeb05c177625ac75637ac42b9
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -28,10 +28,15 @@ A tool for automating and releasing Git repository milestones.
28
28
 
29
29
  # Features
30
30
 
31
- - Provides [Semantic Versioning](http://semver.org) for Git repositories in the form of `v<major>.<minor>.</maintenance>` tags.
32
- Example: `v0.1.0`.
33
- - Provides optional support for signing tags using GPG signing key.
31
+ - Provides [Semantic Versioning](http://semver.org) for Git repositories in the form of
32
+ `v<major>.<minor>.</maintenance>` tags. Example: `v0.1.0`.
33
+ - Provides optional security for signing tags using GPG signing key.
34
34
  - Automatically includes commits since last tag (or HEAD if no tags exist) within each tag message.
35
+ - Groups commit messages by consistent prefixes in order defined: "Fixed", "Added", "Updated", "Removed", "Refactored".
36
+ Otherwise, they are alphabetically sorted.
37
+ - Alphabetically sorts commit messages within each prefix group.
38
+ - Ensures duplicate commit messages are removed (if any).
39
+ - Sanitizes commit messages by removing extra spaces and `[ci skip]` text.
35
40
 
36
41
  # Requirements
37
42
 
@@ -58,6 +63,7 @@ For an insecure install, type the following (not recommended):
58
63
  From the command line, type: milestoner help
59
64
 
60
65
  milestoner -P, [--publish=PUBLISH] # Tag and push to remote repository.
66
+ milestoner -c, [--commits] # Show tag message commits for next milestone.
61
67
  milestoner -h, [--help=HELP] # Show this message or get help for a command.
62
68
  milestoner -p, [--push] # Push tags to remote repository.
63
69
  milestoner -t, [--tag=TAG] # Tag local repository with new version.
@@ -15,6 +15,14 @@ module Milestoner
15
15
  super args, options, config
16
16
  end
17
17
 
18
+ desc "-c, [--commits]", "Show tag message commits for next milestone."
19
+ map %w(-c --commits) => :commits
20
+ def commits version
21
+ tagger = Milestoner::Tagger.new version
22
+ say "Milestone #{version} Commits:"
23
+ tagger.commit_list.each { |commit| say commit }
24
+ end
25
+
18
26
  desc "-t, [--tag=TAG]", "Tag local repository with new version."
19
27
  map %w(-t --tag) => :tag
20
28
  method_option :sign, aliases: "-s", desc: "Sign tag with GPG key.", type: :boolean, default: false
@@ -10,7 +10,7 @@ module Milestoner
10
10
  end
11
11
 
12
12
  def self.version
13
- "0.2.0"
13
+ "0.3.0"
14
14
  end
15
15
 
16
16
  def self.label_version
@@ -39,12 +39,25 @@ module Milestoner
39
39
  def commits
40
40
  groups = build_commit_prefix_groups
41
41
  group_by_commit_prefix! groups
42
- groups.values.flatten
42
+ sort_by_commit_prefix! groups
43
+ groups.values.flatten.uniq
44
+ end
45
+
46
+ def commit_list
47
+ commits.map { |commit| "- #{commit}" }
43
48
  end
44
49
 
45
50
  def create sign: false
46
51
  fail(DuplicateTagError, "Duplicate tag exists: #{version_label}.") if duplicate?
47
- `git tag #{tag_options sign: sign}`
52
+
53
+ begin
54
+ message_file = Tempfile.new Milestoner::Identity.name
55
+ File.open(message_file, "w") { |file| file.write tag_message }
56
+ `git tag #{tag_options message_file, sign: sign}`
57
+ ensure
58
+ message_file.close
59
+ message_file.unlink
60
+ end
48
61
  end
49
62
 
50
63
  def destroy
@@ -68,27 +81,32 @@ module Milestoner
68
81
  end
69
82
 
70
83
  def build_commit_prefix_groups
71
- groups = self.class.commit_prefixes.map.with_object({}) do |prefix, group|
72
- group.merge! prefix => []
73
- end
84
+ groups = self.class.commit_prefixes.map.with_object({}) { |prefix, group| group.merge! prefix => [] }
74
85
  groups.merge! "Other" => []
75
86
  end
76
87
 
88
+ def sanitize_commit commit
89
+ commit.gsub(/\[ci\sskip\]/, "").squeeze(" ").strip
90
+ end
91
+
77
92
  def group_by_commit_prefix! groups = {}
78
93
  raw_commits.each do |commit|
79
94
  prefix = commit[self.class.commit_prefix_regex]
80
95
  key = groups.key?(prefix) ? prefix : "Other"
81
- groups[key] << commit
96
+ groups[key] << sanitize_commit(commit)
82
97
  end
83
98
  end
84
99
 
100
+ def sort_by_commit_prefix! groups = {}
101
+ groups.each { |_, values| values.sort! }
102
+ end
103
+
85
104
  def tag_message
86
- commit_list = commits.map { |commit| "- #{commit}\n" }
87
- %(#{version_message}\n\n#{commit_list.join})
105
+ %(#{version_message}\n\n#{commit_list.join "\n"})
88
106
  end
89
107
 
90
- def tag_options sign: false
91
- options = %(--sign --annotate "#{version_label}" --message "#{tag_message}")
108
+ def tag_options message_file, sign: false
109
+ options = %(--sign --annotate "#{version_label}" --file "#{message_file.path}")
92
110
  return options.gsub("--sign ", "") unless sign
93
111
  options
94
112
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milestoner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -30,7 +30,7 @@ cert_chain:
30
30
  aSif+qBc6oHD7EQWPF5cZkzkIURuwNwPBngZGxIKaMAgRhjGFXzUMAaq++r59cS9
31
31
  xTfQ4k6fglKEgpnLAXiKdo2c8Ym+X4rIKFfedQ==
32
32
  -----END CERTIFICATE-----
33
- date: 2015-09-07 00:00:00.000000000 Z
33
+ date: 2015-09-09 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: thor
metadata.gz.sig CHANGED
Binary file