gerrit 0.7.1 → 0.8.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: bdc2d2701944b045d24493318b2144188a7958b1
4
- data.tar.gz: a1e9f69a5ebeb4530c577c95570740dd4e94c926
3
+ metadata.gz: 3043c0156abae2e06e72d8193b952e910801ebec
4
+ data.tar.gz: 21ef00a5f5cb37ee44f0b1d6c626a89c494d6863
5
5
  SHA512:
6
- metadata.gz: f86937b1256e8baa6fcd9970d2fc2cb6f521e77a7da78d995b59e315b34fd566bce3c94b1280a3bdf06ca22f010858c987b0770a5e38a4a5ff1cae35b4296da0
7
- data.tar.gz: c76fdecba99a652838ee1db02f17c3ae1397ae71e1de27e6cf2c95f6ca4c287766f38e8f8ba13a25f1231e54ca34bad328cec39d96964c5a351474af4285f80c
6
+ metadata.gz: 6a795d812fbb1bc438d713a417dfb853ab500a95ff47caf9615596224ffd7b989a5e50f3d8fe7bbe58cdaa71204ebf2da1352e64617d042431bef9d46cb9b002
7
+ data.tar.gz: 7cae28572e2b8c35fd8872bdfc446772832bdf18f587cb80b5b6b135d869bea2721f01e03ab1aa31e8e57d8160fc1b0d3d096bb4ff148ec7188b79c3b961b06a
@@ -8,6 +8,7 @@ module Gerrit
8
8
  # @see http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
9
9
  module ExitCodes
10
10
  OK = 0 # Successful execution
11
+ ERROR = 1 # Generic error
11
12
  USAGE = 64 # User error (bad command line or invalid input)
12
13
  SOFTWARE = 70 # Internal software error (bug)
13
14
  CONFIG = 78 # Configuration error (invalid file or options)
@@ -44,11 +45,20 @@ module Gerrit
44
45
  # @param arguments [Array<String>]
45
46
  # @raise [Gerrit::Errors::GerritError] when any exceptional circumstance occurs
46
47
  def run_command(config, arguments)
47
- # Display all open changes by default
48
- arguments = ['list'] if arguments.empty?
48
+ arguments = convert_arguments(arguments)
49
49
 
50
50
  require 'gerrit/command/base'
51
51
  Command::Base.from_arguments(config, @ui, arguments).run
52
52
  end
53
+
54
+ def convert_arguments(arguments)
55
+ # Display all open changes by default
56
+ return ['list'] if arguments.empty?
57
+
58
+ return ['help'] if %w[-h --help].include?(arguments.first)
59
+ return ['version'] if %w[-v --version].include?(arguments.first)
60
+
61
+ arguments
62
+ end
53
63
  end
54
64
  end
@@ -10,6 +10,9 @@ module Gerrit::Command
10
10
  commands.each do |command|
11
11
  ui.print command
12
12
  end
13
+
14
+ ui.newline
15
+ ui.info "See #{Gerrit::REPO_URL}#usage for full documentation"
13
16
  end
14
17
 
15
18
  private
@@ -42,11 +42,29 @@ module Gerrit::Command
42
42
  ui.success "Added #{remote_name} #{remote_url}"
43
43
  end
44
44
 
45
+ execute_post_setup_script(Dir.pwd)
46
+
45
47
  ui.newline
46
48
  ui.info 'You can now push commits for review by running: ', newline: false
47
49
  ui.print 'gerrit push'
48
50
  end
49
51
 
52
+ def execute_post_setup_script(repo_directory)
53
+ post_setup_cmd = Array(config[:post_setup])
54
+ return unless post_setup_cmd.any?
55
+
56
+ result =
57
+ ui.spinner('Running post setup script...') do
58
+ spawn(post_setup_cmd)
59
+ end
60
+ if result.success?
61
+ ui.success(result.stdout.rstrip) unless result.stdout.strip.empty?
62
+ else
63
+ ui.error('Failed to run post setup script:')
64
+ ui.error(result.stdout + result.stderr)
65
+ end
66
+ end
67
+
50
68
  def render_remote_url(remote_config)
51
69
  remote_config['url'] % {
52
70
  user: config[:user],
@@ -21,6 +21,9 @@ module Gerrit
21
21
  when Errors::ConfigurationError
22
22
  ui.error ex.message
23
23
  CLI::ExitCodes::CONFIG
24
+ when Errors::GerritCommandFailedError
25
+ ui.error ex.message
26
+ CLI::ExitCodes::ERROR
24
27
  else
25
28
  print_unexpected_exception(ex)
26
29
  CLI::ExitCodes::SOFTWARE
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module Gerrit
3
- VERSION = '0.7.1'
3
+ VERSION = '0.8.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gerrit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-11 00:00:00.000000000 Z
11
+ date: 2015-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: childprocess
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.4.8
125
+ rubygems_version: 2.4.5.1
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Gerrit command line interface