milestoner 5.0.0 → 5.1.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: 977b8a104feb6c918a30a96d7adf1b8aa4a09463
4
- data.tar.gz: ac670db00cd0b4c9f1ee451f8c0b6b3f74eb4c95
3
+ metadata.gz: bad3b3fa0887d91f02df3d8b487033c18c600c90
4
+ data.tar.gz: 45b0ba79b7ffc1b8822c6eedab278022f7984b68
5
5
  SHA512:
6
- metadata.gz: 2d6799557de5b14f4a3194334e08663043bfe42eb42e9151c75da9bdc917aedf6ca5e7362f2f394b7a3dd9be7904a62320815e595cd00d78c8a61382bbbf74df
7
- data.tar.gz: 9d2315cff8c0421e477da2fd2fca26161732b44dbc04dc4fd3261915f67281bd5b073892f07476143886e97bff40f04f4372b2cb6320c1118fc3c1e556f06603
6
+ metadata.gz: 11e30e044729b2103f6151b3eaab9ba23b47bb0fc012a613e79e3dd2baede011241e6ab58db479c5f0f6a4ba78ade27e278fdaf089e0d311b9752ba90e3ff776
7
+ data.tar.gz: f08cac0b68798e0b7ac84b9040f140ca143a09b9403c8bcceaebd5e8fb34e3bfcad0e6652542edae9a20b2a8674ce6069e49b03f7edbda7caa3316601fcf4be5
data/README.md CHANGED
@@ -195,9 +195,9 @@ To test, run:
195
195
 
196
196
  Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
197
197
 
198
- - Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
199
- - Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
200
198
  - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
199
+ - Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
200
+ - Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
201
201
 
202
202
  # Code of Conduct
203
203
 
@@ -24,8 +24,7 @@ module Milestoner
24
24
  # rubocop:disable Metrics/AbcSize
25
25
  def initialize args = [], options = {}, config = {}
26
26
  super args, options, config
27
- @tagger = Tagger.new self.class.configuration.to_h[:version],
28
- commit_prefixes: self.class.configuration.to_h[:git_commit_prefixes]
27
+ @tagger = Tagger.new commit_prefixes: self.class.configuration.to_h[:git_commit_prefixes]
29
28
  @pusher = Pusher.new
30
29
  @publisher = Publisher.new tagger: tagger, pusher: pusher
31
30
  end
@@ -54,8 +53,8 @@ module Milestoner
54
53
 
55
54
  desc "-p, [--push]", "Push local tag to remote repository."
56
55
  map %w[-p --push] => :push
57
- def push
58
- pusher.push
56
+ def push version = self.class.configuration.to_h[:version]
57
+ pusher.push version
59
58
  info "Tags pushed to remote repository."
60
59
  rescue StandardError => exception
61
60
  error exception.message
@@ -4,16 +4,44 @@ module Milestoner
4
4
  module Git
5
5
  # A lightweight Git wrapper.
6
6
  class Kit
7
+ def initialize
8
+ @git_dir = File.join Dir.pwd, ".git"
9
+ end
10
+
7
11
  def supported?
8
- File.exist? File.join(Dir.pwd, ".git")
12
+ File.exist? git_dir
9
13
  end
10
14
 
11
15
  def commits?
12
- system "git log > /dev/null 2>&1"
16
+ !shell("git log").empty?
17
+ end
18
+
19
+ def push_tags
20
+ shell "git push --tags"
21
+ end
22
+
23
+ def tagged?
24
+ !shell("git tag").empty?
25
+ end
26
+
27
+ def tag_local? tag
28
+ shell("git tag --list #{tag}").match?(/\A#{tag}\Z/)
29
+ end
30
+
31
+ def tag_remote? tag
32
+ shell("git ls-remote --tags origin #{tag}").match?(%r(.+tags\/#{tag}\Z))
13
33
  end
14
34
 
15
35
  def remote?
16
- system "git config remote.origin.url"
36
+ !shell("git config remote.origin.url").empty?
37
+ end
38
+
39
+ private
40
+
41
+ attr_reader :git_dir
42
+
43
+ def shell command
44
+ String `#{command}`
17
45
  end
18
46
  end
19
47
  end
@@ -12,7 +12,7 @@ module Milestoner
12
12
  end
13
13
 
14
14
  def self.version
15
- "5.0.0"
15
+ "5.1.0"
16
16
  end
17
17
 
18
18
  def self.version_label
@@ -8,12 +8,10 @@ module Milestoner
8
8
  @pusher = pusher
9
9
  end
10
10
 
11
+ # :reek:BooleanParameter
11
12
  def publish version, sign: false
12
13
  tagger.create version, sign: sign
13
- pusher.push
14
- rescue Errors::Git => error
15
- tagger.delete version
16
- raise error.class, error.message
14
+ pusher.push version
17
15
  end
18
16
 
19
17
  private
@@ -3,22 +3,25 @@
3
3
  module Milestoner
4
4
  # Handles publishing of Git tags to remote repository.
5
5
  class Pusher
6
- def initialize git: Git::Kit.new, shell: Kernel
6
+ def initialize git: Git::Kit.new
7
7
  @git = git
8
- @shell = shell
9
8
  end
10
9
 
11
- def push
12
- fail(Errors::Git) unless git.supported?
13
- fail(Errors::Git, "Git remote repository not configured.") unless git.remote?
10
+ def push version
11
+ version = Versionaire::Version version
14
12
 
15
- return if shell.system("git push --tags")
16
-
17
- fail(Errors::Git, "Git tags could not be pushed to remote repository.")
13
+ fail(Errors::Git, "Remote repository not configured.") unless git.remote?
14
+ fail(Errors::Git, "Remote tag exists: #{version.label}.") if tag_exists?(version)
15
+ return if git.push_tags.empty?
16
+ fail(Errors::Git, "Tags could not be pushed to remote repository.")
18
17
  end
19
18
 
20
19
  private
21
20
 
22
- attr_reader :git, :shell
21
+ attr_reader :git, :version
22
+
23
+ def tag_exists? version
24
+ git.tag_remote? version.label
25
+ end
23
26
  end
24
27
  end
@@ -2,10 +2,12 @@
2
2
 
3
3
  require "forwardable"
4
4
  require "open3"
5
+ require "thor"
5
6
  require "versionaire"
6
7
 
7
8
  module Milestoner
8
9
  # Handles the tagging of a project repository.
10
+ # :reek:TooManyMethods
9
11
  class Tagger
10
12
  extend Forwardable
11
13
 
@@ -13,10 +15,10 @@ module Milestoner
13
15
 
14
16
  def_delegator :version, :label, :version_label
15
17
 
16
- def initialize version = "0.1.0", commit_prefixes: [], git: Git::Kit.new
17
- @version = Versionaire::Version version
18
+ def initialize commit_prefixes: [], git: Git::Kit.new
18
19
  @commit_prefixes = commit_prefixes
19
20
  @git = git
21
+ @shell = Thor::Shell::Color.new
20
22
  end
21
23
 
22
24
  def commit_prefix_regex
@@ -24,22 +26,10 @@ module Milestoner
24
26
  Regexp.union commit_prefixes
25
27
  end
26
28
 
27
- def tagged?
28
- fail(Errors::Git) unless git.supported?
29
- response = `git tag`
30
- !(response.nil? || response.empty?)
31
- end
32
-
33
- def duplicate?
34
- fail(Errors::Git) unless git.supported?
35
- system "git rev-parse #{version.label} > /dev/null 2>&1"
36
- end
37
-
38
29
  def commits
39
- fail(Errors::Git) unless git.supported?
40
30
  groups = build_commit_prefix_groups
41
- group_by_commit_prefix! groups
42
- sort_by_commit_prefix! groups
31
+ group_by_commit_prefix groups
32
+ sort_by_commit_prefix groups
43
33
  groups.values.flatten.uniq
44
34
  end
45
35
 
@@ -47,23 +37,17 @@ module Milestoner
47
37
  commits.map { |commit| "- #{commit}" }
48
38
  end
49
39
 
50
- def create raw_version = version, sign: false
51
- @version = Versionaire::Version raw_version
52
- fail(Errors::Git) unless git.supported?
40
+ # :reek:BooleanParameter
41
+ def create version, sign: false
42
+ @version = Versionaire::Version version
53
43
  fail(Errors::Git, "Unable to tag without commits.") unless git.commits?
54
- fail(Errors::DuplicateTag, "Duplicate tag exists: #{version.label}.") if duplicate?
44
+ return if existing_tag?
55
45
  git_tag sign: sign
56
46
  end
57
47
 
58
- def delete raw_version = version
59
- @version = Versionaire::Version raw_version
60
- fail(Errors::Git) unless git.supported?
61
- Open3.capture3 "git tag --delete #{version.label}" if duplicate?
62
- end
63
-
64
48
  private
65
49
 
66
- attr_reader :git
50
+ attr_reader :git, :shell
67
51
 
68
52
  def git_log_command
69
53
  "git log --oneline --no-merges --format='%s'"
@@ -74,7 +58,7 @@ module Milestoner
74
58
  end
75
59
 
76
60
  def git_commits_command
77
- return "#{git_log_command} #{git_tag_command}" if tagged?
61
+ return "#{git_log_command} #{git_tag_command}" if git.tagged?
78
62
  git_log_command
79
63
  end
80
64
 
@@ -87,11 +71,12 @@ module Milestoner
87
71
  groups.merge! "Other" => []
88
72
  end
89
73
 
74
+ # :reek:UtilityFunction
90
75
  def sanitize_commit commit
91
76
  commit.gsub(/\[ci\sskip\]/, "").squeeze(" ").strip
92
77
  end
93
78
 
94
- def group_by_commit_prefix! groups = {}
79
+ def group_by_commit_prefix groups = {}
95
80
  raw_commits.each do |commit|
96
81
  prefix = commit[commit_prefix_regex]
97
82
  key = groups.key?(prefix) ? prefix : "Other"
@@ -99,7 +84,8 @@ module Milestoner
99
84
  end
100
85
  end
101
86
 
102
- def sort_by_commit_prefix! groups = {}
87
+ # :reek:UtilityFunction
88
+ def sort_by_commit_prefix groups = {}
103
89
  groups.each { |_, values| values.sort! }
104
90
  end
105
91
 
@@ -107,18 +93,28 @@ module Milestoner
107
93
  %(Version #{version}.\n\n#{commit_list.join "\n"}\n\n)
108
94
  end
109
95
 
96
+ # :reek:BooleanParameter
97
+ # :reek:ControlParameter
110
98
  def git_options message_file, sign: false
111
- options = %(--sign --annotate "#{version.label}" ) +
99
+ options = %(--sign --annotate "#{version_label}" ) +
112
100
  %(--cleanup verbatim --file "#{message_file.path}")
113
101
  return options.gsub("--sign ", "") unless sign
114
102
  options
115
103
  end
116
104
 
105
+ def existing_tag?
106
+ return false unless git.tag_local?(version_label)
107
+ shell.say_status :warn, "Local tag exists: #{version_label}. Skipped.", :yellow
108
+ true
109
+ end
110
+
111
+ # :reek:BooleanParameter
112
+ # :reek:TooManyStatements
117
113
  def git_tag sign: false
118
114
  message_file = Tempfile.new Identity.name
119
115
  File.open(message_file, "w") { |file| file.write git_message }
120
116
  status = system "git tag #{git_options message_file, sign: sign}"
121
- fail(Errors::Git, "Unable to create tag: #{version.label}.") unless status
117
+ fail(Errors::Git, "Unable to create tag: #{version_label}.") unless status
122
118
  ensure
123
119
  message_file.close
124
120
  message_file.unlink
metadata CHANGED
@@ -1,36 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milestoner
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZicm9v
14
- a2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQBGRYC
15
- aW8wHhcNMTYxMDE5MTY0NDEzWhcNMTcxMDE5MTY0NDEzWjBBMQ8wDQYDVQQDDAZi
16
- cm9va2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQB
17
- GRYCaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgryPL4/IbWDcL
18
- fnqpnoJALqj+ega7hSsvvD8sac57HPNLeKcOmSafFiQLAnTmmE132ZlFc8kyZRVn
19
- zmqSESowO5jd+ggFuy1ySqQJXhwgik04KedKRUjpIDZePrjw+M5UJT1qzKCKL2xI
20
- nx5cOKP1fSWJ1RRu8JhaDeSloGtYMdw2c28wnKPNIsWDood4xhbLcY9IqeISft2e
21
- oTAHTHandHbvt24X3/n67ceNjLBbsVZPXCC1C8C8ccjHjA4Tm2uiFoDwThMcPggg
22
- 90H6fh0vLFcNAobdPEchbge8tWtfmMPz2+C4yklANn81GA+ANsBS1uwx6mxJoMQU
23
- BNVp0aLvAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
- BBRS85Rn1BaqeIONByw4t46DMDMzHDAfBgNVHREEGDAWgRRicm9va2VAYWxjaGVt
25
- aXN0cy5pbzAfBgNVHRIEGDAWgRRicm9va2VAYWxjaGVtaXN0cy5pbzANBgkqhkiG
26
- 9w0BAQUFAAOCAQEAZMb57Y4wdpbX8XxTukEO7VC1pndccUsxdbziGsAOiuHET3Aq
27
- ygLvrfdYrN88/w+qxncW5bxbO3a6UGkuhIFUPM8zRSE/rh6bCcJljTJrExVt42eV
28
- aYCb7WJNsx3eNXHn3uQodq3tD+lmNJzz2bFeT3smGSKEnALBjqorO/2mpDh4FJ3S
29
- 4CcDYsJ1ywep8LDJDBBGdKz9moL+axryzpeTpgTT/fFYFzRzWrURPyDvPOikh9TX
30
- n/LUZ1dKhIHzfKx1B4+TEIefArObGfkLIDM8+Dq1RX7TF1k81Men7iu4MgE9bYBn
31
- 3dE+xI3FdB5gWcdWxdtgRCmWjtXeYYyb4z6NQQ==
32
- -----END CERTIFICATE-----
33
- date: 2017-01-22 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2017-05-07 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: thor
@@ -52,42 +30,42 @@ dependencies:
52
30
  requirements:
53
31
  - - "~>"
54
32
  - !ruby/object:Gem::Version
55
- version: '5.0'
33
+ version: '5.1'
56
34
  type: :runtime
57
35
  prerelease: false
58
36
  version_requirements: !ruby/object:Gem::Requirement
59
37
  requirements:
60
38
  - - "~>"
61
39
  - !ruby/object:Gem::Version
62
- version: '5.0'
40
+ version: '5.1'
63
41
  - !ruby/object:Gem::Dependency
64
42
  name: runcom
65
43
  requirement: !ruby/object:Gem::Requirement
66
44
  requirements:
67
45
  - - "~>"
68
46
  - !ruby/object:Gem::Version
69
- version: '0.5'
47
+ version: '0.6'
70
48
  type: :runtime
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
51
  requirements:
74
52
  - - "~>"
75
53
  - !ruby/object:Gem::Version
76
- version: '0.5'
54
+ version: '0.6'
77
55
  - !ruby/object:Gem::Dependency
78
56
  name: versionaire
79
57
  requirement: !ruby/object:Gem::Requirement
80
58
  requirements:
81
59
  - - "~>"
82
60
  - !ruby/object:Gem::Version
83
- version: '3.0'
61
+ version: '3.1'
84
62
  type: :runtime
85
63
  prerelease: false
86
64
  version_requirements: !ruby/object:Gem::Requirement
87
65
  requirements:
88
66
  - - "~>"
89
67
  - !ruby/object:Gem::Version
90
- version: '3.0'
68
+ version: '3.1'
91
69
  - !ruby/object:Gem::Dependency
92
70
  name: rake
93
71
  requirement: !ruby/object:Gem::Requirement
@@ -102,6 +80,20 @@ dependencies:
102
80
  - - "~>"
103
81
  - !ruby/object:Gem::Version
104
82
  version: '12.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: gemsmith
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '9.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '9.4'
105
97
  - !ruby/object:Gem::Dependency
106
98
  name: pry
107
99
  requirement: !ruby/object:Gem::Requirement
@@ -206,14 +198,14 @@ dependencies:
206
198
  requirements:
207
199
  - - "~>"
208
200
  - !ruby/object:Gem::Version
209
- version: '3.5'
201
+ version: '3.6'
210
202
  type: :development
211
203
  prerelease: false
212
204
  version_requirements: !ruby/object:Gem::Requirement
213
205
  requirements:
214
206
  - - "~>"
215
207
  - !ruby/object:Gem::Version
216
- version: '3.5'
208
+ version: '3.6'
217
209
  - !ruby/object:Gem::Dependency
218
210
  name: guard-rspec
219
211
  requirement: !ruby/object:Gem::Requirement
@@ -234,42 +226,42 @@ dependencies:
234
226
  requirements:
235
227
  - - "~>"
236
228
  - !ruby/object:Gem::Version
237
- version: '0.0'
229
+ version: '0.1'
238
230
  type: :development
239
231
  prerelease: false
240
232
  version_requirements: !ruby/object:Gem::Requirement
241
233
  requirements:
242
234
  - - "~>"
243
235
  - !ruby/object:Gem::Version
244
- version: '0.0'
236
+ version: '0.1'
245
237
  - !ruby/object:Gem::Dependency
246
238
  name: reek
247
239
  requirement: !ruby/object:Gem::Requirement
248
240
  requirements:
249
241
  - - "~>"
250
242
  - !ruby/object:Gem::Version
251
- version: '4.5'
243
+ version: '4.6'
252
244
  type: :development
253
245
  prerelease: false
254
246
  version_requirements: !ruby/object:Gem::Requirement
255
247
  requirements:
256
248
  - - "~>"
257
249
  - !ruby/object:Gem::Version
258
- version: '4.5'
250
+ version: '4.6'
259
251
  - !ruby/object:Gem::Dependency
260
252
  name: rubocop
261
253
  requirement: !ruby/object:Gem::Requirement
262
254
  requirements:
263
255
  - - "~>"
264
256
  - !ruby/object:Gem::Version
265
- version: '0.47'
257
+ version: '0.48'
266
258
  type: :development
267
259
  prerelease: false
268
260
  version_requirements: !ruby/object:Gem::Requirement
269
261
  requirements:
270
262
  - - "~>"
271
263
  - !ruby/object:Gem::Version
272
- version: '0.47'
264
+ version: '0.48'
273
265
  - !ruby/object:Gem::Dependency
274
266
  name: codeclimate-test-reporter
275
267
  requirement: !ruby/object:Gem::Requirement
@@ -328,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
320
  version: '0'
329
321
  requirements: []
330
322
  rubyforge_project:
331
- rubygems_version: 2.6.9
323
+ rubygems_version: 2.6.12
332
324
  signing_key:
333
325
  specification_version: 4
334
326
  summary: A command line interface for releasing Git repository milestones.
Binary file
data.tar.gz.sig DELETED
@@ -1,3 +0,0 @@
1
- U���* ߗ
2
- ��D ,���;�V)4ajݧ���|��m`�;M���5쯻�a�2F�ޗ3�{YspX�9�I���촰:K��!wR�7��:��v��k_�X��y�ۼ}!����y��r4>�e�E�'G���C�j��|Dj辀fz��qO'a򐺂��;�m��EX�����S/�}�eɷ�!��Zm��~������؇���>�>6�M�U�q|x#����?מ�"�y
3
- �ݙ�-��"��1�$�
metadata.gz.sig DELETED
Binary file