hubstats 0.5.12 → 0.6.0

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: 03f7e5134a271c1d456d0685071339a61a25baa2
4
- data.tar.gz: 65a2b218e9d928cf23465f35f8618e342266efc4
3
+ metadata.gz: 24009a4a6527e5b6f0728e28be81be575d9c388a
4
+ data.tar.gz: 73080c209f89a6acf56ab571547432f694ead77a
5
5
  SHA512:
6
- metadata.gz: 7efb57e76b90c370c11c098501c1aff8ce14452af5a5e118170af366ee20ddcb23ec04743d25c276a8e248de4a934cefae197406e0a89f119d7b52a5bf2ce842
7
- data.tar.gz: e0238e32dafbae7cb5f2d32b4bf66bac614c3c5a78393e1e7f420bee31cae64ed98dff06f03758d780cb9aff8a2454582e1a45285417ab811b1c05c04d3845dd
6
+ metadata.gz: 736243798d4e36fc9ea81b86f143368213e52ea08d7f08432b7ad9ca43855821488a935c8ac2f36a798ee3bdf0713d9202500afca5a9d578af73933e0f8f42ad
7
+ data.tar.gz: 3d112dd041ab75bcac5481abee78d7193d42310ba40528e2717505a484bece9d8d10b8e5f43562e68a9bb77448681d43d41c1c1ab2b38bbd5506551a70cdf39f
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ #### v0.6.0
2
+ * Deleting unused columns from Hubstats database
3
+
4
+ > Emma Sax: Brian Bergstrom: https://github.com/sportngin/hubstats/pull/97
5
+
1
6
  #### v0.5.12
2
7
  * Restrict mysql2 dependency to compatible version
3
8
 
@@ -4,7 +4,7 @@
4
4
  <!-- Title with the repo name and git revision sha -->
5
5
  <h1 class="title text-center">
6
6
  <%= link_to @deploy.repo.name.titleize, repo_path(@deploy.repo.name) %> /
7
- <%= @deploy.git_revision.titleize %>
7
+ <%= @deploy.git_revision %>
8
8
  </h1>
9
9
 
10
10
  <!-- Show the date/time that the deploy was deployed -->
@@ -4,6 +4,15 @@
4
4
  <!-- Title with the user's GitHub username -->
5
5
  <h1 class="title text-center"><a href=<%=@user.html_url%>> <%= @user.login %></a> </h1>
6
6
 
7
+ <!-- Show what team(s) the user is on -->
8
+ <h4 class="text-center">
9
+ <% if @user.team %>
10
+ Assigned Team: <%= @user.team.name %>
11
+ <% else %>
12
+ No Assigned Team
13
+ <% end %>
14
+ </h4>
15
+
7
16
  <!-- Show all of the stats about the user -->
8
17
  <%= render 'hubstats/partials/quick_stats_one' %>
9
18
  </div>
@@ -0,0 +1,64 @@
1
+ class DeleteUnusedColumns < ActiveRecord::Migration
2
+ def change
3
+ remove_column :hubstats_comments, :line
4
+ remove_column :hubstats_comments, :diff_hunk
5
+ remove_column :hubstats_comments, :position
6
+ remove_column :hubstats_comments, :original_position
7
+ remove_column :hubstats_comments, :commit_id
8
+ remove_column :hubstats_comments, :original_commit_id
9
+
10
+ remove_column :hubstats_pull_requests, :commits
11
+ remove_column :hubstats_pull_requests, :changed_files
12
+ remove_column :hubstats_pull_requests, :patch_url
13
+ remove_column :hubstats_pull_requests, :diff_url
14
+ remove_column :hubstats_pull_requests, :commits_url
15
+ remove_column :hubstats_pull_requests, :review_comments_url
16
+ remove_column :hubstats_pull_requests, :review_comment_url
17
+ remove_column :hubstats_pull_requests, :comments_url
18
+ remove_column :hubstats_pull_requests, :statuses_url
19
+ remove_column :hubstats_pull_requests, :body
20
+ remove_column :hubstats_pull_requests, :merge_commit_sha
21
+ remove_column :hubstats_pull_requests, :mergeable
22
+
23
+ remove_column :hubstats_repos, :homepage
24
+ remove_column :hubstats_repos, :language
25
+ remove_column :hubstats_repos, :forks_count
26
+ remove_column :hubstats_repos, :stargazers_count
27
+ remove_column :hubstats_repos, :watches_count
28
+ remove_column :hubstats_repos, :size
29
+ remove_column :hubstats_repos, :open_issues_count
30
+ remove_column :hubstats_repos, :has_issues
31
+ remove_column :hubstats_repos, :has_wiki
32
+ remove_column :hubstats_repos, :has_downloads
33
+ remove_column :hubstats_repos, :private
34
+ remove_column :hubstats_repos, :fork
35
+ remove_column :hubstats_repos, :description
36
+ remove_column :hubstats_repos, :default_branch
37
+ remove_column :hubstats_repos, :clone_url
38
+ remove_column :hubstats_repos, :git_url
39
+ remove_column :hubstats_repos, :ssh_url
40
+ remove_column :hubstats_repos, :svn_url
41
+ remove_column :hubstats_repos, :mirror_url
42
+ remove_column :hubstats_repos, :hooks_url
43
+ remove_column :hubstats_repos, :issue_events_url
44
+ remove_column :hubstats_repos, :events_url
45
+ remove_column :hubstats_repos, :contributors_url
46
+ remove_column :hubstats_repos, :git_commits_url
47
+ remove_column :hubstats_repos, :issue_comment_url
48
+ remove_column :hubstats_repos, :merges_url
49
+ remove_column :hubstats_repos, :issues_url
50
+ remove_column :hubstats_repos, :pulls_url
51
+
52
+ remove_column :hubstats_users, :site_admin
53
+ remove_column :hubstats_users, :gravatar_id
54
+ remove_column :hubstats_users, :followers_url
55
+ remove_column :hubstats_users, :following_url
56
+ remove_column :hubstats_users, :gists_url
57
+ remove_column :hubstats_users, :starred_url
58
+ remove_column :hubstats_users, :subscriptions_url
59
+ remove_column :hubstats_users, :organizations_url
60
+ remove_column :hubstats_users, :repos_url
61
+ remove_column :hubstats_users, :events_url
62
+ remove_column :hubstats_users, :received_events_url
63
+ end
64
+ end
@@ -122,6 +122,25 @@ module Hubstats
122
122
  end
123
123
  end
124
124
 
125
+ # Public - Goes through entire team database and updates the hubstats boolean based on the octokit.yml file
126
+ #
127
+ # Returns - nothing
128
+ def self.deprecate_teams_from_file
129
+ team_list = Hubstats.config.github_config["team_list"] || []
130
+ teams = Hubstats::Team.all
131
+
132
+ teams.each do |team|
133
+ if (!team_list.include? team[:name]) && (team[:hubstats] == true)
134
+ team.update_column(:hubstats, false)
135
+ team.save!
136
+ puts "Changed #{team[:name]} from true to false"
137
+ end
138
+ end
139
+
140
+ puts "All teams are up to date"
141
+ puts "Run 'rake hubstats:update_teams' or 'rake hubstats:update_teams_in_pulls' to grab more teams from GitHub"
142
+ end
143
+
125
144
  # Public - Makes a new webhook from a repository
126
145
  #
127
146
  # repo - the repository that is attempting to have a hook made with
@@ -1,3 +1,3 @@
1
1
  module Hubstats
2
- VERSION = "0.5.12"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -43,6 +43,12 @@ namespace :hubstats do
43
43
  Rake::Task['hubstats:populate:update_teams'].invoke
44
44
  end
45
45
 
46
+ desc "Deprecates teams based on the octokit.yml file"
47
+ task :deprecate_teams_from_file => :environment do
48
+ puts "Deprecating teams based on whitelist in octokit.yml"
49
+ Rake::Task['hubstats:populate:deprecate_teams_from_file'].invoke
50
+ end
51
+
46
52
  desc "Creates webhook from github for organization"
47
53
  task :make_org_webhook => :environment do
48
54
  puts "Making a webhook for an organization in octokit.yml"
@@ -36,6 +36,11 @@ namespace :hubstats do
36
36
  Rake::Task['hubstats:populate:teams'].execute
37
37
  end
38
38
 
39
+ desc "Deprecates teams based on the octokit.yml file"
40
+ task :deprecate_teams_from_file => :environment do
41
+ Hubstats::GithubAPI.deprecate_teams_from_file
42
+ end
43
+
39
44
  desc "Creates the webhook for the current org"
40
45
  task :setup_teams => :environment do
41
46
  Rake::Task['hubstats:populate:create_org_hook'].execute
@@ -10,6 +10,7 @@ module Hubstats
10
10
  team2 = create(:team, :name => "Team Two", :hubstats => false)
11
11
  team3 = create(:team, :name => "Team Three", :hubstats => true)
12
12
  team4 = create(:team, :name => "Team Four", :hubstats => true)
13
+ team5 = create(:team, :name => "Team Five", :hubstats => false)
13
14
  expect(Hubstats::Team).to receive_message_chain("with_id.order_by_name.paginate").and_return([team4, team1, team3, team2])
14
15
  allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
15
16
  get :index
@@ -5,6 +5,11 @@ FactoryGirl.define do
5
5
  hubstats true
6
6
  end
7
7
 
8
+ factory :team_false, :class => Hubstats::Team do
9
+ name "Team One"
10
+ hubstats false
11
+ end
12
+
8
13
  factory :team_hash, class:Hash do
9
14
  association :user, factory: :user_hash, strategy: :build
10
15
  id {Faker::Number.number(6).to_i}
@@ -101,6 +101,22 @@ module Hubstats
101
101
  end
102
102
  end
103
103
 
104
+ context '.deprecate_teams_from_file' do
105
+ subject {Hubstats::GithubAPI}
106
+ let(:team1) {create(:team, :name => "Team One")}
107
+ let(:team2) {create(:team, :name => "Team Two")}
108
+ let(:team3) {create(:team, :name => "Team Three")}
109
+ let(:team4) {create(:team, :name => "Team Four")}
110
+ let(:team5) {create(:team, :name => "Team Five")}
111
+
112
+ it 'should update the teams in the database based on a given whitelist' do
113
+ allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("team_list") { ["Team One", "Team Two", "Team Three", "Team Four"] }
114
+ allow(Hubstats::Team).to receive(:all).and_return( [team1, team2, team3, team4, team5] )
115
+ subject.deprecate_teams_from_file
116
+ expect(Hubstats::Team.where(name: "Team Five").first.hubstats).to eq(false)
117
+ end
118
+ end
119
+
104
120
  context ".update_hook" do
105
121
  subject {Hubstats::GithubAPI}
106
122
  let(:repo) {'hubstats'}
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20150721192612) do
14
+ ActiveRecord::Schema.define(:version => 20160112162918) do
15
15
 
16
16
  create_table "hubstats_comments", :force => true do |t|
17
17
  t.string "kind"
@@ -21,13 +21,7 @@ ActiveRecord::Schema.define(:version => 20150721192612) do
21
21
  t.datetime "created_at"
22
22
  t.datetime "updated_at"
23
23
  t.string "body"
24
- t.string "diff_hunk"
25
24
  t.integer "path"
26
- t.integer "position"
27
- t.string "original_position"
28
- t.string "line"
29
- t.string "commit_id"
30
- t.string "original_commit_id"
31
25
  t.string "html_url"
32
26
  t.string "url"
33
27
  t.string "pull_request_url"
@@ -70,24 +64,12 @@ ActiveRecord::Schema.define(:version => 20150721192612) do
70
64
  t.integer "additions"
71
65
  t.integer "deletions"
72
66
  t.integer "comments"
73
- t.integer "commits"
74
- t.integer "changed_files"
75
67
  t.string "url"
76
68
  t.string "html_url"
77
- t.string "diff_url"
78
- t.string "patch_url"
79
69
  t.string "issue_url"
80
- t.string "commits_url"
81
- t.string "review_comments_url"
82
- t.string "review_comment_url"
83
- t.string "comments_url"
84
- t.string "statuses_url"
85
70
  t.string "state"
86
71
  t.string "title"
87
- t.string "body"
88
- t.string "merge_commit_sha"
89
72
  t.string "merged"
90
- t.string "mergeable"
91
73
  t.integer "deploy_id"
92
74
  t.integer "merged_by"
93
75
  t.datetime "merged_at"
@@ -106,36 +88,8 @@ ActiveRecord::Schema.define(:version => 20150721192612) do
106
88
  t.datetime "pushed_at"
107
89
  t.datetime "created_at"
108
90
  t.datetime "updated_at"
109
- t.string "homepage"
110
- t.string "language"
111
- t.integer "forks_count"
112
- t.integer "stargazers_count"
113
- t.integer "watches_count"
114
- t.integer "size"
115
- t.integer "open_issues_count"
116
- t.boolean "has_issues"
117
- t.boolean "has_wiki"
118
- t.boolean "has_downloads"
119
- t.boolean "private"
120
- t.boolean "fork"
121
- t.string "description"
122
- t.string "default_branch"
123
91
  t.string "url"
124
92
  t.string "html_url"
125
- t.string "clone_url"
126
- t.string "git_url"
127
- t.string "ssh_url"
128
- t.string "svn_url"
129
- t.string "mirror_url"
130
- t.string "hooks_url"
131
- t.string "issue_events_url"
132
- t.string "events_url"
133
- t.string "contributors_url"
134
- t.string "git_commits_url"
135
- t.string "issue_comment_url"
136
- t.string "merges_url"
137
- t.string "issues_url"
138
- t.string "pulls_url"
139
93
  t.string "labels_url"
140
94
  end
141
95
 
@@ -157,22 +111,11 @@ ActiveRecord::Schema.define(:version => 20150721192612) do
157
111
  create_table "hubstats_users", :force => true do |t|
158
112
  t.string "login"
159
113
  t.string "role"
160
- t.boolean "site_admin"
161
- t.datetime "created_at", :null => false
162
- t.datetime "updated_at", :null => false
114
+ t.datetime "created_at", :null => false
115
+ t.datetime "updated_at", :null => false
163
116
  t.string "avatar_url"
164
- t.string "gravatar_id"
165
117
  t.string "url"
166
118
  t.string "html_url"
167
- t.string "followers_url"
168
- t.string "following_url"
169
- t.string "gists_url"
170
- t.string "starred_url"
171
- t.string "subscriptions_url"
172
- t.string "organizations_url"
173
- t.string "repos_url"
174
- t.string "events_url"
175
- t.string "received_events_url"
176
119
  end
177
120
 
178
121
  end
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.5.12
4
+ version: 0.6.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: 2015-09-15 00:00:00.000000000 Z
12
+ date: 2016-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -283,6 +283,7 @@ files:
283
283
  - db/migrate/20150706205049_create_hubstats_teams_users.rb
284
284
  - db/migrate/20150713185013_add_team_id_to_prs.rb
285
285
  - db/migrate/20150721192612_add_indexes_to_tables.rb
286
+ - db/migrate/20160112143749_delete_unused_columns.rb
286
287
  - db/seeds.rb
287
288
  - hubstats.gemspec
288
289
  - lib/generators/hubstats/install_generator.rb
@@ -380,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
381
  version: '0'
381
382
  requirements: []
382
383
  rubyforge_project:
383
- rubygems_version: 2.4.6
384
+ rubygems_version: 2.4.8
384
385
  signing_key:
385
386
  specification_version: 4
386
387
  summary: Github Statistics