microclimate 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/Guardfile +16 -0
- data/LICENSE.txt +22 -0
- data/README.md +64 -0
- data/Rakefile +1 -0
- data/lib/microclimate/base.rb +17 -0
- data/lib/microclimate/branch.rb +19 -0
- data/lib/microclimate/client.rb +13 -0
- data/lib/microclimate/repository.rb +68 -0
- data/lib/microclimate/response.rb +6 -0
- data/lib/microclimate/snapshot.rb +14 -0
- data/lib/microclimate/version.rb +3 -0
- data/lib/microclimate.rb +8 -0
- data/microclimate.gemspec +31 -0
- data/spec/microclimate/branch_spec.rb +46 -0
- data/spec/microclimate/client_spec.rb +26 -0
- data/spec/microclimate/repository_spec.rb +142 -0
- data/spec/microclimate/response_spec.rb +20 -0
- data/spec/microclimate/snapshot_spec.rb +27 -0
- data/spec/spec_helper.rb +8 -0
- metadata +200 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0096c592c6f7279a55f05381d18103fd67f691b1
|
4
|
+
data.tar.gz: 8da822d376c07c89971159caa79da12283c1e187
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72c8591f8fa758262c3922401ca5f59ccdeacc12dda26c2a5876ec90cf32286919b01d7e931d4bd58490d3b9c81bacb386747b1ab1373731cdb291032d3affbc
|
7
|
+
data.tar.gz: 8c293998df2a1c43258e8559655230839f97e7b98a19d6990d4fbf0c2d64679dc8acd10e7339b0f64369b4409afd89cf2514fd750b2bcc24da92b7e294b56e51
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.0
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch('spec/spec_helper.rb') { "spec" }
|
7
|
+
|
8
|
+
# Rails example
|
9
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
10
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
11
|
+
|
12
|
+
# Turnip features and steps
|
13
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
14
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
15
|
+
end
|
16
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Andrew Hao
|
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/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
[![Code
|
2
|
+
Climate](https://codeclimate.com/github/andrewhao/microclimate.png)](https://codeclimate.com/github/andrewhao/microclimate)
|
3
|
+
[![Build
|
4
|
+
Status](https://travis-ci.org/andrewhao/microclimate.svg)](https://travis-ci.org/andrewhao/microclimate)
|
5
|
+
|
6
|
+
# Microclimate
|
7
|
+
|
8
|
+
A Ruby wrapper to the [Code Climate
|
9
|
+
API](https://codeclimate.com/docs/api). Note that it, as documented, is
|
10
|
+
"at the moment, extremely rudimentary, unsupported, and subject to
|
11
|
+
change."
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'microclimate'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install microclimate
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
### Initializing the client & connecting to the repo.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
client = Microclimate::Client.new :api_token =>
|
33
|
+
"321786539ec44cb4ae96b86e09209828416542fe"
|
34
|
+
repo = client.repository_for "533329e76956801171001e7e" # #<Microclimate::Repository:0x007f9764730548
|
35
|
+
```
|
36
|
+
|
37
|
+
### Updating the repository
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
repo.refresh!
|
41
|
+
```
|
42
|
+
|
43
|
+
### Getting the GPA
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
repo.id # => "533329e76956801171001e7e"
|
47
|
+
repo.last_snapshot # => {"gpa" => 2.31}
|
48
|
+
repo.previous_snapshot # => {"gpa" => 2.25}
|
49
|
+
```
|
50
|
+
|
51
|
+
### Branches
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
repo.branch_for("my_test_branch").last_snapshot # => {"gpa" => 2.40}
|
55
|
+
repo.branch_for("master").last_snapshot # => {"gpa" => 2.25}
|
56
|
+
```
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
1. Fork it
|
61
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
62
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
63
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
64
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "faraday"
|
2
|
+
|
3
|
+
module Microclimate
|
4
|
+
class Base
|
5
|
+
def connection
|
6
|
+
@connection ||= ::Faraday.new(:url => host) do |faraday|
|
7
|
+
faraday.request :url_encoded # form-encode POST params
|
8
|
+
faraday.response :logger # log requests to STDOUT
|
9
|
+
faraday.adapter ::Faraday.default_adapter # make requests with Net::HTTP
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def host
|
14
|
+
"https://codeclimate.com"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Microclimate
|
2
|
+
class Branch < Repository
|
3
|
+
attr_accessor :parent_repo, :name
|
4
|
+
|
5
|
+
def initialize(client, parent_repo, name)
|
6
|
+
@client = client
|
7
|
+
@parent_repo = parent_repo
|
8
|
+
@name = name
|
9
|
+
end
|
10
|
+
|
11
|
+
delegate :repo_id => :parent_repo
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def resource_url
|
16
|
+
"/api/repos/#{repo_id}/branches/#{name}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'json'
|
2
|
+
# Represents a source code repository object on CodeClimate.
|
3
|
+
module Microclimate
|
4
|
+
class Repository < Base
|
5
|
+
attr_accessor :repo_id, :client
|
6
|
+
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
# @param [Hash] options An option hash of:
|
10
|
+
# +repo_id+: The SHA identifier of the repository on Code Climate.
|
11
|
+
def initialize(client, options)
|
12
|
+
@client = client
|
13
|
+
@repo_id = options[:repo_id]
|
14
|
+
end
|
15
|
+
|
16
|
+
delegate :api_token => :client,
|
17
|
+
:id => :status,
|
18
|
+
:last_snapshot => :status,
|
19
|
+
:previous_snapshot => :status,
|
20
|
+
:gpa => :last_snapshot
|
21
|
+
|
22
|
+
# Force Code Climate to refresh this repository (at the master branch)
|
23
|
+
def refresh!
|
24
|
+
output = connection.post resource_refresh_url, :api_token => api_token
|
25
|
+
json = output.body
|
26
|
+
Response.new JSON.parse(json)
|
27
|
+
end
|
28
|
+
|
29
|
+
def ready?
|
30
|
+
!last_snapshot.nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
def status
|
34
|
+
output = connection.get resource_url, :api_token => api_token
|
35
|
+
json = output.body
|
36
|
+
Response.new JSON.parse(json)
|
37
|
+
end
|
38
|
+
|
39
|
+
def branch_for(branch_name)
|
40
|
+
Branch.new(client, self, branch_name)
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
def last_snapshot
|
46
|
+
snapshot = status.last_snapshot
|
47
|
+
return nil if snapshot.nil?
|
48
|
+
|
49
|
+
Snapshot.new(snapshot)
|
50
|
+
end
|
51
|
+
|
52
|
+
def previous_snapshot
|
53
|
+
snapshot = status.previous_snapshot
|
54
|
+
return nil if snapshot.nil?
|
55
|
+
|
56
|
+
Snapshot.new(snapshot)
|
57
|
+
end
|
58
|
+
|
59
|
+
def resource_refresh_url
|
60
|
+
"#{resource_url}/refresh"
|
61
|
+
end
|
62
|
+
|
63
|
+
def resource_url
|
64
|
+
"/api/repos/#{repo_id}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
data/lib/microclimate.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'microclimate/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "microclimate"
|
8
|
+
spec.version = Microclimate::VERSION
|
9
|
+
spec.authors = ["Andrew Hao"]
|
10
|
+
spec.email = ["ahao@blurb.com"]
|
11
|
+
spec.description = "An API wrapper for the Code Climate API"
|
12
|
+
spec.summary = "An API wrapper for the Code Climate API"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
spec.add_development_dependency "guard"
|
24
|
+
spec.add_development_dependency "guard-rspec"
|
25
|
+
spec.add_development_dependency "webmock"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
|
28
|
+
spec.add_runtime_dependency "psych"
|
29
|
+
spec.add_runtime_dependency "hashie"
|
30
|
+
spec.add_runtime_dependency "faraday"
|
31
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Microclimate::Branch do
|
4
|
+
let(:repo_id) { "my_repo_id" }
|
5
|
+
let(:repo) { double("repo", :repo_id => repo_id) }
|
6
|
+
let(:name) { "my_branch" }
|
7
|
+
let(:api_token) { "my_api_token" }
|
8
|
+
let(:client) { double("client", :api_token => api_token) }
|
9
|
+
let(:subject) { described_class.new(client, repo, name) }
|
10
|
+
let(:base_url) { "#{subject.host}/api/repos/#{repo_id}/branches/#{name}" }
|
11
|
+
let(:url) { "#{base_url}?api_token=#{api_token}" }
|
12
|
+
let(:gpa) { 2.25 }
|
13
|
+
|
14
|
+
let(:last_snapshot) do
|
15
|
+
{
|
16
|
+
"last_snapshot" => {
|
17
|
+
"gpa" => gpa
|
18
|
+
}
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:json_response) do
|
23
|
+
{"id" => repo_id}.merge(last_snapshot)
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#gpa" do
|
27
|
+
before :each do
|
28
|
+
stub_request(:get, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "hits the branch Code Climate url." do
|
32
|
+
expect(subject.gpa).to eq gpa
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#refresh!" do
|
37
|
+
let(:url) { "#{base_url}/refresh" }
|
38
|
+
|
39
|
+
it "hits the branch Code Climate URL with a POST" do
|
40
|
+
stub_request(:post, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
41
|
+
subject.refresh!
|
42
|
+
|
43
|
+
expect(a_request(:post, url)).to have_been_made
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Microclimate::Client do
|
4
|
+
let(:api_token) { "my_api_token" }
|
5
|
+
subject { described_class.new(:api_token => api_token) }
|
6
|
+
|
7
|
+
describe "#new" do
|
8
|
+
it "initializes correctly with params" do
|
9
|
+
expect(subject).to be_instance_of described_class
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#api_token" do
|
14
|
+
it "returns the attr" do
|
15
|
+
expect(subject.api_token).to eq api_token
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#repository_for" do
|
20
|
+
let(:repo_id) { "my repo id" }
|
21
|
+
|
22
|
+
it "returns an instance of Microclimate::Repository" do
|
23
|
+
expect(subject.repository_for(repo_id)).to be_instance_of Microclimate::Repository
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Microclimate::Repository do
|
4
|
+
let(:repo_id) { "my_repo_id" }
|
5
|
+
let(:api_token) { "my_api_token" }
|
6
|
+
let(:client) { mock("client", :api_token => api_token) }
|
7
|
+
let(:url) { subject.host + "/api/repos/" + repo_id + "?api_token=" + api_token }
|
8
|
+
let(:gpa) { 2.25 }
|
9
|
+
let(:previous_gpa) { 2.50 }
|
10
|
+
let(:last_snapshot) do
|
11
|
+
{
|
12
|
+
"last_snapshot" => {
|
13
|
+
"gpa" => gpa
|
14
|
+
}
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:previous_snapshot) do
|
19
|
+
{
|
20
|
+
"previous_snapshot" => {
|
21
|
+
"gpa" => previous_gpa
|
22
|
+
}
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:json_response) do
|
27
|
+
{"id" => repo_id}.merge(last_snapshot).merge(previous_snapshot)
|
28
|
+
end
|
29
|
+
|
30
|
+
subject { described_class.new client, :repo_id => repo_id }
|
31
|
+
|
32
|
+
describe "#new" do
|
33
|
+
it "returns an instance of Repository" do
|
34
|
+
expect(subject).to be_instance_of described_class
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#ready?" do
|
39
|
+
before :each do
|
40
|
+
stub_request(:get, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
41
|
+
end
|
42
|
+
|
43
|
+
context " with a snapshot" do
|
44
|
+
it "returns true" do
|
45
|
+
expect(subject).to be_ready
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "without a snapshot" do
|
50
|
+
let(:last_snapshot) { {} }
|
51
|
+
|
52
|
+
it "returns false" do
|
53
|
+
expect(subject).to_not be_ready
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#refresh!" do
|
59
|
+
let(:url) { subject.host + "/api/repos/" + repo_id + "/refresh" }
|
60
|
+
let(:json_response) do
|
61
|
+
{"hello" => "world"}
|
62
|
+
end
|
63
|
+
|
64
|
+
before :each do
|
65
|
+
stub_request(:post, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "POSTs to /api/repos/:repo_id/refresh" do
|
69
|
+
subject.refresh!
|
70
|
+
|
71
|
+
expect(a_request(:post, url)).to have_been_made
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#id" do
|
76
|
+
before :each do
|
77
|
+
stub_request(:get, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "returns the id from the response" do
|
81
|
+
expect(subject.id).to eq repo_id
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "branching" do
|
86
|
+
let(:branch_name) { "my_branch" }
|
87
|
+
|
88
|
+
describe "#branch_for" do
|
89
|
+
it "returns a Branch" do
|
90
|
+
expect(subject.branch_for(branch_name)).to be_instance_of Microclimate::Branch
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#gpa" do
|
96
|
+
before :each do
|
97
|
+
stub_request(:get, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "returns the GPA of the last snapshot" do
|
101
|
+
expect(subject.gpa).to eq gpa
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
[:last_snapshot, :previous_snapshot].each do |snapshot_method|
|
106
|
+
describe "##{snapshot_method}" do
|
107
|
+
before :each do
|
108
|
+
stub_request(:get, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
109
|
+
end
|
110
|
+
|
111
|
+
context "without a snapshot" do
|
112
|
+
let(snapshot_method) do
|
113
|
+
{}
|
114
|
+
end
|
115
|
+
|
116
|
+
it "returns nil if no snapshot returned" do
|
117
|
+
expect(subject.send(snapshot_method)).to be_nil
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
it "returns a Snapshot if one exists" do
|
122
|
+
expect(subject.send(snapshot_method)).to be_instance_of Microclimate::Snapshot
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe "#status" do
|
128
|
+
before :each do
|
129
|
+
stub_request(:get, url).with(:api_token => api_token).to_return(:body => json_response.to_json)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "queries codeclimate API URL correctly." do
|
133
|
+
subject.status
|
134
|
+
|
135
|
+
expect(a_request(:get, url)).to have_been_made
|
136
|
+
end
|
137
|
+
|
138
|
+
it "returns a Response object" do
|
139
|
+
expect(subject.status).to be_instance_of Microclimate::Response
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Microclimate::Response do
|
4
|
+
subject { Microclimate::Response.new(json_hash) }
|
5
|
+
|
6
|
+
context "for nested ruby hashes" do
|
7
|
+
let(:json_hash) do
|
8
|
+
{ :foo => {:bar => [1, 2, 3]},
|
9
|
+
:baz => "hello"}
|
10
|
+
end
|
11
|
+
|
12
|
+
it "turns attributes to methods" do
|
13
|
+
expect(subject.baz).to eq "hello"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "can call through nested methods" do
|
17
|
+
expect(subject.foo.bar).to eq [1, 2, 3]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
|
+
|
4
|
+
describe Microclimate::Snapshot do
|
5
|
+
let(:gpa) { 3.00 }
|
6
|
+
let(:sha) { "abcdef1234" }
|
7
|
+
let(:data) do
|
8
|
+
json = {
|
9
|
+
:gpa => gpa,
|
10
|
+
:commit_sha => sha
|
11
|
+
}
|
12
|
+
OpenStruct.new(json)
|
13
|
+
end
|
14
|
+
let(:subject) { described_class.new(data) }
|
15
|
+
|
16
|
+
describe "#gpa" do
|
17
|
+
it "returns the json GPA" do
|
18
|
+
expect(subject.gpa).to eq gpa
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#commit_sha" do
|
23
|
+
it "returns json sha" do
|
24
|
+
expect(subject.commit_sha).to eq sha
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: microclimate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Hao
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-07 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: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
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: guard
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: psych
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: hashie
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: faraday
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: An API wrapper for the Code Climate API
|
140
|
+
email:
|
141
|
+
- ahao@blurb.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".ruby-version"
|
149
|
+
- ".travis.yml"
|
150
|
+
- Gemfile
|
151
|
+
- Guardfile
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- lib/microclimate.rb
|
156
|
+
- lib/microclimate/base.rb
|
157
|
+
- lib/microclimate/branch.rb
|
158
|
+
- lib/microclimate/client.rb
|
159
|
+
- lib/microclimate/repository.rb
|
160
|
+
- lib/microclimate/response.rb
|
161
|
+
- lib/microclimate/snapshot.rb
|
162
|
+
- lib/microclimate/version.rb
|
163
|
+
- microclimate.gemspec
|
164
|
+
- spec/microclimate/branch_spec.rb
|
165
|
+
- spec/microclimate/client_spec.rb
|
166
|
+
- spec/microclimate/repository_spec.rb
|
167
|
+
- spec/microclimate/response_spec.rb
|
168
|
+
- spec/microclimate/snapshot_spec.rb
|
169
|
+
- spec/spec_helper.rb
|
170
|
+
homepage: ''
|
171
|
+
licenses:
|
172
|
+
- MIT
|
173
|
+
metadata: {}
|
174
|
+
post_install_message:
|
175
|
+
rdoc_options: []
|
176
|
+
require_paths:
|
177
|
+
- lib
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
requirements: []
|
189
|
+
rubyforge_project:
|
190
|
+
rubygems_version: 2.2.0
|
191
|
+
signing_key:
|
192
|
+
specification_version: 4
|
193
|
+
summary: An API wrapper for the Code Climate API
|
194
|
+
test_files:
|
195
|
+
- spec/microclimate/branch_spec.rb
|
196
|
+
- spec/microclimate/client_spec.rb
|
197
|
+
- spec/microclimate/repository_spec.rb
|
198
|
+
- spec/microclimate/response_spec.rb
|
199
|
+
- spec/microclimate/snapshot_spec.rb
|
200
|
+
- spec/spec_helper.rb
|