git_find_committer 0.1.0 → 0.1.1

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: 370076a7b31cc1a7a4ee330f6b2a72a009765d64
4
- data.tar.gz: df17d88cfc9e17fa7d4426511414b5765c226ece
3
+ metadata.gz: 6dd5f8b98e480753a6c9cf4325c5932e9a760a03
4
+ data.tar.gz: 92361ee8dd217f7645f629235e7931d2493ccef1
5
5
  SHA512:
6
- metadata.gz: 6b0b315cac68a80f059240e315184c6f4557ae4e77d9648427ec27a5d734471f49d30666c1e95a9e093fdc5b680db61d1b8b0f02a4798407c3a2f23ab6edfca6
7
- data.tar.gz: ed8570f57936ed21a681788249b13fff89481869347b4cf21b23bba78f8c046e47cce86209cd404576b8ade786390af3066b79f2a6966b3de0e198b0ca782a00
6
+ metadata.gz: 64b76addb68157834fd877c7539bd0dabbfd9f57f1bff81bf3ae19ee217e2924f2b1b7e6017790c3b7240d7824810e8be81ec95a18109f4c74ff8332dc5a0f92
7
+ data.tar.gz: 476e4808599fe701535fe14b88316b48683cd1e7a8b05de349db0117511154d56845be201793dfadefbe1f351f00bf811b6dd37b057afddcec9fd1f04f31ed88
data/README.md CHANGED
@@ -23,8 +23,12 @@ Or install it yourself as:
23
23
  ## Usage
24
24
 
25
25
  ```ruby
26
- GitFindCommitter.search(repo: 'balloonbros/sutekki', branch: 'add-ui')
26
+ require 'git_find_committer'
27
+
28
+ committer = GitFindCommitter.search(repo: 'balloonbros/sutekki', branch: 'add-ui')
27
29
  => [{:name=>"Shohei Yamasaki", :commit_count=>51}, {:name=>"keitakawamoto", :commit_count=>21}]
30
+ committer.names(1)
31
+ => ["Shohei Yamasaki"]
28
32
  ```
29
33
 
30
34
  ## Working with GitHub Enterprise
@@ -38,6 +42,16 @@ GitFindCommitter.configure do |c|
38
42
  end
39
43
  ```
40
44
 
45
+ ## Filtering
46
+
47
+ You can filter the committers.
48
+
49
+ ```ruby
50
+ GitFindCommitter.configure do |c|
51
+ c.available_committer_name = %w(shoyan)
52
+ end
53
+ ```
54
+
41
55
  ## Development
42
56
 
43
57
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -19,9 +19,10 @@ module GitFindCommitter
19
19
  end
20
20
  end.sort { |(k1, v1), (k2, v2)| v2 <=> v1 }.to_h
21
21
 
22
- result.each_with_object([]) do |(key,val),arr|
22
+ result = result.each_with_object([]) do |(key,val),arr|
23
23
  arr << {name: key, commit_count: val}
24
24
  end
25
+ Response.new(result)
25
26
  end
26
27
 
27
28
  def find(file)
@@ -7,8 +7,9 @@ module GitFindCommitter
7
7
  @access_token = nil
8
8
  @url = "https://github.com"
9
9
  @tmp_repo_dir = '/tmp/git_find_committer'
10
+ @available_committer_names = nil
10
11
  end
11
- attr_accessor :owner, :repo, :repo_name, :branch, :access_token, :url, :tmp_repo_dir
12
+ attr_accessor :owner, :repo, :repo_name, :branch, :access_token, :url, :tmp_repo_dir, :available_committer_names
12
13
 
13
14
  def set_repo(repo)
14
15
  @repo = repo
@@ -0,0 +1,11 @@
1
+ module GitFindCommitter
2
+ class Filter
3
+ def initialize(config)
4
+ @config = config
5
+ end
6
+
7
+ def select_committer(committer)
8
+ committer.select {|c| @config.available_committer_names.include?(c[:name]) }
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module GitFindCommitter
2
+ class Response < Array
3
+ def names(limit=nil)
4
+ result = self.each_with_object([]) do |arr, result|
5
+ result << arr[:name]
6
+ end
7
+ if limit.nil?
8
+ result
9
+ else
10
+ result[0..(limit-1)]
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module GitFindCommitter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,6 +2,8 @@ require "git_find_committer/version"
2
2
  require "git_find_committer/committer"
3
3
  require "git_find_committer/configuration"
4
4
  require "git_find_committer/repository"
5
+ require "git_find_committer/filter"
6
+ require "git_find_committer/response"
5
7
 
6
8
  module GitFindCommitter
7
9
  def self.configuration
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_find_committer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shohei Yamasaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-22 00:00:00.000000000 Z
11
+ date: 2016-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,9 @@ files:
89
89
  - lib/git_find_committer.rb
90
90
  - lib/git_find_committer/committer.rb
91
91
  - lib/git_find_committer/configuration.rb
92
+ - lib/git_find_committer/filter.rb
92
93
  - lib/git_find_committer/repository.rb
94
+ - lib/git_find_committer/response.rb
93
95
  - lib/git_find_committer/version.rb
94
96
  homepage: https://github.com/shoyan/git_find_committer
95
97
  licenses: