fight_club 0.0.6 → 0.0.7

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: d1427b5a3a1e351abec5a1c6cbf622a65e114962
4
- data.tar.gz: c114061fc6cc816972bb0c685976db830dc7ba97
3
+ metadata.gz: d34def593e81184a62f6cf94c897aaf2b0bd4d9f
4
+ data.tar.gz: e74a9144d1959b1168f31775d3c1ce494b525e78
5
5
  SHA512:
6
- metadata.gz: b57a037439542d409e952f0ff5c2b69e9e8603bd3dfac1d716fd38e05693a3dc41e6f887af968b119e6428d7e3e8377afc1492d6f14063a742185e1310b7a905
7
- data.tar.gz: 6bbe554ceeec0b89d64932d58b268a691a54a1bd67f82fb83a29c910fe85b8e98e347426afe27077124d4f2e7ae7d80c73ce608d471b981e052a80495024d090
6
+ metadata.gz: 149bf227c0f4e283a0589c1b5af1ae54f588d173a93a78b5dc77bbea91de47b482c997a7bc687e48d68f24066b6fc0f1016a08ebe0414c3c771a07850e62bc38
7
+ data.tar.gz: 318c8ba656c7a6ac41fa0d6105c8e5e401bc9d58df290633f1495f826941dbd53a26bfcab524675d23261908d357966616371d71e787c9db02d1d0cc0cc50f78
@@ -4,7 +4,7 @@ require_relative "fight_club/config"
4
4
 
5
5
  module FightClub
6
6
  class << self
7
- attr_writer :config
7
+ attr_writer :config, :log
8
8
  end
9
9
 
10
10
  def self.begin(pull_request)
@@ -15,6 +15,10 @@ module FightClub
15
15
  @config ||= Config.new
16
16
  end
17
17
 
18
+ def self.log
19
+ @log ||= Hash.new { |hsh, key| hsh[key] = [] }
20
+ end
21
+
18
22
  def self.configure
19
23
  yield(config)
20
24
  end
@@ -1,19 +1,22 @@
1
1
  module FightClub
2
2
  class Commenter
3
3
  def self.comment(pr, message)
4
- HTTParty.post(
5
- pr["_links"]["comments"]["href"],
6
- body: {
7
- body: message,
8
- }.to_json,
9
- headers: {
10
- 'Content-Type' => 'application/json',
11
- 'User-Agent' => 'ruby',
12
- "Authorization" => "token #{FightClub.config.oauth}"
13
- }
14
- )
4
+ unless FightClub.log[pr["number"]].include? message
5
+ HTTParty.post(
6
+ pr["_links"]["comments"]["href"],
7
+ body: {
8
+ body: message,
9
+ }.to_json,
10
+ headers: {
11
+ 'Content-Type' => 'application/json',
12
+ 'User-Agent' => 'ruby',
13
+ "Authorization" => "token #{FightClub.config.oauth}"
14
+ }
15
+ )
15
16
 
16
- Logger.new(STDOUT).info "Left a comment on #{pr["number"]} with message: #{message}"
17
+ FightClub.log[pr["number"]] << message
18
+ Logger.new(STDOUT).info "Left a comment on #{pr["number"]} with message: #{message}"
19
+ end
17
20
  end
18
21
  end
19
22
  end
@@ -1,3 +1,3 @@
1
1
  module FightClub
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fight_club
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Minkov