github-contributions 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/Rakefile +7 -0
- data/Readme.md +52 -0
- data/github-contributions.gemspec +25 -0
- data/lib/github-contributions.rb +9 -0
- data/lib/github-contributions/list.rb +57 -0
- data/lib/github-contributions/version.rb +5 -0
- data/spec/test_spec.rb +16 -0
- metadata +94 -0
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/Readme.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Github Contributions
|
2
|
+
|
3
|
+
This Gem is used to find User Contributions list
|
4
|
+
|
5
|
+
**github-contribution** can be used from the command line or as part of a Ruby web framework.
|
6
|
+
|
7
|
+
### Installation
|
8
|
+
|
9
|
+
To install the gem using terminal, run the following command:
|
10
|
+
|
11
|
+
gem install github-contributions
|
12
|
+
|
13
|
+
To use it in rails application add the gem to the Gemfile:
|
14
|
+
|
15
|
+
gem "github-contributions"
|
16
|
+
|
17
|
+
### Basic Usage
|
18
|
+
|
19
|
+
github-contributions can simply import or export issues from an Excel file.:
|
20
|
+
|
21
|
+
require 'github-contributions'
|
22
|
+
require 'github_api'
|
23
|
+
|
24
|
+
your_github_username = '***********'
|
25
|
+
your_github_password = '***********'
|
26
|
+
|
27
|
+
connection = Github.new(basic_auth: "#{your_github_username}:#{your_github_password}")
|
28
|
+
|
29
|
+
# The List Module will fetch all the repositories to which you have contributed.
|
30
|
+
|
31
|
+
Github::Contributions::List.new(connection,your_github_username).list
|
32
|
+
|
33
|
+
### Contributing
|
34
|
+
|
35
|
+
Contributions are welcomed. You can fork a repository, add your code changes to the forked branch, ensure all existing unit tests pass, create new unit tests cover your new changes and finally create a pull request.
|
36
|
+
|
37
|
+
After forking and then cloning the repository locally, install Bundler and then use it
|
38
|
+
to install the development gem dependecies:
|
39
|
+
|
40
|
+
gem install bundler
|
41
|
+
bundle install
|
42
|
+
|
43
|
+
github-contributions this is complete, you should be able to run the test suite:
|
44
|
+
|
45
|
+
rake spec
|
46
|
+
|
47
|
+
|
48
|
+
### Bug Reporting
|
49
|
+
|
50
|
+
Please use the Issues page to report bugs or suggest new enhancements.
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'github-contributions/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "github-contributions"
|
8
|
+
spec.version = Github::Contributions::VERSION
|
9
|
+
spec.authors = ["Ramtin Vaziri", "Manish puri", "Hemali Jain","Amruta Das","Arpit Kulshrestha"]
|
10
|
+
spec.description = %q{Find your contribution in github in Ruby.}
|
11
|
+
spec.summary = %q{github-contributions is a Ruby gem that facilittes easy fetching of repositories you have contributed to.}
|
12
|
+
spec.homepage = "https://github.com/Manik-Ratna/github-contributions"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.required_ruby_version = '>= 1.9.3'
|
21
|
+
|
22
|
+
spec.add_dependency 'github_api'
|
23
|
+
spec.add_development_dependency 'rake', '~>10.1.1'
|
24
|
+
spec.add_development_dependency 'rspec'
|
25
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'github_api'
|
2
|
+
|
3
|
+
module Github
|
4
|
+
module Contributions
|
5
|
+
class Github::Contributions::List
|
6
|
+
attr_reader :connection,:current_user
|
7
|
+
def initialize connection,current_user, options = {}
|
8
|
+
@current_user=current_user
|
9
|
+
@connection = connection
|
10
|
+
end
|
11
|
+
|
12
|
+
def list
|
13
|
+
@list=find_list_of_orgs
|
14
|
+
@list.flatten.compact.uniq
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_list_of_orgs
|
18
|
+
@repos_org=Array.new()
|
19
|
+
@repos_contributions=Array.new()
|
20
|
+
@your_contri=Array.new()
|
21
|
+
@orgs =Array.new()
|
22
|
+
@orgs.push(@current_user)
|
23
|
+
@orgs.push(@connection.orgs.list.map(&:login))
|
24
|
+
@orgs=@orgs.flatten.compact
|
25
|
+
results = []
|
26
|
+
@orgs.collect do |org|
|
27
|
+
results << self.find_repo_of_org(org)
|
28
|
+
end
|
29
|
+
results
|
30
|
+
end
|
31
|
+
|
32
|
+
def find_repo_of_org(org)
|
33
|
+
@repos_org.push(@connection.repos.all(auto_pagination:true).map(&:name))
|
34
|
+
@repos_org.push(@connection.repos.list(auto_pagination: true,user:org).map(&:name))
|
35
|
+
results = []
|
36
|
+
@repos_org.collect do |repos|
|
37
|
+
repos.collect do |repo|
|
38
|
+
results << self.find_contributors(org,repo)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
results
|
42
|
+
end
|
43
|
+
|
44
|
+
def find_contributors(org,repo)
|
45
|
+
@repos_contributions=@connection.repos.contributors(auto_pagination: true,repo:repo,anon:1,user:org).map(&:login) rescue []
|
46
|
+
if @repos_contributions.include? @current_user
|
47
|
+
combo=org+"/"+repo
|
48
|
+
@your_contri.push(combo)
|
49
|
+
end
|
50
|
+
if @your_contri.nil?
|
51
|
+
@your_contri="No Contribution"
|
52
|
+
end
|
53
|
+
@your_contri
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/spec/test_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'github-contributions'
|
2
|
+
|
3
|
+
|
4
|
+
describe 'github-contributions' do
|
5
|
+
before(:all) do
|
6
|
+
@my_github_username = 'github-contributions'
|
7
|
+
@my_github_password = 'github143'
|
8
|
+
@connection = Github.new basic_auth: "#{@my_github_username}:#{@my_github_password}"
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'list your contributions' do
|
12
|
+
list = Github::Contributions::List.new(@connection,@my_github_username).list
|
13
|
+
list.should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: github-contributions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ramtin Vaziri
|
9
|
+
- Manish puri
|
10
|
+
- Hemali Jain
|
11
|
+
- Amruta Das
|
12
|
+
- Arpit Kulshrestha
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: github_api
|
20
|
+
requirement: &72023680 !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
22
|
+
requirements:
|
23
|
+
- - ! '>='
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '0'
|
26
|
+
type: :runtime
|
27
|
+
prerelease: false
|
28
|
+
version_requirements: *72023680
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: &72023410 !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ~>
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 10.1.1
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: *72023410
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: rspec
|
42
|
+
requirement: &72023200 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: *72023200
|
51
|
+
description: Find your contribution in github in Ruby.
|
52
|
+
email:
|
53
|
+
executables: []
|
54
|
+
extensions: []
|
55
|
+
extra_rdoc_files: []
|
56
|
+
files:
|
57
|
+
- .travis.yml
|
58
|
+
- Gemfile
|
59
|
+
- LICENSE.txt
|
60
|
+
- Rakefile
|
61
|
+
- Readme.md
|
62
|
+
- github-contributions.gemspec
|
63
|
+
- lib/github-contributions.rb
|
64
|
+
- lib/github-contributions/list.rb
|
65
|
+
- lib/github-contributions/version.rb
|
66
|
+
- spec/test_spec.rb
|
67
|
+
homepage: https://github.com/Manik-Ratna/github-contributions
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 1.9.3
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 1.8.17
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: github-contributions is a Ruby gem that facilittes easy fetching of repositories
|
92
|
+
you have contributed to.
|
93
|
+
test_files:
|
94
|
+
- spec/test_spec.rb
|