-
Notifications
You must be signed in to change notification settings - Fork 58
/
README.md.erb
182 lines (125 loc) · 4.8 KB
/
README.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# gem release
This gem plugin aims at making gem development easier by automating repetitive work based on conventions, configuration, and templates.
It adds the commands `bootstrap`, `gemspec`, `bump`, `tag` and a `release` to the rubygems `gem` command.
| Project | Gem Release |
| ---------------------- | ------------ |
| Gem name | gem-release |
| License | [MIT](https://github.com/svenfuchs/gem-release/blob/master/LICENSE.md) |
| Version | [![Gem Version](https://img.shields.io/gem/v/gem-release.svg?style=flat-square)](https://badge.fury.io/rb/gem-release) |
| Continuous integration | [![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/svenfuchs/gem-release/tests.yaml?branch=master&style=flat-square)](https://github.com/svenfuchs/gem-release/actions/workflows/tests.yaml) |
| Test coverage | [![Coverage Status](https://img.shields.io/coveralls/svenfuchs/gem-release.svg?style=flat-square)](https://coveralls.io/r/svenfuchs/gem-release) |
| Documentation | [Documentation](https://www.rubydoc.info/gems/gem-release) |
| Credits | [Contributors](https://github.com/svenfuchs/gem-release/graphs/contributors) |
# Table of contents
* [Demo](#demo)
* [Installation](#installation)
* [Configuration](#configuration)
* [Conventions](#conventions)
* [Piping](#piping)
* [Reference](#reference)
* [Scenarios](#scenarios)
* [Development](#development)
# Demo
This gif demos some of the things you can do with this plugin:
![gem-release-demo](https://cloud.githubusercontent.com/assets/2208/25634571/68b78080-2f7b-11e7-9eb2-c7d1df13c727.gif)
## Installation
The gem provides a rubygems plugin, so it's just:
```
gem install gem-release
```
# Configuration
Defaults for all options can be specified in a config file at either one of
these locations:
* `~/.gem_release/config.yml`
* `~/.gem_release.yml`
* `./.gem_release/config.yml`
* `./.gem_release.yml`
Config files must be in the [YAML](http://www.yaml.org/) format, and list
options per command. Common options can be set on the root.
For instance, the following entries will set the `quiet` flag for all commands,
and a custom host name with `gem release`:
```yaml
quiet: true
release:
host: https://example.com
```
Defaults for all options also can be specified as environment variables, for
example `GEM_RELEASE_PRETEND=true`.
Defaults specified in config files and environment variables can be overridden
as command line options when issuing the respective `gem` command.
Only the first config file found in the locations given above will be used, if
any, and defaults from this config file will be merged with both environment
variables and given command line options.
# Conventions
When bootstrapping a new gem:
* A gem name `gem_name` is left untouched when mapped to the path `lib/gem_name`, and the Ruby constant name `GemName`.
* A gem name `gem-name` is mapped to the path `lib/gem/name`, and the Ruby constant name `Gem::Name`
When bumping the version of an existing gem `gem-name` the following locations are checked:
* `lib/gem/name/version.rb`
* `lib/gem-name/version.rb`
# Piping
Output depends on a `tty` being available or not. I.e. when run as an
individual command colorized human readable output will be printed (see the
Demo screencast above). When attached to a pipe then output is kept simple and
parsable.
E.g.:
```
$ gem bump --pretend | cat
bump gem-release 1.0.0 1.0.1
git_add lib/gem/release/version.rb
git_commit "Bump gem-release to 1.0.1"
```
This is useful, for example, for grabbing the next version number:
```
$ gem bump --pretend --no-commit | awk '{ print $4 }'
1.0.1
```
# Reference
The gem `gem-release` adds the following commands to the rubygems `gem` command:
<% cmds.each do |name, help| -%>
* [gem <%= name %>](#gem-<%= name %>) - <%= help[:summary] %>
<% end -%>
<% cmds.each do |name, help| -%>
## gem <%= name %>
<%= help[:summary] %>
<% if help[:arguments] -%>
### Arguments
```
<%= help[:arguments] %>
```
<% end -%>
<% if help[:options] -%>
### Options
```
<%= help[:options] %>
```
<% end -%>
<% if help[:description] -%>
### Description
<%= help[:description] %>
<% end -%>
<% end -%>
# Scenarios
<% scenarios.each do |scenario| -%>
* [<%= scenario[:title] %>](#<%= scenario[:id] %>)
<% end -%>
<% scenarios.each do |scenario| -%>
<%= scenario[:text] %>
<% end -%>
# Development
Running tests:
```
bundle install
bundle exec rspec
```
Testing commands against a [Geminabox](https://github.com/geminabox/geminabox) instance:
```
# start geminabox
bundle install
bundle exec rackup
# workaround rubygems issue with a missing key
# see https://github.com/geminabox/geminabox/issues/153
echo ':localhost: none' >> ~/.gem/credentials
# test release
bundle exec gem release --host=http://localhost:9292 --key localhost
```