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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d01b331c4b3cdce9d3464a76d0a4340e19e91e7
4
- data.tar.gz: 5ff68a222cea0f340527134339fb4e2db272ab1a
3
+ metadata.gz: d5495b63bafb7bac2b1664e052f1c82adadefbfc
4
+ data.tar.gz: 3d45a18839a2a19b02487d00bb43d99415eda748
5
5
  SHA512:
6
- metadata.gz: 5783af584722603f72e354a8391f5b7df243ef4a5a1e4f5bb518e90157e54138d5c393918f97ec5fc22c2fd199d074f9da8a4e69bdc1a65f2e6de8fc304d8ddb
7
- data.tar.gz: 0c43e69387894f86c47e588269c95f61e7b478df799bfb7f5721bdd07bc00092a0dfc51dc5989dae79c6a4dde11aaddafb1c4eb3384c02f423564f95a4b7118d
6
+ metadata.gz: 33e8795828225985d25057cf05394481a806fdda7195c50a582e3d5f54a775244f2631835da77097b5f6349f74aaac70dcfb34bfca28afbbcd651b56c32f8584
7
+ data.tar.gz: c56e9eddebc241a1c11fd1d949f8f09286585f7d12e78a4b7b60147674b93f3736551f63aff7b91dad11564e4d4ba952311948220084b8736e0a75827038d6a7
@@ -1,11 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gem-release (2.0.0.rc.1)
4
+ gem-release (2.0.0.rc.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ addressable (2.5.2)
10
+ public_suffix (>= 2.0.2, < 4.0)
9
11
  builder (3.2.3)
10
12
  coveralls (0.8.21)
11
13
  json (>= 1.8, < 3)
@@ -13,6 +15,8 @@ GEM
13
15
  term-ansicolor (~> 1.3)
14
16
  thor (~> 0.19.4)
15
17
  tins (~> 1.6)
18
+ crack (0.4.3)
19
+ safe_yaml (~> 1.0.0)
16
20
  diff-lcs (1.3)
17
21
  docile (1.1.5)
18
22
  faraday (0.12.0.1)
@@ -23,10 +27,12 @@ GEM
23
27
  httpclient (>= 2.2.7)
24
28
  nesty
25
29
  sinatra (>= 1.2.7)
30
+ hashdiff (0.3.7)
26
31
  httpclient (2.6.0.1)
27
32
  json (2.1.0)
28
33
  multipart-post (2.0.0)
29
34
  nesty (1.0.2)
35
+ public_suffix (3.0.2)
30
36
  rack (1.6.5)
31
37
  rack-protection (1.5.3)
32
38
  rack
@@ -43,6 +49,7 @@ GEM
43
49
  diff-lcs (>= 1.2.0, < 2.0)
44
50
  rspec-support (~> 3.5.0)
45
51
  rspec-support (3.5.0)
52
+ safe_yaml (1.0.4)
46
53
  simplecov (0.14.1)
47
54
  docile (~> 1.1.0)
48
55
  json (>= 1.8, < 3)
@@ -57,6 +64,10 @@ GEM
57
64
  thor (0.19.4)
58
65
  tilt (2.0.7)
59
66
  tins (1.13.2)
67
+ webmock (3.3.0)
68
+ addressable (>= 2.3.6)
69
+ crack (>= 0.3.2)
70
+ hashdiff
60
71
 
61
72
  PLATFORMS
62
73
  ruby
@@ -67,6 +78,7 @@ DEPENDENCIES
67
78
  geminabox
68
79
  rspec
69
80
  simplecov
81
+ webmock
70
82
 
71
83
  BUNDLED WITH
72
84
  1.16.0.pre.2
data/README.md CHANGED
@@ -20,6 +20,7 @@ It adds the commands `bootstrap`, `gemspec`, `bump`, `tag` and a `release` to th
20
20
  * [Installation](#installation)
21
21
  * [Configuration](#configuration)
22
22
  * [Conventions](#conventions)
23
+ * [Piping](#piping)
23
24
  * [Reference](#reference)
24
25
  * [Scenarios](#scenarios)
25
26
  * [Development](#development)
@@ -85,6 +86,29 @@ When bumping the version of an existing gem `gem-name` the following locations a
85
86
  * `lib/gem/name/version.rb`
86
87
  * `lib/gem-name/version.rb`
87
88
 
89
+ # Piping
90
+
91
+ Output depends on a `tty` being available or not. I.e. when run as an
92
+ individual command colorized human readable output will be printed (see the
93
+ Demo screencast above). When attached to a pipe then output is kept simple and
94
+ parsable.
95
+
96
+ E.g.:
97
+
98
+ ```
99
+ $ gem bump --pretend | cat
100
+ bump gem-release 1.0.0 1.0.1
101
+ git_add lib/gem/release/version.rb
102
+ git_commit "Bump gem-release to 1.0.1"
103
+ ```
104
+
105
+ This is useful, for example, for grabbing the next version number:
106
+
107
+ ```
108
+ $ gem bump --pretend --no-commit | awk '{ print $4 }'
109
+ 1.0.1
110
+ ```
111
+
88
112
 
89
113
  # Reference
90
114
 
@@ -109,17 +133,19 @@ gem_name - name of the gem (optional, will default to the current directory name
109
133
  ### Options
110
134
 
111
135
  ```
112
- --[no]-scaffold Scaffold gem files
136
+ --[no-]scaffold Scaffold gem files (default: true)
113
137
  --dir DIR Directory to place the gem in (defaults to the given name, or the current working dir)
138
+ --bin Create an executable ./bin/[name], add executables directive to .gemspec
114
139
  -t, --template NAME Template groups to use for scaffolding
115
140
  --rspec Use the rspec group (by default adds .rspec and spec/spec_helper.rb)
116
- --travis Use the rspec group (by default adds .travis.yml)
117
- -l, --no-license NAME
118
- -s, --strategy NAME Strategy for collecting files [glob|git] in .gemspec
119
- --git Initialize a git repo
141
+ --travis Use the travis group (by default adds .travis.yml)
142
+ -l, --[no-]license NAME License(s) to add (default: mit)
143
+ -s, --strategy NAME Strategy for collecting files [glob|git] in .gemspec (default: glob)
144
+ --[no-]git Initialize a git repo (default: true)
120
145
  --github Initialize a git repo, create on github
121
146
  --remote Git remote repository
122
147
  --push Push the git repo to github
148
+ --[no-]color
123
149
  --pretend
124
150
  ```
125
151
 
@@ -167,7 +193,8 @@ global directory `.gem-release/templates/travis`.
167
193
  The license added by default is the MIT License. If `--license [name]`
168
194
  is given then this license will be added. The only other license file
169
195
  shipped is the Mozilla Public License v2.0. Other licenses must be
170
- present in the local or global directory `.gem-release/licenses`.
196
+ present in the local or global directory `.gem-release/licenses`. If
197
+ `--no-license` is given then no license will be added.
171
198
 
172
199
  ## gem bump
173
200
 
@@ -183,16 +210,18 @@ gem_name - name of the gem (optional, will use the directory name, or all gemspe
183
210
 
184
211
  ```
185
212
  -v, --version VERSION Target version: next [major|minor|patch|pre|release] or a given version number [x.x.x]
186
- -c, --[no-]commit Create a commit after incrementing gem version
187
- -m, --message Commit message template
213
+ -c, --[no-]commit Create a commit after incrementing gem version (default: true)
214
+ -m, --message Commit message template (default: Bump %{name} to %{version} %{skip_ci})
188
215
  --skip-ci Add the [skip ci] tag to the commit message
189
- -p, --[no-]push Push the new commit to the git remote repository
190
- --remote REMOTE Git remote to push to (defaults to origin)
216
+ -p, --push Push the new commit to the git remote repository
217
+ --remote REMOTE Git remote to push to (defaults to origin) (default: origin)
191
218
  -s, --sign GPG sign the commit message
219
+ --branch [BRANCH] Check out a new branch for the target version (e.g. `v1.0.0`)
192
220
  -t, --tag Shortcut for running the `gem tag` command
193
221
  -r, --release Shortcut for the `gem release` command
194
222
  --recurse Recurse into directories that contain gemspec files
195
- --file Full path to the version file
223
+ --file FILE Full path to the version file
224
+ --[no-]color
196
225
  --pretend
197
226
  ```
198
227
 
@@ -219,7 +248,7 @@ major # Bump to the next major level (e.g. 0.0.1 to 1.0.0)
219
248
  minor # Bump to the next minor level (e.g. 0.0.1 to 0.1.0)
220
249
  patch # Bump to the next patch level (e.g. 0.0.1 to 0.0.2)
221
250
  pre|rc|etc # Bump to the next pre-release level (e.g. 0.0.1 to
222
- # 0.1.0-pre.1, 1.0.0-pre.1 to 1.0.0-pre.2)
251
+ # 0.1.0.pre.1, 1.0.0.pre.1 to 1.0.0.pre.2)
223
252
  ```
224
253
 
225
254
  When searching for the version file for a gem named `gem-name`: the
@@ -241,9 +270,11 @@ gem_name - name of the gem (optional, will default to the current directory name
241
270
  ### Options
242
271
 
243
272
  ```
273
+ --[no]-bin Add bin files directive to the gemspec (defaults to true if a ./bin directory exists)
244
274
  --dir DIR Directory to place the gem in (defaults to the given name, or the current working dir)
245
- -l, --[no]-license[s] NAMES License(s) to list in the gemspec
246
- -s, --strategy Strategy for collecting files [glob|git] in gemspec
275
+ -l, --[no-]license NAMES License(s) to list in the gemspec
276
+ -s, --strategy Strategy for collecting files [glob|git] in gemspec (default: glob)
277
+ --[no-]color
247
278
  --pretend
248
279
  ```
249
280
 
@@ -277,7 +308,9 @@ gem_name - name of the gem (optional, will use the first gemspec, or all gemspec
277
308
  --host HOST Push to a compatible host other than rubygems.org
278
309
  -k, --key KEY Use the API key from ~/.gem/credentials
279
310
  -t, --tag Shortcut for running the `gem tag` command
311
+ -p, --push Push tag to the remote git repository
280
312
  --recurse Recurse into directories that contain gemspec files
313
+ --[no-]color
281
314
  --pretend
282
315
  ```
283
316
 
@@ -301,8 +334,10 @@ Tags the HEAD commit with the gem's current version.
301
334
  ### Options
302
335
 
303
336
  ```
304
- -p, --[no]-push Push tag to the remote git repository
305
- --remote REMOTE Git remote to push to (defaults to origin)
337
+ -p, --[no-]push Push tag to the remote git repository
338
+ --remote REMOTE Git remote to push to (default: origin)
339
+ -s, --sign GPG sign the tag
340
+ --[no-]color
306
341
  --pretend
307
342
  ```
308
343
 
@@ -1,4 +1,4 @@
1
- # gem release [![Build Status](https://secure.travis-ci.org/svenfuchs/gem-release.png)](http://travis-ci.org/svenfuchs/gem-release)
1
+ # gem release [![Build Status](https://secure.travis-ci.org/svenfuchs/gem-release.svg)](http://travis-ci.org/svenfuchs/gem-release)
2
2
 
3
3
  This gem plugin aims at making gem development easier by automating repetitive work based on conventions, configuration, and templates.
4
4
 
@@ -8,9 +8,9 @@ It adds the commands `bootstrap`, `gemspec`, `bump`, `tag` and a `release` to th
8
8
  | ---------------------- | ------------ |
9
9
  | Gem name | gem-release |
10
10
  | License | [MIT](https://github.com/svenfuchs/gem-release/blob/master/LICENSE.md) |
11
- | Version | [![Gem Version](https://badge.fury.io/rb/gem-release.png)](http://badge.fury.io/rb/gem-release) |
12
- | Continuous integration | [![Build Status](https://secure.travis-ci.org/svenfuchs/gem-release.png?branch=master)](https://travis-ci.org/svenfuchs/gem-release) |
13
- | Test coverage | [![Coverage Status](https://coveralls.io/repos/svenfuchs/gem-release/badge.png)](https://coveralls.io/r/svenfuchs/gem-release) |
11
+ | Version | [![Gem Version](https://badge.fury.io/rb/gem-release.svg)](http://badge.fury.io/rb/gem-release) |
12
+ | Continuous integration | [![Build Status](https://secure.travis-ci.org/svenfuchs/gem-release.svg?branch=master)](https://travis-ci.org/svenfuchs/gem-release) |
13
+ | Test coverage | [![Coverage Status](https://coveralls.io/repos/svenfuchs/gem-release/badge.svg)](https://coveralls.io/r/svenfuchs/gem-release) |
14
14
  | Documentation | [Documentation](http://rdoc.info/github/svenfuchs/gem-release/frames) |
15
15
  | Credits | [Contributors](https://github.com/svenfuchs/gem-release/graphs/contributors) |
16
16
 
@@ -20,6 +20,7 @@ It adds the commands `bootstrap`, `gemspec`, `bump`, `tag` and a `release` to th
20
20
  * [Installation](#installation)
21
21
  * [Configuration](#configuration)
22
22
  * [Conventions](#conventions)
23
+ * [Piping](#piping)
23
24
  * [Reference](#reference)
24
25
  * [Scenarios](#scenarios)
25
26
  * [Development](#development)
@@ -85,6 +86,29 @@ When bumping the version of an existing gem `gem-name` the following locations a
85
86
  * `lib/gem/name/version.rb`
86
87
  * `lib/gem-name/version.rb`
87
88
 
89
+ # Piping
90
+
91
+ Output depends on a `tty` being available or not. I.e. when run as an
92
+ individual command colorized human readable output will be printed (see the
93
+ Demo screencast above). When attached to a pipe then output is kept simple and
94
+ parsable.
95
+
96
+ E.g.:
97
+
98
+ ```
99
+ $ gem bump --pretend | cat
100
+ bump gem-release 1.0.0 1.0.1
101
+ git_add lib/gem/release/version.rb
102
+ git_commit "Bump gem-release to 1.0.1"
103
+ ```
104
+
105
+ This is useful, for example, for grabbing the next version number:
106
+
107
+ ```
108
+ $ gem bump --pretend --no-commit | awk '{ print $4 }'
109
+ 1.0.1
110
+ ```
111
+
88
112
 
89
113
  # Reference
90
114
 
@@ -3,8 +3,14 @@ module Gem
3
3
  Abort = Class.new(StandardError)
4
4
 
5
5
  STRATEGIES = {
6
- git: '`git ls-files app lib`.split("\n")',
7
- glob: "Dir.glob('{bin/*,lib/**/*,[A-Z]*}')"
6
+ git: {
7
+ files: '`git ls-files app lib`.split("\n")',
8
+ bin_files: '`git ls-files bin`.split("\n").map { |f| File.basename(f) }',
9
+ },
10
+ glob: {
11
+ files: "Dir.glob('{bin/*,lib/**/*,[A-Z]*}')",
12
+ bin_files: "Dir.glob('bin/*').map { |f| File.basename(f) }",
13
+ }
8
14
  }
9
15
  end
10
16
  end
@@ -60,6 +60,7 @@ module Gem
60
60
  DEFAULTS = {
61
61
  strategy: :glob,
62
62
  scaffold: true,
63
+ bin: false,
63
64
  git: true,
64
65
  github: false,
65
66
  push: false,
@@ -70,10 +71,11 @@ module Gem
70
71
  DESCR = {
71
72
  scaffold: 'Scaffold gem files',
72
73
  dir: 'Directory to place the gem in (defaults to the given name, or the current working dir)',
74
+ bin: 'Create an executable ./bin/[name], add executables directive to .gemspec',
73
75
  license: 'License(s) to add',
74
76
  template: 'Template groups to use for scaffolding',
75
77
  rspec: 'Use the rspec group (by default adds .rspec and spec/spec_helper.rb)',
76
- travis: 'Use the rspec group (by default adds .travis.yml)',
78
+ travis: 'Use the travis group (by default adds .travis.yml)',
77
79
  strategy: 'Strategy for collecting files [glob|git] in .gemspec',
78
80
  git: 'Initialize a git repo',
79
81
  github: 'Initialize a git repo, create on github',
@@ -89,6 +91,10 @@ module Gem
89
91
  opts[:dir] = value
90
92
  end
91
93
 
94
+ opt '--bin', descr(:bin) do
95
+ opts[:bin] = true
96
+ end
97
+
92
98
  opt '-t', '--template NAME', descr(:template) do |value|
93
99
  (opts[:templates] ||= []) << value
94
100
  end
@@ -170,10 +176,15 @@ module Gem
170
176
 
171
177
  def files
172
178
  files = Files::Templates.new(FILES, opts[:templates], data).all
179
+ files << executable if opts[:bin]
173
180
  files << license if opts[:license]
174
181
  files.compact
175
182
  end
176
183
 
184
+ def executable
185
+ Files::Templates.executable("bin/#{gem.name}")
186
+ end
187
+
177
188
  def license
178
189
  file = Files::Templates.license(opts[:license], data)
179
190
  warn :unknown_license, opts[:license] unless file
@@ -29,11 +29,16 @@ module Gem
29
29
  }
30
30
 
31
31
  DESCR = {
32
+ bin: 'Add bin files directive to the gemspec (defaults to true if a ./bin directory exists)',
32
33
  dir: 'Directory to place the gem in (defaults to the given name, or the current working dir)',
33
34
  license: 'License(s) to list in the gemspec',
34
35
  strategy: 'Strategy for collecting files [glob|git] in gemspec'
35
36
  }
36
37
 
38
+ opt '--[no]-bin', descr(:bin) do |value|
39
+ opts[:bin] = value
40
+ end
41
+
37
42
  opt '--dir DIR', descr(:dir) do |value|
38
43
  opts[:dir] = value
39
44
  end
@@ -18,7 +18,8 @@ module Gem
18
18
  licenses: licenses,
19
19
  summary: '[summary]',
20
20
  description: '[description]',
21
- files: files
21
+ files: files,
22
+ bin_files: bin_files
22
23
  }
23
24
  end
24
25
 
@@ -61,6 +62,14 @@ module Gem
61
62
  end
62
63
 
63
64
  def files
65
+ strategy[:files]
66
+ end
67
+
68
+ def bin_files
69
+ strategy[:bin_files] if opts.key?(:bin) ? opts[:bin] : File.directory?('./bin')
70
+ end
71
+
72
+ def strategy
64
73
  STRATEGIES[(opts[:strategy] || :glob).to_sym] || STRATEGIES[:glob]
65
74
  end
66
75
  end
@@ -13,12 +13,13 @@ module Gem
13
13
  'version.rb' => 'lib/%{gem_path}/version.rb'
14
14
  }
15
15
 
16
- attr_accessor :source, :target, :data
16
+ attr_accessor :source, :target, :data, :opts
17
17
 
18
- def initialize(source, target, data)
18
+ def initialize(source, target, data, opts)
19
19
  @source = source
20
20
  @target = (FILES[target] || target) % data
21
21
  @data = data
22
+ @opts = opts
22
23
  end
23
24
 
24
25
  PATH = File.expand_path('../..', __FILE__)
@@ -31,6 +32,7 @@ module Gem
31
32
  return false if exists?
32
33
  FileUtils.mkdir_p(File.dirname(target))
33
34
  File.write(target, render)
35
+ FileUtils.chmod('+x', target) if opts[:executable]
34
36
  true
35
37
  end
36
38
 
@@ -14,12 +14,24 @@ module Gem
14
14
  ['../../templates/%s', __FILE__],
15
15
  ]
16
16
 
17
+ EXECUTABLE = [
18
+ ['./.gem-release/executable'],
19
+ ['~/.gem-release/executable'],
20
+ ['../../templates/executable', __FILE__],
21
+ ]
22
+
17
23
  LICENSE = [
18
24
  ['./.gem-release/licenses'],
19
25
  ['~/.gem-release/licenses'],
20
26
  ['../../templates/licenses', __FILE__],
21
27
  ]
22
28
 
29
+ def self.executable(target)
30
+ file = Templates.new([".*"], [], {}).executable
31
+ file.target = target if file
32
+ file
33
+ end
34
+
23
35
  def self.license(name, data)
24
36
  file = Templates.new(["#{name}{,.*}"], [], data).license
25
37
  file.target = "LICENSE#{File.extname(file.target)}" if file
@@ -43,13 +55,17 @@ module Gem
43
55
  templates_for(CUSTOM, '**/*')
44
56
  end
45
57
 
58
+ def executable
59
+ templates_for(EXECUTABLE).first
60
+ end
61
+
46
62
  def license
47
63
  templates_for(LICENSE, files).first
48
64
  end
49
65
 
50
- def templates_for(sources, files)
66
+ def templates_for(sources, files = nil, opts = {})
51
67
  all = Group.new(groups, data, sources, files).all
52
- all.map { |source, target| Template.new(source, target, data) }
68
+ all.map { |source, target| Template.new(source, target, data, opts) }
53
69
  end
54
70
  end
55
71
  end
@@ -22,7 +22,9 @@ module Gem
22
22
  private
23
23
 
24
24
  def pattern
25
- "{#{paths.join(',')}}/{#{files.join(',')}}"
25
+ pattern = "{#{paths.join(',')}}"
26
+ pattern << "/{#{files.join(',')}}" if files.any?
27
+ pattern
26
28
  end
27
29
 
28
30
  def relative(file)
@@ -0,0 +1 @@
1
+ #!/usr/bin/env ruby
@@ -13,7 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.summary = '<%= summary %>'
14
14
  s.description = '<%= description %>'
15
15
 
16
- s.files = <%= files %>
16
+ s.files = <%= files %><% if bin_files %>
17
+ s.executables = <%= bin_files %>
18
+ <% end %>
17
19
  s.platform = Gem::Platform::RUBY
18
20
  s.require_paths = ['lib']
19
21
  end
@@ -1,5 +1,5 @@
1
1
  module Gem
2
2
  module Release
3
- VERSION = '2.0.0.rc.2'
3
+ VERSION = '2.0.0.rc.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.rc.2
4
+ version: 2.0.0.rc.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: 2018-03-18 00:00:00.000000000 Z
12
+ date: 2018-03-24 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 ...)
@@ -56,6 +56,7 @@ files:
56
56
  - lib/gem/release/support/registry.rb
57
57
  - lib/gem/release/templates/.gitignore
58
58
  - lib/gem/release/templates/Gemfile
59
+ - lib/gem/release/templates/executable
59
60
  - lib/gem/release/templates/gemspec
60
61
  - lib/gem/release/templates/licenses/mit.md
61
62
  - lib/gem/release/templates/licenses/mpl-2.md