lita-gerrit 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 283eb823d370a3f6cc278a0ecd2144707198fc9a
4
- data.tar.gz: 2f5bf8e823577fc9dcfcde0cae162b2201650b66
3
+ metadata.gz: b63fa796726ff840033b17ea3e49fb54490b9875
4
+ data.tar.gz: 2b2bf62d813d6e8796fa27b85b53979085e18947
5
5
  SHA512:
6
- metadata.gz: c33fa282ea95be144f071b778d8aa192a8757290d8a826e20411574a3c870fec611abd5536883230d52ab301b63532d936e124ac4dd073d771acd59ae9357987
7
- data.tar.gz: 9a54e29ecf0910354e76ca4fcbc49c27bdd2f881f0fe041be1530501f88f29948924acd7c45a66dfadd595bff778ed91c94ae1664a940403461f97b0d8bb188f
6
+ metadata.gz: f56f3209bfb27973e5587ba4078e0d697873eeff474010a436b921c0609fd52a48c09e4f484f317d8057084f3693db3bac0d3747cdbe8a6a62340c980b326646
7
+ data.tar.gz: f65661a6c7144645d172cda2a6534eef9238a54462a1db557670cec700825af1bf57fe9c8b11dc36a320ef5576c71efff3fa3d2c77f912885fa2dc70eb050356
@@ -2,12 +2,10 @@ module Lita
2
2
  module Handlers
3
3
  class Gerrit < Handler
4
4
 
5
- def self.default_config(config)
6
- config.url = "https://gerrit.example.com"
7
- config.username = "foo"
8
- config.password = "bar"
9
- config.default_room = nil
10
- end
5
+ config :url, default: "https://gerrit.example.com"
6
+ config :username, default: "foo"
7
+ config :password, default: "bar"
8
+ config :default_room
11
9
 
12
10
  #
13
11
  # Fetch details of a given patchset
@@ -17,12 +15,12 @@ module Lita
17
15
 
18
16
  def change_details(response)
19
17
  change_id = response.matches.flatten.first
20
- change_uri = "#{Lita.config.handlers.gerrit.url.chomp("/")}/a/changes/#{change_id}"
21
- change_link = "#{Lita.config.handlers.gerrit.url.chomp("/")}/#{change_id}"
18
+ change_uri = "#{config.url.chomp("/")}/a/changes/#{change_id}"
19
+ change_link = "#{config.url.chomp("/")}/#{change_id}"
22
20
 
23
21
  http_resp = HTTParty.get(change_uri, :digest_auth => {
24
- username: Lita.config.handlers.gerrit.username,
25
- password: Lita.config.handlers.gerrit.password
22
+ username: config.username,
23
+ password: config.password
26
24
  })
27
25
 
28
26
  case http_resp.code
@@ -59,8 +57,8 @@ module Lita
59
57
 
60
58
  if request.params.has_key?("room")
61
59
  room = request.params["room"]
62
- elsif Lita.config.handlers.gerrit.default_room
63
- room = Lita.config.handlers.gerrit.default_room
60
+ elsif config.default_room
61
+ room = config.default_room
64
62
  else
65
63
  raise "Room must be defined. Either fix your hook or specify a default room ('config.handlers.gerrit.default_room')"
66
64
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-gerrit"
3
- spec.version = "0.1.1"
3
+ spec.version = "0.1.2"
4
4
  spec.authors = ["Jonathan Amiez"]
5
5
  spec.email = ["jonathan.amiez@gmail.com"]
6
6
  spec.description = "Gerrit API client and hook events handler"
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
15
  spec.require_paths = ["lib"]
16
16
 
17
- spec.add_runtime_dependency "lita", "~> 3.0"
17
+ spec.add_runtime_dependency "lita", "~> 4.0"
18
18
  spec.add_runtime_dependency "httparty", "~> 0.13.0"
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -11,8 +11,8 @@ describe Lita::Handlers::Gerrit, lita_handler: true do
11
11
  end
12
12
  end
13
13
 
14
- it { routes("get me gerrit 123, please").to(:change_details) }
15
- it { doesnt_route("gerrit foo").to(:change_details) }
14
+ it { is_expected.to route("get me gerrit 123, please").to(:change_details) }
15
+ it { is_expected.not_to route("gerrit foo").to(:change_details) }
16
16
 
17
17
  describe "#change_details" do
18
18
  let(:response) { double("HTTParty::Response") }
@@ -47,7 +47,7 @@ describe Lita::Handlers::Gerrit, lita_handler: true do
47
47
  end
48
48
  end
49
49
 
50
- it { routes_http(:post, "/gerrit/hooks").to(:hook) }
50
+ it { is_expected.to route_http(:post, "/gerrit/hooks").to(:hook) }
51
51
 
52
52
  describe "#hook" do
53
53
  let(:request) do
@@ -61,8 +61,8 @@ describe Lita::Handlers::Gerrit, lita_handler: true do
61
61
  let(:params) { double("Hash") }
62
62
  end
63
63
 
64
- it { routes_http(:post, "/gerrit/build/myroom").to(:build_notification) }
65
- it { doesnt_route_http(:post, "/gerrit/build/").to(:build_notification) }
64
+ it { is_expected.to route_http(:post, "/gerrit/build/myroom").to(:build_notification) }
65
+ it { is_expected.not_to route_http(:post, "/gerrit/build/").to(:build_notification) }
66
66
 
67
67
  describe "#build_notification" do
68
68
  let(:request) { double("Rack::Request") }
@@ -8,3 +8,4 @@ SimpleCov.start { add_filter "/spec/" }
8
8
 
9
9
  require "lita-gerrit"
10
10
  require "lita/rspec"
11
+ Lita.version_3_compatibility_mode = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-gerrit
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
  - Jonathan Amiez
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement