reponaut 1.1.1 → 1.2.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.
- checksums.yaml +4 -4
- data/features/help.feature +3 -3
- data/features/list.feature +51 -0
- data/lib/reponaut/application.rb +37 -9
- data/lib/reponaut/github.rb +12 -2
- data/lib/reponaut/version.rb +1 -1
- data/reponaut.gemspec +1 -1
- data/spec/fixtures/cassettes/dnsimple-python.yml +75 -0
- data/spec/reponaut/github_spec.rb +40 -0
- data/spec/spec_helper.rb +2 -6
- data/spec/support/vcr.rb +6 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5b333973b1cadd089780a6ea4bd5984d4012b4d
|
4
|
+
data.tar.gz: dbb6f53a2e5b1b8abb304f2a327339e41c8595a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b989b86496d509c117584388b061cd98d7b1dad3cf86bec1decca1e98c8a859fb0a4741c9f1077cf226b1e6de64c0dc3956190fdcfc5a54d3b02568bd9221907
|
7
|
+
data.tar.gz: 67d156104e115908c492d9c03e2e991d84618a1b59ffdf97aba50cd1506da74b0e8016fd89b1e19e43c2f82da12f8262a77edf0b6f05b371ace5d7c68a6eb4b8
|
data/features/help.feature
CHANGED
@@ -8,7 +8,7 @@ Feature: Get help
|
|
8
8
|
When I run `reponaut -h`
|
9
9
|
Then it should pass with:
|
10
10
|
"""
|
11
|
-
Usage: reponaut [OPTIONS] USERNAME
|
11
|
+
Usage: reponaut [OPTIONS] USERNAME [LANGUAGE]
|
12
12
|
|
13
13
|
Options:
|
14
14
|
-c, --count Sort by repo count
|
@@ -21,7 +21,7 @@ Feature: Get help
|
|
21
21
|
When I run `reponaut --help`
|
22
22
|
Then it should pass with:
|
23
23
|
"""
|
24
|
-
Usage: reponaut [OPTIONS] USERNAME
|
24
|
+
Usage: reponaut [OPTIONS] USERNAME [LANGUAGE]
|
25
25
|
|
26
26
|
Options:
|
27
27
|
-c, --count Sort by repo count
|
@@ -52,7 +52,7 @@ Feature: Get help
|
|
52
52
|
Then the exit status should not be 0
|
53
53
|
And the stderr should contain:
|
54
54
|
"""
|
55
|
-
Usage: reponaut [OPTIONS] USERNAME
|
55
|
+
Usage: reponaut [OPTIONS] USERNAME [LANGUAGE]
|
56
56
|
|
57
57
|
Options:
|
58
58
|
-c, --count Sort by repo count
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Feature: List repos for a given language
|
2
|
+
|
3
|
+
As a GitHub user
|
4
|
+
I want to see what projects another user has created in a given language
|
5
|
+
In order to see what software they've written
|
6
|
+
|
7
|
+
Scenario: List repositories in a given language
|
8
|
+
Given the GitHub service returns repository data for the user "mdippery"
|
9
|
+
When I run `reponaut mdippery VimL`
|
10
|
+
Then it should pass with:
|
11
|
+
"""
|
12
|
+
nginx.vim -> vim-scripts/nginx.vim
|
13
|
+
Smyck-Color-Scheme -> hukl/Smyck-Color-Scheme
|
14
|
+
vimfiles
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: List repositories in a given language, ignoring case
|
18
|
+
Given the GitHub service returns repository data for the user "mdippery"
|
19
|
+
When I run `reponaut mdippery viml`
|
20
|
+
Then it should pass with:
|
21
|
+
"""
|
22
|
+
nginx.vim -> vim-scripts/nginx.vim
|
23
|
+
Smyck-Color-Scheme -> hukl/Smyck-Color-Scheme
|
24
|
+
vimfiles
|
25
|
+
"""
|
26
|
+
|
27
|
+
Scenario: List repositories in a given language, excluding forks
|
28
|
+
Given the GitHub service returns repository data for the user "mdippery"
|
29
|
+
When I run `reponaut -f mdippery VimL`
|
30
|
+
Then it should pass with:
|
31
|
+
"""
|
32
|
+
vimfiles
|
33
|
+
"""
|
34
|
+
|
35
|
+
Scenario: List repositories in a given language with no results
|
36
|
+
Given the GitHub service returns repository data for the user "mdippery"
|
37
|
+
When I run `reponaut mdippery C++`
|
38
|
+
Then the exit status should not be 0
|
39
|
+
And the output should contain:
|
40
|
+
"""
|
41
|
+
mdippery has no repositories written in C++
|
42
|
+
"""
|
43
|
+
|
44
|
+
Scenario: List repositories in a given language with counts
|
45
|
+
Given the GitHub service returns repository data for the user "mdippery"
|
46
|
+
When I run `reponaut -c mdippery ruby`
|
47
|
+
Then the exit status should not be 0
|
48
|
+
And stderr should contain:
|
49
|
+
"""
|
50
|
+
Cannot pass -c when filtering by language
|
51
|
+
"""
|
data/lib/reponaut/application.rb
CHANGED
@@ -8,7 +8,7 @@ module Reponaut
|
|
8
8
|
class << self
|
9
9
|
def run
|
10
10
|
opts = Slop.parse do |o|
|
11
|
-
o.banner = 'Usage: reponaut [OPTIONS] USERNAME'
|
11
|
+
o.banner = 'Usage: reponaut [OPTIONS] USERNAME [LANGUAGE]'
|
12
12
|
o.separator ''
|
13
13
|
o.separator 'Options:'
|
14
14
|
|
@@ -32,16 +32,51 @@ module Reponaut
|
|
32
32
|
exit 1
|
33
33
|
end
|
34
34
|
|
35
|
+
if opts.arguments.count > 1 && opts.count?
|
36
|
+
$stderr.puts 'Cannot pass -c when filtering by language'
|
37
|
+
exit 2
|
38
|
+
end
|
39
|
+
|
35
40
|
gh = Reponaut::GitHub::Client.new(username)
|
36
41
|
repos = gh.repos.reject { |r| r.language.nil? }
|
37
42
|
repos = repos.find_all { |r| r.source? } if opts.ignore_forks?
|
43
|
+
if opts.arguments.count > 1
|
44
|
+
print_repos(username, opts.arguments[1], repos)
|
45
|
+
else
|
46
|
+
print_repo_counts(username, repos, opts.count?)
|
47
|
+
end
|
48
|
+
rescue Reponaut::GitHub::NoSuchUserError => e
|
49
|
+
$stderr.puts "No such user: #{e}"
|
50
|
+
exit 4
|
51
|
+
rescue Slop::UnknownOption => e
|
52
|
+
$stderr.puts e
|
53
|
+
$stderr.puts 'Run `reponaut --help` for help information'
|
54
|
+
exit 2
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def print_repos(username, language, repos)
|
60
|
+
repos = repos.select { |r| r.language.downcase == language.downcase }
|
61
|
+
if repos.empty?
|
62
|
+
$stderr.puts "#{username} has no repositories written in #{language}"
|
63
|
+
exit 4
|
64
|
+
end
|
65
|
+
repos.sort.each do |r|
|
66
|
+
line = r.name
|
67
|
+
line = "#{line} -> #{r.upstream}" if r.fork?
|
68
|
+
puts line
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def print_repo_counts(username, repos, sort_by_count)
|
38
73
|
if repos.count < 1
|
39
74
|
$stderr.puts "#{username} has no repositories"
|
40
75
|
exit 3
|
41
76
|
end
|
42
77
|
stats = Reponaut::StatisticsCalculator.new(repos)
|
43
78
|
counts = stats.language_counts.pairs
|
44
|
-
counts = if
|
79
|
+
counts = if sort_by_count
|
45
80
|
counts.sort do |a, b|
|
46
81
|
res = b[1] <=> a[1]
|
47
82
|
if res == 0
|
@@ -58,13 +93,6 @@ module Reponaut
|
|
58
93
|
counts.each do |e|
|
59
94
|
printf "%-*s %*d\n", longest_label, e[0], longest_count, e[1]
|
60
95
|
end
|
61
|
-
rescue Reponaut::GitHub::NoSuchUserError => e
|
62
|
-
$stderr.puts "No such user: #{e}"
|
63
|
-
exit 4
|
64
|
-
rescue Slop::UnknownOption => e
|
65
|
-
$stderr.puts e
|
66
|
-
$stderr.puts 'Run `reponaut --help` for help information'
|
67
|
-
exit 2
|
68
96
|
end
|
69
97
|
end
|
70
98
|
end
|
data/lib/reponaut/github.rb
CHANGED
@@ -19,7 +19,7 @@ module Reponaut
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def repos
|
22
|
-
JSON.parse(repo_data).map { |e| Repository.new(e) }
|
22
|
+
JSON.parse(repo_data).map { |e| Repository.new(self, e) }
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_s
|
@@ -44,7 +44,8 @@ module Reponaut
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class Repository
|
47
|
-
def initialize(data)
|
47
|
+
def initialize(service, data)
|
48
|
+
@service = service
|
48
49
|
@data = data
|
49
50
|
end
|
50
51
|
|
@@ -52,10 +53,19 @@ module Reponaut
|
|
52
53
|
!fork?
|
53
54
|
end
|
54
55
|
|
56
|
+
def upstream
|
57
|
+
return nil unless fork?
|
58
|
+
@service.class.get("/repos/#{full_name}")['parent']['full_name']
|
59
|
+
end
|
60
|
+
|
55
61
|
def to_s
|
56
62
|
full_name
|
57
63
|
end
|
58
64
|
|
65
|
+
def <=>(other)
|
66
|
+
name.downcase <=> other.name.downcase
|
67
|
+
end
|
68
|
+
|
59
69
|
def method_missing(symbol, *args)
|
60
70
|
if @data.include?(symbol.to_s)
|
61
71
|
@data[symbol.to_s]
|
data/lib/reponaut/version.rb
CHANGED
data/reponaut.gemspec
CHANGED
@@ -27,5 +27,5 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_development_dependency('cucumber', '~> 2.0')
|
28
28
|
gem.add_development_dependency('rspec', '~> 3.3')
|
29
29
|
gem.add_development_dependency('vcr', '~> 3.0')
|
30
|
-
gem.add_development_dependency('webmock', '~>
|
30
|
+
gem.add_development_dependency('webmock', '~> 2.0')
|
31
31
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/repos/mdippery/dnsimple-python
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- GitHub.com
|
23
|
+
Date:
|
24
|
+
- Fri, 08 Apr 2016 00:04:18 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Status:
|
30
|
+
- 200 OK
|
31
|
+
X-Ratelimit-Limit:
|
32
|
+
- '60'
|
33
|
+
X-Ratelimit-Remaining:
|
34
|
+
- '45'
|
35
|
+
X-Ratelimit-Reset:
|
36
|
+
- '1460076487'
|
37
|
+
Cache-Control:
|
38
|
+
- public, max-age=60, s-maxage=60
|
39
|
+
Vary:
|
40
|
+
- Accept
|
41
|
+
- Accept-Encoding
|
42
|
+
Etag:
|
43
|
+
- W/"baec42f3a15609c6acc82a6afa721f5d"
|
44
|
+
Last-Modified:
|
45
|
+
- Fri, 03 Apr 2015 00:33:20 GMT
|
46
|
+
X-Github-Media-Type:
|
47
|
+
- github.v3
|
48
|
+
Access-Control-Expose-Headers:
|
49
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
50
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
51
|
+
Access-Control-Allow-Origin:
|
52
|
+
- "*"
|
53
|
+
Content-Security-Policy:
|
54
|
+
- default-src 'none'
|
55
|
+
Strict-Transport-Security:
|
56
|
+
- max-age=31536000; includeSubdomains; preload
|
57
|
+
X-Content-Type-Options:
|
58
|
+
- nosniff
|
59
|
+
X-Frame-Options:
|
60
|
+
- deny
|
61
|
+
X-Xss-Protection:
|
62
|
+
- 1; mode=block
|
63
|
+
X-Served-By:
|
64
|
+
- 2811da37fbdda4367181b328b22b2499
|
65
|
+
X-Github-Request-Id:
|
66
|
+
- D0480C04:76D5:4F11989:5706F582
|
67
|
+
body:
|
68
|
+
encoding: ASCII-8BIT
|
69
|
+
string: '{"id":33326369,"name":"dnsimple-python","full_name":"mdippery/dnsimple-python","owner":{"login":"mdippery","id":22942,"avatar_url":"https://avatars.githubusercontent.com/u/22942?v=3","gravatar_id":"","url":"https://api.github.com/users/mdippery","html_url":"https://github.com/mdippery","followers_url":"https://api.github.com/users/mdippery/followers","following_url":"https://api.github.com/users/mdippery/following{/other_user}","gists_url":"https://api.github.com/users/mdippery/gists{/gist_id}","starred_url":"https://api.github.com/users/mdippery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdippery/subscriptions","organizations_url":"https://api.github.com/users/mdippery/orgs","repos_url":"https://api.github.com/users/mdippery/repos","events_url":"https://api.github.com/users/mdippery/events{/privacy}","received_events_url":"https://api.github.com/users/mdippery/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mdippery/dnsimple-python","description":"Python
|
70
|
+
client for DNSimple domain registration and DNS hosting","fork":true,"url":"https://api.github.com/repos/mdippery/dnsimple-python","forks_url":"https://api.github.com/repos/mdippery/dnsimple-python/forks","keys_url":"https://api.github.com/repos/mdippery/dnsimple-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdippery/dnsimple-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdippery/dnsimple-python/teams","hooks_url":"https://api.github.com/repos/mdippery/dnsimple-python/hooks","issue_events_url":"https://api.github.com/repos/mdippery/dnsimple-python/issues/events{/number}","events_url":"https://api.github.com/repos/mdippery/dnsimple-python/events","assignees_url":"https://api.github.com/repos/mdippery/dnsimple-python/assignees{/user}","branches_url":"https://api.github.com/repos/mdippery/dnsimple-python/branches{/branch}","tags_url":"https://api.github.com/repos/mdippery/dnsimple-python/tags","blobs_url":"https://api.github.com/repos/mdippery/dnsimple-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdippery/dnsimple-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdippery/dnsimple-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdippery/dnsimple-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdippery/dnsimple-python/statuses/{sha}","languages_url":"https://api.github.com/repos/mdippery/dnsimple-python/languages","stargazers_url":"https://api.github.com/repos/mdippery/dnsimple-python/stargazers","contributors_url":"https://api.github.com/repos/mdippery/dnsimple-python/contributors","subscribers_url":"https://api.github.com/repos/mdippery/dnsimple-python/subscribers","subscription_url":"https://api.github.com/repos/mdippery/dnsimple-python/subscription","commits_url":"https://api.github.com/repos/mdippery/dnsimple-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdippery/dnsimple-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdippery/dnsimple-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdippery/dnsimple-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdippery/dnsimple-python/contents/{+path}","compare_url":"https://api.github.com/repos/mdippery/dnsimple-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdippery/dnsimple-python/merges","archive_url":"https://api.github.com/repos/mdippery/dnsimple-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdippery/dnsimple-python/downloads","issues_url":"https://api.github.com/repos/mdippery/dnsimple-python/issues{/number}","pulls_url":"https://api.github.com/repos/mdippery/dnsimple-python/pulls{/number}","milestones_url":"https://api.github.com/repos/mdippery/dnsimple-python/milestones{/number}","notifications_url":"https://api.github.com/repos/mdippery/dnsimple-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdippery/dnsimple-python/labels{/name}","releases_url":"https://api.github.com/repos/mdippery/dnsimple-python/releases{/id}","deployments_url":"https://api.github.com/repos/mdippery/dnsimple-python/deployments","created_at":"2015-04-02T18:58:31Z","updated_at":"2015-04-03T00:33:20Z","pushed_at":"2015-04-03T00:33:20Z","git_url":"git://github.com/mdippery/dnsimple-python.git","ssh_url":"git@github.com:mdippery/dnsimple-python.git","clone_url":"https://github.com/mdippery/dnsimple-python.git","svn_url":"https://github.com/mdippery/dnsimple-python","homepage":"https://dnsimple.com/documentation/api","size":131,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","parent":{"id":972696,"name":"dnsimple-python","full_name":"mikemaccana/dnsimple-python","owner":{"login":"mikemaccana","id":172594,"avatar_url":"https://avatars.githubusercontent.com/u/172594?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemaccana","html_url":"https://github.com/mikemaccana","followers_url":"https://api.github.com/users/mikemaccana/followers","following_url":"https://api.github.com/users/mikemaccana/following{/other_user}","gists_url":"https://api.github.com/users/mikemaccana/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemaccana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemaccana/subscriptions","organizations_url":"https://api.github.com/users/mikemaccana/orgs","repos_url":"https://api.github.com/users/mikemaccana/repos","events_url":"https://api.github.com/users/mikemaccana/events{/privacy}","received_events_url":"https://api.github.com/users/mikemaccana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mikemaccana/dnsimple-python","description":"Python
|
71
|
+
client for DNSimple domain registration and DNS hosting","fork":false,"url":"https://api.github.com/repos/mikemaccana/dnsimple-python","forks_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/forks","keys_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/teams","hooks_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/hooks","issue_events_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/issues/events{/number}","events_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/events","assignees_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/assignees{/user}","branches_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/branches{/branch}","tags_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/tags","blobs_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/statuses/{sha}","languages_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/languages","stargazers_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/stargazers","contributors_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/contributors","subscribers_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/subscribers","subscription_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/subscription","commits_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/contents/{+path}","compare_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/merges","archive_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/downloads","issues_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/issues{/number}","pulls_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/pulls{/number}","milestones_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/milestones{/number}","notifications_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/labels{/name}","releases_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/releases{/id}","deployments_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/deployments","created_at":"2010-10-08T16:53:43Z","updated_at":"2016-03-20T13:37:39Z","pushed_at":"2016-03-15T15:31:54Z","git_url":"git://github.com/mikemaccana/dnsimple-python.git","ssh_url":"git@github.com:mikemaccana/dnsimple-python.git","clone_url":"https://github.com/mikemaccana/dnsimple-python.git","svn_url":"https://github.com/mikemaccana/dnsimple-python","homepage":"https://dnsimple.com/documentation/api","size":62,"stargazers_count":35,"watchers_count":35,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":6,"forks":25,"open_issues":6,"watchers":35,"default_branch":"master"},"source":{"id":972696,"name":"dnsimple-python","full_name":"mikemaccana/dnsimple-python","owner":{"login":"mikemaccana","id":172594,"avatar_url":"https://avatars.githubusercontent.com/u/172594?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemaccana","html_url":"https://github.com/mikemaccana","followers_url":"https://api.github.com/users/mikemaccana/followers","following_url":"https://api.github.com/users/mikemaccana/following{/other_user}","gists_url":"https://api.github.com/users/mikemaccana/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemaccana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemaccana/subscriptions","organizations_url":"https://api.github.com/users/mikemaccana/orgs","repos_url":"https://api.github.com/users/mikemaccana/repos","events_url":"https://api.github.com/users/mikemaccana/events{/privacy}","received_events_url":"https://api.github.com/users/mikemaccana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mikemaccana/dnsimple-python","description":"Python
|
72
|
+
client for DNSimple domain registration and DNS hosting","fork":false,"url":"https://api.github.com/repos/mikemaccana/dnsimple-python","forks_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/forks","keys_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/teams","hooks_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/hooks","issue_events_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/issues/events{/number}","events_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/events","assignees_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/assignees{/user}","branches_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/branches{/branch}","tags_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/tags","blobs_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/statuses/{sha}","languages_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/languages","stargazers_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/stargazers","contributors_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/contributors","subscribers_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/subscribers","subscription_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/subscription","commits_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/contents/{+path}","compare_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/merges","archive_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/downloads","issues_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/issues{/number}","pulls_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/pulls{/number}","milestones_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/milestones{/number}","notifications_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/labels{/name}","releases_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/releases{/id}","deployments_url":"https://api.github.com/repos/mikemaccana/dnsimple-python/deployments","created_at":"2010-10-08T16:53:43Z","updated_at":"2016-03-20T13:37:39Z","pushed_at":"2016-03-15T15:31:54Z","git_url":"git://github.com/mikemaccana/dnsimple-python.git","ssh_url":"git@github.com:mikemaccana/dnsimple-python.git","clone_url":"https://github.com/mikemaccana/dnsimple-python.git","svn_url":"https://github.com/mikemaccana/dnsimple-python","homepage":"https://dnsimple.com/documentation/api","size":62,"stargazers_count":35,"watchers_count":35,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":6,"forks":25,"open_issues":6,"watchers":35,"default_branch":"master"},"network_count":25,"subscribers_count":0}'
|
73
|
+
http_version:
|
74
|
+
recorded_at: Fri, 08 Apr 2016 00:04:18 GMT
|
75
|
+
recorded_with: VCR 3.0.1
|
@@ -62,6 +62,46 @@ module Reponaut
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
describe '#upstream' do
|
67
|
+
it 'returns nil if the repository is not a fork' do
|
68
|
+
VCR.use_cassette(username) do
|
69
|
+
repo = github.repos.find { |r| r.full_name == 'mdippery/chameleon' }
|
70
|
+
expect(repo.upstream).to be nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'returns a string representing the source repository if the repo is a fork' do
|
75
|
+
VCR.use_cassette(username) do
|
76
|
+
repo = github.repos.find { |r| r.full_name == 'mdippery/dnsimple-python' }
|
77
|
+
VCR.use_cassette(repo.name) do
|
78
|
+
expect(repo.upstream).to eq('mikemaccana/dnsimple-python')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#<=>' do
|
85
|
+
it 'sorts repositories lexicographically by name' do
|
86
|
+
VCR.use_cassette(username, :allow_playback_repeats => true) do
|
87
|
+
r1 = github.repos.find { |r| r.full_name == 'mdippery/chameleon' }
|
88
|
+
r2 = github.repos.find { |r| r.full_name == 'mdippery/dnsimple-python' }
|
89
|
+
expect(r1 <=> r2).to eq(-1)
|
90
|
+
expect(r2 <=> r1).to eq(1)
|
91
|
+
expect(r1 <=> r1).to eq(0)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'ignores case when sorting' do
|
96
|
+
VCR.use_cassette(username, :allow_playback_repeats => true) do
|
97
|
+
r1 = github.repos.find { |r| r.full_name == 'mdippery/nginx.vim' }
|
98
|
+
r2 = github.repos.find { |r| r.full_name == 'mdippery/Smyck-Color-Scheme' }
|
99
|
+
expect(r1 <=> r2).to eq(-1)
|
100
|
+
expect(r2 <=> r1).to eq(1)
|
101
|
+
expect(r1 <=> r1).to eq(0)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
65
105
|
end
|
66
106
|
end
|
67
107
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/vcr.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reponaut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dippery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '2.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '2.0'
|
125
125
|
description: Analysis tool for GitHub users
|
126
126
|
email:
|
127
127
|
- michael@monkey-robot.com
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- bin/reponaut
|
138
138
|
- features/count.feature
|
139
139
|
- features/help.feature
|
140
|
+
- features/list.feature
|
140
141
|
- features/step_definitions/github_steps.rb
|
141
142
|
- features/support/aruba.rb
|
142
143
|
- features/support/vcr.rb
|
@@ -148,6 +149,7 @@ files:
|
|
148
149
|
- lib/reponaut/statistics.rb
|
149
150
|
- lib/reponaut/version.rb
|
150
151
|
- reponaut.gemspec
|
152
|
+
- spec/fixtures/cassettes/dnsimple-python.yml
|
151
153
|
- spec/fixtures/cassettes/emptyuser.yml
|
152
154
|
- spec/fixtures/cassettes/mdippery.yml
|
153
155
|
- spec/fixtures/cassettes/nosuchuser.yml
|
@@ -157,6 +159,7 @@ files:
|
|
157
159
|
- spec/reponaut/hash_spec.rb
|
158
160
|
- spec/reponaut/statistics_spec.rb
|
159
161
|
- spec/spec_helper.rb
|
162
|
+
- spec/support/vcr.rb
|
160
163
|
homepage: https://github.com/mdippery/reponaut
|
161
164
|
licenses:
|
162
165
|
- MIT
|
@@ -184,9 +187,11 @@ summary: Analyzes GitHub users' profiles
|
|
184
187
|
test_files:
|
185
188
|
- features/count.feature
|
186
189
|
- features/help.feature
|
190
|
+
- features/list.feature
|
187
191
|
- features/step_definitions/github_steps.rb
|
188
192
|
- features/support/aruba.rb
|
189
193
|
- features/support/vcr.rb
|
194
|
+
- spec/fixtures/cassettes/dnsimple-python.yml
|
190
195
|
- spec/fixtures/cassettes/emptyuser.yml
|
191
196
|
- spec/fixtures/cassettes/mdippery.yml
|
192
197
|
- spec/fixtures/cassettes/nosuchuser.yml
|
@@ -196,3 +201,4 @@ test_files:
|
|
196
201
|
- spec/reponaut/hash_spec.rb
|
197
202
|
- spec/reponaut/statistics_spec.rb
|
198
203
|
- spec/spec_helper.rb
|
204
|
+
- spec/support/vcr.rb
|