gem-release 2.0.0.dev.2 → 2.0.0.dev.3

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: 2eae2d6d553dc7f227a2d77d312478f9b350fc70
4
- data.tar.gz: a9eb400332f183359a9607452f1988870a971765
3
+ metadata.gz: 3379c9a8fe1a960836949e5167f96f83d10c71c7
4
+ data.tar.gz: a59c0b440b3d1ffd6cc862f2d696b267b478268d
5
5
  SHA512:
6
- metadata.gz: 7f044bdc3f1e96aeb2e106efffbeb8f30e304f5d7d87ee26255c9e2d3a18c263ce219e2c6046c8bb3e155ecd708f50f56b209cd844e62ec3bed84a43e5c8d14e
7
- data.tar.gz: a9411129a69515026f8a9fc51b0a64b216f1224f729ce61ff9345ea4c9075d84f0044cfa1a8cf1fd488c629138ea750659337ed9920496ce860710dc92fb6499
6
+ metadata.gz: 3c31dd8dadfea502f17759e37228e920e773d7a7584d84cbc2c58ea5752ea9fd6bfd9ee2499866756feea1a6297d203c13384dee10d7a6b74aaa7a44a5309f82
7
+ data.tar.gz: 6e23a458c04035355e4e62c78992e125f17f39a9d1a5d24f26326cdb906ab1477263619b8f6fd88927b27490bba13d205af9384466bdc644f24116141f5dbba9
data/TODO.txt CHANGED
@@ -3,14 +3,42 @@
3
3
  - Add defaults to options help output [5]
4
4
  - Add specs for all error conditions [6]
5
5
  - Add a changelog [7]
6
+ - Check for TODO tags [17]
6
7
 
7
8
  - Make sure we don't double tag the same repo when several args are given [9]
8
9
 
10
+ - Port "Adding ability to GPG sign commits and tags" [10]
11
+ https://github.com/svenfuchs/gem-release/pull/44
12
+
13
+ # Done
14
+
15
+ x Port "Support version files of gems with *rb suffix" done:2017-05-02 [13]
16
+ https://github.com/svenfuchs/gem-release/pull/53
17
+ Ported
18
+
19
+ x Port "Add --message for BumpCommand", allow to use a config var for this done:2017-05-02 [11]
20
+ https://github.com/svenfuchs/gem-release/pull/61
21
+ Ported
22
+
23
+ x Port "Maintenance tasks" done:2017-05-02 [12]
24
+ https://github.com/svenfuchs/gem-release/pull/57
25
+ Ported
26
+
27
+ x Check "bump any version file" done:2017-05-02 [14]
28
+ https://github.com/svenfuchs/gem-release/pull/45
29
+ Ported
30
+
31
+ x Consider "gem bootstrap --private for private gems" done:2017-05-01 [15]
32
+ https://github.com/svenfuchs/gem-release/issues/51
33
+ Already covered via custom templates
34
+
35
+ x See if we can remove unused common options from `help` done:2017-05-01 [16]
36
+ https://github.com/svenfuchs/gem-release/issues/55
37
+ Can't figure out how, without removing options globally for everyone/all other commands
38
+
9
39
  x Release and tag should fail if there are uncommitted changes done:2017-05-01 [8]
10
40
  https://github.com/svenfuchs/gem-release/issues/34
11
41
 
12
- # Double check
13
-
14
42
  x Misleading success message done:2017-05-01 [4]
15
43
  https://github.com/svenfuchs/gem-release/issues/60
16
44
  Pushing foo-0.0.5.gem
@@ -43,20 +43,32 @@ module Gem
43
43
 
44
44
  DESCR = {
45
45
  version: 'Target version: next [major|minor|patch|pre|release] or a given version number [x.x.x]',
46
- commit: 'Perform a commit after incrementing gem version',
46
+ commit: 'Create a commit after incrementing gem version',
47
+ message: 'Commit message template',
47
48
  push: 'Push the new commit to the git remote repository',
48
49
  remote: 'Git remote to push to (defaults to origin)',
50
+ sign: 'GPG sign the commit message',
49
51
  tag: 'Shortcut for running the `gem tag` command',
50
52
  recurse: 'Recurse into directories that contain gemspec files',
51
- release: 'Shortcut for the `gem release` command'
53
+ release: 'Shortcut for the `gem release` command',
54
+ file: 'Full path to the version file'
52
55
  }
53
56
 
54
57
  DEFAULTS = {
55
- commit: true,
56
- push: false,
57
- remote: 'origin'
58
+ commit: true,
59
+ message: 'Bump to %{to} [skip ci]',
60
+ push: false,
61
+ remote: 'origin'
58
62
  }
59
63
 
64
+ opt '-v', '--version VERSION', DESCR[:version] do |value|
65
+ opts[:version] = value
66
+ end
67
+
68
+ opt '-m', '--message', DESCR[:message] do |value|
69
+ opts[:message] = value
70
+ end
71
+
60
72
  opt '-c', '--[no-]commit', DESCR[:commit] do |value|
61
73
  opts[:commit] = value
62
74
  end
@@ -69,8 +81,8 @@ module Gem
69
81
  opts[:remote] = value
70
82
  end
71
83
 
72
- opt '-v', '--version VERSION', DESCR[:version] do |value|
73
- opts[:version] = value
84
+ opt '-s', '--sign', DESCR[:sign] do |value|
85
+ opts[:sign] = value
74
86
  end
75
87
 
76
88
  opt '-t', '--tag', DESCR[:tag] do |value|
@@ -85,6 +97,10 @@ module Gem
85
97
  opts[:recurse] = value
86
98
  end
87
99
 
100
+ opt '--file', DESCR[:file] do |value|
101
+ opts[:file] = value
102
+ end
103
+
88
104
  MSGS = {
89
105
  bump: 'Bumping %s from version %s to %s',
90
106
  version: 'Changing version in %s from %s to %s',
@@ -98,7 +114,7 @@ module Gem
98
114
 
99
115
  CMDS = {
100
116
  git_add: 'git add %s',
101
- git_commit: 'git commit -m "Bump to %s"',
117
+ git_commit: 'git commit -m %p %s',
102
118
  git_push: 'git push %s'
103
119
  }
104
120
 
@@ -131,7 +147,7 @@ module Gem
131
147
 
132
148
  def commit
133
149
  cmd :git_add, version.path
134
- cmd :git_commit, version.to
150
+ cmd :git_commit, message, opts[:sign] ? '-S' : ''
135
151
  end
136
152
 
137
153
  def push
@@ -150,8 +166,12 @@ module Gem
150
166
  @version = nil
151
167
  end
152
168
 
169
+ def message
170
+ opts[:message] % version.to_h
171
+ end
172
+
153
173
  def version
154
- @version ||= Files::Version.new(gem.name, opts[:version])
174
+ @version ||= Files::Version.new(gem.name, opts[:version], only(opts, :file))
155
175
  end
156
176
 
157
177
  def push?
@@ -31,6 +31,7 @@ module Gem
31
31
  DESCR = {
32
32
  push: 'Push tag to the remote git repository',
33
33
  remote: 'Git remote to push to (defaults to origin)',
34
+ sign: 'GPG sign the tag',
34
35
  }
35
36
 
36
37
  opt '-p', '--[no]-push', DESCR[:push] do
@@ -50,7 +51,7 @@ module Gem
50
51
  }
51
52
 
52
53
  CMDS = {
53
- git_tag: 'git tag -am "tag %s" %s',
54
+ git_tag: 'git tag -am "tag %s" %s %s',
54
55
  git_push: 'git push --tags %s'
55
56
  }
56
57
 
@@ -71,7 +72,7 @@ module Gem
71
72
  end
72
73
 
73
74
  def tag
74
- cmd :git_tag, tag_name, tag_name
75
+ cmd :git_tag, tag_name, tag_name, opts[:sign] ? '--sign' : ''
75
76
  end
76
77
 
77
78
  def push
@@ -27,7 +27,7 @@ module Gem
27
27
 
28
28
  def paths
29
29
  paths = PATHS.map { |path| File.expand_path(path) }
30
- paths.select { |path| File.exists?(path) }
30
+ paths.select { |path| File.exist?(path) }
31
31
  end
32
32
  end
33
33
  end
@@ -22,7 +22,7 @@ module Gem
22
22
  end
23
23
 
24
24
  def exists?
25
- filename && File.exists?(filename)
25
+ filename && File.exist?(filename)
26
26
  end
27
27
 
28
28
  private
@@ -10,7 +10,7 @@ module Gem
10
10
  def data
11
11
  {
12
12
  gem_name: gem_name,
13
- gem_path: gem_name.gsub('-', '/'),
13
+ gem_path: gem_path,
14
14
  module_names: module_names,
15
15
  author: user_name,
16
16
  email: user_email,
@@ -32,6 +32,10 @@ module Gem
32
32
  gem.name || raise('No gem_name given.')
33
33
  end
34
34
 
35
+ def gem_path
36
+ gem_name.gsub('-', '/').sub(/_rb$/, '')
37
+ end
38
+
35
39
  def user_name
36
40
  system.git_user_name || '[your name]'
37
41
  end
@@ -32,7 +32,7 @@ module Gem
32
32
  def paths
33
33
  @paths ||= groups.map do |group|
34
34
  paths = paths_for(group).map { |path| File.expand_path(*path) }
35
- paths.detect { |path| File.exists?(path) }
35
+ paths.detect { |path| File.exist?(path) }
36
36
  end.compact
37
37
  end
38
38
 
@@ -3,7 +3,7 @@ require 'gem/release/version/number'
3
3
  module Gem
4
4
  module Release
5
5
  module Files
6
- class Version < Struct.new(:name, :version)
6
+ class Version < Struct.new(:name, :version, :opts)
7
7
  VERSION = /(VERSION\s*=\s*(?:"|'))((?:(?!"|').)*)("|')/
8
8
  RELEASE = /^(\d+)\.(\d+)\.(\d+)(.*)$/
9
9
  PRE_RELEASE = /^(\d+)\.(\d+)\.(\d+)\.?(.*)(\d+)$/
@@ -19,7 +19,7 @@ module Gem
19
19
  end
20
20
 
21
21
  def path
22
- @path ||= paths.detect { |path| File.exists?(path) }
22
+ @path ||= opts[:file] || paths.detect { |path| File.exist?(path) }
23
23
  end
24
24
 
25
25
  def from
@@ -30,6 +30,10 @@ module Gem
30
30
  @to ||= number.bump
31
31
  end
32
32
 
33
+ def to_h
34
+ { from: from, to: to }
35
+ end
36
+
33
37
  private
34
38
 
35
39
  def paths
@@ -62,6 +66,10 @@ module Gem
62
66
  def path_to(path)
63
67
  "lib/#{path}/version.rb"
64
68
  end
69
+
70
+ def name
71
+ @name ||= super.sub(/_rb$/, '')
72
+ end
65
73
  end
66
74
  end
67
75
  end
@@ -17,6 +17,7 @@ module Gem
17
17
  info cmd, *args
18
18
  cmd = self.class::CMDS[cmd] % args
19
19
  end
20
+ cmd = cmd.strip
20
21
  notice "$ #{cmd}"
21
22
  result = pretend? ? true : system.run(cmd)
22
23
  abort "The command `#{cmd}` was unsuccessful." unless result
@@ -31,7 +32,7 @@ module Gem
31
32
  %w(announce notice info warn error).each do |level|
32
33
  define_method(level) do |msg, *args|
33
34
  msg = self.class::MSGS[msg] % args if msg.is_a?(Symbol)
34
- context.send(level, msg) unless quiet?
35
+ context.send(level, msg.strip) unless quiet?
35
36
  end
36
37
  end
37
38
 
@@ -58,6 +58,13 @@ module Gem
58
58
  abort
59
59
  end
60
60
 
61
+ def show_help
62
+ p "KEKSE"
63
+ exit
64
+ parser.program_name = usage
65
+ say parser
66
+ end
67
+
61
68
  def cmd
62
69
  self.class.cmd
63
70
  end
@@ -1,5 +1,5 @@
1
1
  module Gem
2
2
  module Release
3
- VERSION = '2.0.0.dev.2'
3
+ VERSION = '2.0.0.dev.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.dev.2
4
+ version: 2.0.0.dev.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-01 00:00:00.000000000 Z
12
+ date: 2017-05-02 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Release your ruby gems with ease. (What a bold statement for such a tiny
15
15
  plugin ...)