gergich 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gergich.rb +7 -0
- data/spec/gergich_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8af2aab61e1b5c93269e3d9e2e6d4fb5dd01201
|
4
|
+
data.tar.gz: 88a33e274c6a36ec65be8e32a05c151ef747f4d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc12a8e5761990be3b1de20fa15dfd9392e83dcdb2c6a72553d859b9e88787550129fe48006674e4f4594f3170fd39037dfa8cb17440860d766634556a0a576f
|
7
|
+
data.tar.gz: 9da9a59b35a715a688d7e9f3e700a011ccfa4ee027b8454c60fb70ef694faa9a80d5834e83458392947f38b26a322e0e7f99805c93e0ae642cdfcfd8261349a8
|
data/lib/gergich.rb
CHANGED
@@ -197,6 +197,13 @@ module Gergich
|
|
197
197
|
ret = HTTParty.send(method, url, options).body
|
198
198
|
if ret.sub!(/\A\)\]\}'\n/, "") && ret =~ /\A("|\[|\{)/
|
199
199
|
JSON.parse("[#{ret}]")[0] # array hack so we can parse a string literal
|
200
|
+
elsif ret =~ /Not Found: (?<change_id>.*)/
|
201
|
+
raise("Cannot find Change-Id: #{Regexp.last_match[:change_id]}.\n"\
|
202
|
+
"This is most likely due to this"\
|
203
|
+
" Change-Id already being used"\
|
204
|
+
" by an ABANDONED change.\n"\
|
205
|
+
"To fix, `git commit --amend`,"\
|
206
|
+
" remove the Change-Id line, and push again.")
|
200
207
|
else
|
201
208
|
raise("Non-JSON response: #{ret}")
|
202
209
|
end
|
data/spec/gergich_spec.rb
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
require_relative "../lib/gergich"
|
2
2
|
|
3
|
+
RSpec.describe Gergich::API do
|
4
|
+
let(:result) { double(:result, { body: "Not Found: 1234" }) }
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
allow(HTTParty).to receive(:send).and_return(result)
|
8
|
+
allow(described_class).to receive(:base_options).and_return({})
|
9
|
+
end
|
10
|
+
|
11
|
+
it "provides helpful error when Change-Id not found" do
|
12
|
+
expect { described_class.get("/a/changes/1234") }.to raise_error(/Cannot find Change-Id: 1234/)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
3
16
|
RSpec.describe Gergich::Draft do
|
4
17
|
let!(:draft) do
|
5
18
|
commit = double(:commit, {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gergich
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|