gem-release 2.0.0.dev.4 → 2.0.0.dev.5

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: c266a1ed9b7d5a3b2f1594b0aa4a14e98faafd87
4
- data.tar.gz: ed1b9717bc85dbf71f9adf5d17b389e2a1b26a78
3
+ metadata.gz: 6eec8f1a113b0850b5700b9226b6350cad8167f3
4
+ data.tar.gz: bda046a3fa483a9d09f7f493146266e17241dbd8
5
5
  SHA512:
6
- metadata.gz: cc5fe621e481c9aeae16e3bca40ca475a1c6d3f708c5c4ee4bf225d783e581f7a10b6f235dcf490b6d853174f2a605c1d2da9b9ef65505c0dbf0c807babb2926
7
- data.tar.gz: 2db3a96f254bd5bda9ebfd4f6900643de49e9a921e87be4cb4410c96184a20f35d7ac907441dfb2960bf73eb0093594e5345f884f9be249e38b8cd9b29a282b7
6
+ metadata.gz: 458818e6e27ae01927d51a6813f08d07d9359cfe6e6a682c33494127bde073d2b4b1b692868e8e2451eef497fe7b74811459c099413b51f7b2fafdb8254e8b33
7
+ data.tar.gz: a68e3c396bdcb8295ac1c05ff50a36f78b494c418d341619635431c3cfde56789005549d8c41c218277e82ff30b6f7adeb4b271976cce9bf9f16f7142266b400
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## v2.0.0
4
+
5
+ This is a major rewrite, 7 years after the initial implementation.
6
+
7
+ ### Major changes
8
+
9
+ * Consistent config format, using config files, environment variables, and
10
+ command line options
11
+ * Custom template groups for `gem bootstrap`
12
+ * 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))
15
+ * Consistent command line option defaults across commands when invoked with a
16
+ shortcut, e.g. `gem bump --release --tag` vs `gem release --tag`
17
+ * Colorized, more consistently formatted output
18
+
19
+ ### Other changes
20
+
21
+ * Fix misleading success message when `gem push` fails
22
+ * 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
27
+ * 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.3)
4
+ gem-release (2.0.0.dev.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -28,7 +28,7 @@ It adds the commands `bootstrap`, `gemspec`, `bump`, `tag` and a `release` to th
28
28
 
29
29
  This gif demos some of the things you can do with this plugin:
30
30
 
31
- ![gem-relase-demo](https://cloud.githubusercontent.com/assets/2208/25568627/12a3b468-2e07-11e7-8d7b-055b5d7c71b9.gif)
31
+ ![gem-release-demo](https://cloud.githubusercontent.com/assets/2208/25634571/68b78080-2f7b-11e7-9eb2-c7d1df13c727.gif)
32
32
 
33
33
  ## Installation
34
34
 
@@ -28,7 +28,7 @@ It adds the commands `bootstrap`, `gemspec`, `bump`, `tag` and a `release` to th
28
28
 
29
29
  This gif demos some of the things you can do with this plugin:
30
30
 
31
- ![gem-relase-demo](https://cloud.githubusercontent.com/assets/2208/25568627/12a3b468-2e07-11e7-8d7b-055b5d7c71b9.gif)
31
+ ![gem-release-demo](https://cloud.githubusercontent.com/assets/2208/25634571/68b78080-2f7b-11e7-9eb2-c7d1df13c727.gif)
32
32
 
33
33
  ## Installation
34
34
 
@@ -32,6 +32,12 @@ module Gem
32
32
  @opts ||= superclass != self.class && superclass.respond_to?(:opts) ? superclass.opts.dup : []
33
33
  end
34
34
 
35
+ def descr(opt)
36
+ descr = self::DESCR[opt]
37
+ descr = "#{descr} (default: #{self::DEFAULTS[opt]})" if self::DEFAULTS.key?(opt)
38
+ descr
39
+ end
40
+
35
41
  def usage(usage = nil)
36
42
  usage ? @usage = usage : @usage || '[usage]'
37
43
  end
@@ -8,8 +8,6 @@ module Gem
8
8
  class Bootstrap < Base
9
9
  summary 'Scaffolds a new gem from template files.'
10
10
 
11
- # TODO document license
12
-
13
11
  description <<~str
14
12
  #{summary} Optionally initialize a git repository, set a git remote, and push
15
13
  to the remote repository.
@@ -53,7 +51,8 @@ module Gem
53
51
  The license added by default is the MIT License. If `--license [name]` is given
54
52
  then this license will be added. The only other license file shipped is the
55
53
  Mozilla Public License v2.0. Other licenses must be present in the local or
56
- global directory `.gem-release/licenses`.
54
+ global directory `.gem-release/licenses`. If `--no-license` is given then no
55
+ license will be added.
57
56
  str
58
57
 
59
58
  arg :gem_name, 'name of the gem (optional, will default to the current directory name if not specified)'
@@ -71,7 +70,7 @@ module Gem
71
70
  DESCR = {
72
71
  scaffold: 'Scaffold gem files',
73
72
  dir: 'Directory to place the gem in (defaults to the given name, or the current working dir)',
74
- licenses: 'License(s) to add',
73
+ license: 'License(s) to add',
75
74
  template: 'Template groups to use for scaffolding',
76
75
  rspec: 'Use the rspec group (by default adds .rspec and spec/spec_helper.rb)',
77
76
  travis: 'Use the rspec group (by default adds .travis.yml)',
@@ -82,47 +81,47 @@ module Gem
82
81
  push: 'Push the git repo to github'
83
82
  }
84
83
 
85
- opt '--[no]-scaffold', DESCR[:scaffold] do |value|
84
+ opt '--[no-]scaffold', descr(:scaffold) do |value|
86
85
  opts[:scaffold] = value
87
86
  end
88
87
 
89
- opt '--dir DIR', DESCR[:dir] do |value|
88
+ opt '--dir DIR', descr(:dir) do |value|
90
89
  opts[:dir] = value
91
90
  end
92
91
 
93
- opt '-t', '--template NAME', DESCR[:template] do |value|
92
+ opt '-t', '--template NAME', descr(:template) do |value|
94
93
  (opts[:templates] ||= []) << value
95
94
  end
96
95
 
97
- opt '--rspec', DESCR[:rspec] do |value|
96
+ opt '--rspec', descr(:rspec) do |value|
98
97
  (opts[:templates] ||= []) << :rspec
99
98
  end
100
99
 
101
- opt '--travis', DESCR[:travis] do |value|
100
+ opt '--travis', descr(:travis) do |value|
102
101
  (opts[:templates] ||= []) << :travis
103
102
  end
104
103
 
105
- opt '-l', '--no-license NAME', DESCR[:license] do |value|
106
- value ? (opts[:license] ||= []) << value : opts[:license] = []
104
+ opt '-l', '--[no-]license NAME', descr(:license) do |value|
105
+ opts[:license] = value
107
106
  end
108
107
 
109
- opt '-s', '--strategy NAME', DESCR[:strategy] do |value|
108
+ opt '-s', '--strategy NAME', descr(:strategy) do |value|
110
109
  opts[:strategy] = value
111
110
  end
112
111
 
113
- opt '--git', DESCR[:git] do |value|
112
+ opt '--[no-]git', descr(:git) do |value|
114
113
  opts[:git] = value
115
114
  end
116
115
 
117
- opt '--github', DESCR[:github] do |value|
116
+ opt '--github', descr(:github) do |value|
118
117
  opts[:github] = value
119
118
  end
120
119
 
121
- opt '--remote', DESCR[:remote] do |value|
120
+ opt '--remote', descr(:remote) do |value|
122
121
  opts[:remote] = value
123
122
  end
124
123
 
125
- opt '--push', DESCR[:push] do |value|
124
+ opt '--push', descr(:push) do |value|
126
125
  opts[:push] = value
127
126
  end
128
127
 
@@ -57,52 +57,55 @@ module Gem
57
57
 
58
58
  DEFAULTS = {
59
59
  commit: true,
60
- message: 'Bump to %{to} %{skip_ci}',
60
+ message: 'Bump %{name} to %{version} %{skip_ci}',
61
61
  push: false,
62
- remote: 'origin'
62
+ remote: 'origin',
63
+ skip_ci: false,
64
+ sign: false,
65
+ recurse: false
63
66
  }
64
67
 
65
- opt '-v', '--version VERSION', DESCR[:version] do |value|
68
+ opt '-v', '--version VERSION', descr(:version) do |value|
66
69
  opts[:version] = value
67
70
  end
68
71
 
69
- opt '-c', '--[no-]commit', DESCR[:commit] do |value|
72
+ opt '-c', '--[no-]commit', descr(:commit) do |value|
70
73
  opts[:commit] = value
71
74
  end
72
75
 
73
- opt '-m', '--message', DESCR[:message] do |value|
76
+ opt '-m', '--message', descr(:message) do |value|
74
77
  opts[:message] = value
75
78
  end
76
79
 
77
- opt '--skip-ci', DESCR[:skip_ci] do |value|
80
+ opt '--skip-ci', descr(:skip_ci) do |value|
78
81
  opts[:skip_ci] = value
79
82
  end
80
83
 
81
- opt '-p', '--[no-]push', DESCR[:push] do |value|
84
+ opt '-p', '--push', descr(:push) do |value|
82
85
  opts[:push] = value
83
86
  end
84
87
 
85
- opt '--remote REMOTE', DESCR[:remote] do |value|
88
+ opt '--remote REMOTE', descr(:remote) do |value|
86
89
  opts[:remote] = value
87
90
  end
88
91
 
89
- opt '-s', '--sign', DESCR[:sign] do |value|
92
+ opt '-s', '--sign', descr(:sign) do |value|
90
93
  opts[:sign] = value
91
94
  end
92
95
 
93
- opt '-t', '--tag', DESCR[:tag] do |value|
96
+ opt '-t', '--tag', descr(:tag) do |value|
94
97
  opts[:tag] = value
95
98
  end
96
99
 
97
- opt '-r', '--release', DESCR[:release] do |value|
100
+ opt '-r', '--release', descr(:release) do |value|
98
101
  opts[:release] = value
99
102
  end
100
103
 
101
- opt '--recurse', DESCR[:recurse] do |value|
104
+ opt '--recurse', descr(:recurse) do |value|
102
105
  opts[:recurse] = value
103
106
  end
104
107
 
105
- opt '--file', DESCR[:file] do |value|
108
+ opt '--file', descr(:file) do |value|
106
109
  opts[:file] = value
107
110
  end
108
111
 
@@ -127,8 +130,8 @@ module Gem
127
130
  in_gem_dirs do
128
131
  validate
129
132
  bump
130
- commit if opts[:commit]
131
- push if opts[:commit] && opts[:push]
133
+ commit if opts[:commit]
134
+ push if opts[:commit] && opts[:push]
132
135
  reset
133
136
  end
134
137
  tag if opts[:tag]
@@ -139,8 +142,8 @@ module Gem
139
142
 
140
143
  def validate
141
144
  abort :git_dirty unless git_clean?
142
- abort :not_found, gem.name, version.path || '?' unless version.exists?
143
145
  abort :no_git_remote, remote if push? && !git_remotes.include?(remote.to_s)
146
+ abort :not_found, gem.name, version.path || '?' unless version.exists?
144
147
  end
145
148
 
146
149
  def bump
@@ -167,13 +170,9 @@ module Gem
167
170
  Release.new(context, args, except(opts, :tag)).run
168
171
  end
169
172
 
170
- def reset
171
- @version = nil
172
- end
173
-
174
173
  def message
175
- args = version.to_h
176
- args = args.merge(skip_ci: opts[:skip_ci] ? '[skip ci]' : '')
174
+ args = { name: gem.name, skip_ci: opts[:skip_ci] ? '[skip ci]' : '' }
175
+ args = args.merge(version.to_h)
177
176
  opts[:message] % args
178
177
  end
179
178
 
@@ -181,6 +180,10 @@ module Gem
181
180
  @version ||= Files::Version.new(gem.name, opts[:version], only(opts, :file))
182
181
  end
183
182
 
183
+ def reset
184
+ @version = nil
185
+ end
186
+
184
187
  def push?
185
188
  opts[:push]
186
189
  end
@@ -34,15 +34,15 @@ module Gem
34
34
  strategy: 'Strategy for collecting files [glob|git] in gemspec'
35
35
  }
36
36
 
37
- opt '--dir DIR', DESCR[:dir] do |value|
37
+ opt '--dir DIR', descr(:dir) do |value|
38
38
  opts[:dir] = value
39
39
  end
40
40
 
41
- opt '-l', '--[no]-license[s] NAMES', DESCR[:license] do |value|
41
+ opt '-l', '--[no-]license NAMES', descr(:license) do |value|
42
42
  value ? (opts[:license] ||= []) << value : opts[:license] = []
43
43
  end
44
44
 
45
- opt '-s', '--strategy', DESCR[:strategy] do |value|
45
+ opt '-s', '--strategy', descr(:strategy) do |value|
46
46
  opts[:strategy] = value
47
47
  end
48
48
 
@@ -22,26 +22,37 @@ module Gem
22
22
 
23
23
  arg :gem_name, 'name of the gem (optional, will use the first gemspec, or all gemspecs if --recurse is given)'
24
24
 
25
+ DEFAULTS = {
26
+ tag: false,
27
+ push: false,
28
+ recurse: false
29
+ }
30
+
25
31
  DESCR = {
26
32
  host: 'Push to a compatible host other than rubygems.org',
27
33
  key: 'Use the API key from ~/.gem/credentials',
28
34
  tag: 'Shortcut for running the `gem tag` command',
35
+ push: 'Push tag to the remote git repository',
29
36
  recurse: 'Recurse into directories that contain gemspec files'
30
37
  }
31
38
 
32
- opt '-h', '--host HOST', DESCR[:host] do |value|
39
+ opt '-h', '--host HOST', descr(:host) do |value|
33
40
  opts[:host] = value
34
41
  end
35
42
 
36
- opt '-k', '--key KEY', DESCR[:key] do |value|
43
+ opt '-k', '--key KEY', descr(:key) do |value|
37
44
  opts[:key] = value
38
45
  end
39
46
 
40
- opt '-t', '--tag', DESCR[:tag] do |value|
47
+ opt '-t', '--tag', descr(:tag) do |value|
41
48
  opts[:tag] = value
42
49
  end
43
50
 
44
- opt '--recurse', DESCR[:recurse] do |value|
51
+ opt '-p', '--push', descr(:push) do |value|
52
+ opts[:push] = value
53
+ end
54
+
55
+ opt '--recurse', descr(:recurse) do |value|
45
56
  opts[:recurse] = value
46
57
  end
47
58
 
@@ -24,26 +24,32 @@ module Gem
24
24
  str
25
25
 
26
26
  DEFAULTS = {
27
- push: true,
28
- remote: 'origin'
27
+ push: false,
28
+ remote: 'origin',
29
+ sign: false
29
30
  }
30
31
 
31
32
  DESCR = {
32
- push: 'Push tag to the remote git repository',
33
- remote: 'Git remote to push to (defaults to origin)',
34
- sign: 'GPG sign the tag',
33
+ push: 'Push tag to the remote git repository',
34
+ remote: 'Git remote to push to',
35
+ sign: 'GPG sign the tag',
35
36
  }
36
37
 
37
- opt '-p', '--[no]-push', DESCR[:push] do
38
- opts[:push] = true
38
+ opt '-p', '--push', descr(:push) do |value|
39
+ opts[:push] = value
39
40
  end
40
41
 
41
- opt '--remote REMOTE', DESCR[:remote] do |value|
42
+ opt '--remote REMOTE', descr(:remote) do |value|
42
43
  opts[:remote] = value
43
44
  end
44
45
 
46
+ opt '-s', '--sign', descr(:sign) do |value|
47
+ opts[:sign] = value
48
+ end
49
+
45
50
  MSGS = {
46
51
  tag: 'Tagging %s as version %s',
52
+ exists: 'Skipping %s, tag already exists.',
47
53
  git_tag: 'Creating git tag %s',
48
54
  git_push: 'Pushing tags to the %s git repository',
49
55
  no_remote: 'Cannot push to missing git remote %s',
@@ -59,8 +65,7 @@ module Gem
59
65
  in_gem_dirs do
60
66
  announce :tag, gem.name, gem.version
61
67
  validate
62
- tag
63
- push if opts[:push]
68
+ tag_and_push
64
69
  end
65
70
  end
66
71
 
@@ -71,6 +76,16 @@ module Gem
71
76
  abort :no_remote, remote if push? && !git_remotes.include?(remote)
72
77
  end
73
78
 
79
+ def tag_and_push
80
+ return info :exists, tag_name if exists?
81
+ tag
82
+ push if opts[:push]
83
+ end
84
+
85
+ def exists?
86
+ git_tags.include?(tag_name)
87
+ end
88
+
74
89
  def tag
75
90
  cmd :git_tag, tag_name, tag_name, opts[:sign] ? '--sign' : ''
76
91
  end
@@ -71,7 +71,6 @@ module Gem
71
71
  end
72
72
 
73
73
  def with_spacing(str, space)
74
- # space = false if self.class.last.nil?
75
74
  str = "\n#{str}" if space && !self.class.last
76
75
  self.class.last = space
77
76
  str
@@ -20,6 +20,10 @@ module Gem
20
20
  `git remote`.split("\n")
21
21
  end
22
22
 
23
+ def git_tags
24
+ `git tag`.split("\n")
25
+ end
26
+
23
27
  def git_user_name
24
28
  str = `git config --get user.name`.strip
25
29
  str unless str.empty?
@@ -31,7 +31,7 @@ module Gem
31
31
  end
32
32
 
33
33
  def to_h
34
- { from: from, to: to }
34
+ { from: from, version: to }
35
35
  end
36
36
 
37
37
  private
@@ -5,8 +5,8 @@ module Gem
5
5
  module Helper
6
6
  extend Forwardable
7
7
  def_delegators :context, :gem, :system
8
- def_delegators :system, :git_clean?, :git_remotes, :git_user_name,
9
- :git_user_email, :github_user_name
8
+ def_delegators :system, :git_clean?, :git_remotes, :git_tags,
9
+ :git_user_name, :git_user_email, :github_user_name
10
10
 
11
11
  def run(cmd)
12
12
  return true if send(cmd)
@@ -1,5 +1,5 @@
1
1
  module Gem
2
2
  module Release
3
- VERSION = '2.0.0.dev.4'
3
+ VERSION = '2.0.0.dev.5'
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.4
4
+ version: 2.0.0.dev.5
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-02 00:00:00.000000000 Z
12
+ date: 2017-05-06 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 ...)
@@ -19,12 +19,12 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - CHANGELOG.md
22
23
  - Gemfile
23
24
  - Gemfile.lock
24
25
  - MIT-LICENSE.md
25
26
  - README.md
26
27
  - README.md.erb
27
- - TODO.txt
28
28
  - lib/gem/release.rb
29
29
  - lib/gem/release/cmds.rb
30
30
  - lib/gem/release/cmds/base.rb
data/TODO.txt DELETED
@@ -1,67 +0,0 @@
1
- # Todo
2
-
3
- - Add defaults to options help output [5]
4
- - Add specs for all error conditions [6]
5
- - Add a changelog [7]
6
- - Check for TODO tags [17]
7
-
8
- - Make sure we don't double tag the same repo when several args are given [9]
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
-
39
- x Release and tag should fail if there are uncommitted changes done:2017-05-01 [8]
40
- https://github.com/svenfuchs/gem-release/issues/34
41
-
42
- x Misleading success message done:2017-05-01 [4]
43
- https://github.com/svenfuchs/gem-release/issues/60
44
- Pushing foo-0.0.5.gem
45
- Pushing gem to http://localhost:9292...
46
- ...
47
- ERROR: While executing gem ... (Errno::ECONNREFUSED)
48
- Failed to open TCP connection to localhost:9292 (Connection refused - connect(2) for "localhost" port 9292)
49
-
50
- x Issues with in-repo gems done:2017-05-01 [1]
51
- https://github.com/svenfuchs/gem-release/issues/58
52
-
53
- x bump fails when there is a space in the path to project done:2017-05-01 [2]
54
- https://github.com/svenfuchs/gem-release/issues/33
55
- looks like this is fixed. this did not result in any errors:
56
- cd /tmp
57
- mkdir -p '/tmp/seanmackesey/Google Drive/code/lib/ruby'
58
- cd /tmp/seanmackesey/Google\ Drive/code/lib/ruby
59
- gem bootstrap foo
60
- gem bump --no-push
61
-
62
- x gem bump --tag --release pushes the wrong version done:2017-05-01 [3]
63
- https://github.com/svenfuchs/gem-release/issues/36
64
- $ gem bump --tag --release
65
- Bumping foo from version 0.0.3 to 0.0.4
66
- ...
67
- Pushing foo-0.0.4.gem