gem-release 2.0.0.dev.5 → 2.0.0.rc.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
2
  SHA1:
3
- metadata.gz: 6eec8f1a113b0850b5700b9226b6350cad8167f3
4
- data.tar.gz: bda046a3fa483a9d09f7f493146266e17241dbd8
3
+ metadata.gz: 195c4cc3e957a72b5fd32d7b8988d4fb58afc373
4
+ data.tar.gz: 88be1c1f3b825670de7da30c65f19244494e625a
5
5
  SHA512:
6
- metadata.gz: 458818e6e27ae01927d51a6813f08d07d9359cfe6e6a682c33494127bde073d2b4b1b692868e8e2451eef497fe7b74811459c099413b51f7b2fafdb8254e8b33
7
- data.tar.gz: a68e3c396bdcb8295ac1c05ff50a36f78b494c418d341619635431c3cfde56789005549d8c41c218277e82ff30b6f7adeb4b271976cce9bf9f16f7142266b400
6
+ metadata.gz: 871a21b9858931a0b7b2c374eb553a5a70f61e3d6b26055b7975ade21e20ea36d597a28083073bab27128297b1b39dd9cae79cf080f0eeb2877be831d6f03694
7
+ data.tar.gz: 24d5cbd92af1a4726328750b880d9871379891935667184b6638de34b6ef0e1aad020be8d87bbdf2c3cf13a2c3badc79bfdfa4f2d52d90eff07957b4dfcfd54b
@@ -6,22 +6,21 @@ This is a major rewrite, 7 years after the initial implementation.
6
6
 
7
7
  ### Major changes
8
8
 
9
- * Consistent config format, using config files, environment variables, and
10
- command line options
9
+ * Consistent config format, using config files, environment variables, and command line options
11
10
  * Custom template groups for `gem bootstrap`
12
11
  * Complete help output in `gem [command] --help`
13
- * Consistent behaviour in multi-gem scenarios (see the
14
- [README](https://github.com/svenfuchs/gem-release/blob/master/README.md#scenarios))
12
+ * Consistent behaviour in multi-gem scenarios (see the [README](https://github.com/svenfuchs/gem-release/blob/master/README.md#scenarios))
15
13
  * Consistent command line option defaults across commands when invoked with a
16
14
  shortcut, e.g. `gem bump --release --tag` vs `gem release --tag`
17
15
  * Colorized, more consistently formatted output
16
+ * Parse friendly output on all commands when not on a tty (e.g. `gem bump --pretend --no-commit | awk '{ print $4 }')
18
17
 
19
18
  ### Other changes
20
19
 
21
20
  * Fix misleading success message when `gem push` fails
22
21
  * Release and tag now fail if there are uncommitted changes
23
- * Add `--message` and `--skip-ci` to `gem bump` in order to customize the
24
- commit message
25
- * Add `--sign` to `gem bump` and `gem tag` in order to GPG sign commits and
26
- tags
22
+ * Add `--message` and `--skip-ci` to `gem bump` in order to customize the commit message
23
+ * Add `--branch` to `gem bump` in order to switch to a new branch
24
+ * Add `--sign` to `gem bump` and `gem tag` in order to GPG sign commits and tags
25
+ * Add `--no-color` to all commands
27
26
  * Support version files of gems with an `*_rb` suffix
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gem-release (2.0.0.dev.4)
4
+ gem-release (2.0.0.dev.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -69,4 +69,4 @@ DEPENDENCIES
69
69
  simplecov
70
70
 
71
71
  BUNDLED WITH
72
- 1.14.6
72
+ 1.16.0.pre.2
@@ -34,10 +34,14 @@ module Gem
34
34
 
35
35
  def descr(opt)
36
36
  descr = self::DESCR[opt]
37
- descr = "#{descr} (default: #{self::DEFAULTS[opt]})" if self::DEFAULTS.key?(opt)
37
+ descr = "#{descr} (default: #{default(opt)})" if default(opt)
38
38
  descr
39
39
  end
40
40
 
41
+ def default(opt)
42
+ Base::DEFAULTS[opt] || self::DEFAULTS[opt]
43
+ end
44
+
41
45
  def usage(usage = nil)
42
46
  usage ? @usage = usage : @usage || '[usage]'
43
47
  end
@@ -53,6 +57,16 @@ module Gem
53
57
  end
54
58
  end
55
59
 
60
+ DEFAULTS = {
61
+ color: true,
62
+ pretend: false,
63
+ quiet: false
64
+ }
65
+
66
+ opt '--[no-]color' do |value|
67
+ opts[:color] = value
68
+ end
69
+
56
70
  opt '--pretend' do
57
71
  opts[:pretend] = true
58
72
  end
@@ -194,12 +194,12 @@ module Gem
194
194
  end
195
195
 
196
196
  def create_repo
197
- cmd :git_remote, remote, "#{github_user_name}/#{gem.name}"
197
+ cmd :git_remote, remote, "#{git.user_login}/#{gem.name}"
198
198
  cmd :git_push, remote if opts[:push]
199
199
  end
200
200
 
201
201
  def data
202
- Data.new(system, gem, opts).data
202
+ Data.new(git, gem, opts).data
203
203
  end
204
204
 
205
205
  def remote
@@ -43,6 +43,7 @@ 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
+ branch: 'Check out a new branch for the target version (e.g. `v1.0.0`)',
46
47
  commit: 'Create a commit after incrementing gem version',
47
48
  message: 'Commit message template',
48
49
  skip_ci: 'Add the [skip ci] tag to the commit message',
@@ -59,10 +60,12 @@ module Gem
59
60
  commit: true,
60
61
  message: 'Bump %{name} to %{version} %{skip_ci}',
61
62
  push: false,
63
+ branch: false,
62
64
  remote: 'origin',
63
65
  skip_ci: false,
64
66
  sign: false,
65
- recurse: false
67
+ recurse: false,
68
+ pretend: false
66
69
  }
67
70
 
68
71
  opt '-v', '--version VERSION', descr(:version) do |value|
@@ -93,6 +96,10 @@ module Gem
93
96
  opts[:sign] = value
94
97
  end
95
98
 
99
+ opt '--branch [BRANCH]', descr(:branch) do |value|
100
+ opts[:branch] = value.nil? ? true : value
101
+ end
102
+
96
103
  opt '-t', '--tag', descr(:tag) do |value|
97
104
  opts[:tag] = value
98
105
  end
@@ -113,6 +120,7 @@ module Gem
113
120
  bump: 'Bumping %s from version %s to %s',
114
121
  version: 'Changing version in %s from %s to %s',
115
122
  git_add: 'Staging %s',
123
+ git_checkout: 'Checking out branch %s',
116
124
  git_commit: 'Creating commit',
117
125
  git_push: 'Pushing to the %s git repository',
118
126
  git_dirty: 'Uncommitted changes found. Please commit or stash.',
@@ -121,14 +129,16 @@ module Gem
121
129
  }
122
130
 
123
131
  CMDS = {
124
- git_add: 'git add %s',
125
- git_commit: 'git commit -m %p %s',
126
- git_push: 'git push %s'
132
+ git_checkout: 'git checkout -b %s',
133
+ git_add: 'git add %s',
134
+ git_commit: 'git commit -m %p %s',
135
+ git_push: 'git push %s'
127
136
  }
128
137
 
129
138
  def run
130
139
  in_gem_dirs do
131
140
  validate
141
+ checkout if opts[:branch]
132
142
  bump
133
143
  commit if opts[:commit]
134
144
  push if opts[:commit] && opts[:push]
@@ -141,11 +151,15 @@ module Gem
141
151
  private
142
152
 
143
153
  def validate
144
- abort :git_dirty unless git_clean?
145
- abort :no_git_remote, remote if push? && !git_remotes.include?(remote.to_s)
154
+ abort :git_dirty unless git.clean?
155
+ abort :no_git_remote, remote if push? && !git.remotes.include?(remote.to_s)
146
156
  abort :not_found, gem.name, version.path || '?' unless version.exists?
147
157
  end
148
158
 
159
+ def checkout
160
+ cmd :git_checkout, branch
161
+ end
162
+
149
163
  def bump
150
164
  announce :bump, gem.name, version.from, version.to
151
165
  return true if pretend?
@@ -170,6 +184,15 @@ module Gem
170
184
  Release.new(context, args, except(opts, :tag)).run
171
185
  end
172
186
 
187
+ def branch
188
+ case opts[:branch]
189
+ when ::String
190
+ opts[:branch]
191
+ when true
192
+ "v#{version.to}"
193
+ end
194
+ end
195
+
173
196
  def message
174
197
  args = { name: gem.name, skip_ci: opts[:skip_ci] ? '[skip ci]' : '' }
175
198
  args = args.merge(version.to_h)
@@ -77,7 +77,7 @@ module Gem
77
77
  end
78
78
 
79
79
  def data
80
- Data.new(system, gem, opts).data
80
+ Data.new(git, gem, opts).data
81
81
  end
82
82
  end
83
83
  end
@@ -79,7 +79,7 @@ module Gem
79
79
  private
80
80
 
81
81
  def validate
82
- abort :git_dirty unless git_clean?
82
+ abort :git_dirty unless git.clean?
83
83
  end
84
84
 
85
85
  def release
@@ -3,7 +3,7 @@ require 'gem/release/context'
3
3
  module Gem
4
4
  module Release
5
5
  module Cmds
6
- class Runner < Struct.new(:context, :name, :args, :opts)
6
+ class Runner < Struct.new(:name, :args, :opts, :context)
7
7
  def run
8
8
  run_cmd
9
9
  success
@@ -11,6 +11,10 @@ module Gem
11
11
 
12
12
  private
13
13
 
14
+ def success
15
+ context.ui.success "All is good, thanks my friend."
16
+ end
17
+
14
18
  def run_cmd
15
19
  const.new(context, args, opts).run
16
20
  end
@@ -19,28 +23,20 @@ module Gem
19
23
  Base[name]
20
24
  end
21
25
 
22
- def opts
23
- except(super, :args, :build_args)
24
- end
25
-
26
26
  def args
27
27
  super.select { |arg| arg.is_a?(String) && arg[0] != '-' }
28
28
  end
29
29
 
30
- def success
31
- context.success "All is good, thanks my friend." unless quiet?
32
- end
33
-
34
- def quiet?
35
- opts[:quiet] || opts[:silent]
36
- end
37
-
38
30
  def opts
39
- @opts ||= config.merge(super)
31
+ @opts ||= except(Base::DEFAULTS.merge(config.merge(super)), :args, :build_args)
40
32
  end
41
33
 
42
34
  def config
43
- context.config.for(name.to_sym)
35
+ Context.new.config.for(name.to_sym)
36
+ end
37
+
38
+ def context
39
+ @context ||= super || Context.new(opts)
44
40
  end
45
41
 
46
42
  def except(hash, *keys)
@@ -35,7 +35,7 @@ module Gem
35
35
  sign: 'GPG sign the tag',
36
36
  }
37
37
 
38
- opt '-p', '--push', descr(:push) do |value|
38
+ opt '-p', '--[no-]push', descr(:push) do |value|
39
39
  opts[:push] = value
40
40
  end
41
41
 
@@ -72,8 +72,8 @@ module Gem
72
72
  private
73
73
 
74
74
  def validate
75
- abort :git_dirty unless git_clean?
76
- abort :no_remote, remote if push? && !git_remotes.include?(remote)
75
+ abort :git_dirty unless git.clean?
76
+ abort :no_remote, remote if push? && !git.remotes.include?(remote)
77
77
  end
78
78
 
79
79
  def tag_and_push
@@ -83,7 +83,7 @@ module Gem
83
83
  end
84
84
 
85
85
  def exists?
86
- git_tags.include?(tag_name)
86
+ git.tags.include?(tag_name)
87
87
  end
88
88
 
89
89
  def tag
@@ -1,59 +1,30 @@
1
1
  require 'gem/release/context/gem'
2
+ require 'gem/release/context/git'
2
3
  require 'gem/release/context/paths'
3
- require 'gem/release/context/system'
4
+ require 'gem/release/context/ui'
4
5
 
5
6
  module Gem
6
7
  module Release
7
8
  class Context
8
- class << self
9
- attr_accessor :last
10
- end
11
-
12
- attr_accessor :config, :gem, :system
13
-
14
- COLORS = {
15
- red: "\e[31m",
16
- green: "\e[32m",
17
- yellow: "\e[33m",
18
- blue: "\e[34m",
19
- gray: "\e[37m",
20
- reset: "\e[0m"
21
- }
9
+ attr_accessor :config, :gem, :git, :ui
22
10
 
23
- def initialize(name = nil)
11
+ def initialize(*args)
12
+ opts = args.last.is_a?(Hash) ? args.pop : {}
13
+ name = args.shift
24
14
  @config = Config.new
25
15
  @gem = Gem.new(name || File.basename(Dir.pwd))
26
- @system = System.new
27
- end
28
-
29
- def announce(str)
30
- puts colored(:green, with_spacing(str, true))
31
- end
32
-
33
- def info(str)
34
- puts colored(:blue, with_spacing(str, true))
35
- end
36
-
37
- def notice(str)
38
- puts colored(:gray, with_spacing(str, false))
39
- end
40
-
41
- def warn(str)
42
- puts colored(:yellow, with_spacing(str, false))
43
- end
44
-
45
- def error(str)
46
- puts colored(:red, with_spacing(str, true))
16
+ @git = Git.new
17
+ @ui = Ui.new(opts)
47
18
  end
48
19
 
49
- def success(str)
50
- announce(str)
51
- puts
20
+ def run(cmd)
21
+ system(cmd)
52
22
  end
53
23
 
54
- def abort(str)
55
- error(str)
56
- exit 1
24
+ def gem_cmd(cmd, *args)
25
+ ::Gem::Commands.const_get("#{cmd.to_s.capitalize}Command").new.invoke(*args.flatten)
26
+ # TODO what's with the return value? maybe add our own abstraction that can check the result?
27
+ true
57
28
  end
58
29
 
59
30
  def in_dirs(args, opts, &block)
@@ -64,17 +35,10 @@ module Gem
64
35
  Paths::ByGemspecs.new(args, opts).in_dirs(&block)
65
36
  end
66
37
 
67
- private
68
-
69
- def colored(color, str)
70
- [COLORS[color], str, COLORS[:reset]].join
71
- end
72
-
73
- def with_spacing(str, space)
74
- str = "\n#{str}" if space && !self.class.last
75
- self.class.last = space
76
- str
77
- end
38
+ def abort(str)
39
+ ui.error(str)
40
+ exit 1
41
+ end
78
42
  end
79
43
  end
80
44
  end
@@ -1,40 +1,30 @@
1
1
  module Gem
2
2
  module Release
3
3
  class Context
4
- class System
5
- def run(cmd)
6
- system(cmd)
7
- end
8
-
9
- def gem_cmd(cmd, *args)
10
- ::Gem::Commands.const_get("#{cmd.to_s.capitalize}Command").new.invoke(*args.flatten)
11
- # TODO what's with the return value? maybe add our own abstraction that can check the result?
12
- true
13
- end
14
-
15
- def git_clean?
4
+ class Git
5
+ def clean?
16
6
  system 'git diff-index --quiet HEAD'
17
7
  end
18
8
 
19
- def git_remotes
9
+ def remotes
20
10
  `git remote`.split("\n")
21
11
  end
22
12
 
23
- def git_tags
13
+ def tags
24
14
  `git tag`.split("\n")
25
15
  end
26
16
 
27
- def git_user_name
17
+ def user_name
28
18
  str = `git config --get user.name`.strip
29
19
  str unless str.empty?
30
20
  end
31
21
 
32
- def git_user_email
22
+ def user_email
33
23
  str = `git config --get user.email`.strip
34
24
  str unless str.empty?
35
25
  end
36
26
 
37
- def github_user_name
27
+ def user_login
38
28
  str = `git config --get github.user`.strip
39
29
  str.empty? ? git_user_name : str
40
30
  end
@@ -0,0 +1,128 @@
1
+ module Gem
2
+ module Release
3
+ class Context
4
+ module Ui
5
+ class << self
6
+ def new(opts)
7
+ const = Quiet if opts[:quiet]
8
+ const ||= Tty if $stdout.tty?
9
+ const ||= Pipe
10
+ const.new(opts)
11
+ end
12
+ end
13
+
14
+ class Base < Struct.new(:opts)
15
+ attr_writer :stdout
16
+
17
+ def stdout
18
+ @stdout || $stdout
19
+ end
20
+
21
+ def puts(*str)
22
+ stdout.puts(*str)
23
+ end
24
+ end
25
+
26
+ class Pipe < Base
27
+ %i(announce info notice warn error).each do |name|
28
+ define_method (name) do |msg, args = nil, _ = nil|
29
+ puts format_msg(msg, args)
30
+ end
31
+ end
32
+
33
+ %i(success cmd).each do |name|
34
+ define_method (name) { |*| }
35
+ end
36
+
37
+ private
38
+
39
+ def format_msg(msg, args)
40
+ msg = [msg, args].flatten.map(&:to_s)
41
+ msg = msg.map { |str| quote_spaced(str) }
42
+ msg.join(' ').strip
43
+ end
44
+
45
+ def quote_spaced(str)
46
+ str.include?(' ') ? %("#{str}") : str
47
+ end
48
+ end
49
+
50
+ class Quiet < Base
51
+ %i(announce info notice warn error success cmd).each do |name|
52
+ define_method (name) { |*| }
53
+ end
54
+ end
55
+
56
+ module Colors
57
+ COLORS = {
58
+ red: "\e[31m",
59
+ green: "\e[32m",
60
+ yellow: "\e[33m",
61
+ blue: "\e[34m",
62
+ gray: "\e[37m",
63
+ reset: "\e[0m"
64
+ }
65
+
66
+ def colored(color, str)
67
+ [COLORS[color], str, COLORS[:reset]].join
68
+ end
69
+ end
70
+
71
+ class Tty < Base
72
+ include Colors
73
+
74
+ def announce(msg, args = [], msgs = [])
75
+ msg = format_msg(msg, args, msgs)
76
+ puts colored(:green, with_spacing(msg, true))
77
+ end
78
+
79
+ def info(msg, args = [], msgs = [])
80
+ msg = format_msg(msg, args, msgs)
81
+ puts colored(:blue, with_spacing(msg, true))
82
+ end
83
+
84
+ def notice(msg, args = [], msgs = [])
85
+ msg = format_msg(msg, args, msgs)
86
+ puts colored(:gray, with_spacing(msg, false))
87
+ end
88
+
89
+ def warn(msg, args = [], msgs = [])
90
+ msg = format_msg(msg, args, msgs)
91
+ puts colored(:yellow, with_spacing(msg, false))
92
+ end
93
+
94
+ def error(msg, args = [], msgs = [])
95
+ msg = format_msg(msg, args, msgs)
96
+ puts colored(:red, with_spacing(msg, true))
97
+ end
98
+
99
+ def success(msg)
100
+ announce(msg)
101
+ puts
102
+ end
103
+
104
+ def cmd(msg)
105
+ notice("$ #{msg}")
106
+ end
107
+
108
+ private
109
+
110
+ def colored(color, str)
111
+ opts[:color] ? super : str
112
+ end
113
+
114
+ def format_msg(msg, args, msgs)
115
+ msg = msgs[msg] % args if msg.is_a?(Symbol)
116
+ msg.strip
117
+ end
118
+
119
+ def with_spacing(str, space)
120
+ str = "\n#{str}" if space && !@last
121
+ @last = space
122
+ str
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
@@ -4,7 +4,7 @@ require 'gem/release/helper/string'
4
4
 
5
5
  module Gem
6
6
  module Release
7
- class Data < Struct.new(:system, :gem, :opts)
7
+ class Data < Struct.new(:git, :gem, :opts)
8
8
  include Helper::String
9
9
 
10
10
  def data
@@ -36,16 +36,20 @@ module Gem
36
36
  gem_name.gsub('-', '/').sub(/_rb$/, '')
37
37
  end
38
38
 
39
+ def user_login
40
+ git.user_login || '[your login]'
41
+ end
42
+
39
43
  def user_name
40
- system.git_user_name || '[your name]'
44
+ git.user_name || '[your name]'
41
45
  end
42
46
 
43
47
  def user_email
44
- system.git_user_email || '[your email]'
48
+ git.user_email || '[your email]'
45
49
  end
46
50
 
47
51
  def homepage
48
- "https://github.com/#{user_name}/#{gem_name}"
52
+ "https://github.com/#{user_login}/#{gem_name}"
49
53
  end
50
54
 
51
55
  def licenses
@@ -4,9 +4,7 @@ module Gem
4
4
  module Release
5
5
  module Helper
6
6
  extend Forwardable
7
- def_delegators :context, :gem, :system
8
- def_delegators :system, :git_clean?, :git_remotes, :git_tags,
9
- :git_user_name, :git_user_email, :github_user_name
7
+ def_delegators :context, :gem, :git, :ui
10
8
 
11
9
  def run(cmd)
12
10
  return true if send(cmd)
@@ -18,21 +16,20 @@ module Gem
18
16
  cmd = self.class::CMDS[cmd] % args
19
17
  end
20
18
  cmd = cmd.strip
21
- notice "$ #{cmd}"
22
- result = pretend? ? true : system.run(cmd)
19
+ ui.cmd cmd
20
+ result = pretend? ? true : context.run(cmd)
23
21
  abort "The command `#{cmd}` was unsuccessful." unless result
24
22
  end
25
23
 
26
24
  def gem_cmd(cmd, *args)
27
25
  info cmd, *args if cmd.is_a?(Symbol)
28
- notice "$ gem #{cmd} #{args.join(' ')}"
29
- pretend? ? true : system.gem_cmd(cmd, *args)
26
+ ui.cmd "gem #{cmd} #{args.join(' ')}"
27
+ pretend? ? true : context.gem_cmd(cmd, *args)
30
28
  end
31
29
 
32
30
  %w(announce notice info warn error).each do |level|
33
31
  define_method(level) do |msg, *args|
34
- msg = self.class::MSGS[msg] % args if msg.is_a?(Symbol)
35
- context.send(level, msg.strip) unless quiet?
32
+ ui.send(level, msg, args, self.class::MSGS)
36
33
  end
37
34
  end
38
35
 
@@ -51,9 +51,7 @@ module Gem
51
51
  end
52
52
 
53
53
  def execute
54
- args = opts.delete(:args)
55
- context = Context.new
56
- Cmds::Runner.new(context, cmd, args, opts).run
54
+ Cmds::Runner.new(cmd, opts.delete(:args), opts).run
57
55
  rescue Abort
58
56
  abort
59
57
  end
@@ -1,5 +1,5 @@
1
1
  module Gem
2
2
  module Release
3
- VERSION = '2.0.0.dev.5'
3
+ VERSION = '2.0.0.rc.1'
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@ module Gem
2
2
  module Release
3
3
  module Version
4
4
  class Number < Struct.new(:number, :target)
5
- NUMBER = /^(\d+)\.(\d+).(\d+).?(\w+)?.?(\d+)?$/
5
+ NUMBER = /^(\d+)\.?(\d+)?\.?(\d+)?\.?(\w+)?\.?(\d+)?$/
6
6
 
7
7
  STAGES = %i(alpha beta pre rc)
8
8
 
@@ -25,14 +25,14 @@ module Gem
25
25
  end
26
26
 
27
27
  def minor
28
- part = parts[1]
28
+ part = parts[1].to_i
29
29
  part = 0 if to?(:major)
30
30
  part += 1 if to?(:minor) || fresh_pre_release?
31
31
  part
32
32
  end
33
33
 
34
34
  def patch
35
- part = parts[2]
35
+ part = parts[2].to_i
36
36
  part = 0 if to?(:major, :minor) || fresh_pre_release?
37
37
  part += 1 if to?(:patch) && from_release?
38
38
  part
@@ -44,9 +44,7 @@ module Gem
44
44
 
45
45
  def num
46
46
  return if to_release?
47
- part = parts[4].to_i
48
- part += 1 if from_release? || same_stage?
49
- part
47
+ same_stage? ? parts[4].to_i + 1 : 1
50
48
  end
51
49
 
52
50
  def to?(*targets)
@@ -89,12 +87,18 @@ module Gem
89
87
 
90
88
  def parts
91
89
  @parts ||= matches.compact.map(&:to_i).tap do |parts|
92
- parts[3] = matches[3] && matches[3].to_sym
90
+ parts[3] = matches[3].to_sym if matches[3]
93
91
  end
94
92
  end
95
93
 
96
94
  def matches
97
- @matches ||= number.match(NUMBER).to_a[1..-1]
95
+ @matches ||= parse.to_a[1..-1]
96
+ end
97
+
98
+ def parse
99
+ matches = number.match(NUMBER)
100
+ raise Abort, "Cannot parse version number #{number}" unless matches
101
+ matches
98
102
  end
99
103
  end
100
104
  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.5
4
+ version: 2.0.0.rc.1
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-06 00:00:00.000000000 Z
12
+ date: 2018-03-18 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 ...)
@@ -40,8 +40,9 @@ files:
40
40
  - lib/gem/release/context.rb
41
41
  - lib/gem/release/context/gem.rb
42
42
  - lib/gem/release/context/gemspec.rb
43
+ - lib/gem/release/context/git.rb
43
44
  - lib/gem/release/context/paths.rb
44
- - lib/gem/release/context/system.rb
45
+ - lib/gem/release/context/ui.rb
45
46
  - lib/gem/release/data.rb
46
47
  - lib/gem/release/files/template.rb
47
48
  - lib/gem/release/files/template/context.rb
@@ -91,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
92
  version: 1.3.1
92
93
  requirements: []
93
94
  rubyforge_project:
94
- rubygems_version: 2.6.11
95
+ rubygems_version: 2.6.13
95
96
  signing_key:
96
97
  specification_version: 4
97
98
  summary: Release your ruby gems with ease