always_be_contributing 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +1 -0
- data/LICENSE +13 -0
- data/README.rdoc +33 -0
- data/Rakefile +5 -0
- data/always_be_contributing.gemspec +29 -0
- data/bin/always-be-contributing +7 -0
- data/lib/always_be_contributing.rb +6 -0
- data/lib/always_be_contributing/cli.rb +41 -0
- data/lib/always_be_contributing/contribution.rb +18 -0
- data/lib/always_be_contributing/core_ext/date/month_calculator.rb +12 -0
- data/lib/always_be_contributing/org.rb +24 -0
- data/lib/always_be_contributing/user.rb +34 -0
- data/lib/always_be_contributing/version.rb +3 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e6dff897b3078e330db15399888d69b9e699000
|
4
|
+
data.tar.gz: 3379d780fbea5f2079d4f60a81a4cfb6ee3b9834
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: acc1e30fad9888d837d078e5ebfa7d2ca57dec8d78be342e877e1e3f287302060b0720dd3f88b5cac41a46727b091f8b07586f2bfab679f4d0dffd3a682fb69c
|
7
|
+
data.tar.gz: f230f131c2de3f50990b0ddb6c321d2e68ddfeadd3b08f5b6f2dd9a54d47ce84dd1eeccdc2bf3079d5cc827f94590d32f2ad782e156fdb83a20d794f7f594619
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemspec
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2013, Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for
|
4
|
+
any purpose with or without fee is hereby granted, provided that the
|
5
|
+
above copyright notice and this permission notice appear in all copies.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
13
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
= Always Be Contributing
|
2
|
+
|
3
|
+
You've got a team of Committers. But who's the best?
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
== Getting Started
|
8
|
+
|
9
|
+
# Install
|
10
|
+
gem install always_be_contributing
|
11
|
+
# Configure github credentials
|
12
|
+
echo machine api.github.com login josephholsten password sekret >> ~/.netrc
|
13
|
+
# Run
|
14
|
+
always-be-contributing simplymeasured
|
15
|
+
|
16
|
+
== TODO
|
17
|
+
|
18
|
+
- Travis CI integrations
|
19
|
+
- tdd achievments ala {nose}[http://exogen.github.io/nose-achievements/]
|
20
|
+
|
21
|
+
Metrics
|
22
|
+
- contributions per month
|
23
|
+
- consecutive days streak
|
24
|
+
|
25
|
+
leaderboard groups
|
26
|
+
- org per member
|
27
|
+
- single project contributors
|
28
|
+
|
29
|
+
== License
|
30
|
+
|
31
|
+
Always Be Commiting is Copyright (c) 2013 {Joseph Anthony Pasquale
|
32
|
+
Holsten}[http://josephholsten.com] and distributed under the ISC
|
33
|
+
license. See the LICENSE file for more info.
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'always_be_contributing/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "always_be_contributing"
|
8
|
+
spec.version = AlwaysBeContributing::VERSION
|
9
|
+
spec.author = "Joseph Anthony Pasquale Holsten"
|
10
|
+
spec.email = "joseph@josephholsten.com"
|
11
|
+
spec.homepage = "https://github.com/josephholsten/always_be_contributing"
|
12
|
+
spec.description = <<-EOF
|
13
|
+
Always Be Contributing counts who has
|
14
|
+
contributing most to your orginization on Github.
|
15
|
+
EOF
|
16
|
+
spec.extra_rdoc_files = %w[ LICENSE README.rdoc ]
|
17
|
+
spec.rdoc_options << "--charset=UTF-8" <<
|
18
|
+
"--title" << "Always Be Contributing Documentation" <<
|
19
|
+
"--main" << "README.rdoc"
|
20
|
+
spec.license = 'ISC'
|
21
|
+
spec.summary = spec.description.split(/\.\s+/).first
|
22
|
+
spec.files = `git ls-files`.split($/)
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'rdoc'
|
29
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'always_be_contributing/core_ext/date/month_calculator'
|
2
|
+
require 'always_be_contributing/org'
|
3
|
+
require 'octokit'
|
4
|
+
|
5
|
+
module AlwaysBeContributing
|
6
|
+
class CLI
|
7
|
+
attr_accessor :github_org
|
8
|
+
|
9
|
+
def initialize(args)
|
10
|
+
@github_org = args[0]
|
11
|
+
Octokit.netrc = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
exit_usage unless github_org
|
16
|
+
render
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def begin_date
|
21
|
+
Date.today.beginning_of_month
|
22
|
+
end
|
23
|
+
|
24
|
+
def member_contribution_counts
|
25
|
+
@member_contribution_counts ||= begin
|
26
|
+
Org.new(github_org).
|
27
|
+
member_contribution_count_since(begin_date)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def render
|
32
|
+
puts "=== Contributions for members of github-org: #{github_org} since: #{begin_date} ==="
|
33
|
+
member_contribution_counts.each {|u| puts "%15s %3i" % u }
|
34
|
+
end
|
35
|
+
|
36
|
+
def exit_usage
|
37
|
+
$stderr.puts "usage: #{$0} github-org"
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module AlwaysBeContributing
|
4
|
+
class Contribution < Struct.new(:date, :value)
|
5
|
+
def self.from_raw(raw)
|
6
|
+
AlwaysBeContributing::Contribution.new(raw[0],raw[1])
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(date, value)
|
10
|
+
self.date = Date.parse(date)
|
11
|
+
self.value = value
|
12
|
+
end
|
13
|
+
|
14
|
+
def nil?
|
15
|
+
self.date.nil? || self.value.nil?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'always_be_contributing/user'
|
2
|
+
|
3
|
+
module AlwaysBeContributing
|
4
|
+
class Org < Struct.new(:name)
|
5
|
+
def members
|
6
|
+
member_ids.map {|id| User.new id }
|
7
|
+
end
|
8
|
+
|
9
|
+
def member_contribution_count_since(begin_date)
|
10
|
+
{}.tap do |contribution_counts|
|
11
|
+
members.each do |m|
|
12
|
+
contribution_counts[m.name] = m.contribution_count_since(begin_date)
|
13
|
+
end
|
14
|
+
end.
|
15
|
+
sort_by {|u| u[1] }.
|
16
|
+
reverse
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def member_ids
|
21
|
+
Octokit.org_members(name).map(&:login)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
require 'always_be_contributing/contribution'
|
6
|
+
|
7
|
+
module AlwaysBeContributing
|
8
|
+
class User < Struct.new(:name)
|
9
|
+
def contributions
|
10
|
+
doc = contribution_url.read
|
11
|
+
JSON.parse(doc).map do |cont|
|
12
|
+
Contribution.from_raw(cont)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def contributions_since(start_date)
|
17
|
+
contributions.select do |c|
|
18
|
+
c.date >= start_date
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def contribution_count_since(start_date)
|
23
|
+
@contribution_count_since ||= {}
|
24
|
+
@contribution_count_since[start_date] ||= begin
|
25
|
+
contributions_since(start_date).map(&:value).reduce(&:+)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def contribution_url
|
31
|
+
URI.parse "https://github.com/users/#{name}/contributions_calendar_data"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: always_be_contributing
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joseph Anthony Pasquale Holsten
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: |2
|
56
|
+
Always Be Contributing counts who has
|
57
|
+
contributing most to your orginization on Github.
|
58
|
+
email: joseph@josephholsten.com
|
59
|
+
executables:
|
60
|
+
- always-be-contributing
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files:
|
63
|
+
- LICENSE
|
64
|
+
- README.rdoc
|
65
|
+
files:
|
66
|
+
- .gitignore
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE
|
69
|
+
- README.rdoc
|
70
|
+
- Rakefile
|
71
|
+
- always_be_contributing.gemspec
|
72
|
+
- bin/always-be-contributing
|
73
|
+
- lib/always_be_contributing.rb
|
74
|
+
- lib/always_be_contributing/cli.rb
|
75
|
+
- lib/always_be_contributing/contribution.rb
|
76
|
+
- lib/always_be_contributing/core_ext/date/month_calculator.rb
|
77
|
+
- lib/always_be_contributing/org.rb
|
78
|
+
- lib/always_be_contributing/user.rb
|
79
|
+
- lib/always_be_contributing/version.rb
|
80
|
+
homepage: https://github.com/josephholsten/always_be_contributing
|
81
|
+
licenses:
|
82
|
+
- ISC
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options:
|
86
|
+
- --charset=UTF-8
|
87
|
+
- --title
|
88
|
+
- Always Be Contributing Documentation
|
89
|
+
- --main
|
90
|
+
- README.rdoc
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.0.0
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Always Be Contributing counts who has contributing most to your orginization
|
109
|
+
on Github
|
110
|
+
test_files: []
|