githubscore 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0125ae74669465ad4a3047053b842b8f43ea77ba
4
+ data.tar.gz: bf0b4d05536ab85692528b093f93860acb530928
5
+ SHA512:
6
+ metadata.gz: 007e8b11967514df09e82e8bc1907fba1edc8e7709952db48da3ab397a75a0a169e0b77fbbbf089a97c855c96f9940ecf6d19d984402de3cacdf499dd3b03b6c
7
+ data.tar.gz: 4d497273db770b6a27d9e059d51ad4c1c7fcbe8c93abd7b11a93f3d835575ad75aaba14f2dff7d9e6192f69fdd2d81766860f07f56dd580c94065c0d983d9ebc
Binary file
@@ -0,0 +1,3 @@
1
+ a!�b�c"(���N��mK
2
+ �XE#���Ȱ��
3
+ ��I��:L��S�{��1�<Z�J���������*y���^���E>-����,�ȘH����.��.��(��S�s����X�Ȗ;����}dj�f����<�
@@ -0,0 +1,26 @@
1
+ # -*- ruby -*-
2
+
3
+ require "autotest/restart"
4
+
5
+ Autotest.add_hook :initialize do |at|
6
+ at.testlib = "minitest/autorun"
7
+ at.add_exception "tmp"
8
+
9
+ # at.extra_files << "../some/external/dependency.rb"
10
+ #
11
+ # at.libs << ":../some/external"
12
+ #
13
+ # at.add_exception "vendor"
14
+ #
15
+ # at.add_mapping(/dependency.rb/) do |f, _|
16
+ # at.files_matching(/test_.*rb$/)
17
+ # end
18
+ #
19
+ # %w(TestA TestB).each do |klass|
20
+ # at.extra_class_map[klass] = "test/test_misc.rb"
21
+ # end
22
+ end
23
+
24
+ # Autotest.add_hook :run_command do |at|
25
+ # system "rake build"
26
+ # end
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2016-06-15
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,8 @@
1
+ .autotest
2
+ History.rdoc
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ bin/githubscore
7
+ lib/githubscore.rb
8
+ test/test_githubscore.rb
@@ -0,0 +1,61 @@
1
+ = githubscore
2
+
3
+ home :: https://github.com/seattlerb/githubscore
4
+ rdoc :: http://docs.seattlerb.org/githubscore
5
+
6
+ == DESCRIPTION:
7
+
8
+ githubscore provides a dashboard overview of the current state of your
9
+ github issues and pull requests.
10
+
11
+ == FEATURES/PROBLEMS:
12
+
13
+ * Outputs an easy to read scorecard on the state of your projects
14
+ * Lists "worst-first" so you can focus on the biggest problem.
15
+
16
+ == SYNOPSIS:
17
+
18
+ % githubscore zenspider seattlerb
19
+ ...
20
+ seattlerb/hoe = 2 2014-05-10 71w | 0 n/a 0w | 143w
21
+ zenspider/elisp = 1 2014-02-02 123w | 0 n/a 0w | 123w
22
+ seattlerb/ohmygems = 1 2014-02-26 119w | 0 n/a 0w | 119w
23
+ seattlerb/wilson = 1 2014-04-13 113w | 0 n/a 0w | 113w
24
+ seattlerb/sexp_processor = 1 2014-05-09 109w | 0 n/a 0w | 109w
25
+ seattlerb/debride = 2 2015-04-28 46w | 0 n/a 0w | 93w
26
+ seattlerb/minitest-sprint = 1 2015-03-12 65w | 0 n/a 0w | 65w
27
+ seattlerb/flog = 1 2015-05-27 55w | 0 n/a 0w | 55w
28
+ seattlerb/minitest-debugger = 1 2015-10-07 36w | 0 n/a 0w | 36w
29
+
30
+ == REQUIREMENTS:
31
+
32
+ * octokit ~> 4.0
33
+
34
+ == INSTALL:
35
+
36
+ * sudo gem install githubscore
37
+
38
+ == LICENSE:
39
+
40
+ (The MIT License)
41
+
42
+ Copyright (c) Ryan Davis, seattle.rb
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining
45
+ a copy of this software and associated documentation files (the
46
+ 'Software'), to deal in the Software without restriction, including
47
+ without limitation the rights to use, copy, modify, merge, publish,
48
+ distribute, sublicense, and/or sell copies of the Software, and to
49
+ permit persons to whom the Software is furnished to do so, subject to
50
+ the following conditions:
51
+
52
+ The above copyright notice and this permission notice shall be
53
+ included in all copies or substantial portions of the Software.
54
+
55
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
56
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
57
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
58
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
59
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
60
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
61
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require "rubygems"
4
+ require "hoe"
5
+
6
+ Hoe.plugin :isolate
7
+ Hoe.plugin :seattlerb
8
+ Hoe.plugin :rdoc
9
+
10
+ Hoe.spec "githubscore" do
11
+ developer "Ryan Davis", "ryand-ruby@zenspider.com"
12
+
13
+ license "MIT"
14
+
15
+ dependency "octokit", "~> 4.0"
16
+ end
17
+
18
+ task :run => :isolate do
19
+ proj = ENV["PROJ"] || "zenspider seattlerb"
20
+ ruby "-Ilib bin/githubscore #{proj}"
21
+ end
22
+
23
+ # vim: syntax=ruby
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "githubscore"
4
+
5
+ Githubscore.run ARGV if $0 == __FILE__
@@ -0,0 +1,126 @@
1
+ require "octokit"
2
+
3
+ Octokit.auto_paginate = true
4
+
5
+ class Githubscore
6
+ VERSION = "1.0.0"
7
+
8
+ NOW = Time.now
9
+ SECS_PER_WEEK = 86_400 * 7
10
+
11
+ def self.run args
12
+ self.new.run args
13
+ end
14
+
15
+ def run args
16
+ repos = process_args args
17
+ stats = process_repos repos
18
+
19
+ sorted = stats.sort_by { |_, bc, _, ba, pc, _, pa, tot| [-tot, -bc-pc] }
20
+
21
+ total = 0
22
+
23
+ sorted.each do |data|
24
+ total += data[-1]
25
+ puts "%-35s = %3d %10s %3dw | %3d %10s %3dw | %4dw" % data
26
+ end
27
+
28
+ puts
29
+ puts "total = %d" % total
30
+ end
31
+
32
+ def process_args args
33
+ args << client.user.login if args.empty?
34
+
35
+ repos = args.flat_map { |name|
36
+ case name
37
+ when /^\w+$/ then
38
+ client.repos(name, :type => "owner")
39
+ when /\// then
40
+ client.repo(name)
41
+ else
42
+ abort "Unhandled arg: #{name.inspect}"
43
+ end
44
+ }.uniq
45
+
46
+ repos.sort_by { |h|
47
+ -h[:stargazers_count] - h[:watchers_count] - h[:forks_count]
48
+ }.map { |h| h[:full_name] }
49
+ end
50
+
51
+ def process_repos repos
52
+ fmt = "\r%4d/%4d"
53
+ max = repos.size
54
+
55
+ done = false
56
+ stats = repos.each_with_index.map { |repo, i|
57
+ next if done
58
+
59
+ $stderr.print fmt % [i, max]
60
+
61
+ issues = begin
62
+ client.list_issues repo
63
+ rescue Interrupt
64
+ done = true
65
+ next
66
+ end
67
+
68
+ next if issues.empty?
69
+ prs, bugs = issues.partition { |h| h[:pull_request] }
70
+
71
+ [
72
+ repo,
73
+ bugs.count, oldest(bugs), avg_weeks(bugs),
74
+ prs.count, oldest(prs), avg_weeks(prs),
75
+ tot_weeks(issues),
76
+ ]
77
+ }.compact
78
+
79
+ $stderr.print "\n\n"
80
+
81
+ stats
82
+ end
83
+
84
+ def avg_weeks ary
85
+ return 0 if ary.empty?
86
+ tot_weeks(ary) / ary.size
87
+ end
88
+
89
+ def tot_weeks ary
90
+ return 0 if ary.empty?
91
+ ary.map { |h| NOW - h[:created_at] }.inject(&:+) / SECS_PER_WEEK
92
+ end
93
+
94
+ def oldest ary
95
+ old = ary.map { |h| h[:created_at] }.min
96
+ old && old.iso8601[0..9] || "n/a"
97
+ end
98
+
99
+ def git_param name, default = nil
100
+ param = `git config github.#{name}`.chomp
101
+ param.empty? ? default : param
102
+ end
103
+
104
+ def client
105
+ @client ||=
106
+ begin
107
+ endpoints = {}
108
+ endpoints[:api] = git_param(:api)
109
+ endpoints[:web] = git_param(:web)
110
+
111
+ auth = {
112
+ :name => git_param(:name),
113
+ :user => git_param(:user),
114
+ :oauth => git_param("oauth-token"),
115
+ }
116
+
117
+ unless auth[:user] && auth[:oauth]
118
+ raise "Missing authentication parameters."
119
+ end
120
+
121
+ auth[:name] ||= auth[:user]
122
+
123
+ Octokit::Client.new :access_token => auth[:oauth]
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,8 @@
1
+ require "minitest/autorun"
2
+ require "githubscore"
3
+
4
+ class TestGithubscore < Minitest::Test
5
+ def test_sanity
6
+ flunk "write tests or I will kneecap you"
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: githubscore
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Davis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
+ ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
+ GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
16
+ AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
+ JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
+ b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
19
+ taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
20
+ oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
21
+ GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
+ qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
+ gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
+ HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
+ AQB+Hx8xUgrpZa4P8H8gR8zme5kISwQrG80MbpqJV6/G3/ZicRFhN5sjwu0uHGue
26
+ bd9Cymf6oIRwHVarJux2M32T6bL07Hmi07w2QaPc3MnMKB/D46SRZ2JSSGPFRBTc
27
+ SilobMRoGs/7B15uGFUEnNrCB/ltMqhwwSx1r++UQPfeySHEV9uqu03E5Vb7J37O
28
+ 2Er6PLXHRiYsIycD1LkMi6YnixdITRHmrqJYE2rsjaIfpIehiusVAPHkNf7qbpHq
29
+ qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
30
+ NLq5jm1fq6Y9Uolu3RJbmycf
31
+ -----END CERTIFICATE-----
32
+ date: 2016-06-15 00:00:00.000000000 Z
33
+ dependencies:
34
+ - !ruby/object:Gem::Dependency
35
+ name: octokit
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rdoc
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '4.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: hoe
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.15'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.15'
76
+ description: |-
77
+ githubscore provides a dashboard overview of the current state of your
78
+ github issues and pull requests.
79
+ email:
80
+ - ryand-ruby@zenspider.com
81
+ executables:
82
+ - githubscore
83
+ extensions: []
84
+ extra_rdoc_files:
85
+ - History.rdoc
86
+ - Manifest.txt
87
+ - README.rdoc
88
+ files:
89
+ - .autotest
90
+ - History.rdoc
91
+ - Manifest.txt
92
+ - README.rdoc
93
+ - Rakefile
94
+ - bin/githubscore
95
+ - lib/githubscore.rb
96
+ - test/test_githubscore.rb
97
+ homepage: https://github.com/seattlerb/githubscore
98
+ licenses:
99
+ - MIT
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options:
103
+ - --main
104
+ - README.rdoc
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 2.4.5
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: githubscore provides a dashboard overview of the current state of your github
123
+ issues and pull requests.
124
+ test_files: []
Binary file