hubstats 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.markdown +1 -0
  3. data/README.md +10 -4
  4. data/app/assets/javascripts/hubstats/deploys.js +0 -0
  5. data/app/assets/stylesheets/hubstats/application.css +14 -8
  6. data/app/assets/stylesheets/hubstats/bootstrap.css +1 -1
  7. data/app/controllers/hubstats/deploys_controller.rb +42 -0
  8. data/app/controllers/hubstats/repos_controller.rb +3 -0
  9. data/app/controllers/hubstats/users_controller.rb +2 -0
  10. data/app/models/hubstats/deploy.rb +36 -0
  11. data/app/views/hubstats/deploys/index.html.erb +40 -0
  12. data/app/views/hubstats/deploys/show.html.erb +18 -0
  13. data/app/views/hubstats/partials/_deploy.html.erb +23 -0
  14. data/app/views/hubstats/partials/_deploys-condensed.html.erb +18 -0
  15. data/app/views/hubstats/partials/_header.html.erb +2 -1
  16. data/app/views/hubstats/partials/_pull-condensed.html.erb +1 -1
  17. data/app/views/hubstats/partials/_quick_stats.html.erb +6 -0
  18. data/app/views/hubstats/repos/dashboard.html.erb +8 -8
  19. data/app/views/hubstats/repos/show.html.erb +1 -1
  20. data/app/views/hubstats/tables/_deploys-condensed.html.erb +7 -0
  21. data/app/views/hubstats/tables/_deploys.html.erb +7 -0
  22. data/app/views/hubstats/tables/_grouped_deploys.html.erb +16 -0
  23. data/config/routes.rb +9 -10
  24. data/db/migrate/20150526154850_create_hubstats_deploys.rb +10 -0
  25. data/db/seeds.rb +30 -0
  26. data/hubstats.gemspec +2 -2
  27. data/lib/generators/hubstats/octokit.example.yml +1 -1
  28. data/lib/hubstats/version.rb +1 -1
  29. data/lib/tasks/hubstats_tasks.rake +7 -1
  30. data/test/dummy/db/schema.rb +8 -1
  31. metadata +16 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWQ4NWFiMTY4ZjY2NGYxODgwZmVlNTI1YjI0ODkxMGRlNzkyMzcwNA==
4
+ YmYyMTJlM2ZlOWJhNDFjYjcwNTI3Yjg4OWJkYmVmZTQ3MTg2ZDZiNw==
5
5
  data.tar.gz: !binary |-
6
- OTZhZjVlNDk1ZmE4ZDdiZDE2NDVjMGJkMWI0YTkzOTk1MDZhNzAyOQ==
6
+ ZmQzYjZlNjMwYWJiZjBmYWY1NTBmMWY4YTFiN2FiOGY2NWNlNmQwMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWM1MzNiYzg0ZWZmNzU4NGYzNzg3NjRlYzU4NDVkODcyOTEwMzhhMDRlNGFh
10
- ZDEzMjRkZmY3NjJlNjU5M2IxY2JjZjBkZGJiODUwMzljYzM5NmUyYTMyNzU4
11
- M2ViNDkxZWQxN2UwOGQxNzBmMzEwODI1ZTk3NTZhMDRkYjk3ZGM=
9
+ YWQyN2QwMDAyNzBkYzg4MWZmZjJlMjM1NDkzMTU3ZjM5YzcyNDc2NGFjNzBh
10
+ MGI3OWFiZGUyMTA5ODg0NWE2ZWJhNTE1OTk5Mzk3MGIzZWQ2YmY3NTBjYjZi
11
+ MWMxMTg0ODA0MGNlMjU5MmQ5NzBhYTRhNGZmMzRmNWQwZTA0MTM=
12
12
  data.tar.gz: !binary |-
13
- NDQ0YTQwNzQ4MGE4MzZlZWNhMTQ2ZjRhNmExOGFhZGRiNjdhY2ViZTUxMWE2
14
- Mzk5Y2UzNTNmNzA4ZmYwODU4MzA2YmQwNzNhZTI2MDhkYjM0MDYwYWEwMzNj
15
- NTgzMmVlZjI1MTczMTJmNDYzZGZjMWY0ZmEwYzBiNWNmY2ZmNTg=
13
+ NDJhNGQ5OTk3MTY3YzZkNTY4ZWE0ZGRhZjhiMzAzOWRjM2ExYTMwNzYyNzcx
14
+ Y2ZjYWQ5YWM4ODUyNTRhYWQ4NWE2ZWVmY2I2ZjM4NDE1MDMxOGNkZjgwMjhk
15
+ MmQ1NzhiYmIzMTlmYjEzNGJmM2RhODRmOTgzNDg2YmZlOGUzOGE=
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,4 @@
1
+ #### v0.3.0
1
2
  #### v0.2.3
2
3
  #### v0.2.2
3
4
  #### v0.2.1
data/README.md CHANGED
@@ -4,6 +4,8 @@ Hubstats is a rails plugin which allows you to search and monitor pull requests
4
4
 
5
5
  ## Setup
6
6
 
7
+ The following setup is designed to only be used when integrating this plugin into a rails application or for when adding new migrations.
8
+
7
9
  Run `rails generate hubstats:install`.
8
10
 
9
11
  Run `rake hubstats:install:migrations`.
@@ -18,13 +20,13 @@ Hubstats is a rails plugin which allows you to search and monitor pull requests
18
20
 
19
21
  Hubstats needs Github credentials to access your repos, these can be setup in one of two ways:
20
22
 
21
- #### octokit.yml
23
+ #### Configuring the `octokit.yml`
22
24
 
23
- Add your GitHub API token or ClientID and Secret to octokit.yml.
25
+ Add your GitHub API token or ClientID and Secret to `octokit.yml`.
24
26
 
25
27
  #### Environment Variables
26
28
 
27
- Hubstats can also use OAUTH access tokens stored in ENV["GITHUB_API_TOKEN"] or for Application Authentication in ENV["CLIENT_ID"] and ENV["CLIENT_SECRET"], if for some reason you don't want to store them in octokit.yml.
29
+ Hubstats can also use OAUTH access tokens stored in ENV["GITHUB_API_TOKEN"] or for Application Authentication in ENV["CLIENT_ID"] and ENV["CLIENT_SECRET"], if for some reason you don't want to store them in `octokit.yml`.
28
30
 
29
31
  ### Webhooks
30
32
 
@@ -44,11 +46,15 @@ Set the endpoint to be:
44
46
 
45
47
  Hubstats needs to know what repos for it to watch. You can set it to watch either an entire organization or a list of specific repos in octokit.yml.
46
48
 
49
+ ### Testing
50
+
51
+ All of the automated tests are written in RSpec. Since hubstats is a plugin, not an application, we need to install the plugin into a Rails application to run. The `test` directory is a dummy rails application for manually testing the UI by serving hubstats locally. When developing and using the `test/dummy` locally, then the test will automatically sync with any updated code, so it doesn't need to be re-served when changes are made with the normal Rails application. When in the development process, one just needs to run `rails s` once from the command line (while in `test/dummy`) to serve the plugin. http://guides.rubyonrails.org/plugins.html will give more information on the implementation of a Rails plugin.
52
+
47
53
  ## TL:DR
48
54
 
49
55
  Run `rails generate hubstats:install`.
50
56
 
51
- Configure octokit.yml with your Github information.
57
+ Configure `octokit.yml` with your Github information.
52
58
 
53
59
  Run `rake hubstats:install:migrations`.
54
60
 
File without changes
@@ -45,7 +45,9 @@
45
45
  .single-pull > .user-image,
46
46
  .single-pull > .user-image-small,
47
47
  .single-user > .user-image,
48
- .single-user > .user-image-small {
48
+ .single-user > .user-image-small,
49
+ .single-deploy > .user-image,
50
+ .single-deploy > .user-image-small {
49
51
  padding: 5px;
50
52
  }
51
53
 
@@ -70,7 +72,7 @@
70
72
  height: 36px;
71
73
  }
72
74
 
73
- .pulls, .comments, .users, .repos {
75
+ .pulls, .comments, .users, .repos, .deploys {
74
76
  margin: 15px 0px 15px 0px;
75
77
  border: 1px solid #ccc;
76
78
  border-radius: 5px;
@@ -80,20 +82,22 @@
80
82
  margin: 0px 0px 15px 0px;
81
83
  }
82
84
 
83
- .pulls > .col, .comments > .col, .users > .col, .repos > .col{
85
+ .pulls > .col, .comments > .col, .users > .col, .repos > .col, .deploys > .col {
84
86
  padding: 0px 5px 0px 5px;
85
87
  }
86
88
 
87
89
  .row .single-pull,
88
90
  .row .single-comment,
89
91
  .row .single-user,
90
- .row .single-repo {
92
+ .row .single-repo,
93
+ .row .single-deploy {
91
94
  padding:5px;
92
95
  margin: 0px;
93
96
  border-bottom: 1px solid #ccc;
94
97
  }
95
98
 
96
- .single-pull.group-header {
99
+ .single-pull.group-header,
100
+ .single-deploy.group-header {
97
101
  padding: 10px;
98
102
  background-color: #F5F5F5;
99
103
  }
@@ -108,13 +112,15 @@
108
112
 
109
113
  .single-pull > .pull-info,
110
114
  .single-user > .user-info,
111
- .single-repo > .repo-info {
115
+ .single-repo > .repo-info,
116
+ .single-deploy > .deploy-info, {
112
117
  padding: 0px;
113
118
  }
114
119
 
115
120
  .pull-info > h4,
116
121
  .user-info > h4,
117
- .repo-info > h4 {
122
+ .repo-info > h4,
123
+ .deploy-info > h4 {
118
124
  margin: 0px;
119
125
  }
120
126
 
@@ -138,4 +144,4 @@
138
144
  a.header:hover {
139
145
  cursor: pointer;
140
146
  text-decoration: none;
141
- }
147
+ }
@@ -5781,4 +5781,4 @@ button.close {
5781
5781
  .hidden-print {
5782
5782
  display: none !important;
5783
5783
  }
5784
- }
5784
+ }
@@ -0,0 +1,42 @@
1
+ require_dependency "hubstats/application_controller"
2
+
3
+ module Hubstats
4
+ class DeploysController < ApplicationController
5
+
6
+ def index
7
+ #deploy_id = Hubstats::Deploy
8
+ # .order_with_timespan(@timespan, "ASC")
9
+ # .belonging_to_users(params[:users])
10
+ # .belonging_to_repos(params[:repo])
11
+ # .has_many_pull_requests(params[:pull_requests])
12
+ # .map(&:id)
13
+
14
+ # sets to include user and repo, and sorts data
15
+ @deploys = Hubstats::Deploy.includes(:user).includes(:repo)
16
+ .order_with_timespan(@timespan, params[:order])
17
+ # .belonging_to_users(params[:users]).belonging_to_repos(params[:repos])
18
+ # .paginate(:page => params[:page], :per_page => 15).order("deployed_at DESC")
19
+
20
+ if params[:group] == 'user'
21
+ @groups = @deploys.to_a.group_by(&:user_name)
22
+ elsif params[:group] == 'repo'
23
+ @groups = @deploys.to_a.group_by(&:repo_name)
24
+ else
25
+ @groups = nil
26
+ end
27
+ end
28
+
29
+ def show
30
+ end
31
+
32
+ def create
33
+ @deploy = Deploy.new(params[:deploy])
34
+ if @deploy.save
35
+ redirect_to :action => 'index'
36
+ else
37
+ render :nothing => true, :status => 400
38
+ end
39
+ end
40
+
41
+ end
42
+ end
@@ -22,9 +22,11 @@ module Hubstats
22
22
  @pull_requests = Hubstats::PullRequest.belonging_to_repo(@repo.id).updated_since(@timespan).order("updated_at DESC").limit(20)
23
23
  @users = Hubstats::User.with_pulls_or_comments(@timespan,@repo.id).only_active.limit(20)
24
24
  @pull_count = Hubstats::PullRequest.belonging_to_repo(@repo.id).updated_since(@timespan).count(:all)
25
+ @deploy_count = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_since(@timespan).count(:all)
25
26
  @user_count = Hubstats::User.with_pulls_or_comments(@timespan,@repo.id).only_active.length
26
27
  @stats = {
27
28
  user_count: @user_count,
29
+ deploy_count: @deploy_count,
28
30
  pull_count: @pull_count,
29
31
  comment_count: Hubstats::Comment.belonging_to_repo(@repo.id).created_since(@timespan).count(:all),
30
32
  avg_additions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).average(:additions).to_i,
@@ -41,6 +43,7 @@ module Hubstats
41
43
  @user_count = Hubstats::User.with_pulls_or_comments(@timespan).only_active.length
42
44
  @stats = {
43
45
  user_count: @user_count,
46
+ deploy_count: Hubstats::Deploy.count(:all),
44
47
  pull_count: Hubstats::PullRequest.merged_since(@timespan).count(:all),
45
48
  comment_count: Hubstats::Comment.created_since(@timespan).count(:all),
46
49
  avg_additions: Hubstats::PullRequest.merged_since(@timespan).average(:additions).to_i,
@@ -24,9 +24,11 @@ module Hubstats
24
24
  @comments = Hubstats::Comment.belonging_to_user(@user.id).created_since(@timespan).order("created_at DESC").limit(20)
25
25
  @review = Hubstats::User.pulls_reviewed_count(@timespan).where(login: params[:id]).first
26
26
  @pull_count = Hubstats::PullRequest.belonging_to_user(@user.id).updated_since(@timespan).count(:all)
27
+ #@deploy_count = Hubstats::Deploy.belonging_to_user(@user.id).deployed_since(@timespan).count(:all)
27
28
  @comment_count = Hubstats::Comment.belonging_to_user(@user.id).created_since(@timespan).count(:all)
28
29
  @stats = {
29
30
  pull_count: Hubstats::PullRequest.belonging_to_user(@user.id).merged_since(@timespan).count(:all),
31
+ #deploy_count: Hubstats::Deploy.belonginging_to_user(@user.id).deployed_since(@timespan).count(:all),
30
32
  comment_count: @comment_count,
31
33
  review_count: @review ? @review.reviews_count : 0,
32
34
  avg_additions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_user(@user.id).average(:additions).to_i,
@@ -0,0 +1,36 @@
1
+ module Hubstats
2
+ class Deploy < ActiveRecord::Base
3
+
4
+ scope :deployed_since, lambda {|time| where("hubstats_deploys.deployed_at > ?", time) }
5
+ scope :belonging_to_repo, lambda {|repo_id| where(repo_id: repo_id)}
6
+ scope :belonging_to_user, lambda {|user_id| where(user_id: user_id)}
7
+ scope :belonging_to_repos, lambda {|repo_id| where(repo_id: repo_id.split(',')) if repo_id}
8
+ scope :belonging_to_users, lambda {|user_id| where(user_id: user_id.split(',')) if user_id}
9
+ scope :order_with_timespan
10
+ #scope :has_many_pull_requests, lambda {|| where(....)}
11
+
12
+ attr_accessible :git_revision, :repo_id, :deployed_at, :deployed_by
13
+
14
+ belongs_to :user
15
+ belongs_to :repo
16
+ has_many :pull_requests
17
+
18
+ # Order the data in a given timespan in a given order
19
+ def self.order_with_timespan(timespan, order)
20
+ order = ["ASC", "DESC"].detect{|order_type| order_type.to_s == order.to_s.upcase } || "DESC"
21
+ deployed_since(timespan).order("hubstats_deploys.deployed_at #{order}")
22
+ end
23
+
24
+ # Sorts based on whether data is being grouped by user or repo
25
+ #def self.group_by(group)
26
+ # if group == 'user'
27
+ # with_user_name.order("user_name ASC")
28
+ # elsif group == 'repo'
29
+ # with_repo_name.order("repo_name asc")
30
+ # else
31
+ # scoped
32
+ # end
33
+ # end
34
+
35
+ end
36
+ end
@@ -0,0 +1,40 @@
1
+ <div class="container" %>
2
+ <div class="row" %>
3
+ <div class="col col-lg-3 col-md-3 col-sm-3">
4
+
5
+ <!--This div is the two controls on the top left, one is for repos and one is for users-->
6
+ <div class="form-group">
7
+ <input class="select2-control" id="repos">
8
+ </input>
9
+ </div>
10
+ <div class="form-group">
11
+ <input class="select2-control" id="users">
12
+ </input>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="col col-lg-9 col-md-9 col-sm-9">
17
+ <!--The below div is for the different buttons that control the sorting of what deploys users want to view-->
18
+ <div id="sort-group" class="btn-group" data-toggle="buttons">
19
+ <label class="btn btn-default" id="desc">
20
+ <input type="radio" name="sort"> Newest
21
+ </label>
22
+ <label class="btn btn-default" id="asc">
23
+ <input type="radio" name="sort"> Oldest
24
+ </label>
25
+ </div>
26
+
27
+ <!--The following div is for the group by drop down menu on the top right (but not the timespan one)-->
28
+ <select id="group-by" class="form-control pull-right" style="width: 100px; display: inline; ">
29
+ <option value="">Group By</option>
30
+ <option value="user">User</option>
31
+ <option value="repo">Repo</option>
32
+ </select>
33
+
34
+ <%= render 'hubstats/tables/deploys' %>
35
+
36
+
37
+
38
+ </div>
39
+ </div>
40
+ </div>
@@ -0,0 +1,18 @@
1
+ <div class="container" id="repo">
2
+ <!-- <div class="row">
3
+ <h1 class="title text-center">
4
+ <%= link_to @deploy.name.titleize, deploy_path %> /
5
+ <a href=<%=@deploy.html_url%>>
6
+ <%= @deploy.title.titleize %>
7
+ </a>
8
+ </h1>
9
+ <%= render 'hubstats/partials/quick_stats' %>
10
+ </div>
11
+
12
+ <div class="col col-lg-8 col-lg-offset-2">
13
+ <div class="row">
14
+ <h4> Comments </h4>
15
+ <%= render 'hubstats/tables/comments' %>
16
+ </div>
17
+ </div> -->
18
+ </div>
@@ -0,0 +1,23 @@
1
+ <div class="row single-deploy">
2
+
3
+ <!-- <div class="user-image col-lg-1 col-md-1 col-sm-1" >
4
+ <img src= <%= deploy.deployed_by%> alt= <%= deploy.deployed_by%> >
5
+ </div>-->
6
+
7
+ <div class="deploy-info col-lg-9 col-md-9 col-sm-9">
8
+ <h4>
9
+ <%= link_to deploy.repo.name, repo_path(deploy.repo.name) %>
10
+ </h4>
11
+ <br> <!--will eventually have to get link working-->
12
+ by <%= link_to deploy.deployed_by, user_path(deploy.deployed_by) %>
13
+ <%= "#{time_ago_in_words(deploy.deployed_at)} ago "%>
14
+ </div>
15
+
16
+ <div class="col-lg-2 col-md-2 col-sm-2" >
17
+ <div class="deploy-right">
18
+ <a class="subtle"
19
+ <span class="octicon octicon-mark-github"></span>
20
+ </a>
21
+ </div>
22
+ </div>
23
+ </div>
@@ -0,0 +1,18 @@
1
+ <div class="row single-deploy">
2
+
3
+ <div class="deploy-info col-lg-9 col-md-9 col-sm-9 col-xs-8">
4
+ <h4>
5
+ <%= link_to deploy.repo.name, repo_path({:repo => deploy.repo.name, :id => deploy.id}) %>
6
+ </h4>
7
+ by <%= link_to deploy.deployed_by, user_path(deploy.deployed_by) %>
8
+ <%= "#{time_ago_in_words(deploy.deployed_at)} ago "%>
9
+ </div>
10
+
11
+ <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2" >
12
+ <div class="deploy-right">
13
+ <a class="subtle" href=<%= deploy.html_url %> >
14
+ <span class="octicon octicon-mark-github"></span>
15
+ </a>
16
+ </div>
17
+ </div>
18
+ </div>
@@ -14,6 +14,7 @@
14
14
 
15
15
  <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
16
16
  <ul class="nav navbar-nav navbar-right">
17
+ <li><%= link_to "Deploys", deploys_path%></li>
17
18
  <li><%= link_to "Metrics", metrics_path%></li>
18
19
  <li><%= link_to "Pulls", root_path%></li>
19
20
  <li><%= link_to "Users", users_path%></li>
@@ -28,4 +29,4 @@
28
29
  </div>
29
30
  </div>
30
31
  </nav>
31
- </div>
32
+ </div>
@@ -26,4 +26,4 @@
26
26
  </span>
27
27
  </div>
28
28
  </div>
29
- </div>
29
+ </div>
@@ -5,6 +5,12 @@
5
5
  <h4> Active Users </h4>
6
6
  </div>
7
7
  <% end %>
8
+ <% if @stats.has_key? :deploy_count %>
9
+ <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
10
+ <h1> <%= @stats[:deploy_count] %> </h1>
11
+ <h4> Deploys </h4>
12
+ </div>
13
+ <% end %>
8
14
  <% if @stats.has_key? :pull_count %>
9
15
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
10
16
  <h1> <%= @stats[:pull_count] %> </h1>
@@ -2,23 +2,23 @@
2
2
  <div class="row text-center">
3
3
  <%= render 'hubstats/partials/quick_stats' %>
4
4
  </div>
5
+
5
6
  <div class="row">
6
-
7
- <div class="col col-lg-6">
8
- <h3> Active Repositories </h3>
7
+ <div class="col col-lg-12">
8
+ <h3> All Repositories </h3>
9
9
  <%= render 'hubstats/tables/repos' %>
10
- <% if @repo_count > 20 %>
10
+ <!-- <% if @repo_count > 20 %>
11
11
  <p class="pull-right"><%= link_to "View All", repos_path %></p>
12
- <% end %>
12
+ <% end %>-->
13
13
  </div>
14
14
 
15
- <div class="col col-lg-6">
15
+ <!-- <div class="col col-lg-6">
16
16
  <h3> Active Users </h3>
17
17
  <%= render 'hubstats/tables/users-condensed' %>
18
18
  <% if @user_count > 20 %>
19
19
  <p class="pull-right"><%= link_to "View All", users_path %></p>
20
20
  <% end %>
21
- </div>
21
+ </div> -->
22
22
 
23
23
  </div>
24
- </div>
24
+ </div>
@@ -22,4 +22,4 @@
22
22
 
23
23
  </div>
24
24
 
25
- </div>
25
+ </div>
@@ -0,0 +1,7 @@
1
+ <% if @deploys.length > 0 %>
2
+ <div class="deploys">
3
+ <%= render partial: 'hubstats/partials/deploys-condensed', collection: @deploys, as: :deploy %>
4
+ </div>
5
+ <% else %>
6
+ <p> No deploys to show </p>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if @deploys.length > 0 %>
2
+ <div class="deploys">
3
+ <%= render partial: 'hubstats/partials/deploy', collection: @deploys, as: :deploy %>
4
+ </div>
5
+ <% else %>
6
+ <p> No deploys to show </p>
7
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <% if @deploys.length > 0 %>
2
+ <% if @groups %>
3
+ <% @groups.each do |group| %>
4
+ <div class="deploys">
5
+ <div class="row single-pull group-header">
6
+ <h3> <%= group[0] %> </h3>
7
+ </div>
8
+ <%= render partial: 'hubstats/partials/deploy', collection: group[1], as: :deploy %>
9
+ </div>
10
+ <% end %>
11
+ <% else %>
12
+ <%= render 'hubstats/tables/deploys' %>
13
+ <% end %>
14
+ <% else %>
15
+ <p> No deploys to show </p>
16
+ <% end %>
data/config/routes.rb CHANGED
@@ -1,15 +1,14 @@
1
1
  Hubstats::Engine.routes.draw do
2
- root to: "pull_requests#index"
3
-
4
- post "/handler" => "events#handler", :as => "handler"
5
- get "/metrics" => "repos#dashboard", :as => "metrics"
6
- get "/pulls" => "pull_requests#index", :as => :pulls
7
- get "/users" => "users#index", :as => :users
8
- get "/repos" => "repos#index", :as => :repos
9
- get "/user/:id" => "users#show", :as => :user
10
- get "/:repo" => "repos#show", :as => :repo
2
+ root to: "pull_requests#index" #sets default root to be the pulls page
3
+ post "/handler" => "events#handler", :as => :handler
4
+ resources :deploys, :only => [:index, :create] #routes to both index and to create method
5
+ get "/metrics" => "repos#dashboard", :as => :metrics #routes to list of repos and stats
6
+ get "/pulls" => "pull_requests#index", :as => :pulls #routes to list of pulls
7
+ get "/users" => "users#index", :as => :users #routes to list of users
8
+ get "/user/:id" => "users#show", :as => :user #routes to specific user's contributions
9
+ get "/repos" => "repos#dashboard", :as => :repos #routes to list of repos and stats
10
+ get "/:repo" => "repos#show", :as => :repo #routes to specific repo's stats
11
11
  scope "/:repo", :as => :repo do
12
12
  get '/pull/:id' => "pull_requests#show", :as => :pull
13
13
  end
14
-
15
14
  end
@@ -0,0 +1,10 @@
1
+ class CreateHubstatsDeploys < ActiveRecord::Migration
2
+ def change
3
+ create_table :hubstats_deploys do |t|
4
+ t.string :git_revision
5
+ t.integer :repo_id
6
+ t.timestamp :deployed_at
7
+ t.string :deployed_by
8
+ end
9
+ end
10
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,30 @@
1
+ deploy_list = [
2
+ ["c1a2b37", "sportngin/ngin", "2009-12-03 18:00:00 -0500", "emmasax1"],
3
+ ["i32jb9e", "sportngin/linkshare", "2010-05-26 17:00:00 -0500", "aplackner"],
4
+ ["w19dkid", "sportngin/active_zuora_v1", "2011-08-21 02:00:00 -0500", "jonkarna"],
5
+ ["n83b20c", "sportngin/boss_service", "2006-11-08 05:00:00 -0500", "gorje001"],
6
+ ["c92kda8", "sportngin/pocket_ngin", "2008-11-10 12:00:00 -0500", "NickLaMuro"],
7
+ ["b91k9dk", "sportngin/user_service", "2010-02-18 11:00:00 -0500", "matthewkrieger"],
8
+ ["ieoq630", "sportngin/simple_benchmark", "2007-04-14 11:00:00 -0500", "melcollova"],
9
+ ["c1a2b38", "sportngin/ngin", "2009-12-03 18:01:00 -0500", "emmasax1"],
10
+ ["c1a2b39", "sportngin/ngin", "2009-12-04 13:00:00 -0500", "lukeludwig"],
11
+ ["29xkdi9", "sportngin/tst_dashboard", "2015-01-18 14:00:00 -0500", "mrreynolds"],
12
+ ["9xkdjqk", "sportngin/automation", "2015-03-21 07:00:00 -0500", "lackac"],
13
+ ["is93h1n", "sportngin/janky", "2014-12-31 09:00:00 -0500", "EvaMartinuzzi"],
14
+ ["kdiq13j", "sportngin/ngin", "2013-11-17 04:00:00 -0500", "Olson3R"],
15
+ ["ciap1kd", "sportngin/statcore_ice_hockey", "2010-08-29 01:00:00 -0500", "odelltuttle"],
16
+ ["iek9s0d", "sportngin/freshbooks.rb", "2015-05-13 12:00:00 -0500", "tombadaczewski"],
17
+ ["918240d", "sportngin/pocket_ngin", "2015-04-01 03:00:00 -0500", "plaincheesepizza"],
18
+ ["dis8203", "sportngin/sport_ngin_live", "2015-02-27 08:00:00 -0500", "GeoffreyHinck"],
19
+ ["2kd9sac", "sportngin/jarvis", "2015-05-26 03:00:00 -0500", "Bleisz22"],
20
+ ["0slqi83", "sportngin/utils", "2015-05-27 13:00:00 -0500", "cdelrosario"],
21
+ ["c92k102", "sportngin/passenger", "2015-05-27 12:00:00 -0500", "panderson74"]
22
+ ]
23
+
24
+ def replace_name_with_id (repo_name)
25
+ return Hubstats::Repo.where(full_name: repo_name).first.id.to_i
26
+ end
27
+
28
+ deploy_list.each do |git_revision, repo_name, deployed_at, deployed_by|
29
+ Hubstats::Deploy.create(git_revision: git_revision, repo_id: replace_name_with_id(repo_name), deployed_at: deployed_at, deployed_by: deployed_by)
30
+ end
data/hubstats.gemspec CHANGED
@@ -7,8 +7,8 @@ require "hubstats/version"
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "hubstats"
9
9
  s.version = Hubstats::VERSION
10
- s.authors = ["Elliot Hursh"]
11
- s.email = ["elliothursh@gmail.com"]
10
+ s.authors = ["Elliot Hursh", "Emma Sax"]
11
+ s.email = ["elliothursh@gmail.com", "emma.sax4@gmail.com"]
12
12
  s.homepage = ""
13
13
  s.summary = "Github Statistics"
14
14
  s.description = "Github Statistics"
@@ -8,4 +8,4 @@ github_config: # Must include either org_name || repo_list
8
8
  # repo_list: [<ARRAY OF REPOS>]
9
9
 
10
10
  webhook_secret: #<40 CHARACTER ACCESS TOKEN >
11
- webhook_endpoint: #<url of webhook enpoint>
11
+ webhook_endpoint: #<url of webhook endpoint>
@@ -1,3 +1,3 @@
1
1
  module Hubstats
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -23,4 +23,10 @@ namespace :hubstats do
23
23
  Rake::Task['hubstats:populate:update_repos'].invoke
24
24
  end
25
25
 
26
- end
26
+ desc "Updates the seed"
27
+ task :seed => :environment do
28
+ puts "Updating seed"
29
+ Rake::Task['db:seed'].invoke
30
+ end
31
+
32
+ end
@@ -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 => 20150521203261) do
14
+ ActiveRecord::Schema.define(:version => 20150526155910) do
15
15
 
16
16
  create_table "hubstats_comments", :force => true do |t|
17
17
  t.string "kind"
@@ -36,6 +36,13 @@ ActiveRecord::Schema.define(:version => 20150521203261) do
36
36
  add_index "hubstats_comments", ["pull_request_id"], :name => "index_hubstats_comments_on_pull_request_id"
37
37
  add_index "hubstats_comments", ["user_id"], :name => "index_hubstats_comments_on_user_id"
38
38
 
39
+ create_table "hubstats_deploys", :force => true do |t|
40
+ t.string "git_revision"
41
+ t.integer "repo_id"
42
+ t.datetime "deployed_at"
43
+ t.string "deployed_by"
44
+ end
45
+
39
46
  create_table "hubstats_labels", :force => true do |t|
40
47
  t.string "name"
41
48
  t.string "color"
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Hursh
8
+ - Emma Sax
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
12
+ date: 2015-05-28 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rails
@@ -125,6 +126,7 @@ dependencies:
125
126
  description: Github Statistics
126
127
  email:
127
128
  - elliothursh@gmail.com
129
+ - emma.sax4@gmail.com
128
130
  executables: []
129
131
  extensions: []
130
132
  extra_rdoc_files: []
@@ -144,6 +146,7 @@ files:
144
146
  - app/assets/javascripts/hubstats/application.js
145
147
  - app/assets/javascripts/hubstats/bootstrap.js
146
148
  - app/assets/javascripts/hubstats/bootstrap.min.js
149
+ - app/assets/javascripts/hubstats/deploys.js
147
150
  - app/assets/javascripts/hubstats/events.js
148
151
  - app/assets/javascripts/hubstats/pull_requests.js
149
152
  - app/assets/javascripts/hubstats/repos.js
@@ -159,6 +162,7 @@ files:
159
162
  - app/assets/stylesheets/hubstats/users.css
160
163
  - app/assets/stylesheets/scaffold.css
161
164
  - app/controllers/hubstats/application_controller.rb
165
+ - app/controllers/hubstats/deploys_controller.rb
162
166
  - app/controllers/hubstats/events_controller.rb
163
167
  - app/controllers/hubstats/pull_requests_controller.rb
164
168
  - app/controllers/hubstats/repos_controller.rb
@@ -169,12 +173,17 @@ files:
169
173
  - app/helpers/hubstats/repos_helper.rb
170
174
  - app/helpers/hubstats/users_helper.rb
171
175
  - app/models/hubstats/comment.rb
176
+ - app/models/hubstats/deploy.rb
172
177
  - app/models/hubstats/label.rb
173
178
  - app/models/hubstats/pull_request.rb
174
179
  - app/models/hubstats/repo.rb
175
180
  - app/models/hubstats/user.rb
181
+ - app/views/hubstats/deploys/index.html.erb
182
+ - app/views/hubstats/deploys/show.html.erb
176
183
  - app/views/hubstats/partials/_comment-condensed.html.erb
177
184
  - app/views/hubstats/partials/_comment.html.erb
185
+ - app/views/hubstats/partials/_deploy.html.erb
186
+ - app/views/hubstats/partials/_deploys-condensed.html.erb
178
187
  - app/views/hubstats/partials/_header.html.erb
179
188
  - app/views/hubstats/partials/_pull-condensed.html.erb
180
189
  - app/views/hubstats/partials/_pull.html.erb
@@ -188,6 +197,9 @@ files:
188
197
  - app/views/hubstats/repos/show.html.erb
189
198
  - app/views/hubstats/tables/_comments-condensed.html.erb
190
199
  - app/views/hubstats/tables/_comments.html.erb
200
+ - app/views/hubstats/tables/_deploys-condensed.html.erb
201
+ - app/views/hubstats/tables/_deploys.html.erb
202
+ - app/views/hubstats/tables/_grouped_deploys.html.erb
191
203
  - app/views/hubstats/tables/_grouped_pulls.html.erb
192
204
  - app/views/hubstats/tables/_pulls-condensed.html.erb
193
205
  - app/views/hubstats/tables/_pulls.html.erb
@@ -205,6 +217,8 @@ files:
205
217
  - db/migrate/20140604130550_create_hubstats_repos.rb
206
218
  - db/migrate/20140703173123_create_hubstats_labels.rb
207
219
  - db/migrate/20140703200752_create_hubstats_labels_pull_requests.rb
220
+ - db/migrate/20150526154850_create_hubstats_deploys.rb
221
+ - db/seeds.rb
208
222
  - hubstats.gemspec
209
223
  - lib/generators/hubstats/install_generator.rb
210
224
  - lib/generators/hubstats/octokit.example.yml