bumper 0.0.1
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 +7 -0
- data/.gitignore +15 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +2 -0
- data/bin/bumper_pusher +5 -0
- data/bumper_pusher.gemspec +25 -0
- data/lib/bumper_pusher.rb +32 -0
- data/lib/bumper_pusher/bumper.rb +303 -0
- data/lib/bumper_pusher/parser.rb +55 -0
- data/lib/bumper_pusher/version.rb +3 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 55a3f57075539088c571390e8f53c4aa7ea42eb6
|
4
|
+
data.tar.gz: f0763048142dc65816ed8bc9d75e4ce1efa9e141
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6cdcde25eccad205fda8b0ef442a880e58005571b79ccc0c393da0d815b79da42ab10e1da92fe765a175b016d695278032d6f7e8fec2604cd9d308737063bbfb
|
7
|
+
data.tar.gz: 4e668a0a117f84a7345ea8af1d7812bb579478d55ad53a25493cae2ea4f5c16a009627723f651e9d6ead0da16b5bcb016c6c387b044c688f64d2449b1edc2d4b
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.1.4] (https://github.com/skywinder/bumper_pusher/tree/0.1.4)
|
4
|
+
#### 19/11/14
|
5
|
+
- *Merged pull-request:* Add check and warrning message, if you try to bump not from master branch [\#4](https://github.com/skywinder/bumper_pusher/pull/4) ([skywinder](https://github.com/skywinder))
|
6
|
+
|
7
|
+
- *Merged pull-request:* Remove confirmation for build for beta builds [\#3](https://github.com/skywinder/bumper_pusher/pull/3) ([skywinder](https://github.com/skywinder))
|
8
|
+
|
9
|
+
## [0.1.2] (https://github.com/skywinder/bumper_pusher/tree/0.1.2)
|
10
|
+
#### 19/11/14
|
11
|
+
- *Merged pull-request:* Install and remove gem after push [\#2](https://github.com/skywinder/bumper_pusher/pull/2) ([skywinder](https://github.com/skywinder))
|
12
|
+
|
13
|
+
- *Merged pull-request:* Don't generate changelog for beta build [\#1](https://github.com/skywinder/bumper_pusher/pull/1) ([skywinder](https://github.com/skywinder))
|
14
|
+
|
15
|
+
## [0.1.1] (https://github.com/skywinder/bumper_pusher/tree/0.1.1)
|
16
|
+
#### 18/11/14
|
17
|
+
## [0.1.0] (https://github.com/skywinder/bumper_pusher/tree/0.1.0)
|
18
|
+
#### 18/11/14
|
19
|
+
## [0.0.2] (https://github.com/skywinder/bumper_pusher/tree/0.0.2)
|
20
|
+
#### 14/11/14
|
21
|
+
|
22
|
+
|
23
|
+
\* *This changelog was generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Petr Korolev
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# BumperPusher
|
2
|
+
|
3
|
+
This gem make bumping and pushing your ruby gems easy and fast!
|
4
|
+
|
5
|
+
- Works with `gemspec` and `podspec` files
|
6
|
+
- Automatically detect your current version (from `spec` or `version.rb` file)
|
7
|
+
- Auto-bump spec
|
8
|
+
- Auto-push spec
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
[sudo] gem install bumper_pusher
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
- Just print: `bumper_pusher` and that's it!
|
15
|
+
- If you want to test, that all works as expected: try **dry_run** mode: `bumper_pusher --dry-run`
|
16
|
+
- To bump version print: `bumper_pusher [option]`
|
17
|
+
- `-r` for bump release (`1.2.3` -> `2.0.0`)
|
18
|
+
- `-m` for bump minor (`1.2.3` -> `1.3.0`)
|
19
|
+
- `-p` for bump patch (`1.2.3` -> `1.2.4`) **default option**
|
20
|
+
|
21
|
+
- To install locally your gemspec `bumper_pusher -b`
|
22
|
+
|
23
|
+
### Params
|
24
|
+
Usage: bumper_pusher [options]
|
25
|
+
-d, --dry-run Dry run
|
26
|
+
--release Bump release version
|
27
|
+
-m, --minor Bump minor version
|
28
|
+
-p, --patch Bump patch version
|
29
|
+
-r, --revert Revert last bump
|
30
|
+
-i, --[no-]install Install this gem after push it. Default is true.
|
31
|
+
-b, --beta Build beta gem without commit and push
|
32
|
+
-v, --version Print version number
|
33
|
+
-c, --[no]-changelog Auto generation of changelog and pushing it origin. Default is true
|
34
|
+
|
35
|
+
## Alternatives
|
36
|
+
- https://github.com/peritus/bumpversion
|
37
|
+
- https://github.com/vojtajina/grunt-bump
|
38
|
+
- https://github.com/gregorym/bump
|
39
|
+
- https://github.com/svenfuchs/gem-release
|
40
|
+
|
41
|
+
## Features & Benefits of this project
|
42
|
+
|
43
|
+
- **Very easy to use**: just print `bumper_pusher` in your repo folder.
|
44
|
+
- Support version storage directly in `gemspec` file and in `version.rb`
|
45
|
+
- Check that you're bumping from `master`. (otherwise print warning with confirmation)
|
46
|
+
- Check that your `git status` in clean
|
47
|
+
- Ability to build test gem easily `bumper_pusher -b`
|
48
|
+
- Ability to generate changelog for new version by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)
|
49
|
+
- Support both `gemspec` and `podspec` files
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it ( https://github.com/skywinder/bumper_pusher/fork )
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/bumper_pusher
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'bumper_pusher/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "bumper"
|
9
|
+
spec.version = BumperPusher::VERSION
|
10
|
+
spec.authors = ["Petr Korolev"]
|
11
|
+
spec.email = ["sky4winder@gmail.com"]
|
12
|
+
spec.summary = %q{Easiest way to bump your specs}
|
13
|
+
spec.description = %q{Bumping and pushing your ruby gems easy and fast!}
|
14
|
+
spec.homepage = ""
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_runtime_dependency(%q<colorize>, ["~> 0.7"])
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative 'bumper_pusher/version'
|
4
|
+
require_relative 'bumper_pusher/parser'
|
5
|
+
require_relative 'bumper_pusher/bumper'
|
6
|
+
|
7
|
+
module BumperPusher
|
8
|
+
|
9
|
+
class Pusher
|
10
|
+
attr_reader :options
|
11
|
+
def initialize
|
12
|
+
@options = BumperPusher::Parser.new.parse_options
|
13
|
+
@options.freeze
|
14
|
+
|
15
|
+
@parser = BumperPusher::Bumper.new(@options)
|
16
|
+
|
17
|
+
if @options[:revert]
|
18
|
+
@parser.revert_last_bump
|
19
|
+
else
|
20
|
+
@parser.run_bumping_script
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
if $0 == __FILE__
|
30
|
+
bumper = BumperPusher::Pusher.new
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,303 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
3
|
+
module BumperPusher
|
4
|
+
|
5
|
+
POD_SPEC_TYPE = 'podspec'
|
6
|
+
GEM_SPEC_TYPE = 'gemspec'
|
7
|
+
|
8
|
+
class Bumper
|
9
|
+
|
10
|
+
@spec_mode
|
11
|
+
|
12
|
+
def initialize(options)
|
13
|
+
@options = options
|
14
|
+
@spec_file = find_spec_file
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_repo_is_clean_or_dry_run
|
18
|
+
value =%x[#{'git status --porcelain'}]
|
19
|
+
|
20
|
+
if value.empty?
|
21
|
+
puts 'Repo is clean -> continue'
|
22
|
+
else
|
23
|
+
if @options[:dry_run]
|
24
|
+
puts 'Repo not clean, "Dry run" enabled -> continue'
|
25
|
+
else
|
26
|
+
if @options[:beta]
|
27
|
+
puts 'Repo not clean, "Beta build" enabled -> continue'
|
28
|
+
else
|
29
|
+
puts 'Repository not clean -> exit'
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
current_branch = `git rev-parse --abbrev-ref HEAD`.strip!
|
36
|
+
if current_branch != 'master'
|
37
|
+
puts "Warning: You're not in 'master' branch (#{current_branch})!".yellow
|
38
|
+
ask_sure_Y
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def find_spec_file
|
44
|
+
|
45
|
+
pod_arr = execute_line("find . -name '*.#{POD_SPEC_TYPE}'").split("\n")
|
46
|
+
gem_arr = execute_line("find . -name '*.#{GEM_SPEC_TYPE}'").split("\n")
|
47
|
+
if gem_arr.any? && pod_arr.any?
|
48
|
+
puts 'Warning: both podspec and gemspec found!'.yellow
|
49
|
+
end
|
50
|
+
all_specs = gem_arr | pod_arr
|
51
|
+
|
52
|
+
spec_file = ''
|
53
|
+
|
54
|
+
case all_specs.count
|
55
|
+
when 0
|
56
|
+
puts 'No spec files found. -> Exit.'
|
57
|
+
exit
|
58
|
+
when 1
|
59
|
+
spec_file = all_specs[0]
|
60
|
+
else
|
61
|
+
puts 'Which spec should be used?'
|
62
|
+
all_specs.each_with_index { |file, index| puts "#{index+1}. #{file}" }
|
63
|
+
input_index = Integer(gets.chomp)
|
64
|
+
spec_file = all_specs[input_index-1]
|
65
|
+
end
|
66
|
+
|
67
|
+
if spec_file == nil
|
68
|
+
puts "Can't find specified spec file -> exit"
|
69
|
+
exit
|
70
|
+
end
|
71
|
+
|
72
|
+
if gem_arr.include?(spec_file)
|
73
|
+
@spec_mode = GEM_SPEC_TYPE
|
74
|
+
else
|
75
|
+
if pod_arr.include?(spec_file)
|
76
|
+
@spec_mode = POD_SPEC_TYPE
|
77
|
+
else
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
spec_file.sub('./', '')
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
def find_current_gem_file
|
88
|
+
list_of_specs = execute_line("find . -name '*.gem'")
|
89
|
+
arr = list_of_specs.split("\n")
|
90
|
+
|
91
|
+
spec_file = ''
|
92
|
+
|
93
|
+
case arr.count
|
94
|
+
when 0
|
95
|
+
if @options[:dry_run]
|
96
|
+
return "test.#{POD_SPEC_TYPE}"
|
97
|
+
end
|
98
|
+
puts "No #{POD_SPEC_TYPE} files found. -> Exit."
|
99
|
+
exit
|
100
|
+
when 1
|
101
|
+
spec_file = arr[0]
|
102
|
+
else
|
103
|
+
puts 'Which spec should be used?'
|
104
|
+
arr.each_with_index { |file, index| puts "#{index+1}. #{file}" }
|
105
|
+
input_index = Integer(gets.chomp)
|
106
|
+
spec_file = arr[input_index-1]
|
107
|
+
end
|
108
|
+
|
109
|
+
if spec_file == nil
|
110
|
+
puts "Can't find specified spec file -> exit"
|
111
|
+
exit
|
112
|
+
end
|
113
|
+
|
114
|
+
spec_file.sub('./', '')
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
def find_version_in_file(podspec)
|
119
|
+
readme = File.read(podspec)
|
120
|
+
|
121
|
+
#try to find version in format 1.22.333
|
122
|
+
re = /(\d+)\.(\d+)\.(\d+)/m
|
123
|
+
|
124
|
+
match_result = re.match(readme)
|
125
|
+
|
126
|
+
unless match_result
|
127
|
+
puts 'Not found any versions'
|
128
|
+
exit
|
129
|
+
end
|
130
|
+
|
131
|
+
puts "Found version #{match_result[0]}"
|
132
|
+
return match_result[0], match_result.captures
|
133
|
+
end
|
134
|
+
|
135
|
+
def bump_version(versions_array)
|
136
|
+
bumped_result = versions_array.dup
|
137
|
+
bumped_result.map! { |x| x.to_i }
|
138
|
+
|
139
|
+
if @options[:beta]
|
140
|
+
bumped_version = versions_array.join('.') + '.1'
|
141
|
+
else
|
142
|
+
case @options[:bump_number]
|
143
|
+
when :major
|
144
|
+
bumped_result[0] += 1
|
145
|
+
bumped_result[1] = 0
|
146
|
+
bumped_result[2] = 0
|
147
|
+
when :minor
|
148
|
+
bumped_result[1] += 1
|
149
|
+
bumped_result[2] = 0
|
150
|
+
when :patch
|
151
|
+
bumped_result[2] += 1
|
152
|
+
else
|
153
|
+
raise('unknown bump_number')
|
154
|
+
end
|
155
|
+
bumped_version = bumped_result.join('.')
|
156
|
+
end
|
157
|
+
|
158
|
+
puts "Bump version: #{versions_array.join('.')} -> #{bumped_version}"
|
159
|
+
|
160
|
+
unless @options[:dry_run] || @options[:beta]
|
161
|
+
ask_sure_Y
|
162
|
+
end
|
163
|
+
|
164
|
+
bumped_version
|
165
|
+
end
|
166
|
+
|
167
|
+
def ask_sure_Y
|
168
|
+
puts 'Are you sure? Press Y to continue:'
|
169
|
+
str = gets.chomp
|
170
|
+
if str != 'Y'
|
171
|
+
puts '-> exit'
|
172
|
+
exit
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def execute_line(line)
|
177
|
+
output = `#{line}`
|
178
|
+
check_exit_status(output)
|
179
|
+
|
180
|
+
output
|
181
|
+
end
|
182
|
+
|
183
|
+
def execute_line_if_not_dry_run(line)
|
184
|
+
if @options[:dry_run]
|
185
|
+
puts "Dry run: #{line}"
|
186
|
+
nil
|
187
|
+
else
|
188
|
+
puts line
|
189
|
+
value = %x[#{line}]
|
190
|
+
puts value
|
191
|
+
check_exit_status(value)
|
192
|
+
value
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def check_exit_status(output)
|
197
|
+
if $?.exitstatus != 0
|
198
|
+
puts "Output:\n#{output}\nExit status = #{$?.exitstatus} ->Terminate script."
|
199
|
+
exit
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def run_bumping_script
|
204
|
+
|
205
|
+
check_repo_is_clean_or_dry_run
|
206
|
+
|
207
|
+
version_file = find_version_file
|
208
|
+
result, versions_array = find_version_in_file(version_file)
|
209
|
+
bumped_version = bump_version(versions_array)
|
210
|
+
|
211
|
+
if @options[:bump]
|
212
|
+
execute_line_if_not_dry_run("sed -i \"\" \"s/#{result}/#{bumped_version}/\" README.md")
|
213
|
+
execute_line_if_not_dry_run("sed -i \"\" \"s/#{result}/#{bumped_version}/\" #{version_file}")
|
214
|
+
end
|
215
|
+
|
216
|
+
if @options[:commit]
|
217
|
+
execute_line_if_not_dry_run("git commit --all -m \"Update #{@spec_mode} to version #{bumped_version}\"")
|
218
|
+
execute_line_if_not_dry_run("git tag #{bumped_version}")
|
219
|
+
end
|
220
|
+
|
221
|
+
if @options[:push]
|
222
|
+
execute_line_if_not_dry_run('git push')
|
223
|
+
execute_line_if_not_dry_run('git push --tags')
|
224
|
+
end
|
225
|
+
|
226
|
+
if @options[:push]
|
227
|
+
if @spec_mode == POD_SPEC_TYPE
|
228
|
+
execute_line_if_not_dry_run("pod trunk push #{@spec_file}")
|
229
|
+
else
|
230
|
+
if @spec_mode == GEM_SPEC_TYPE
|
231
|
+
execute_line_if_not_dry_run("gem build #{@spec_file}")
|
232
|
+
gem = find_current_gem_file
|
233
|
+
execute_line_if_not_dry_run("gem push #{gem}")
|
234
|
+
|
235
|
+
if @options[:install]
|
236
|
+
execute_line_if_not_dry_run("gem install #{gem}")
|
237
|
+
end
|
238
|
+
|
239
|
+
execute_line_if_not_dry_run("rm #{gem}")
|
240
|
+
else
|
241
|
+
raise 'Unknown spec type'
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
if @options[:beta]
|
247
|
+
if @spec_mode == GEM_SPEC_TYPE
|
248
|
+
execute_line_if_not_dry_run("gem build #{@spec_file}")
|
249
|
+
gem = find_current_gem_file
|
250
|
+
execute_line_if_not_dry_run("gem install #{gem}")
|
251
|
+
|
252
|
+
execute_line_if_not_dry_run("sed -i \"\" \"s/#{bumped_version}/#{result}/\" README.md")
|
253
|
+
execute_line_if_not_dry_run("sed -i \"\" \"s/#{bumped_version}/#{result}/\" #{version_file}")
|
254
|
+
execute_line_if_not_dry_run("rm #{gem}")
|
255
|
+
else
|
256
|
+
raise 'Unknown spec type'
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
|
261
|
+
if @options[:changelog] && !@options[:beta]
|
262
|
+
if `which github_changelog_generator`.empty?
|
263
|
+
puts 'Cancelled bumping: no github_changelog_generator gem found'
|
264
|
+
else
|
265
|
+
execute_line_if_not_dry_run('github_changelog_generator')
|
266
|
+
execute_line_if_not_dry_run("git commit CHANGELOG.md -m \"Update changelog for version #{bumped_version}\"")
|
267
|
+
execute_line_if_not_dry_run('git push')
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
272
|
+
|
273
|
+
def find_version_file
|
274
|
+
version_file = nil
|
275
|
+
arr = `find . -name 'version.rb'`.split("\n")
|
276
|
+
case arr.count
|
277
|
+
when 0
|
278
|
+
puts "version.rb file found (#{arr[0]}) -> bump this file"
|
279
|
+
when 1
|
280
|
+
version_file = arr[0]
|
281
|
+
else
|
282
|
+
puts 'More than 1 version.rb file found. -> skip'
|
283
|
+
end
|
284
|
+
|
285
|
+
version_file ? version_file.sub('./', '') : @spec_file
|
286
|
+
end
|
287
|
+
|
288
|
+
def revert_last_bump
|
289
|
+
spec_file = @spec_file
|
290
|
+
result, _ = find_version_in_file(spec_file)
|
291
|
+
|
292
|
+
puts "DELETE tag #{result} and HARD reset HEAD~1?\nPress Y to continue:"
|
293
|
+
str = gets.chomp
|
294
|
+
if str != 'Y'
|
295
|
+
puts '-> exit'
|
296
|
+
exit
|
297
|
+
end
|
298
|
+
execute_line_if_not_dry_run("git tag -d #{result}")
|
299
|
+
execute_line_if_not_dry_run('git reset --hard HEAD~1')
|
300
|
+
execute_line_if_not_dry_run("git push --delete origin #{result}")
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
module BumperPusher
|
5
|
+
|
6
|
+
class Parser
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
def parse_options
|
13
|
+
options = {:dry_run => false, :bump_number => :patch, :changelog => true, :bump => true, :commit => true, :build => true, :push => true, :install => true}
|
14
|
+
|
15
|
+
OptionParser.new { |opts|
|
16
|
+
opts.banner = 'Usage: bumper_pusher [options]'
|
17
|
+
|
18
|
+
opts.on('-d', '--dry-run', 'Dry run') do |v|
|
19
|
+
options[:dry_run] = v
|
20
|
+
end
|
21
|
+
opts.on('-r', '--release', 'Bump release version') do |v|
|
22
|
+
options[:bump_number] = :major
|
23
|
+
end
|
24
|
+
opts.on('-m', '--minor', 'Bump minor version') do |v|
|
25
|
+
options[:bump_number] = :minor
|
26
|
+
end
|
27
|
+
opts.on('-p', '--patch', 'Bump patch version') do |v|
|
28
|
+
options[:bump_number] = :patch
|
29
|
+
end
|
30
|
+
opts.on('-r', '--revert', 'Revert last bump') do |v|
|
31
|
+
options[:revert] = v
|
32
|
+
end
|
33
|
+
opts.on('-i', '--[no-]install', 'Install this gem after push it. Default is true.') do |v|
|
34
|
+
options[:install] = v
|
35
|
+
end
|
36
|
+
opts.on('-b', '--beta', 'Build beta gem without commit and push') do |v|
|
37
|
+
options[:beta] = v
|
38
|
+
options[:bump] = v
|
39
|
+
options[:build] = v
|
40
|
+
options[:commit] = !v
|
41
|
+
options[:push] = !v
|
42
|
+
|
43
|
+
end
|
44
|
+
opts.on('-v', '--version', 'Print version number') do |v|
|
45
|
+
puts "Version: #{BumperPusher::VERSION}"
|
46
|
+
exit
|
47
|
+
end
|
48
|
+
opts.on('-c', '--[no]-changelog', 'Auto generation of changelog and pushing it origin. Default is true') do |v|
|
49
|
+
options[:changelog] = v
|
50
|
+
end
|
51
|
+
}.parse!
|
52
|
+
options
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bumper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Petr Korolev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.7'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.7'
|
55
|
+
description: Bumping and pushing your ruby gems easy and fast!
|
56
|
+
email:
|
57
|
+
- sky4winder@gmail.com
|
58
|
+
executables:
|
59
|
+
- bumper_pusher
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- CHANGELOG.md
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/bumper_pusher
|
70
|
+
- bumper_pusher.gemspec
|
71
|
+
- lib/bumper_pusher.rb
|
72
|
+
- lib/bumper_pusher/bumper.rb
|
73
|
+
- lib/bumper_pusher/parser.rb
|
74
|
+
- lib/bumper_pusher/version.rb
|
75
|
+
homepage: ''
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.4.4
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Easiest way to bump your specs
|
99
|
+
test_files: []
|