git_bumper 0.1.1 → 0.1.2

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: 9dbebb5b4068fbb7d06f8f8f6e5833ff6b7e7571
4
- data.tar.gz: ef4b3519f87bda65e8818ec17186b8631dbd4bfd
3
+ metadata.gz: 242f97c1afcd0a3b35fdb21a3cdbe077aefb5348
4
+ data.tar.gz: 6a349f3457a478ed0c43a323e6579604e6ff7b63
5
5
  SHA512:
6
- metadata.gz: 70507cc3b729a0ed77834e7d3daf26de9d3b8a2689265821a5a05319aed87243daa63afdf5477326b111e828a2908dbf7912635272276b0d076ecad0b152f4a8
7
- data.tar.gz: 362e024de5c17480b783678554f5fb67740d121e92b9170083a81076721f4fe6f7d101f9cfec07d4a805f8e8ae69a319ae8d600483ba24e0a77d97d9ee798b8e
6
+ metadata.gz: 3ed798d97e37762dbf386d1caf574cf3017c040485e5826ed000263c5fab921d9f0c3fa8518dd24cabe20265f28ffa463ce9e9a0665e19cdcf05da9fbc85f3a1
7
+ data.tar.gz: fa64bac181c82fad8989a9ee35197025ae9d811a1c7cd97b80c33dec6767a76e528ea0ffd9a513f876a2e287ddcf82d1d35e21da88e343018c42fbe7245cc250
@@ -2,16 +2,20 @@ module GitBumper
2
2
  # This class receives a Hash of options parsed by CLIParser and executes the
3
3
  # requested action.
4
4
  class CLI
5
+ attr_reader :error_msg
6
+
5
7
  # @param [Hash]
6
8
  def initialize(options)
7
9
  @options = options
10
+ @error = false
11
+ @error_msg = ''
8
12
  end
9
13
 
10
14
  def run
11
15
  Git.fetch_tags
12
16
 
13
17
  old_tag = greatest_tag
14
- abort 'No tags found.' unless old_tag
18
+ return error('No tags found.') unless old_tag
15
19
 
16
20
  new_tag = old_tag.clone
17
21
  new_tag.increment(@options.fetch(:increment))
@@ -20,14 +24,23 @@ module GitBumper
20
24
  puts "The new tag will be #{new_tag}"
21
25
  puts 'Push to origin? (y/N)'
22
26
 
23
- abort 'Aborted.' unless prompt_yes
27
+ return error('Aborted.') unless prompt_yes
24
28
 
25
29
  Git.create_tag(new_tag)
26
30
  Git.push_tag(new_tag)
27
31
  end
28
32
 
33
+ def error?
34
+ @error
35
+ end
36
+
29
37
  private
30
38
 
39
+ def error(msg)
40
+ @error = true
41
+ @error_msg = msg
42
+ end
43
+
31
44
  def prompt_yes
32
45
  STDIN.gets.chomp.to_s =~ /y(es)?/i
33
46
  end
@@ -33,7 +33,7 @@ module GitBumper
33
33
  end
34
34
  .on('-h', '--help', 'Prints this help') do
35
35
  puts @parser
36
- exit
36
+ return false
37
37
  end
38
38
 
39
39
  @parser.parse!(@argv)
@@ -1,3 +1,3 @@
1
1
  module GitBumper
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/lib/git_bumper.rb CHANGED
@@ -10,7 +10,11 @@ module GitBumper
10
10
 
11
11
  def run
12
12
  parser = CLIParser.new(ARGV)
13
- parser.parse
14
- CLI.new(parser.options).run
13
+ abort unless parser.parse
14
+
15
+ cli = CLI.new(parser.options)
16
+ cli.run
17
+
18
+ abort cli.error_msg if cli.error?
15
19
  end
16
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_bumper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lenon Marcel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-12 00:00:00.000000000 Z
11
+ date: 2015-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,19 +60,9 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
64
- - ".rspec"
65
- - ".rubocop.yml"
66
- - ".travis.yml"
67
- - CODE_OF_CONDUCT.md
68
- - Gemfile
69
63
  - LICENSE.txt
70
64
  - README.md
71
- - Rakefile
72
- - bin/console
73
65
  - bin/git-bump
74
- - bin/setup
75
- - git_bumper.gemspec
76
66
  - lib/git_bumper.rb
77
67
  - lib/git_bumper/build_tag.rb
78
68
  - lib/git_bumper/cli.rb
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.rubocop.yml DELETED
@@ -1 +0,0 @@
1
- require: rubocop-rspec
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.10.6
data/CODE_OF_CONDUCT.md DELETED
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in git_bumper.gemspec
4
- gemspec
5
-
6
- gem 'codeclimate-test-reporter', group: :test, require: nil
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'git_bumper'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
data/git_bumper.gemspec DELETED
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'git_bumper/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'git_bumper'
8
- spec.version = GitBumper::VERSION
9
- spec.authors = ['Lenon Marcel']
10
- spec.email = ['lenon.marcel@gmail.com']
11
-
12
- spec.summary = 'A CLI utility to bump git tags.'
13
- spec.description = 'A CLI utility to bump git tags.'
14
- spec.homepage = 'https://github.com/lenon/git_bumper'
15
- spec.license = 'MIT'
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.executables = ['git-bump']
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_development_dependency 'bundler', '~> 1.10'
22
- spec.add_development_dependency 'rake', '~> 10.0'
23
- spec.add_development_dependency 'rspec'
24
- end