hubstats 0.5.4 → 0.5.5
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 +4 -4
 - data/CHANGELOG.markdown +9 -0
 - data/app/controllers/hubstats/deploys_controller.rb +2 -2
 - data/app/controllers/hubstats/pull_requests_controller.rb +1 -1
 - data/app/controllers/hubstats/repos_controller.rb +11 -34
 - data/app/controllers/hubstats/teams_controller.rb +7 -6
 - data/app/controllers/hubstats/users_controller.rb +1 -7
 - data/app/helpers/hubstats/metrics_helper.rb +105 -0
 - data/app/models/hubstats/comment.rb +2 -0
 - data/app/models/hubstats/deploy.rb +15 -1
 - data/app/models/hubstats/label.rb +2 -0
 - data/app/models/hubstats/pull_request.rb +3 -1
 - data/app/models/hubstats/repo.rb +2 -0
 - data/app/models/hubstats/team.rb +2 -0
 - data/app/models/hubstats/user.rb +3 -1
 - data/app/views/hubstats/deploys/index.html.erb +4 -0
 - data/app/views/hubstats/deploys/show.html.erb +1 -1
 - data/app/views/hubstats/partials/_dashboard.html.erb +14 -0
 - data/app/views/hubstats/partials/_header.html.erb +5 -5
 - data/app/views/hubstats/partials/_quick_stats_one.html.erb +93 -0
 - data/app/views/hubstats/partials/_quick_stats_two.html.erb +93 -0
 - data/app/views/hubstats/pull_requests/show.html.erb +1 -1
 - data/app/views/hubstats/repos/index.html.erb +14 -0
 - data/app/views/hubstats/repos/show.html.erb +2 -2
 - data/app/views/hubstats/teams/index.html.erb +3 -0
 - data/app/views/hubstats/teams/show.html.erb +2 -2
 - data/app/views/hubstats/users/index.html.erb +4 -14
 - data/app/views/hubstats/users/show.html.erb +1 -1
 - data/config/routes.rb +1 -2
 - data/lib/hubstats/engine.rb +1 -0
 - data/lib/hubstats/version.rb +1 -1
 - data/spec/controllers/hubstats/deploys_controller_spec.rb +18 -15
 - data/spec/controllers/hubstats/pull_requests_controller_spec.rb +17 -12
 - data/spec/controllers/hubstats/repos_controller_spec.rb +21 -14
 - data/spec/controllers/hubstats/teams_controller_spec.rb +5 -4
 - data/spec/controllers/hubstats/users_controller_spec.rb +10 -9
 - data/spec/factories/comment.rb +3 -1
 - data/spec/factories/pull_requests.rb +5 -3
 - data/spec/factories/repo.rb +1 -1
 - data/spec/factories/users.rb +1 -1
 - data/spec/lib/hubstats/events_handler_spec.rb +10 -3
 - data/spec/lib/hubstats/github_api_spec.rb +2 -0
 - data/spec/models/hubstats/comment_spec.rb +7 -15
 - data/spec/models/hubstats/pull_request_spec.rb +22 -4
 - data/spec/models/hubstats/team_spec.rb +1 -1
 - data/spec/models/hubstats/user_spec.rb +6 -6
 - metadata +7 -5
 - data/app/views/hubstats/partials/_quick_addition_stats.html.erb +0 -33
 - data/app/views/hubstats/partials/_quick_stats.html.erb +0 -69
 - data/app/views/hubstats/repos/dashboard.html.erb +0 -24
 
| 
         @@ -14,19 +14,19 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
                        {:data => {:repo_path => repos_path(), :user_path => users_path(), :team_path => teams_path()}, :class => "navbar-brand title", :id =>"brand"}%>
         
     | 
| 
       15 
15 
     | 
    
         
             
                  </div>
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                  <!-- Show all of the pages (Teams,  
     | 
| 
      
 17 
     | 
    
         
            +
                  <!-- Show all of the pages (Repositories, Teams, Users, Deployments, Pull Requests) in tab form -->
         
     | 
| 
       18 
18 
     | 
    
         
             
                  <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
         
     | 
| 
       19 
19 
     | 
    
         
             
                    <ul class="nav navbar-nav navbar-right">
         
     | 
| 
      
 20 
     | 
    
         
            +
                      <li class="<%='navbar-active' if params[:controller] == 'hubstats/repos'%>">
         
     | 
| 
      
 21 
     | 
    
         
            +
                        <%= link_to "Repositories", repos_path%></li>
         
     | 
| 
       20 
22 
     | 
    
         
             
                      <li class="<%='navbar-active' if params[:controller] == 'hubstats/teams'%>">
         
     | 
| 
       21 
23 
     | 
    
         
             
                        <%= link_to "Teams", teams_path%></li>
         
     | 
| 
      
 24 
     | 
    
         
            +
                      <li class="<%='navbar-active' if params[:controller] == 'hubstats/users'%>">
         
     | 
| 
      
 25 
     | 
    
         
            +
                        <%= link_to "Users", users_path%></li>
         
     | 
| 
       22 
26 
     | 
    
         
             
                      <li class="<%='navbar-active' if params[:controller] == 'hubstats/deploys'%>">
         
     | 
| 
       23 
27 
     | 
    
         
             
                        <%= link_to "Deployments", deploys_path%></li>
         
     | 
| 
       24 
     | 
    
         
            -
                      <li class="<%='navbar-active' if params[:controller] == 'hubstats/repos'%>">
         
     | 
| 
       25 
     | 
    
         
            -
                        <%= link_to "Metrics", metrics_path%></li>
         
     | 
| 
       26 
28 
     | 
    
         
             
                      <li class="<%='navbar-active' if params[:controller] == 'hubstats/pull_requests'%>">
         
     | 
| 
       27 
29 
     | 
    
         
             
                        <%= link_to "Pull Requests", root_path%></li>
         
     | 
| 
       28 
     | 
    
         
            -
                      <li class="<%='navbar-active' if params[:controller] == 'hubstats/users'%>">
         
     | 
| 
       29 
     | 
    
         
            -
                        <%= link_to "Users", users_path%></li>
         
     | 
| 
       30 
30 
     | 
    
         
             
                      <li>
         
     | 
| 
       31 
31 
     | 
    
         
             
                        <!-- Show the datepicker -->
         
     | 
| 
       32 
32 
     | 
    
         
             
                        <div class="input-daterange input-group" id="datepicker">
         
     | 
| 
         @@ -0,0 +1,93 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!-- All of the options for showing any stats -->
         
     | 
| 
      
 2 
     | 
    
         
            +
            <div class="col-lg-<%= (12-(@stats_row_one.length)*2)/2 %>"></div>
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :active_user_count %>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 6 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:active_user_count] %> </h1>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <h4> Active Users </h4>
         
     | 
| 
      
 8 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 9 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 10 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :developer_count %>
         
     | 
| 
      
 11 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 12 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:developer_count] %> </h1>
         
     | 
| 
      
 13 
     | 
    
         
            +
                <h4> Developers </h4>
         
     | 
| 
      
 14 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 15 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 16 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :reviewer_count %>
         
     | 
| 
      
 17 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 18 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:reviewer_count] %> </h1>
         
     | 
| 
      
 19 
     | 
    
         
            +
                <h4> Reviewers </h4>
         
     | 
| 
      
 20 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 21 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 22 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :pull_count %>
         
     | 
| 
      
 23 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 24 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:pull_count] %> </h1>
         
     | 
| 
      
 25 
     | 
    
         
            +
                <h4> Merged Pull Requests </h4>
         
     | 
| 
      
 26 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 27 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 28 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :pulls_per_dev %>
         
     | 
| 
      
 29 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
         
     | 
| 
      
 30 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:pulls_per_dev] %> </h1>
         
     | 
| 
      
 31 
     | 
    
         
            +
                <h4> Pull Requests per Developer </h4>
         
     | 
| 
      
 32 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 33 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 34 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :deploy_count %>
         
     | 
| 
      
 35 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 36 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:deploy_count] %> </h1>
         
     | 
| 
      
 37 
     | 
    
         
            +
                <h4> Deployments </h4>
         
     | 
| 
      
 38 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 39 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 40 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :comment_count %>
         
     | 
| 
      
 41 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 42 
     | 
    
         
            +
                <h1><%= @stats_row_one[:comment_count] %> </h1>
         
     | 
| 
      
 43 
     | 
    
         
            +
                <h4> Comments </h4>
         
     | 
| 
      
 44 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 45 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 46 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :review_count %>
         
     | 
| 
      
 47 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 48 
     | 
    
         
            +
                 <h1> <%= @stats_row_one[:review_count] %> </h1>
         
     | 
| 
      
 49 
     | 
    
         
            +
                <h4> Code Reviews </h4>
         
     | 
| 
      
 50 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 51 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 52 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :comments_per_rev %>
         
     | 
| 
      
 53 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
         
     | 
| 
      
 54 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:comments_per_rev] %> </h1>
         
     | 
| 
      
 55 
     | 
    
         
            +
                <h4> Comments per Reviewer </h4>
         
     | 
| 
      
 56 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 57 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 58 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :repo_count %>
         
     | 
| 
      
 59 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 60 
     | 
    
         
            +
                 <h1> <%= @stats_row_one[:repo_count] %> </h1>
         
     | 
| 
      
 61 
     | 
    
         
            +
                <h4> Repositories with Pull Requests or Comments </h4>
         
     | 
| 
      
 62 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 63 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 64 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :net_additions %>
         
     | 
| 
      
 65 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 66 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:net_additions] %> </h1>
         
     | 
| 
      
 67 
     | 
    
         
            +
                <h4> Net Additions </h4>
         
     | 
| 
      
 68 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 69 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 70 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :avg_additions %>
         
     | 
| 
      
 71 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 72 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:avg_additions] %> </h1>
         
     | 
| 
      
 73 
     | 
    
         
            +
                <h4> Average Additions per Pull Request </h4>
         
     | 
| 
      
 74 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 75 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 76 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :avg_deletions%>
         
     | 
| 
      
 77 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 78 
     | 
    
         
            +
                <h1><%= @stats_row_one[:avg_deletions] %> </h1>
         
     | 
| 
      
 79 
     | 
    
         
            +
                <h4> Average Deletions per Pull Request </h4>
         
     | 
| 
      
 80 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 81 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 82 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :additions %>
         
     | 
| 
      
 83 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 84 
     | 
    
         
            +
                <h1> <%= @stats_row_one[:additions] %> </h1>
         
     | 
| 
      
 85 
     | 
    
         
            +
                <h4> Additions </h4>
         
     | 
| 
      
 86 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 87 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 88 
     | 
    
         
            +
            <% if @stats_row_one.has_key? :deletions%>
         
     | 
| 
      
 89 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 90 
     | 
    
         
            +
                <h1><%= @stats_row_one[:deletions] %> </h1>
         
     | 
| 
      
 91 
     | 
    
         
            +
                <h4> Deletions </h4>
         
     | 
| 
      
 92 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 93 
     | 
    
         
            +
            <% end %>
         
     | 
| 
         @@ -0,0 +1,93 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!-- All of the options for showing any stats -->
         
     | 
| 
      
 2 
     | 
    
         
            +
            <div class="col-lg-<%= (12-(@stats_row_two.length)*2)/2 %>"></div>
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :active_user_count %>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 6 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:active_user_count] %> </h1>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <h4> Active Users </h4>
         
     | 
| 
      
 8 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 9 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 10 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :developer_count %>
         
     | 
| 
      
 11 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 12 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:developer_count] %> </h1>
         
     | 
| 
      
 13 
     | 
    
         
            +
                <h4> Developers </h4>
         
     | 
| 
      
 14 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 15 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 16 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :reviewer_count %>
         
     | 
| 
      
 17 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 18 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:reviewer_count] %> </h1>
         
     | 
| 
      
 19 
     | 
    
         
            +
                <h4> Reviewers </h4>
         
     | 
| 
      
 20 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 21 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 22 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :pull_count %>
         
     | 
| 
      
 23 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 24 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:pull_count] %> </h1>
         
     | 
| 
      
 25 
     | 
    
         
            +
                <h4> Merged Pull Requests </h4>
         
     | 
| 
      
 26 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 27 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 28 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :pulls_per_dev %>
         
     | 
| 
      
 29 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
         
     | 
| 
      
 30 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:pulls_per_dev] %> </h1>
         
     | 
| 
      
 31 
     | 
    
         
            +
                <h4> Pull Requests per Developer </h4>
         
     | 
| 
      
 32 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 33 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 34 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :deploy_count %>
         
     | 
| 
      
 35 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 36 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:deploy_count] %> </h1>
         
     | 
| 
      
 37 
     | 
    
         
            +
                <h4> Deployments </h4>
         
     | 
| 
      
 38 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 39 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 40 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :comment_count %>
         
     | 
| 
      
 41 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 42 
     | 
    
         
            +
                <h1><%= @stats_row_two[:comment_count] %> </h1>
         
     | 
| 
      
 43 
     | 
    
         
            +
                <h4> Comments </h4>
         
     | 
| 
      
 44 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 45 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 46 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :review_count %>
         
     | 
| 
      
 47 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 48 
     | 
    
         
            +
                 <h1> <%= @stats_row_two[:review_count] %> </h1>
         
     | 
| 
      
 49 
     | 
    
         
            +
                <h4> Code Reviews </h4>
         
     | 
| 
      
 50 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 51 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 52 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :comments_per_rev %>
         
     | 
| 
      
 53 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
         
     | 
| 
      
 54 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:comments_per_rev] %> </h1>
         
     | 
| 
      
 55 
     | 
    
         
            +
                <h4> Comments per Reviewer </h4>
         
     | 
| 
      
 56 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 57 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 58 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :repo_count %>
         
     | 
| 
      
 59 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 60 
     | 
    
         
            +
                 <h1> <%= @stats_row_two[:repo_count] %> </h1>
         
     | 
| 
      
 61 
     | 
    
         
            +
                <h4> Repositories with Pull Requests or Comments </h4>
         
     | 
| 
      
 62 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 63 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 64 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :net_additions %>
         
     | 
| 
      
 65 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 66 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:net_additions] %> </h1>
         
     | 
| 
      
 67 
     | 
    
         
            +
                <h4> Net Additions </h4>
         
     | 
| 
      
 68 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 69 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 70 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :avg_additions %>
         
     | 
| 
      
 71 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 72 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:avg_additions] %> </h1>
         
     | 
| 
      
 73 
     | 
    
         
            +
                <h4> Average Additions per Pull Request </h4>
         
     | 
| 
      
 74 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 75 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 76 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :avg_deletions%>
         
     | 
| 
      
 77 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 78 
     | 
    
         
            +
                <h1><%= @stats_row_two[:avg_deletions] %> </h1>
         
     | 
| 
      
 79 
     | 
    
         
            +
                <h4> Average Deletions per Pull Request </h4>
         
     | 
| 
      
 80 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 81 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 82 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :additions %>
         
     | 
| 
      
 83 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 84 
     | 
    
         
            +
                <h1> <%= @stats_row_two[:additions] %> </h1>
         
     | 
| 
      
 85 
     | 
    
         
            +
                <h4> Additions </h4>
         
     | 
| 
      
 86 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 87 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 88 
     | 
    
         
            +
            <% if @stats_row_two.has_key? :deletions%>
         
     | 
| 
      
 89 
     | 
    
         
            +
              <div class="col col-lg-2 col-md-3 col-sm-3 col-xs-3 text-center">
         
     | 
| 
      
 90 
     | 
    
         
            +
                <h1><%= @stats_row_two[:deletions] %> </h1>
         
     | 
| 
      
 91 
     | 
    
         
            +
                <h4> Deletions </h4>
         
     | 
| 
      
 92 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 93 
     | 
    
         
            +
            <% end %>
         
     | 
| 
         @@ -10,7 +10,7 @@ 
     | 
|
| 
       10 
10 
     | 
    
         
             
                </h1>
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                <!-- Show the date/time that the deploy was deployed -->
         
     | 
| 
       13 
     | 
    
         
            -
                <%= render 'hubstats/partials/ 
     | 
| 
      
 13 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_one' %>
         
     | 
| 
       14 
14 
     | 
    
         
             
              </div>
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              <!-- If the pull request is closed, then show the deploy that merged this PR -->
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <div class="container" id="repo">
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              <%= render 'hubstats/partials/dashboard', :collection => dashboard %>
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              <div class="row">
         
     | 
| 
      
 6 
     | 
    
         
            +
                <div class="col col-lg-12">
         
     | 
| 
      
 7 
     | 
    
         
            +
                  <%= render 'hubstats/tables/repos' %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                  <div class="text-center">
         
     | 
| 
      
 9 
     | 
    
         
            +
                    <%= will_paginate @repo, renderer: BootstrapPagination::Rails %>
         
     | 
| 
      
 10 
     | 
    
         
            +
                  </div>
         
     | 
| 
      
 11 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 12 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 13 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
         @@ -5,14 +5,14 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
                <h1 class="title text-center"><a href=<%=@repo.html_url%>> <%= @repo.name.titleize %> </a></h1>
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                <!-- Show all of the stats about the repository -->
         
     | 
| 
       8 
     | 
    
         
            -
                <%= render 'hubstats/partials/ 
     | 
| 
      
 8 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_one' %>    
         
     | 
| 
       9 
9 
     | 
    
         
             
                <br>
         
     | 
| 
       10 
10 
     | 
    
         
             
                <br>
         
     | 
| 
       11 
11 
     | 
    
         
             
                <br>
         
     | 
| 
       12 
12 
     | 
    
         
             
                <br>
         
     | 
| 
       13 
13 
     | 
    
         
             
                <br>
         
     | 
| 
       14 
14 
     | 
    
         
             
                <br>
         
     | 
| 
       15 
     | 
    
         
            -
                <%= render 'hubstats/partials/ 
     | 
| 
      
 15 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_two' %>
         
     | 
| 
       16 
16 
     | 
    
         
             
              </div>
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              <div class="row">
         
     | 
| 
         @@ -5,14 +5,14 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
                <h1 class="title text-center"><%= @team.name %></a> </h1>
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                <!-- Show all of the stats about the team -->
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_one' %>
         
     | 
| 
       9 
9 
     | 
    
         
             
                <br>
         
     | 
| 
       10 
10 
     | 
    
         
             
                <br>
         
     | 
| 
       11 
11 
     | 
    
         
             
                <br>
         
     | 
| 
       12 
12 
     | 
    
         
             
                <br>
         
     | 
| 
       13 
13 
     | 
    
         
             
                <br>
         
     | 
| 
       14 
14 
     | 
    
         
             
                <br>
         
     | 
| 
       15 
     | 
    
         
            -
                <%= render 'hubstats/partials/ 
     | 
| 
      
 15 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_two' %>
         
     | 
| 
       16 
16 
     | 
    
         
             
              </div>
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              <div class="row">
         
     | 
| 
         @@ -1,20 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            <div class="container" id="user"%>
         
     | 
| 
       2 
     | 
    
         
            -
              <div class="row"%>
         
     | 
| 
       3 
     | 
    
         
            -
                <div class="col-lg-3">
         
     | 
| 
       4 
2 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       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>
         
     | 
| 
      
 3 
     | 
    
         
            +
              <%= render 'hubstats/partials/dashboard', :collection => dashboard %>
         
     | 
| 
      
 4 
     | 
    
         
            +
              <br>
         
     | 
| 
       15 
5 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                <div class="col-lg- 
     | 
| 
      
 6 
     | 
    
         
            +
              <div class="row"%>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <div class="col col-lg-12">
         
     | 
| 
       18 
8 
     | 
    
         
             
                  <%= render 'hubstats/tables/users' %>
         
     | 
| 
       19 
9 
     | 
    
         
             
                  <div class="text-center">
         
     | 
| 
       20 
10 
     | 
    
         
             
                    <%= will_paginate @users, renderer: BootstrapPagination::Rails %>
         
     | 
| 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
                <h1 class="title text-center"><a href=<%=@user.html_url%>> <%= @user.login %></a> </h1>
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                <!-- Show all of the stats about the user -->
         
     | 
| 
       8 
     | 
    
         
            -
                <%= render 'hubstats/partials/ 
     | 
| 
      
 8 
     | 
    
         
            +
                <%= render 'hubstats/partials/quick_stats_one' %>
         
     | 
| 
       9 
9 
     | 
    
         
             
              </div>
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              <div class="row">
         
     | 
    
        data/config/routes.rb
    CHANGED
    
    | 
         @@ -7,8 +7,7 @@ Hubstats::Engine.routes.draw do 
     | 
|
| 
       7 
7 
     | 
    
         
             
              resources :teams, :only => [:index, :show]
         
     | 
| 
       8 
8 
     | 
    
         
             
              get "/users" => "users#index", :as => :users # routes to list of users
         
     | 
| 
       9 
9 
     | 
    
         
             
              get "/user/:id" => "users#show", :as => :user # routes to specific user's contributions
         
     | 
| 
       10 
     | 
    
         
            -
              get "/ 
     | 
| 
       11 
     | 
    
         
            -
              get "/repos" => "repos#index", :as => :repos # route is for the repo filter on the pull request and deploys page
         
     | 
| 
      
 10 
     | 
    
         
            +
              get "/repos" => "repos#index", :as => :repos # routes to the list of repos
         
     | 
| 
       12 
11 
     | 
    
         
             
              get "/:repo" => "repos#show", :as => :repo # routes to specific repo's stats
         
     | 
| 
       13 
12 
     | 
    
         
             
              scope "/:repo", :as => :repo do
         
     | 
| 
       14 
13 
     | 
    
         
             
                get '/pull/:id' => "pull_requests#show", :as => :pull # routes to the specific repo's pull id
         
     | 
    
        data/lib/hubstats/engine.rb
    CHANGED
    
    
    
        data/lib/hubstats/version.rb
    CHANGED
    
    
| 
         @@ -6,7 +6,7 @@ module Hubstats 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                describe "#index" do
         
     | 
| 
       8 
8 
     | 
    
         
             
                  it "should correctly order all of the deploys" do
         
     | 
| 
       9 
     | 
    
         
            -
                    repo = create(:repo, :full_name => "sportngin/ngin")
         
     | 
| 
      
 9 
     | 
    
         
            +
                    repo = create(:repo, :full_name => "sportngin/ngin", :updated_at => Date.today)
         
     | 
| 
       10 
10 
     | 
    
         
             
                    deploy1 = create(:deploy, :git_revision => "c1a2b37",
         
     | 
| 
       11 
11 
     | 
    
         
             
                                              :repo_id => 101010,
         
     | 
| 
       12 
12 
     | 
    
         
             
                                              :deployed_at => "2009-02-03 03:00:00 -0500",
         
     | 
| 
         @@ -33,12 +33,13 @@ module Hubstats 
     | 
|
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                describe "#show" do
         
     | 
| 
       35 
35 
     | 
    
         
             
                  it "should show the pull requests of the specific deploy" do
         
     | 
| 
       36 
     | 
    
         
            -
                    repo = create(:repo, :full_name => "sportngin/ngin")
         
     | 
| 
      
 36 
     | 
    
         
            +
                    repo = create(:repo, :full_name => "sportngin/ngin", :updated_at => Date.today)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    user = build(:user, :updated_at => Date.today)
         
     | 
| 
       37 
38 
     | 
    
         
             
                    deploy = create(:deploy, :git_revision => "c1a2b37",
         
     | 
| 
       38 
39 
     | 
    
         
             
                                             :repo_id => 101010,
         
     | 
| 
       39 
40 
     | 
    
         
             
                                             :deployed_at => "2009-02-03 03:00:00 -0500")
         
     | 
| 
       40 
     | 
    
         
            -
                    pull1 = create(:pull_request, :deploy_id => deploy.id, :repo => repo)
         
     | 
| 
       41 
     | 
    
         
            -
                    pull2 = create(:pull_request, :deploy_id => deploy.id, :repo => repo)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    pull1 = create(:pull_request, :deploy_id => deploy.id, :repo => repo, :updated_at => Date.today, :user_id => user.id)
         
     | 
| 
      
 42 
     | 
    
         
            +
                    pull2 = create(:pull_request, :deploy_id => deploy.id, :repo => repo, :updated_at => Date.today, :user_id => user.id)
         
     | 
| 
       42 
43 
     | 
    
         
             
                    get :show, id: deploy.id
         
     | 
| 
       43 
44 
     | 
    
         
             
                    expect(assigns(:deploy)).to eq(deploy)
         
     | 
| 
       44 
45 
     | 
    
         
             
                    expect(assigns(:pull_requests)).to contain_exactly(pull1, pull2)
         
     | 
| 
         @@ -48,35 +49,37 @@ module Hubstats 
     | 
|
| 
       48 
49 
     | 
    
         | 
| 
       49 
50 
     | 
    
         
             
                describe "#create" do
         
     | 
| 
       50 
51 
     | 
    
         
             
                  before :each do
         
     | 
| 
       51 
     | 
    
         
            -
                     
     | 
| 
      
 52 
     | 
    
         
            +
                    user = build(:user, :updated_at => Date.today)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    repo = create(:repo, :id => 505050, :full_name => "example/name", :updated_at => Date.today)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    create(:pull_request, :number => 33364992, :merged_by => 202020, :updated_at => Date.today, :user_id => user.id, :repo_id => repo.id)
         
     | 
| 
       52 
55 
     | 
    
         
             
                  end
         
     | 
| 
       53 
56 
     | 
    
         | 
| 
       54 
57 
     | 
    
         
             
                  it 'should create a deploy' do
         
     | 
| 
       55 
58 
     | 
    
         
             
                    post(:create, {"git_revision" => "c1a2b37",
         
     | 
| 
       56 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 59 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       57 
60 
     | 
    
         
             
                                   "deployed_at" => "2009-02-03 03:00:00 -0500",
         
     | 
| 
       58 
61 
     | 
    
         
             
                                   "pull_request_ids" => "33364992, 5870592, 33691392"})
         
     | 
| 
       59 
62 
     | 
    
         
             
                    expect(assigns(:deploy).git_revision).to eq("c1a2b37")
         
     | 
| 
       60 
63 
     | 
    
         
             
                    expect(assigns(:deploy).deployed_at).to eq("2009-02-03 03:00:00 -0500")
         
     | 
| 
       61 
     | 
    
         
            -
                    expect(assigns(:deploy).repo_id).to eq( 
     | 
| 
      
 64 
     | 
    
         
            +
                    expect(assigns(:deploy).repo_id).to eq(505050)
         
     | 
| 
       62 
65 
     | 
    
         
             
                    expect(assigns(:deploy).user_id).to eq(202020)
         
     | 
| 
       63 
66 
     | 
    
         
             
                    expect(response).to have_http_status(200)
         
     | 
| 
       64 
67 
     | 
    
         
             
                  end
         
     | 
| 
       65 
68 
     | 
    
         | 
| 
       66 
69 
     | 
    
         
             
                  it 'should create a deploy without a deployed_at because nil time turns into current time' do
         
     | 
| 
       67 
70 
     | 
    
         
             
                    post(:create, {"git_revision" => "c1a2b37",
         
     | 
| 
       68 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 71 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       69 
72 
     | 
    
         
             
                                   "deployed_at" => nil,
         
     | 
| 
       70 
73 
     | 
    
         
             
                                   "pull_request_ids" => "33364992, 5870592, 33691392"})
         
     | 
| 
       71 
74 
     | 
    
         
             
                    expect(assigns(:deploy).git_revision).to eq("c1a2b37")
         
     | 
| 
       72 
     | 
    
         
            -
                    expect(assigns(:deploy).repo_id).to eq( 
     | 
| 
      
 75 
     | 
    
         
            +
                    expect(assigns(:deploy).repo_id).to eq(505050)
         
     | 
| 
       73 
76 
     | 
    
         
             
                    expect(assigns(:deploy).user_id).to eq(202020)
         
     | 
| 
       74 
77 
     | 
    
         
             
                    expect(response).to have_http_status(200)
         
     | 
| 
       75 
78 
     | 
    
         
             
                  end
         
     | 
| 
       76 
79 
     | 
    
         | 
| 
       77 
80 
     | 
    
         
             
                  it 'should NOT create a deploy without a git_revision' do
         
     | 
| 
       78 
81 
     | 
    
         
             
                    post(:create, {"git_revision" => nil,
         
     | 
| 
       79 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 82 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       80 
83 
     | 
    
         
             
                                   "deployed_at" => "2009-02-03 03:00:00 -0500",
         
     | 
| 
       81 
84 
     | 
    
         
             
                                   "pull_request_ids" => "33364992, 5870592, 33691392"})
         
     | 
| 
       82 
85 
     | 
    
         
             
                    expect(response).to have_http_status(400)
         
     | 
| 
         @@ -84,7 +87,7 @@ module Hubstats 
     | 
|
| 
       84 
87 
     | 
    
         | 
| 
       85 
88 
     | 
    
         
             
                  it 'should create a deploy without a user_id' do
         
     | 
| 
       86 
89 
     | 
    
         
             
                    post(:create, {"git_revision" => "c1a2b37",
         
     | 
| 
       87 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 90 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       88 
91 
     | 
    
         
             
                                   "deployed_at" => "2009-02-03 03:00:00 -0500",
         
     | 
| 
       89 
92 
     | 
    
         
             
                                   "pull_request_ids" => "33364992, 5870592, 33691392"})
         
     | 
| 
       90 
93 
     | 
    
         
             
                    expect(response).to have_http_status(200)
         
     | 
| 
         @@ -108,7 +111,7 @@ module Hubstats 
     | 
|
| 
       108 
111 
     | 
    
         | 
| 
       109 
112 
     | 
    
         
             
                  it 'should NOT create a deploy without pull request ids' do
         
     | 
| 
       110 
113 
     | 
    
         
             
                    post(:create, {"git_revision" => "c1a2b37",
         
     | 
| 
       111 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 114 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       112 
115 
     | 
    
         
             
                                   "deployed_at" => "2009-02-03 03:00:00 -0500",
         
     | 
| 
       113 
116 
     | 
    
         
             
                                   "pull_request_ids" => nil})
         
     | 
| 
       114 
117 
     | 
    
         
             
                    expect(response).to have_http_status(400)
         
     | 
| 
         @@ -116,7 +119,7 @@ module Hubstats 
     | 
|
| 
       116 
119 
     | 
    
         | 
| 
       117 
120 
     | 
    
         
             
                  it 'should NOT create a deploy when given empty pull request ids' do
         
     | 
| 
       118 
121 
     | 
    
         
             
                    post(:create, {"git_revision" => "c1a2b37",
         
     | 
| 
       119 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 122 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       120 
123 
     | 
    
         
             
                                   "deployed_at" => "2009-02-03 03:00:00 -0500",
         
     | 
| 
       121 
124 
     | 
    
         
             
                                   "pull_request_ids" => ""})
         
     | 
| 
       122 
125 
     | 
    
         
             
                    expect(response).to have_http_status(400)
         
     | 
| 
         @@ -124,7 +127,7 @@ module Hubstats 
     | 
|
| 
       124 
127 
     | 
    
         | 
| 
       125 
128 
     | 
    
         
             
                  it 'should NOT create a deploy when given something that are not pull request ids' do
         
     | 
| 
       126 
129 
     | 
    
         
             
                    post(:create, {"git_revision" => "c1a2b37",
         
     | 
| 
       127 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 130 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       128 
131 
     | 
    
         
             
                                   "deployed_at" => "2009-02-03 03:00:00 -0500",
         
     | 
| 
       129 
132 
     | 
    
         
             
                                   "pull_request_ids" => "blah bleh blooh"})
         
     | 
| 
       130 
133 
     | 
    
         
             
                    expect(response).to have_http_status(400)
         
     | 
| 
         @@ -132,7 +135,7 @@ module Hubstats 
     | 
|
| 
       132 
135 
     | 
    
         | 
| 
       133 
136 
     | 
    
         
             
                  it 'should NOT create a deploy when given invalid pull request ids' do
         
     | 
| 
       134 
137 
     | 
    
         
             
                    post(:create, {"git_revision" => "c1a2b37",
         
     | 
| 
       135 
     | 
    
         
            -
                                   "repo_name" => " 
     | 
| 
      
 138 
     | 
    
         
            +
                                   "repo_name" => "example/name",
         
     | 
| 
       136 
139 
     | 
    
         
             
                                   "deployed_at" => "2009-02-03 03:00:00 -0500",
         
     | 
| 
       137 
140 
     | 
    
         
             
                                   "pull_request_ids" => "77, 81, 92"})
         
     | 
| 
       138 
141 
     | 
    
         
             
                    expect(response).to have_http_status(400)
         
     |