bumper_pusher 0.1.19 → 0.2.0

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: 0a9c5cd1665ac64509ae6bbf4b100fb27b849f4e
4
- data.tar.gz: f9485c660084ebf25899dd2882437a2b8f47646b
3
+ metadata.gz: 6dc5d4fcc685a0acc2de47503b2b698495e597b3
4
+ data.tar.gz: f9247122e1c0a2f5f5eb91e786704680ce85f883
5
5
  SHA512:
6
- metadata.gz: e4752e488a17bba0be91d952128286195d29c056250ac747528db9201206ae279631f7ad73df5e67024ccdf2cf26add89fcb8f600273ae2172124a761f2f0772
7
- data.tar.gz: fcac06d720762eed85d7787331ffb22e32fb1c597793c53c5d09418f9d407c6dea9a083572a73e202e6b068cb97c3465d4ca9ed382f20f22492a63c18ea7f311
6
+ metadata.gz: c8893da349684ec06a7fc39299e892416d94d067b59af8f9733b97bbc004beaa3a7e4718d11254e48dfac6561072ff1957df71e4a5535ee0d61946eef9584290
7
+ data.tar.gz: ccc1b36afc38b2a3dc87e5c1664d9d38676c83a89512adc6d94c34bcf53e0e6bc88df49c7d44ebe9c3136ebf28be186ae133f0901823f1c394ef7de74f161d6b
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Metrics/LineLength:
4
+ Enabled: false
5
+
6
+ #http://viget.com/extend/just-use-double-quoted-ruby-strings
7
+ Style/StringLiterals:
8
+ EnforcedStyle: double_quotes
9
+
data/.rubocop_todo.yml ADDED
File without changes
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  # Specify your gem's dependencies in bumper_pusher.gemspec
3
3
  gemspec
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- task default: %w[test]
1
+ task default: %w(test)
2
2
 
3
3
  task :test do
4
4
  end
data/bin/bumper_pusher CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'bumper_pusher'
3
+ require "bumper_pusher"
4
4
 
5
5
  BumperPusher::Pusher.new
@@ -1,17 +1,17 @@
1
1
  # coding: utf-8
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path("../lib", __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'bumper_pusher/version'
5
+ require "bumper_pusher/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "bumper_pusher"
9
9
  spec.version = BumperPusher::VERSION
10
10
  spec.authors = ["Petr Korolev"]
11
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 = %q{https://github.com/skywinder/bumper_pusher}
12
+ spec.summary = "Easiest way to bump your specs"
13
+ spec.description = "Bumping and pushing your ruby gems easy and fast!"
14
+ spec.homepage = "https://github.com/skywinder/bumper_pusher"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0")
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "bundler", "~> 1.7"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
 
25
- spec.add_runtime_dependency(%q<colorize>, ["~> 0.7"])
26
- spec.add_runtime_dependency(%q<github_changelog_generator>, ">= 1.2", "< 5.0")
25
+ spec.add_runtime_dependency("colorize", ["~> 0.7"])
26
+ spec.add_runtime_dependency("github_changelog_generator", ">= 1.2", "< 5.0")
27
27
  end
@@ -1,13 +1,11 @@
1
- require 'colorize'
1
+ require "colorize"
2
2
  require "readline"
3
- require 'open3'
3
+ require "open3"
4
4
  module BumperPusher
5
-
6
- POD_SPEC_TYPE = 'podspec'
7
- GEM_SPEC_TYPE = 'gemspec'
5
+ POD_SPEC_TYPE = "podspec"
6
+ GEM_SPEC_TYPE = "gemspec"
8
7
 
9
8
  class Bumper
10
-
11
9
  @spec_mode
12
10
 
13
11
  def initialize(options)
@@ -16,10 +14,10 @@ module BumperPusher
16
14
  end
17
15
 
18
16
  def check_repo_is_clean_or_dry_run
19
- value =%x[#{'git status --porcelain'}]
17
+ value = `#{"git status --porcelain"}`
20
18
 
21
19
  if value.empty?
22
- puts 'Repo is clean -> continue'
20
+ puts "Repo is clean -> continue"
23
21
  else
24
22
  if @options[:dry_run]
25
23
  puts 'Repo not clean, "Dry run" enabled -> continue'
@@ -27,7 +25,7 @@ module BumperPusher
27
25
  if @options[:beta]
28
26
  puts 'Repo not clean, "Beta build" enabled -> continue'
29
27
  else
30
- puts 'Repository not clean -> exit'
28
+ puts "Repository not clean -> exit"
31
29
  exit
32
30
  end
33
31
  end
@@ -39,13 +37,13 @@ module BumperPusher
39
37
 
40
38
  if is_git_flow_installed
41
39
  # supposed, that with git flow you should release from develop branch
42
- if current_branch != 'develop' && !is_branch_hotfix?
40
+ if current_branch != "develop" && !is_branch_hotfix?
43
41
  puts "Warning: You're in branch (#{current_branch})!".yellow
44
42
  ask_sure_y
45
43
  end
46
44
  else
47
45
  # supposed, that w/o git flow you should release from master or release branch
48
- if current_branch != 'master' || !/release/.match(current_branch)[0].nil?
46
+ if current_branch != "master" || !/release/.match(current_branch)[0].nil?
49
47
  puts "Warning: You're in branch (#{current_branch})!".yellow
50
48
  ask_sure_y
51
49
  end
@@ -58,23 +56,21 @@ module BumperPusher
58
56
  `git rev-parse --abbrev-ref HEAD`.strip!
59
57
  end
60
58
 
61
-
62
59
  def find_spec_file
63
-
64
60
  pod_arr = execute_line("find . -name '*.#{POD_SPEC_TYPE}' -maxdepth 1").split("\n")
65
61
  gem_arr = execute_line("find . -name '*.#{GEM_SPEC_TYPE}' -maxdepth 1").split("\n")
66
62
  if gem_arr.any? && pod_arr.any?
67
- puts 'Warning: both podspec and gemspec found!'.yellow
63
+ puts "Warning: both podspec and gemspec found!".yellow
68
64
  end
69
65
  all_specs = gem_arr | pod_arr
70
66
 
71
- spec_file = ''
67
+ spec_file = ""
72
68
 
73
69
  case all_specs.count
74
70
  when 0
75
- puts 'No spec files found. -> Exit.'
71
+ puts "No spec files found. -> Exit."
76
72
  if is_debug?
77
- puts 'Debug -> set @spec_mode to gem -> continue'
73
+ puts "Debug -> set @spec_mode to gem -> continue"
78
74
  @spec_mode = GEM_SPEC_TYPE
79
75
  else
80
76
  exit
@@ -82,13 +78,13 @@ module BumperPusher
82
78
  when 1
83
79
  spec_file = all_specs[0]
84
80
  else
85
- puts 'Which spec should be used?'
86
- all_specs.each_with_index { |file, index| puts "#{index+1}. #{file}" }
81
+ puts "Which spec should be used?"
82
+ all_specs.each_with_index { |file, index| puts "#{index + 1}. #{file}" }
87
83
  input_index = Integer(gets.chomp)
88
- spec_file = all_specs[input_index-1]
84
+ spec_file = all_specs[input_index - 1]
89
85
  end
90
86
 
91
- if spec_file == nil
87
+ if spec_file.nil?
92
88
  puts "Can't find specified spec file -> exit"
93
89
  exit
94
90
  end
@@ -96,76 +92,68 @@ module BumperPusher
96
92
  if gem_arr.include?(spec_file)
97
93
  @spec_mode = GEM_SPEC_TYPE
98
94
  else
99
- if pod_arr.include?(spec_file)
100
- @spec_mode = POD_SPEC_TYPE
101
- else
102
-
103
- end
95
+ @spec_mode = POD_SPEC_TYPE if pod_arr.include?(spec_file)
104
96
 
105
97
  end
106
98
 
107
- spec_file.sub('./', '')
108
-
99
+ spec_file.sub("./", "")
109
100
  end
110
101
 
111
102
  def is_debug?
112
- (ENV['RUBYLIB'] =~ /ruby-debug-ide/) ? true : false
103
+ (ENV["RUBYLIB"] =~ /ruby-debug-ide/) ? true : false
113
104
  end
114
105
 
115
106
  def find_current_gem_file
116
107
  list_of_specs = execute_line("find . -name '*.gem' -maxdepth 1")
117
108
  arr = list_of_specs.split("\n")
118
109
 
119
- spec_file = ''
110
+ spec_file = ""
120
111
 
121
112
  case arr.count
122
113
  when 0
123
- if @options[:dry_run]
124
- return "test.#{POD_SPEC_TYPE}"
125
- end
114
+ return "test.#{POD_SPEC_TYPE}" if @options[:dry_run]
126
115
  puts "No #{POD_SPEC_TYPE} files found. -> Exit."
127
116
  exit
128
117
  when 1
129
118
  spec_file = arr[0]
130
119
  else
131
- puts 'Which spec should be used?'
132
- arr.each_with_index { |file, index| puts "#{index+1}. #{file}" }
120
+ puts "Which spec should be used?"
121
+ arr.each_with_index { |file, index| puts "#{index + 1}. #{file}" }
133
122
  input_index = Integer(gets.chomp)
134
- spec_file = arr[input_index-1]
123
+ spec_file = arr[input_index - 1]
135
124
  end
136
125
 
137
- if spec_file == nil
126
+ if spec_file.nil?
138
127
  puts "Can't find specified spec file -> exit"
139
128
  exit
140
129
  end
141
130
 
142
- spec_file.sub('./', '')
143
-
131
+ spec_file.sub("./", "")
144
132
  end
145
133
 
146
134
  def find_version_in_file(podspec)
147
135
  readme = File.read(podspec)
148
136
 
149
- #try to find version in format 1.22.333
137
+ # try to find version in format 1.22.333
150
138
  re = /(\d+)\.(\d+)\.(\d+)/m
151
139
 
152
140
  match_result = re.match(readme)
153
141
 
154
142
  unless match_result
155
- puts 'Not found any versions'
143
+ puts "Not found any versions"
156
144
  exit
157
145
  end
158
146
 
159
147
  puts "Found version #{match_result[0]}"
160
- return match_result[0], match_result.captures
148
+ [match_result[0], match_result.captures]
161
149
  end
162
150
 
163
151
  def bump_version(versions_array)
164
152
  bumped_result = versions_array.dup
165
- bumped_result.map! { |x| x.to_i }
153
+ bumped_result.map!(&:to_i)
166
154
 
167
155
  if @options[:beta]
168
- bumped_version = versions_array.join('.') + '.1'
156
+ bumped_version = versions_array.join(".") + ".1"
169
157
  else
170
158
  case @options[:bump_number]
171
159
  when :major
@@ -178,26 +166,24 @@ module BumperPusher
178
166
  when :patch
179
167
  bumped_result[2] += 1
180
168
  else
181
- raise('unknown bump_number')
169
+ fail("unknown bump_number")
182
170
  end
183
- bumped_version = bumped_result.join('.')
171
+ bumped_version = bumped_result.join(".")
184
172
  end
185
173
 
186
174
  puts "Bump version: #{versions_array.join('.')} -> #{bumped_version}"
187
175
 
188
- unless @options[:dry_run] || @options[:beta]
189
- ask_sure_y
190
- end
176
+ ask_sure_y unless @options[:dry_run] || @options[:beta]
191
177
 
192
178
  bumped_version
193
179
  end
194
180
 
195
181
  def ask_sure_y
196
182
  unless @options[:dry_run]
197
- puts 'Are you sure? Press Y to continue:'
183
+ puts "Are you sure? Press Y to continue:"
198
184
  str = gets.chomp
199
- if str != 'Y'
200
- puts '-> exit'
185
+ if str != "Y"
186
+ puts "-> exit"
201
187
  exit
202
188
  end
203
189
  end
@@ -210,15 +196,15 @@ module BumperPusher
210
196
  output
211
197
  end
212
198
 
213
- # @param [Object] line
214
- # @param [Object] check_exit
199
+ # @param [Object] line
200
+ # @param [Object] check_exit
215
201
  def execute_line_if_not_dry_run(line, check_exit = true)
216
202
  if @options[:dry_run]
217
203
  puts "Dry run: #{line}"
218
204
  check_exit ? nil : 0
219
205
  else
220
206
  puts line
221
- value = %x[#{line}]
207
+ value = `#{line}`
222
208
  if check_exit
223
209
  puts value
224
210
  check_exit_status(value)
@@ -236,25 +222,25 @@ module BumperPusher
236
222
  else
237
223
  Open3.popen3(cmd) do |i, o, e, th|
238
224
  Thread.new {
239
- until i.closed? do
240
- input =Readline.readline("", true).strip
225
+ until i.closed?
226
+ input = Readline.readline("", true).strip
241
227
  i.puts input
242
228
  end
243
229
  }
244
230
 
245
231
  t_err = Thread.new {
246
- until e.eof? do
247
- putc e.readchar
248
- end
232
+ putc e.readchar until e.eof?
249
233
  }
250
234
 
251
235
  t_out = Thread.new {
252
- until o.eof? do
253
- putc o.readchar
254
- end
236
+ putc o.readchar until o.eof?
255
237
  }
256
238
 
257
- Process::waitpid(th.pid) rescue nil
239
+ begin
240
+ Process.waitpid(th.pid)
241
+ rescue
242
+ nil
243
+ end
258
244
  # "rescue nil" is there in case process already ended.
259
245
 
260
246
  t_err.join
@@ -263,7 +249,6 @@ module BumperPusher
263
249
  end
264
250
  end
265
251
 
266
-
267
252
  def check_exit_status(output)
268
253
  if $?.exitstatus != 0
269
254
  puts "Output:\n#{output}\nExit status = #{$?.exitstatus} ->Terminate script."
@@ -272,26 +257,22 @@ module BumperPusher
272
257
  end
273
258
 
274
259
  def run_bumping_script
275
-
276
260
  check_repo_is_clean_or_dry_run
277
261
 
278
262
  unless @options[:beta]
279
- unless is_branch_hotfix?
280
- execute_line_if_not_dry_run('git pull')
281
- end
263
+ execute_line_if_not_dry_run("git pull") unless is_branch_hotfix?
282
264
  current_branch = get_current_branch
283
265
  execute_line_if_not_dry_run("git checkout master && git pull && git checkout #{current_branch}")
284
- execute_line_if_not_dry_run('git pull --all')
285
- execute_line_if_not_dry_run('git push --all')
266
+ execute_line_if_not_dry_run("git pull --all")
267
+ execute_line_if_not_dry_run("git push --all")
286
268
  end
287
269
 
288
270
  version_file = find_version_file
289
271
  result, versions_array = find_version_in_file(version_file)
290
272
  bumped_version = bump_version(versions_array)
291
273
 
292
-
293
274
  unless @options[:beta]
294
- execute_line_if_not_dry_run('git push --all')
275
+ execute_line_if_not_dry_run("git push --all")
295
276
  if is_git_flow_installed && !is_branch_hotfix?
296
277
  execute_line_if_not_dry_run("git flow release start #{bumped_version}")
297
278
  end
@@ -302,12 +283,20 @@ module BumperPusher
302
283
  execute_line_if_not_dry_run("sed -i \"\" \"s/#{result}/#{bumped_version}/\" #{version_file}")
303
284
  end
304
285
 
286
+ gem = find_current_gem_file
287
+ execute_line_if_not_dry_run("gem build #{@spec_file}")
288
+ if @options[:install]
289
+ if @spec_mode == GEM_SPEC_TYPE
290
+ execute_line_if_not_dry_run("gem install #{gem}")
291
+ end
292
+ end
293
+
305
294
  if @options[:commit]
306
295
  execute_line_if_not_dry_run("git commit --all -m \"Update #{@spec_mode} to version #{bumped_version}\"")
307
296
 
308
297
  if is_git_flow_installed
309
298
  if is_branch_hotfix?
310
- branch_split = get_current_branch.split('/').last
299
+ branch_split = get_current_branch.split("/").last
311
300
  unless execute_line_if_not_dry_run("git flow hotfix finish -n #{branch_split}", check_exit = false) == 0
312
301
  ask_to_merge
313
302
  execute_line_if_not_dry_run("git flow hotfix finish -n #{branch_split}")
@@ -318,32 +307,25 @@ module BumperPusher
318
307
  execute_line_if_not_dry_run("git flow release finish -n #{bumped_version}")
319
308
  end
320
309
  end
321
- execute_line_if_not_dry_run('git checkout master')
310
+ execute_line_if_not_dry_run("git checkout master")
322
311
  end
323
- execute_line_if_not_dry_run('git push --all')
312
+ execute_line_if_not_dry_run("git push --all")
324
313
  execute_line_if_not_dry_run("git tag #{bumped_version}")
325
314
  end
326
315
 
327
316
  if @options[:push]
328
- execute_line_if_not_dry_run('git push --all')
329
- execute_line_if_not_dry_run('git push --tags')
330
-
317
+ execute_line_if_not_dry_run("git push --all")
318
+ execute_line_if_not_dry_run("git push --tags")
331
319
 
332
320
  if @spec_mode == POD_SPEC_TYPE
333
321
  execute_line_if_not_dry_run("pod trunk push #{@spec_file}")
334
322
  else
335
323
  if @spec_mode == GEM_SPEC_TYPE
336
- execute_line_if_not_dry_run("gem build #{@spec_file}")
337
- gem = find_current_gem_file
338
324
  execute_line_if_not_dry_run("gem push #{gem}")
339
325
 
340
- if @options[:install]
341
- execute_line_if_not_dry_run("gem install #{gem}")
342
- end
343
-
344
326
  execute_line_if_not_dry_run("rm #{gem}")
345
327
  else
346
- raise 'Unknown spec type'
328
+ fail "Unknown spec type"
347
329
  end
348
330
  end
349
331
  end
@@ -358,45 +340,43 @@ module BumperPusher
358
340
  execute_line_if_not_dry_run("sed -i \"\" \"s/#{bumped_version}/#{result}/\" #{version_file}")
359
341
  execute_line_if_not_dry_run("rm #{gem}")
360
342
  else
361
- raise 'Unknown spec type'
343
+ fail "Unknown spec type"
362
344
  end
363
345
  end
364
346
 
365
-
366
347
  if @options[:changelog] && !@options[:beta]
367
348
  if `which github_changelog_generator`.empty?
368
- puts 'Cancelled bumping: no github_changelog_generator gem found'
349
+ puts "Cancelled bumping: no github_changelog_generator gem found"
369
350
  else
370
351
 
371
352
  if is_git_flow_installed
372
- execute_line_if_not_dry_run('git flow hotfix start update-changelog')
353
+ execute_line_if_not_dry_run("git flow hotfix start update-changelog")
373
354
  end
374
- execute_line_if_not_dry_run('github_changelog_generator')
355
+ execute_line_if_not_dry_run("github_changelog_generator")
375
356
  execute_line_if_not_dry_run("git commit CHANGELOG.md -m \"Update changelog for version #{bumped_version}\"")
376
357
  if is_git_flow_installed
377
- unless execute_line_if_not_dry_run('git flow hotfix finish -n update-changelog', check_exit = false) == 0
358
+ unless execute_line_if_not_dry_run("git flow hotfix finish -n update-changelog", check_exit = false) == 0
378
359
  ask_to_merge
379
- execute_line_if_not_dry_run('git flow hotfix finish -n update-changelog')
360
+ execute_line_if_not_dry_run("git flow hotfix finish -n update-changelog")
380
361
  end
381
362
  execute_line_if_not_dry_run("git push && git checkout master && git push && git checkout #{get_current_branch}")
382
363
  else
383
- execute_line_if_not_dry_run('git push')
364
+ execute_line_if_not_dry_run("git push")
384
365
  end
385
366
 
386
367
  end
387
368
  end
388
-
389
369
  end
390
370
 
391
371
  def ask_to_merge
392
- puts 'Automatic merge failed, please open new terminal, resolve conflicts, then press Y. Or press N to terminate'
393
- str = ''
394
- while str != 'Y' && str != 'N'
372
+ puts "Automatic merge failed, please open new terminal, resolve conflicts, then press Y. Or press N to terminate"
373
+ str = ""
374
+ while str != "Y" && str != "N"
395
375
  str = gets.chomp
396
376
  puts str
397
377
  end
398
- if str == 'N'
399
- puts '-> exit'
378
+ if str == "N"
379
+ puts "-> exit"
400
380
  exit
401
381
  end
402
382
  end
@@ -411,42 +391,40 @@ module BumperPusher
411
391
  puts "version.rb file found (#{arr[0]}) -> bump this file"
412
392
  version_file = arr[0]
413
393
  else
414
- puts 'More than 1 version.rb file found. -> skip'
394
+ puts "More than 1 version.rb file found. -> skip"
415
395
  end
416
396
 
417
- version_file ? version_file.sub('./', '') : @spec_file
397
+ version_file ? version_file.sub("./", "") : @spec_file
418
398
  end
419
399
 
420
400
  def revert_last_bump
421
401
  spec_file = @spec_file
422
- result, _ = find_version_in_file(spec_file)
402
+ result, = find_version_in_file(spec_file)
423
403
 
424
404
  puts "DELETE tag #{result} and HARD reset HEAD~1?\nPress Y to continue:"
425
405
  str = gets.chomp
426
- if str != 'Y'
427
- puts '-> exit'
406
+ if str != "Y"
407
+ puts "-> exit"
428
408
  exit
429
409
  end
430
410
  execute_line_if_not_dry_run("git tag -d #{result}")
431
- execute_line_if_not_dry_run('git reset --hard HEAD~1')
411
+ execute_line_if_not_dry_run("git reset --hard HEAD~1")
432
412
  execute_line_if_not_dry_run("git push --delete origin #{result}")
433
413
  end
434
414
 
435
415
  def is_git_flow_installed
436
- system('git flow version') ? true : false
416
+ system("git flow version") ? true : false
437
417
  end
438
418
 
439
419
  def is_branch_hotfix?
440
420
  branch = get_current_branch
441
- branch.include? 'hotfix'
421
+ branch.include? "hotfix"
442
422
  end
443
-
444
423
  end
445
-
446
424
  end
447
425
 
448
- if $0 == __FILE__
449
- puts 'bumper.rb self run'
426
+ if $PROGRAM_NAME == __FILE__
427
+ puts "bumper.rb self run"
450
428
 
451
429
  BumperPusher::Bumper.new({}).execute_interactive_if_not_dry_run("pwd")
452
430
  end
@@ -1,55 +1,51 @@
1
1
  #!/usr/bin/env ruby
2
- require 'optparse'
2
+ require "optparse"
3
3
 
4
4
  module BumperPusher
5
-
6
5
  class Parser
7
-
8
6
  def initialize
9
-
10
7
  end
11
8
 
12
9
  def parse_options
13
- options = {:dry_run => false, :bump_number => :patch, :changelog => true, :bump => true, :commit => true, :build => true, :push => true, :install => true}
10
+ options = { dry_run: false, bump_number: :patch, changelog: true, bump: true, commit: true, build: true, push: true, install: true }
14
11
 
15
- OptionParser.new { |opts|
16
- opts.banner = 'Usage: bumper_pusher [options]'
12
+ OptionParser.new do |opts|
13
+ opts.banner = "Usage: bumper_pusher [options]"
17
14
 
18
- opts.on('-d', '--dry-run', 'Dry run') do |v|
15
+ opts.on("-d", "--dry-run", "Dry run") do |v|
19
16
  options[:dry_run] = v
20
17
  end
21
- opts.on('-r', '--release', 'Bump release version') do |v|
18
+ opts.on("-r", "--release", "Bump release version") do |_v|
22
19
  options[:bump_number] = :major
23
20
  end
24
- opts.on('-m', '--minor', 'Bump minor version') do |v|
21
+ opts.on("-m", "--minor", "Bump minor version") do |_v|
25
22
  options[:bump_number] = :minor
26
23
  end
27
- opts.on('-p', '--patch', 'Bump patch version') do |v|
24
+ opts.on("-p", "--patch", "Bump patch version") do |_v|
28
25
  options[:bump_number] = :patch
29
26
  end
30
- opts.on('-r', '--revert', 'Revert last bump') do |v|
27
+ opts.on("-r", "--revert", "Revert last bump") do |v|
31
28
  options[:revert] = v
32
29
  end
33
- opts.on('-i', '--[no-]install', 'Install this gem after push it. Default is true.') do |v|
30
+ opts.on("-i", "--[no-]install", "Install this gem after push it. Default is true.") do |v|
34
31
  options[:install] = v
35
32
  end
36
- opts.on('-b', '--beta', 'Build beta gem without commit and push') do |v|
33
+ opts.on("-b", "--beta", "Build beta gem without commit and push") do |v|
37
34
  options[:beta] = v
38
35
  options[:bump] = v
39
36
  options[:build] = v
40
37
  options[:commit] = !v
41
38
  options[:push] = !v
42
-
43
39
  end
44
- opts.on('-v', '--version', 'Print version number') do |v|
40
+ opts.on("-v", "--version", "Print version number") do |_v|
45
41
  puts "Version: #{BumperPusher::VERSION}"
46
42
  exit
47
43
  end
48
- opts.on('-c', '--[no]-changelog', 'Auto generation of changelog and pushing it origin. Default is true') do |v|
44
+ opts.on("-c", "--[no]-changelog", "Auto generation of changelog and pushing it origin. Default is true") do |v|
49
45
  options[:changelog] = v
50
46
  end
51
- }.parse!
47
+ end.parse!
52
48
  options
53
49
  end
54
50
  end
55
- end
51
+ end
@@ -1,3 +1,3 @@
1
1
  module BumperPusher
2
- VERSION = "0.1.19"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/bumper_pusher.rb CHANGED
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative 'bumper_pusher/version'
4
- require_relative 'bumper_pusher/parser'
5
- require_relative 'bumper_pusher/bumper'
3
+ require_relative "bumper_pusher/version"
4
+ require_relative "bumper_pusher/parser"
5
+ require_relative "bumper_pusher/bumper"
6
6
 
7
7
  module BumperPusher
8
-
9
8
  class Pusher
10
9
  attr_reader :options
11
10
  def initialize
@@ -19,14 +18,8 @@ module BumperPusher
19
18
  else
20
19
  @parser.run_bumping_script
21
20
  end
22
-
23
21
  end
24
22
  end
25
-
26
-
27
23
  end
28
24
 
29
- if $0 == __FILE__
30
- bumper = BumperPusher::Pusher.new
31
-
32
- end
25
+ bumper = BumperPusher::Pusher.new if $PROGRAM_NAME == __FILE__
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumper_pusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Korolev
@@ -81,6 +81,8 @@ extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
83
  - ".gitignore"
84
+ - ".rubocop.yml"
85
+ - ".rubocop_todo.yml"
84
86
  - ".travis.yml"
85
87
  - CHANGELOG.md
86
88
  - Gemfile