gigest 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 715f23541f1ef08e03ef8a13dea8508af0410bff
4
- data.tar.gz: a544d557f9cf747e67e42a86c7ba0d56fe4f3819
3
+ metadata.gz: 00cf6a0d15011a341013d5a97479d30501106354
4
+ data.tar.gz: 196898ab74fba977405fe91cad999a83dbb93dc7
5
5
  SHA512:
6
- metadata.gz: 8a45704f73a4e22a472414a0c059029f9446daa6d2d4ccdb7a3bddccbd5cfb8e32b5b5d49d66896670431bd308b3402bec9518cc9d5da15a3688ba21a1eab224
7
- data.tar.gz: 2aad9a8f4b7073c9a50011f138e38e9d40e3b93bb1f44a157c42f3e011e7eef2cd759d4a401f94b4c017546d11105bdd7528bbc43bd35e97a79cb6ce811d7c6d
6
+ metadata.gz: bbd6a4501472973eed4ce18b0a62bc17a735f7d9a8b1a671085aec971ed21bc604c53b93105d772b02929f993690325e1d7254d019648a0625e00a2103a53050
7
+ data.tar.gz: 65ce73fd2b7dd5d67c78a62b999fd39b23d715a52e2516ba6cdcb8658788a59b912d26f9c84799788061438e24bf616ceb3b4e64258bec9fcda31a838afd6f6b
@@ -6,7 +6,11 @@ module Gigest
6
6
  @connection = GithubConnection.new(auth_params)
7
7
  end
8
8
 
9
- def process_for(account=nil)
9
+ def analyzable?(account)
10
+ @connection.exists?(account)
11
+ end
12
+
13
+ def process_for(account)
10
14
  @account_details = @connection.details_for(account)
11
15
  @repositories = @connection.repositories_for(account)
12
16
  @repositories_with_gemfile = @repositories.select(&:has_gemfile?)
@@ -4,7 +4,13 @@ module Gigest
4
4
  @connection = Octokit::Client.new(auth_params)
5
5
  end
6
6
 
7
- def details_for(account=nil)
7
+ def exists?(account)
8
+ @connection.user(account) ? true : false
9
+ rescue Octokit::NotFound
10
+ false
11
+ end
12
+
13
+ def details_for(account)
8
14
  details = @connection.user(account)
9
15
 
10
16
  {
@@ -17,7 +23,7 @@ module Gigest
17
23
  }
18
24
  end
19
25
 
20
- def repositories_for(account=nil)
26
+ def repositories_for(account)
21
27
  all_repositories = []
22
28
 
23
29
  page = 0
@@ -1,3 +1,3 @@
1
1
  module Gigest
2
- VERSION = "2.2.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"get","uri":"https://api.github.com/users/thisisaverylongloginnamethatdontexist","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/vnd.github.beta+json"],"User-Agent":["Octokit Ruby Gem 2.0.0"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":404,"message":"Not Found"},"headers":{"Server":["GitHub.com"],"Date":["Sat, 31 Aug 2013 14:40:11 GMT"],"Content-Type":["application/json; charset=utf-8"],"Transfer-Encoding":["chunked"],"Status":["404 Not Found"],"X-Ratelimit-Limit":["60"],"X-Ratelimit-Remaining":["58"],"X-Ratelimit-Reset":["1377963610"],"X-Github-Media-Type":["github.beta; format=json"],"X-Content-Type-Options":["nosniff"],"Access-Control-Allow-Credentials":["true"],"Access-Control-Expose-Headers":["ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes"],"Access-Control-Allow-Origin":["*"],"X-Github-Request-Id":["7884ef7a-6beb-4f5c-bd76-e380334e9581"]},"body":{"encoding":"UTF-8","base64_string":"eyJtZXNzYWdlIjoiTm90IEZvdW5kIn0=\n"},"http_version":null},"recorded_at":"Sat, 31 Aug 2013 14:40:21 GMT"}],"recorded_with":"VCR 2.5.0"}
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"get","uri":"https://api.github.com/users/winston","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/vnd.github.beta+json"],"User-Agent":["Octokit Ruby Gem 2.0.0"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["GitHub.com"],"Date":["Sat, 31 Aug 2013 14:40:10 GMT"],"Content-Type":["application/json; charset=utf-8"],"Transfer-Encoding":["chunked"],"Status":["200 OK"],"X-Ratelimit-Limit":["60"],"X-Ratelimit-Remaining":["59"],"X-Ratelimit-Reset":["1377963610"],"Cache-Control":["public, max-age=60, s-maxage=60"],"Last-Modified":["Sat, 31 Aug 2013 01:47:29 GMT"],"Etag":["\"8ccdf9a5aff75f8af19b902aeac9bbb4\""],"Vary":["Accept","Accept-Encoding"],"X-Github-Media-Type":["github.beta; format=json"],"X-Content-Type-Options":["nosniff"],"Access-Control-Allow-Credentials":["true"],"Access-Control-Expose-Headers":["ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes"],"Access-Control-Allow-Origin":["*"],"X-Github-Request-Id":["82d45985-630a-457a-bf59-d8007b13f80d"]},"body":{"encoding":"UTF-8","base64_string":"eyJsb2dpbiI6IndpbnN0b24iLCJpZCI6MjExMiwiYXZhdGFyX3VybCI6Imh0\ndHBzOi8vMC5ncmF2YXRhci5jb20vYXZhdGFyLzE1YWQxMGVlY2QzYmMyODE2\nNmI3ZTYyN2NjYTJlZGViP2Q9aHR0cHMlM0ElMkYlMkZpZGVudGljb25zLmdp\ndGh1Yi5jb20lMkZhMjlkMTU5ODAyNGY5ZTg3YmVhYjRiOTg0MTFkNDhjZS5w\nbmciLCJncmF2YXRhcl9pZCI6IjE1YWQxMGVlY2QzYmMyODE2NmI3ZTYyN2Nj\nYTJlZGViIiwidXJsIjoiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS91c2Vycy93\naW5zdG9uIiwiaHRtbF91cmwiOiJodHRwczovL2dpdGh1Yi5jb20vd2luc3Rv\nbiIsImZvbGxvd2Vyc191cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3Vz\nZXJzL3dpbnN0b24vZ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lYXRlZF9h\ndCI6IjIwMDgtMDMtMDRUMDc6MTQ6NDBaIiwidXBkYXRlZF9hdCI6IjIwMTMt\nMDgtMzFUMDE6NDc6MjlaIiwicHVibGljX2dpc3RzIjo1MH0=\n"},"http_version":null},"recorded_at":"Sat, 31 Aug 2013 14:40:20 GMT"}],"recorded_with":"VCR 2.5.0"}
@@ -13,6 +13,14 @@ describe Gigest::Analytics do
13
13
  end
14
14
  end
15
15
 
16
+ describe "#analyzable?" do
17
+ it "delegates to connection" do
18
+ Gigest::GithubConnection.any_instance.should_receive(:exists?).with("winston")
19
+
20
+ analytics.analyzable?("winston")
21
+ end
22
+ end
23
+
16
24
  describe "#process_for" do
17
25
  let(:account_details) { {name: "naruto", company: "konoha"} }
18
26
  let(:repositories) { [repo1, repo2] }
@@ -34,6 +34,20 @@ describe Gigest::GithubConnection do
34
34
  end
35
35
  end
36
36
 
37
+ describe "#exists?", :vcr do
38
+ context "valid GitHub account" do
39
+ it "returns true" do
40
+ expect(connection.exists?("winston")).to be_true
41
+ end
42
+ end
43
+
44
+ context "invalid GitHUb account" do
45
+ it "returns false" do
46
+ expect(connection.exists?("thisisaverylongloginnamethatdontexist")).to be_false
47
+ end
48
+ end
49
+ end
50
+
37
51
  describe "#details_for", :vcr do
38
52
  let(:expected) do
39
53
  contents = JSON.parse(File.read(File.join(Dir.pwd, "spec", "fixtures", file)))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gigest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winston Teo
@@ -111,6 +111,8 @@ files:
111
111
  - spec/fixtures/vcr_cassettes/Gigest_Analytics/_summary/when_repositories_exist/generates_a_summary_report.json
112
112
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_details_for/organization/.json
113
113
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_details_for/user/.json
114
+ - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_exists_/invalid_GitHUb_account/returns_false.json
115
+ - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_exists_/valid_GitHub_account/returns_true.json
114
116
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_gemfile_for/when_Gemfile_does_not_exist/returns_nil.json
115
117
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_gemfile_for/when_Gemfile_exists/returns_the_Gemfile_contents.json
116
118
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_repositories_for/organization/returns_an_array_of_Gigest_GithubRepo.json
@@ -153,6 +155,8 @@ test_files:
153
155
  - spec/fixtures/vcr_cassettes/Gigest_Analytics/_summary/when_repositories_exist/generates_a_summary_report.json
154
156
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_details_for/organization/.json
155
157
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_details_for/user/.json
158
+ - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_exists_/invalid_GitHUb_account/returns_false.json
159
+ - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_exists_/valid_GitHub_account/returns_true.json
156
160
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_gemfile_for/when_Gemfile_does_not_exist/returns_nil.json
157
161
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_gemfile_for/when_Gemfile_exists/returns_the_Gemfile_contents.json
158
162
  - spec/fixtures/vcr_cassettes/Gigest_GithubConnection/_repositories_for/organization/returns_an_array_of_Gigest_GithubRepo.json