hubstats 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +5 -0
- data/app/controllers/hubstats/users_controller.rb +1 -0
- data/app/helpers/hubstats/metrics_helper.rb +2 -2
- data/app/models/hubstats/comment.rb +1 -0
- data/app/models/hubstats/pull_request.rb +1 -0
- data/app/models/hubstats/user.rb +4 -3
- data/lib/hubstats/version.rb +1 -1
- data/spec/controllers/hubstats/repos_controller_spec.rb +3 -0
- data/spec/controllers/hubstats/users_controller_spec.rb +2 -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: c81117f077e962453994f09ec5e806c32fb4b0c3
|
4
|
+
data.tar.gz: 9400a593fd42d99fcc32a05a437a53ee5a620937
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dd16f156ddf9c069529ab49b371abc7c3a328169b72e3d8390f34b01a02b10138ad02a154de9c67e6158f17cd85405bfdd0a9e59ba81c8440f5c14f4ed57145
|
7
|
+
data.tar.gz: 9db16e4c561c99cdcb7186750aa2012f0cc29890d9fa161486d55f36683b0656390160aaaedfbfecdcda8385cde74bf820a2bd8bb03cbcc8095dfe6ecf0a66be
|
data/CHANGELOG.markdown
CHANGED
@@ -14,6 +14,7 @@ module Hubstats
|
|
14
14
|
@users = Hubstats::User.where(id: params[:id].split(",")).order("login ASC")
|
15
15
|
else
|
16
16
|
@users = Hubstats::User.with_all_metrics(@start_date, @end_date)
|
17
|
+
.where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"])
|
17
18
|
.with_id(params[:users])
|
18
19
|
.custom_order(params[:order])
|
19
20
|
.paginate(:page => params[:page], :per_page => 15)
|
@@ -26,14 +26,14 @@ module Hubstats
|
|
26
26
|
#
|
27
27
|
# Returns - the number of pull requests
|
28
28
|
def get_pull_count
|
29
|
-
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).count(:all)
|
29
|
+
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).ignore_pulls_by(Hubstats::User.ignore_users_ids).count(:all)
|
30
30
|
end
|
31
31
|
|
32
32
|
# Public - Gets the number of comments within the start date and end date
|
33
33
|
#
|
34
34
|
# Returns - the number of comments
|
35
35
|
def get_comment_count
|
36
|
-
Hubstats::Comment.created_in_date_range(@start_date, @end_date).count(:all)
|
36
|
+
Hubstats::Comment.created_in_date_range(@start_date, @end_date).ignore_comments_by(Hubstats::User.ignore_users_ids).count(:all)
|
37
37
|
end
|
38
38
|
|
39
39
|
# Public - Gets the number of comments per reviewer within the start date and end date
|
@@ -5,6 +5,7 @@ module Hubstats
|
|
5
5
|
|
6
6
|
# Various checks that can be used to filter and find info about comments.
|
7
7
|
scope :created_in_date_range, lambda {|start_date, end_date| where("hubstats_comments.created_at BETWEEN ? AND ?", start_date, end_date)}
|
8
|
+
scope :ignore_comments_by, lambda {|user_ids| where("user_id NOT IN (?)", user_ids) if user_ids}
|
8
9
|
scope :belonging_to_pull_request, lambda {|pull_request_id| where(pull_request_id: pull_request_id)}
|
9
10
|
scope :belonging_to_user, lambda {|user_id| where(user_id: user_id)}
|
10
11
|
scope :belonging_to_team, lambda {|user_ids| where(user_id: user_ids) if user_ids}
|
@@ -9,6 +9,7 @@ module Hubstats
|
|
9
9
|
scope :created_in_date_range, lambda {|start_date, end_date| where("hubstats_pull_requests.created_at BETWEEN ? AND ?", start_date, end_date)}
|
10
10
|
scope :merged_in_date_range, lambda {|start_date, end_date| where("hubstats_pull_requests.merged").where("hubstats_pull_requests.merged_at BETWEEN ? AND ?", start_date, end_date)}
|
11
11
|
scope :created_since, lambda {|days| where("hubstats_pull_requests.created_at > ?", Date.today - days)}
|
12
|
+
scope :ignore_pulls_by, lambda {|user_ids| where("user_id NOT IN (?)", user_ids) if user_ids}
|
12
13
|
scope :belonging_to_repo, lambda {|repo_id| where(repo_id: repo_id)}
|
13
14
|
scope :belonging_to_team, lambda {|team_id| where(team_id: team_id)}
|
14
15
|
scope :belonging_to_user, lambda {|user_id| where(user_id: user_id)}
|
data/app/models/hubstats/user.rb
CHANGED
@@ -3,10 +3,11 @@ module Hubstats
|
|
3
3
|
|
4
4
|
# Various checks that can be used to filter and find info about users.
|
5
5
|
scope :with_id, lambda {|user_id| where(id: user_id.split(',')) if user_id}
|
6
|
-
scope :only_active, -> { having("comment_count > 0 OR pull_request_count > 0 OR deploy_count > 0") }
|
7
|
-
scope :is_developer, -> { having("pull_request_count > 0") }
|
8
|
-
scope :is_reviewer, -> { having("comment_count > 0") }
|
6
|
+
scope :only_active, -> { where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).having("comment_count > 0 OR pull_request_count > 0 OR deploy_count > 0") }
|
7
|
+
scope :is_developer, -> { where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).having("pull_request_count > 0") }
|
8
|
+
scope :is_reviewer, -> { where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).having("comment_count > 0") }
|
9
9
|
scope :with_contributions, lambda {|start_date, end_date, repo_id| with_all_metrics_repos(start_date, end_date, repo_id) if repo_id}
|
10
|
+
scope :ignore_users_ids, -> { where("login IN (?)", Hubstats.config.github_config["ignore_users_list"]).pluck(:id) }
|
10
11
|
|
11
12
|
# Public - Counts all of the deploys for selected user that occurred between the start_date and end_date.
|
12
13
|
#
|
data/lib/hubstats/version.rb
CHANGED
@@ -22,6 +22,7 @@ module Hubstats
|
|
22
22
|
:name => "goosey",
|
23
23
|
:full_name => "sportngin/goosey",
|
24
24
|
:updated_at => Date.today)
|
25
|
+
allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
|
25
26
|
get :index
|
26
27
|
expect(assigns(:repos)).to contain_exactly(repo2, repo1, repo3, repo4)
|
27
28
|
end
|
@@ -43,6 +44,7 @@ module Hubstats
|
|
43
44
|
:user => user)
|
44
45
|
deploy1 = create(:deploy, :repo_id => 101010)
|
45
46
|
deploy2 = create(:deploy, :repo_id => 101010)
|
47
|
+
allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
|
46
48
|
get :show, repo: repo.name
|
47
49
|
expect(assigns(:repo)).to eq(repo)
|
48
50
|
expect(assigns(:repo).pull_requests).to contain_exactly(pull1, pull2)
|
@@ -71,6 +73,7 @@ module Hubstats
|
|
71
73
|
:full_name => "sportngin/goosey",
|
72
74
|
:updated_at => Date.today)
|
73
75
|
expect(Hubstats::Repo).to receive_message_chain("with_id.custom_order.paginate").and_return([repo1, repo2, repo3, repo4])
|
76
|
+
allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
|
74
77
|
get :index
|
75
78
|
expect(response).to have_http_status(200)
|
76
79
|
end
|
@@ -11,6 +11,7 @@ module Hubstats
|
|
11
11
|
user3 = create(:user, :id => 303030, :login => "examplePerson3", :updated_at => Date.today)
|
12
12
|
user4 = create(:user, :id => 404040, :login => "examplePerson4", :updated_at => Date.today)
|
13
13
|
expect(Hubstats::User).to receive_message_chain("with_id.custom_order.paginate").and_return([user2, user3, user1, user4])
|
14
|
+
allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
|
14
15
|
get :index
|
15
16
|
expect(response).to have_http_status(200)
|
16
17
|
end
|
@@ -26,6 +27,7 @@ module Hubstats
|
|
26
27
|
deploy2 = create(:deploy, :user_id => 101010)
|
27
28
|
comment1 = create(:comment, :user => user, :updated_at => Date.today)
|
28
29
|
comment2 = create(:comment, :user => user, :updated_at => Date.today)
|
30
|
+
allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
|
29
31
|
get :show, id: "examplePerson"
|
30
32
|
expect(assigns(:user)).to eq(user)
|
31
33
|
expect(assigns(:user).pull_requests).to contain_exactly(pull1, pull2)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elliot Hursh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|