ghstatus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +82 -0
- data/Rakefile +1 -0
- data/bin/ghstatus +21 -0
- data/ghstatus.gemspec +26 -0
- data/lib/ghstatus.rb +9 -0
- data/lib/ghstatus/api.rb +25 -0
- data/lib/ghstatus/cmd_helper.rb +56 -0
- data/lib/ghstatus/message.rb +25 -0
- data/lib/ghstatus/status.rb +17 -0
- data/lib/ghstatus/version.rb +3 -0
- data/spec/cassettes/current_status.yml +46 -0
- data/spec/cassettes/last_status.yml +46 -0
- data/spec/cassettes/last_statuses.yml +51 -0
- data/spec/message_spec.rb +24 -0
- data/spec/spec_helper.rb +86 -0
- data/spec/status_spec.rb +15 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YTRkY2JmNTgyZTI1MWVhNzYwOWVkNTQ5NWVlZWNiMGJlMzQyYjZmOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YWI1MzY0MTkyYjBlYjJhMTY3OTRlNjM1NWYyOTNiN2I5M2Y2Y2M1NA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjQ2NDQ4OGU1NWI2NDlkY2Y1YTgwMDc1ODcxMzVlMGRlYzMyOTVjMGEzZTA3
|
10
|
+
ZDEwYTI1MWM1N2UwOGJiMTg5MzMxZDRmYzEzYzNiMDAwNWEyNTVjNzU0NDUz
|
11
|
+
YjNjMTJjYWY4MzgzNGFjMzE4ZTZkZmZhZmY5NzRjZWRmYzMwMTQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDhmZmExOGQ4MzRmOGFlNjhhM2U1ZDUxODFiMmQ1MTcyN2E4NDEzODFlNDA3
|
14
|
+
YzYxOGU5ZDNhNTY4M2YwZGRlODJiOGY3YWNmODZjMWZjNjMyOWQxYTg5NTcx
|
15
|
+
MWQ2ZTMzYWZmZThhNzMwM2EyY2VmZWM0MjBhNmM2NmVhOTIwZWQ=
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ile Eftimov
|
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,82 @@
|
|
1
|
+
# Gst
|
2
|
+
|
3
|
+
Easily get Github's Status as Ruby objects or use the command line tool.
|
4
|
+
|
5
|
+
## Motivation
|
6
|
+
|
7
|
+
I used to get these very often:
|
8
|
+
|
9
|
+
```
|
10
|
+
➜ repo-name git:(master) git push origin master
|
11
|
+
fatal: 'origin' does not appear to be a git repository
|
12
|
+
fatal: Could not read from remote repository.
|
13
|
+
|
14
|
+
Please make sure you have the correct access rights
|
15
|
+
and the repository exists.
|
16
|
+
```
|
17
|
+
|
18
|
+
And often I didn't know if it's my internet connection's fault, or GitHub's APIs had problems.
|
19
|
+
And I am too lazy to open the browser and check status.github.com everytime I see the message above.
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Add this line to your application's Gemfile:
|
24
|
+
|
25
|
+
gem 'gst'
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install gst
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
### In Ruby
|
38
|
+
|
39
|
+
To get the current Github Status:
|
40
|
+
```ruby
|
41
|
+
GST::Status.current
|
42
|
+
```
|
43
|
+
|
44
|
+
To get the last Github Status message:
|
45
|
+
```ruby
|
46
|
+
GST::Message.last
|
47
|
+
```
|
48
|
+
|
49
|
+
To get most recent Github Status messages:
|
50
|
+
```ruby
|
51
|
+
GST::Message.recent
|
52
|
+
```
|
53
|
+
|
54
|
+
### Via command line
|
55
|
+
|
56
|
+
The current API status:
|
57
|
+
```bash
|
58
|
+
ghstatus
|
59
|
+
```
|
60
|
+
|
61
|
+
Last API status as a human readable message:
|
62
|
+
```bash
|
63
|
+
ghstatus last
|
64
|
+
```
|
65
|
+
|
66
|
+
Last few API statuses as a human readable messages:
|
67
|
+
```bash
|
68
|
+
ghstatus recent
|
69
|
+
```
|
70
|
+
|
71
|
+
Help:
|
72
|
+
```bash
|
73
|
+
ghstatus help
|
74
|
+
```
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
1. Fork it ( http://github.com/<my-github-username>/gst/fork )
|
79
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
80
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
81
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
82
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/ghstatus
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
path = File.expand_path(File.dirname(__FILE__))
|
3
|
+
$:<< "#{path}/../lib"
|
4
|
+
|
5
|
+
require 'ghstatus'
|
6
|
+
|
7
|
+
arg = ARGV[0]
|
8
|
+
available_commands = ['help', 'last', 'recent']
|
9
|
+
|
10
|
+
if available_commands.include?(arg)
|
11
|
+
case arg.downcase
|
12
|
+
when 'help'
|
13
|
+
GHStatus::CMDHelper.help
|
14
|
+
when 'last'
|
15
|
+
GHStatus::CMDHelper.print_last_message(GHStatus::Message.last)
|
16
|
+
when 'recent'
|
17
|
+
GHStatus::CMDHelper.print_recent_messages(GHStatus::Message.recent)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
GHStatus::CMDHelper.print_status(GHStatus::Status.current)
|
21
|
+
end
|
data/ghstatus.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ghstatus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ghstatus"
|
8
|
+
spec.version = GHStatus::VERSION
|
9
|
+
spec.authors = ["Ile Eftimov"]
|
10
|
+
spec.email = ["ileeftimov@gmail.com"]
|
11
|
+
spec.summary = %q{GitHub status in a gem.}
|
12
|
+
spec.description = %q{Get GitHub's status via the command line. Or use it in an app.}
|
13
|
+
spec.homepage = "https://github.com/fteem/ghstatus"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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.5"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.3"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
spec.add_dependency "rest-client", "~> 1.7"
|
25
|
+
spec.add_dependency "rainbow", "~> 2.0"
|
26
|
+
end
|
data/lib/ghstatus.rb
ADDED
data/lib/ghstatus/api.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module GHStatus
|
5
|
+
class Api
|
6
|
+
STATUS_URL = "https://status.github.com/api/status.json"
|
7
|
+
LAST_MSG_URL = "https://status.github.com/api/last-message.json"
|
8
|
+
MSGS_URL = "https://status.github.com/api/messages.json"
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def last_message
|
12
|
+
JSON.parse(RestClient.get(LAST_MSG_URL))
|
13
|
+
end
|
14
|
+
|
15
|
+
def recent_messages
|
16
|
+
JSON.parse(RestClient.get(MSGS_URL))
|
17
|
+
end
|
18
|
+
|
19
|
+
def status
|
20
|
+
JSON.parse(RestClient.get(STATUS_URL))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rainbow'
|
2
|
+
|
3
|
+
module GHStatus
|
4
|
+
class CMDHelper
|
5
|
+
class << self
|
6
|
+
def help
|
7
|
+
puts "GHStatus - a command line tool for quick checkup of GitHub's API status."
|
8
|
+
puts "Available methods:"
|
9
|
+
puts "\tghstatus help - shows this help message."
|
10
|
+
puts "\tghstatus - shows the current API status."
|
11
|
+
puts "\tghstatus last - shows the last API status as a human readable message."
|
12
|
+
puts "\tghstatus recent - shows the last few API statuses as a human readable messages."
|
13
|
+
end
|
14
|
+
|
15
|
+
def print_status status
|
16
|
+
title
|
17
|
+
puts "Status: #{color(status.status.capitalize)}"
|
18
|
+
puts "Updated on #{status.updated_on.strftime("%m-%d-%Y at %I:%M%p")}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def print_last_message message
|
22
|
+
title
|
23
|
+
print_message message
|
24
|
+
end
|
25
|
+
|
26
|
+
def print_recent_messages messages
|
27
|
+
title
|
28
|
+
messages.each do |msg|
|
29
|
+
print_message msg
|
30
|
+
puts "-" * 32
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def print_message message
|
37
|
+
puts "Status: #{color(message.status.capitalize)}"
|
38
|
+
puts "Message: #{message.body}"
|
39
|
+
puts "Created on #{message.created_on.strftime("%m-%d-%Y at %I:%M%p")}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def title
|
43
|
+
puts "[GitHub API Status]"
|
44
|
+
puts "=" * 19
|
45
|
+
end
|
46
|
+
|
47
|
+
def color string
|
48
|
+
if string == 'Good'
|
49
|
+
Rainbow(string).green
|
50
|
+
else
|
51
|
+
Rainbow(string).yellow
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module GHStatus
|
2
|
+
class Message
|
3
|
+
class << self
|
4
|
+
def last
|
5
|
+
response = GHStatus::Api.last_message
|
6
|
+
new(response['status'], response['body'], response['created_on'])
|
7
|
+
end
|
8
|
+
|
9
|
+
def recent
|
10
|
+
response = GHStatus::Api.recent_messages
|
11
|
+
response.collect do |r|
|
12
|
+
new(r['status'], r['body'], r['created_on'])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :status, :body, :created_on
|
18
|
+
|
19
|
+
def initialize(status, body, created_on)
|
20
|
+
@body = body
|
21
|
+
@status = status
|
22
|
+
@created_on = DateTime.parse(created_on)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module GHStatus
|
2
|
+
class Status
|
3
|
+
class << self
|
4
|
+
def current
|
5
|
+
response = GHStatus::Api.status
|
6
|
+
new(response['status'], response['last_updated'])
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :status, :updated_on
|
11
|
+
|
12
|
+
def initialize(status, updated_on)
|
13
|
+
@status = status
|
14
|
+
@updated_on = DateTime.parse(updated_on)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://status.github.com/api/status.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
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, 29 Aug 2014 17:19:22 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
Keep-Alive:
|
30
|
+
- timeout=5
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
Content-Length:
|
34
|
+
- '55'
|
35
|
+
X-Octostatus-Request-Id:
|
36
|
+
- 297a17ab-1efe-4fe9-92a7-3b9b0f34392e
|
37
|
+
Timing-Allow-Origin:
|
38
|
+
- https://github.com
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=31536000
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ! '{"status":"good","last_updated":"2014-08-29T17:19:18Z"}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Fri, 29 Aug 2014 17:19:22 GMT
|
46
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://status.github.com/api/last-message.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
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, 29 Aug 2014 17:19:23 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
Keep-Alive:
|
30
|
+
- timeout=5
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
Content-Length:
|
34
|
+
- '93'
|
35
|
+
X-Octostatus-Request-Id:
|
36
|
+
- 27bc8e9d-bbae-47cb-9f11-02f0b3a4a200
|
37
|
+
Timing-Allow-Origin:
|
38
|
+
- https://github.com
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=31536000
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ! '{"status":"good","body":"Everything operating normally.","created_on":"2014-08-27T18:27:59Z"}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Fri, 29 Aug 2014 17:19:22 GMT
|
46
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://status.github.com/api/messages.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
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, 29 Aug 2014 17:19:23 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
Keep-Alive:
|
30
|
+
- timeout=5
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
Content-Length:
|
34
|
+
- '553'
|
35
|
+
X-Octostatus-Request-Id:
|
36
|
+
- 960cfd1d-a05e-4b85-ab23-92f234beb9c5
|
37
|
+
Timing-Allow-Origin:
|
38
|
+
- https://github.com
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=31536000
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ! '[{"status":"good","body":"Everything operating normally.","created_on":"2014-08-27T18:27:59Z"},{"status":"minor","body":"We''re
|
44
|
+
performing a short maintenance procedure which will temporarily impact access
|
45
|
+
to a small number of repositories","created_on":"2014-08-27T18:24:04Z"},{"status":"good","body":"Everything
|
46
|
+
operating normally.","created_on":"2014-08-27T14:30:35Z"},{"status":"minor","body":"We''re
|
47
|
+
performing a short maintenance procedure which will temporarily impact access
|
48
|
+
to a small number of repositories","created_on":"2014-08-27T14:17:58Z"}]'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Fri, 29 Aug 2014 17:19:23 GMT
|
51
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GHStatus::Message do
|
4
|
+
it 'gets the last status' do
|
5
|
+
VCR.use_cassette('last_status') do
|
6
|
+
last_status = described_class.last
|
7
|
+
expect(last_status).to be_kind_of GHStatus::Message
|
8
|
+
expect(last_status.body).to eq "Everything operating normally."
|
9
|
+
expect(last_status.status).to eq "good"
|
10
|
+
expect(last_status.created_on).to be_kind_of Date
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'gets the recent statuses' do
|
15
|
+
VCR.use_cassette('last_statuses') do
|
16
|
+
last_statuses = described_class.recent
|
17
|
+
expect(last_statuses).to be_kind_of Array
|
18
|
+
expect(last_statuses.first).to be_kind_of GHStatus::Message
|
19
|
+
expect(last_statuses.first.body).to eq "Everything operating normally."
|
20
|
+
expect(last_statuses.first.status).to eq "good"
|
21
|
+
expect(last_statuses.first.created_on).to be_kind_of Date
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'ghstatus'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
6
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
7
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, make a
|
13
|
+
# separate helper file that requires this one and then use it only in the specs
|
14
|
+
# that actually need it.
|
15
|
+
#
|
16
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
17
|
+
# users commonly want.
|
18
|
+
#
|
19
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
20
|
+
RSpec.configure do |config|
|
21
|
+
# The settings below are suggested to provide a good initial experience
|
22
|
+
# with RSpec, but feel free to customize to your heart's content.
|
23
|
+
=begin
|
24
|
+
# These two settings work together to allow you to limit a spec run
|
25
|
+
# to individual examples or groups you care about by tagging them with
|
26
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
27
|
+
# get run.
|
28
|
+
config.filter_run :focus
|
29
|
+
config.run_all_when_everything_filtered = true
|
30
|
+
|
31
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
32
|
+
# file, and it's useful to allow more verbose output when running an
|
33
|
+
# individual spec file.
|
34
|
+
if config.files_to_run.one?
|
35
|
+
# Use the documentation formatter for detailed output,
|
36
|
+
# unless a formatter has already been configured
|
37
|
+
# (e.g. via a command-line flag).
|
38
|
+
config.default_formatter = 'doc'
|
39
|
+
end
|
40
|
+
|
41
|
+
# Print the 10 slowest examples and example groups at the
|
42
|
+
# end of the spec run, to help surface which specs are running
|
43
|
+
# particularly slow.
|
44
|
+
config.profile_examples = 10
|
45
|
+
|
46
|
+
# Run specs in random order to surface order dependencies. If you find an
|
47
|
+
# order dependency and want to debug it, you can fix the order by providing
|
48
|
+
# the seed, which is printed after each run.
|
49
|
+
# --seed 1234
|
50
|
+
config.order = :random
|
51
|
+
|
52
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
53
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
54
|
+
# test failures related to randomization by passing the same `--seed` value
|
55
|
+
# as the one that triggered the failure.
|
56
|
+
Kernel.srand config.seed
|
57
|
+
|
58
|
+
# rspec-expectations config goes here. You can use an alternate
|
59
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
60
|
+
# assertions if you prefer.
|
61
|
+
config.expect_with :rspec do |expectations|
|
62
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
63
|
+
# For more details, see:
|
64
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
65
|
+
expectations.syntax = :expect
|
66
|
+
end
|
67
|
+
|
68
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
69
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
70
|
+
config.mock_with :rspec do |mocks|
|
71
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
72
|
+
# For more details, see:
|
73
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
74
|
+
mocks.syntax = :expect
|
75
|
+
|
76
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
77
|
+
# a real object. This is generally recommended.
|
78
|
+
mocks.verify_partial_doubles = true
|
79
|
+
end
|
80
|
+
=end
|
81
|
+
end
|
82
|
+
|
83
|
+
VCR.configure do |c|
|
84
|
+
c.cassette_library_dir = 'spec/cassettes'
|
85
|
+
c.hook_into :webmock # or :fakeweb
|
86
|
+
end
|
data/spec/status_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe GHStatus::Status do
|
5
|
+
|
6
|
+
it 'gets the current status' do
|
7
|
+
VCR.use_cassette('current_status') do
|
8
|
+
last_status = described_class.current
|
9
|
+
expect(last_status).to be_kind_of GHStatus::Status
|
10
|
+
expect(last_status.status).to eq "good"
|
11
|
+
expect(last_status.updated_on).to be_kind_of Date
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ghstatus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ile Eftimov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-30 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.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rainbow
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
description: Get GitHub's status via the command line. Or use it in an app.
|
84
|
+
email:
|
85
|
+
- ileeftimov@gmail.com
|
86
|
+
executables:
|
87
|
+
- ghstatus
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- .rspec
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/ghstatus
|
98
|
+
- ghstatus.gemspec
|
99
|
+
- lib/ghstatus.rb
|
100
|
+
- lib/ghstatus/api.rb
|
101
|
+
- lib/ghstatus/cmd_helper.rb
|
102
|
+
- lib/ghstatus/message.rb
|
103
|
+
- lib/ghstatus/status.rb
|
104
|
+
- lib/ghstatus/version.rb
|
105
|
+
- spec/cassettes/current_status.yml
|
106
|
+
- spec/cassettes/last_status.yml
|
107
|
+
- spec/cassettes/last_statuses.yml
|
108
|
+
- spec/message_spec.rb
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
- spec/status_spec.rb
|
111
|
+
homepage: https://github.com/fteem/ghstatus
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.4.1
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: GitHub status in a gem.
|
135
|
+
test_files:
|
136
|
+
- spec/cassettes/current_status.yml
|
137
|
+
- spec/cassettes/last_status.yml
|
138
|
+
- spec/cassettes/last_statuses.yml
|
139
|
+
- spec/message_spec.rb
|
140
|
+
- spec/spec_helper.rb
|
141
|
+
- spec/status_spec.rb
|
142
|
+
has_rdoc:
|