fight_club 0.0.9 → 0.1.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: 3dd8e091bcdc3c97d6fc623680bd1b6cbbe5ef90
4
- data.tar.gz: 3647be0a28898ba52a6e2ea04e12c369ea31b892
3
+ metadata.gz: 7e8c3a9ffbe09800fa3501bc2b0f9cfca4b617b6
4
+ data.tar.gz: 7c69a31fef40e7c319278041e2020369031909f0
5
5
  SHA512:
6
- metadata.gz: c91eadb43d79f28b7f5d682a2d08a608bd96cdbe78dd5f7f5ad8474adc9abf4c1c7baa77f9c8b946f6b25b8cb00321c4e5838e8c0a1cbf6f897b8288ca86d3b6
7
- data.tar.gz: d21a86a810e3965837fd20a20e66ad0a119a5bd292520bdbef9d409de917e69d5cf63c3d651e692340bc19aed2964e61457412abdbcd387301f2edf50975a145
6
+ metadata.gz: 9348925d56d4e876477f2b871f439217f88ee957cc818db81be3144180d9836d1209f48c85cb86ed00248d4be12f070622a03a75c7d90b3806ddd82770ad5b9b
7
+ data.tar.gz: 870326a4b2488db4d82d7c40d2d8e806ca166ef4827c95b62917808b4ea2a98529c01e1356091273536404df0c5a0eec1a6709f5e69e23179a5763bd00f960c1
@@ -5,7 +5,7 @@ require_relative "fight_club/config"
5
5
 
6
6
  module FightClub
7
7
  class << self
8
- attr_writer :config, :log
8
+ attr_writer :config
9
9
  end
10
10
 
11
11
  def self.begin(pull_request)
@@ -16,10 +16,6 @@ module FightClub
16
16
  @config ||= Config.new
17
17
  end
18
18
 
19
- def self.log
20
- @log ||= Hash.new { |hsh, key| hsh[key] = [] }
21
- end
22
-
23
19
  def self.configure
24
20
  yield(config)
25
21
  end
@@ -1,7 +1,7 @@
1
1
  module FightClub
2
2
  class Commenter
3
3
  def self.comment(pr, message)
4
- unless FightClub.log[pr["number"]].include? message
4
+ unless FightClub.comment_check.call(pr, message)
5
5
  HTTParty.post(
6
6
  pr["_links"]["comments"]["href"],
7
7
  body: {
@@ -14,7 +14,7 @@ module FightClub
14
14
  }
15
15
  )
16
16
 
17
- FightClub.log[pr["number"]] << message
17
+ FightClub.save_comment(pr, message)
18
18
  Logger.new(STDOUT).info "Left a comment on #{pr["number"]} with message: #{message}"
19
19
  end
20
20
  end
@@ -1,7 +1,8 @@
1
1
  module FightClub
2
2
  class Config
3
3
  attr_accessor :repo, :oauth, :repo_name,
4
- :uri, :master_branch, :repos_directory
4
+ :uri, :master_branch, :repos_directory,
5
+ :comment_check, :save_comment
5
6
 
6
7
  def initialize
7
8
  @repo = 'baxterthehacker/public-repo'
@@ -10,6 +11,8 @@ module FightClub
10
11
  @uri = 'git@github.com:baxterthehacker/public-repo.git'
11
12
  @master_branch = 'master'
12
13
  @repos_directory = '/tmp'
14
+ @comment_check = Proc.new { |pr, comment| false }
15
+ @save_comment = Proc.new { |pr, comment| false }
13
16
  end
14
17
  end
15
18
  end
@@ -1,3 +1,3 @@
1
1
  module FightClub
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fight_club
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Minkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-02 00:00:00.000000000 Z
11
+ date: 2016-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler