hubstats 0.3.17 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +0 -1
  3. data/CHANGELOG.markdown +10 -0
  4. data/MIT-LICENSE +3 -1
  5. data/README.md +2 -2
  6. data/app/assets/javascripts/hubstats/application.js +80 -24
  7. data/app/assets/javascripts/hubstats/pull_requests.js +35 -3
  8. data/app/assets/javascripts/hubstats/select2.js +8 -1
  9. data/app/assets/javascripts/hubstats/users.js +17 -5
  10. data/app/assets/stylesheets/hubstats/application.css +39 -1
  11. data/app/assets/stylesheets/hubstats/bootstrap.css +0 -6
  12. data/app/assets/stylesheets/hubstats/deploys.css +2 -0
  13. data/app/assets/stylesheets/hubstats/label.css +2 -0
  14. data/app/assets/stylesheets/hubstats/octicons.css.erb +2 -0
  15. data/app/assets/stylesheets/hubstats/pull_requests.css +2 -0
  16. data/app/controllers/hubstats/application_controller.rb +12 -4
  17. data/app/controllers/hubstats/base_controller.rb +8 -0
  18. data/app/controllers/hubstats/deploys_controller.rb +31 -8
  19. data/app/controllers/hubstats/events_controller.rb +11 -0
  20. data/app/controllers/hubstats/pull_requests_controller.rb +9 -1
  21. data/app/controllers/hubstats/repos_controller.rb +17 -3
  22. data/app/controllers/hubstats/users_controller.rb +15 -0
  23. data/app/models/hubstats/comment.rb +13 -5
  24. data/app/models/hubstats/deploy.rb +29 -6
  25. data/app/models/hubstats/label.rb +16 -4
  26. data/app/models/hubstats/pull_request.rb +44 -2
  27. data/app/models/hubstats/repo.rb +48 -4
  28. data/app/models/hubstats/user.rb +130 -32
  29. data/app/views/hubstats/deploys/index.html.erb +1 -3
  30. data/app/views/hubstats/deploys/show.html.erb +7 -2
  31. data/app/views/hubstats/partials/_comment-condensed.html.erb +3 -0
  32. data/app/views/hubstats/partials/_comment.html.erb +3 -0
  33. data/app/views/hubstats/partials/_deploy-condensed.html.erb +2 -2
  34. data/app/views/hubstats/partials/_deploy.html.erb +1 -1
  35. data/app/views/hubstats/partials/_footer.html.erb +22 -0
  36. data/app/views/hubstats/partials/_header.html.erb +18 -10
  37. data/app/views/hubstats/partials/_pull-condensed.html.erb +2 -0
  38. data/app/views/hubstats/partials/_pull.html.erb +2 -0
  39. data/app/views/hubstats/partials/_quick_addition_stats.html.erb +2 -0
  40. data/app/views/hubstats/partials/_quick_stats.html.erb +1 -0
  41. data/app/views/hubstats/partials/_repo.html.erb +2 -3
  42. data/app/views/hubstats/partials/_user-condensed.html.erb +4 -0
  43. data/app/views/hubstats/partials/_user.html.erb +4 -2
  44. data/app/views/hubstats/pull_requests/index.html.erb +6 -1
  45. data/app/views/hubstats/pull_requests/show.html.erb +5 -0
  46. data/app/views/hubstats/repos/dashboard.html.erb +6 -4
  47. data/app/views/hubstats/repos/show.html.erb +6 -1
  48. data/app/views/hubstats/tables/_comments-condensed.html.erb +2 -1
  49. data/app/views/hubstats/tables/_comments.html.erb +2 -1
  50. data/app/views/hubstats/tables/_deploys-condensed.html.erb +1 -0
  51. data/app/views/hubstats/tables/_deploys.html.erb +1 -0
  52. data/app/views/hubstats/tables/_grouped_deploys.html.erb +1 -0
  53. data/app/views/hubstats/tables/_grouped_pulls.html.erb +1 -0
  54. data/app/views/hubstats/tables/_pulls-condensed.html.erb +1 -0
  55. data/app/views/hubstats/tables/_pulls.html.erb +1 -0
  56. data/app/views/hubstats/tables/_repos-condensed.html.erb +1 -0
  57. data/app/views/hubstats/tables/_repos.html.erb +1 -0
  58. data/app/views/hubstats/tables/_users-condensed.html.erb +1 -0
  59. data/app/views/hubstats/tables/_users.html.erb +1 -1
  60. data/app/views/hubstats/users/index.html.erb +3 -2
  61. data/app/views/hubstats/users/show.html.erb +7 -1
  62. data/app/views/layouts/hubstats/application.html.erb +4 -4
  63. data/config/routes.rb +2 -1
  64. data/db/seeds.rb +41 -0
  65. data/hubstats.gemspec +1 -0
  66. data/lib/generators/hubstats/install_generator.rb +2 -1
  67. data/lib/hub_helper.rb +18 -0
  68. data/lib/hubstats.rb +0 -30
  69. data/lib/hubstats/events_handler.rb +25 -7
  70. data/lib/hubstats/github_api.rb +43 -15
  71. data/lib/hubstats/version.rb +1 -1
  72. data/lib/tasks/hubstats_tasks.rake +1 -0
  73. data/lib/tasks/populate_task.rake +2 -1
  74. data/spec/controllers/hubstats/deploys_controller_spec.rb +0 -3
  75. data/spec/controllers/hubstats/pull_requests_controller_spec.rb +3 -4
  76. data/spec/controllers/hubstats/repos_controller_spec.rb +4 -5
  77. data/spec/factories/comment.rb +2 -1
  78. data/spec/factories/deploys.rb +1 -0
  79. data/spec/factories/pull_requests.rb +1 -0
  80. data/spec/factories/repo.rb +1 -0
  81. data/spec/factories/users.rb +2 -1
  82. data/spec/lib/hubstats/github_api_spec.rb +5 -5
  83. metadata +41 -26
  84. data/date_range +0 -0
@@ -1,3 +1,3 @@
1
1
  module Hubstats
2
- VERSION = "0.3.17"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -1,3 +1,4 @@
1
+ # A variety of commands that can be used to populate the database information
1
2
  namespace :hubstats do
2
3
 
3
4
  desc "Create the database, load the schema, and pull data from Github (use hubstats:reset to also drop the db first)"
@@ -1,7 +1,8 @@
1
+ # A variety of commands that can be used to populate the database information
1
2
  namespace :hubstats do
2
3
  namespace :populate do
3
4
 
4
- desc "Pull repos from Github save to database"
5
+ desc "Pull repos from Github saves in database"
5
6
  task :setup_repos => :environment do
6
7
  Hubstats::GithubAPI.get_repos.each do |repo|
7
8
  Rake::Task["hubstats:populate:setup_repo"].execute({repo: repo})
@@ -47,7 +47,6 @@ module Hubstats
47
47
  end
48
48
 
49
49
  describe "#create" do
50
-
51
50
  before :each do
52
51
  create(:pull_request, :number => 33364992, :merged_by => 202020)
53
52
  end
@@ -60,7 +59,6 @@ module Hubstats
60
59
  expect(assigns(:deploy).git_revision).to eq("c1a2b37")
61
60
  expect(assigns(:deploy).deployed_at).to eq("2009-02-03 03:00:00 -0500")
62
61
  expect(assigns(:deploy).repo_id).to eq(101010)
63
- expect(assigns(:pull_request_id_array)).to eq([33364992, 5870592, 33691392])
64
62
  expect(assigns(:deploy).user_id).to eq(202020)
65
63
  expect(response).to have_http_status(200)
66
64
  end
@@ -72,7 +70,6 @@ module Hubstats
72
70
  "pull_request_ids" => "33364992, 5870592, 33691392"})
73
71
  expect(assigns(:deploy).git_revision).to eq("c1a2b37")
74
72
  expect(assigns(:deploy).repo_id).to eq(101010)
75
- expect(assigns(:pull_request_id_array)).to eq([33364992, 5870592, 33691392])
76
73
  expect(assigns(:deploy).user_id).to eq(202020)
77
74
  expect(response).to have_http_status(200)
78
75
  end
@@ -31,14 +31,13 @@ module Hubstats
31
31
  pull = create(:pull_request, :user => user,
32
32
  :repo => repo,
33
33
  :deploy_id => 404040)
34
- comment1 = create(:comment, :pull_request_id => pull.id, :created_at => "2015-06-16")
35
- comment2 = create(:comment, :pull_request_id => pull.id, :created_at => "2015-06-16")
36
- comment3 = create(:comment, :pull_request_id => pull.id, :created_at => "2015-06-16")
34
+ comment1 = create(:comment, :pull_request_id => pull.id, :created_at => @start_date)
35
+ comment2 = create(:comment, :pull_request_id => pull.id, :created_at => @start_date)
36
+ comment3 = create(:comment, :pull_request_id => pull.id, :created_at => @start_date)
37
37
  get :show, repo: repo, id: pull.id
38
38
  expect(assigns(:pull_request)).to eq(pull)
39
39
  expect(assigns(:pull_request).repo_id).to eq(101010)
40
40
  expect(assigns(:pull_request).deploy_id).to eq(404040)
41
- # Below test could potentially fail if the date range changes
42
41
  expect(assigns(:comments)).to contain_exactly(comment1, comment2, comment3)
43
42
  expect(assigns(:pull_request).user_id).to eq(user.id)
44
43
  end
@@ -9,21 +9,20 @@ module Hubstats
9
9
  repo1 = create(:repo, :id => 101010,
10
10
  :name => "silly",
11
11
  :full_name => "sportngin/silly",
12
- :updated_at => "2015-06-16")
12
+ :updated_at => @start_date)
13
13
  repo2 = create(:repo, :id => 202020,
14
14
  :name => "funny",
15
15
  :full_name => "sportngin/funny",
16
- :updated_at => "2015-06-16")
16
+ :updated_at => @start_date)
17
17
  repo3 = create(:repo, :id => 303030,
18
18
  :name => "loosey",
19
19
  :full_name => "sportngin/loosey",
20
- :updated_at => "2015-06-16")
20
+ :updated_at => @start_date)
21
21
  repo4 = create(:repo, :id => 404040,
22
22
  :name => "goosey",
23
23
  :full_name => "sportngin/goosey",
24
- :updated_at => "2015-06-16")
24
+ :updated_at => @start_date)
25
25
  get :index
26
- # Below test could potentially fail if the date range changes
27
26
  expect(assigns(:repos)).to contain_exactly(repo2, repo1, repo3, repo4)
28
27
  end
29
28
  end
@@ -1,3 +1,4 @@
1
+ # Generates fake comment data we can use to test with
1
2
  FactoryGirl.define do
2
3
  factory :comment, :class => Hubstats::Comment do
3
4
  user
@@ -20,4 +21,4 @@ FactoryGirl.define do
20
21
  association :comment, factory: :comment_hash, strategy: :build
21
22
  initialize_with { attributes }
22
23
  end
23
- end
24
+ end
@@ -1,3 +1,4 @@
1
+ # Generates fake deploy data we can use to test with
1
2
  FactoryGirl.define do
2
3
  factory :deploy, :class => Hubstats::Deploy do
3
4
  git_revision "3dis01"
@@ -1,3 +1,4 @@
1
+ # Generates fake pull request data we can use to test with
1
2
  FactoryGirl.define do
2
3
  factory :pull_request, :class => Hubstats::PullRequest do
3
4
  user
@@ -1,3 +1,4 @@
1
+ # Generates fake repo data we can use to test with
1
2
  FactoryGirl.define do
2
3
  factory :repo, :class => Hubstats::Repo do
3
4
  id 101010
@@ -1,3 +1,4 @@
1
+ # Generates fake user data we can use to test with
1
2
  FactoryGirl.define do
2
3
  factory :user, :class => Hubstats::User do
3
4
  login { Faker::Internet.user_name }
@@ -13,4 +14,4 @@ FactoryGirl.define do
13
14
  initialize_with { attributes }
14
15
  end
15
16
 
16
- end
17
+ end
@@ -59,11 +59,11 @@ module Hubstats
59
59
  allow(ENV).to receive(:[]).and_return(nil)
60
60
  end
61
61
 
62
- # commented out because it fails half the time as a result of so many repeated calls to Octokit
63
- #it 'should fail to initialize at all' do
64
- # Hubstats::GithubAPI.configure()
65
- # expect{Hubstats::GithubAPI.client}.to raise_error Octokit::Unauthorized
66
- #end
62
+ # If this test begins to fail, it is because there are so many repeated calls to Octokit; just comment out
63
+ it 'should fail to initialize at all' do
64
+ Hubstats::GithubAPI.configure()
65
+ expect{Hubstats::GithubAPI.client}.to raise_error Octokit::Unauthorized
66
+ end
67
67
  end
68
68
  end
69
69
 
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.3.17
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Hursh
@@ -9,48 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-25 00:00:00.000000000 Z
12
+ date: 2015-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 3.2.18
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 3.2.18
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: octokit
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '3.2'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '3.2'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: will_paginate-bootstrap
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ! '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
@@ -67,60 +67,74 @@ dependencies:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
69
  version: 3.5.9
70
+ - !ruby/object:Gem::Dependency
71
+ name: bootstrap-datepicker-rails
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 1.4.0
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 1.4.0
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rspec-rails
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - ~>
88
+ - - "~>"
75
89
  - !ruby/object:Gem::Version
76
90
  version: 3.0.0.beta
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - ~>
95
+ - - "~>"
82
96
  - !ruby/object:Gem::Version
83
97
  version: 3.0.0.beta
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: shoulda-matchers
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
- - - ~>
102
+ - - "~>"
89
103
  - !ruby/object:Gem::Version
90
104
  version: '2.6'
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
- - - ~>
109
+ - - "~>"
96
110
  - !ruby/object:Gem::Version
97
111
  version: '2.6'
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: factory_girl_rails
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
- - - ~>
116
+ - - "~>"
103
117
  - !ruby/object:Gem::Version
104
118
  version: '4.4'
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
108
122
  requirements:
109
- - - ~>
123
+ - - "~>"
110
124
  - !ruby/object:Gem::Version
111
125
  version: '4.4'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: faker
114
128
  requirement: !ruby/object:Gem::Requirement
115
129
  requirements:
116
- - - ~>
130
+ - - "~>"
117
131
  - !ruby/object:Gem::Version
118
132
  version: '1.3'
119
133
  type: :development
120
134
  prerelease: false
121
135
  version_requirements: !ruby/object:Gem::Requirement
122
136
  requirements:
123
- - - ~>
137
+ - - "~>"
124
138
  - !ruby/object:Gem::Version
125
139
  version: '1.3'
126
140
  description: Github Statistics
@@ -131,12 +145,12 @@ executables: []
131
145
  extensions: []
132
146
  extra_rdoc_files: []
133
147
  files:
134
- - .codeclimate.yml
135
- - .gitignore
136
- - .octopolo.yml
137
- - .rspec
138
- - .soyuz.yml
139
- - .travis.yml
148
+ - ".codeclimate.yml"
149
+ - ".gitignore"
150
+ - ".octopolo.yml"
151
+ - ".rspec"
152
+ - ".soyuz.yml"
153
+ - ".travis.yml"
140
154
  - CHANGELOG.markdown
141
155
  - Gemfile
142
156
  - MIT-LICENSE
@@ -187,6 +201,7 @@ files:
187
201
  - app/views/hubstats/partials/_comment.html.erb
188
202
  - app/views/hubstats/partials/_deploy-condensed.html.erb
189
203
  - app/views/hubstats/partials/_deploy.html.erb
204
+ - app/views/hubstats/partials/_footer.html.erb
190
205
  - app/views/hubstats/partials/_header.html.erb
191
206
  - app/views/hubstats/partials/_pull-condensed.html.erb
192
207
  - app/views/hubstats/partials/_pull.html.erb
@@ -215,7 +230,6 @@ files:
215
230
  - app/views/hubstats/users/show.html.erb
216
231
  - app/views/layouts/hubstats/application.html.erb
217
232
  - config/routes.rb
218
- - date_range
219
233
  - db/migrate/20140604130339_create_hubstats_pull_requests.rb
220
234
  - db/migrate/20140604130457_create_hubstats_users.rb
221
235
  - db/migrate/20140604130504_create_hubstats_comments.rb
@@ -227,6 +241,7 @@ files:
227
241
  - db/migrate/20150605184015_add_user_id_delete_deployed_by_to_deploy.rb
228
242
  - db/migrate/20150605190549_add_merged_by_column_to_pull_request.rb
229
243
  - db/migrate/20150625164705_make_merged_at_datetime.rb
244
+ - db/seeds.rb
230
245
  - hubstats.gemspec
231
246
  - lib/generators/hubstats/install_generator.rb
232
247
  - lib/generators/hubstats/octokit.example.yml
@@ -308,17 +323,17 @@ require_paths:
308
323
  - lib
309
324
  required_ruby_version: !ruby/object:Gem::Requirement
310
325
  requirements:
311
- - - ! '>='
326
+ - - ">="
312
327
  - !ruby/object:Gem::Version
313
328
  version: '0'
314
329
  required_rubygems_version: !ruby/object:Gem::Requirement
315
330
  requirements:
316
- - - ! '>='
331
+ - - ">="
317
332
  - !ruby/object:Gem::Version
318
333
  version: '0'
319
334
  requirements: []
320
335
  rubyforge_project:
321
- rubygems_version: 2.4.7
336
+ rubygems_version: 2.2.2
322
337
  signing_key:
323
338
  specification_version: 4
324
339
  summary: Github Statistics
data/date_range DELETED
File without changes