pushpop-github-status 0.0.1
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.
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +66 -0
- data/README.md +86 -0
- data/lib/pushpop-github-status.rb +43 -0
- data/lib/pushpop-github-status/version.rb +3 -0
- data/pushpop-github-status.gemspec +24 -0
- data/spec/pushpop-github-status_spec.rb +24 -0
- data/spec/spec_helper.rb +10 -0
- metadata +119 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pushpop-github-status (0.0.1)
|
5
|
+
http
|
6
|
+
multi_json (~> 1.11)
|
7
|
+
pushpop
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (4.2.5)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
json (~> 1.7, >= 1.7.7)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
17
|
+
tzinfo (~> 1.1)
|
18
|
+
clockwork (1.2.0)
|
19
|
+
activesupport
|
20
|
+
tzinfo
|
21
|
+
diff-lcs (1.2.5)
|
22
|
+
dotenv (2.0.2)
|
23
|
+
http (0.6.3)
|
24
|
+
http_parser.rb (~> 0.6.0)
|
25
|
+
http_parser.rb (0.6.0)
|
26
|
+
i18n (0.7.0)
|
27
|
+
json (1.8.3)
|
28
|
+
minitest (5.8.2)
|
29
|
+
multi_json (1.11.2)
|
30
|
+
pushpop (0.4.0)
|
31
|
+
clockwork
|
32
|
+
dotenv
|
33
|
+
sinatra
|
34
|
+
thor
|
35
|
+
rack (1.6.4)
|
36
|
+
rack-protection (1.5.3)
|
37
|
+
rack
|
38
|
+
rspec (3.4.0)
|
39
|
+
rspec-core (~> 3.4.0)
|
40
|
+
rspec-expectations (~> 3.4.0)
|
41
|
+
rspec-mocks (~> 3.4.0)
|
42
|
+
rspec-core (3.4.0)
|
43
|
+
rspec-support (~> 3.4.0)
|
44
|
+
rspec-expectations (3.4.0)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.4.0)
|
47
|
+
rspec-mocks (3.4.0)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.4.0)
|
50
|
+
rspec-support (3.4.0)
|
51
|
+
sinatra (1.4.6)
|
52
|
+
rack (~> 1.4)
|
53
|
+
rack-protection (~> 1.4)
|
54
|
+
tilt (>= 1.3, < 3)
|
55
|
+
thor (0.19.1)
|
56
|
+
thread_safe (0.3.5)
|
57
|
+
tilt (2.0.1)
|
58
|
+
tzinfo (1.2.2)
|
59
|
+
thread_safe (~> 0.1)
|
60
|
+
|
61
|
+
PLATFORMS
|
62
|
+
ruby
|
63
|
+
|
64
|
+
DEPENDENCIES
|
65
|
+
pushpop-github-status!
|
66
|
+
rspec
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Pushpop-Github-Status
|
2
|
+
|
3
|
+
This is a step for [pushpop](https://github.com/pushpop-project/pushpop) that pulls Github's current status. It will pull all 4 status endpoints by default:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
require "pushpop"
|
7
|
+
require "pushpop-github-status"
|
8
|
+
|
9
|
+
job "Github status job" do
|
10
|
+
every 5.minutes
|
11
|
+
|
12
|
+
github_status
|
13
|
+
|
14
|
+
step "do something with the status" do |gs|
|
15
|
+
gs.status
|
16
|
+
end
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
The format of the step's return value is:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
{
|
24
|
+
# Format like https://status.github.com/api/status.json
|
25
|
+
status: { },
|
26
|
+
|
27
|
+
# Format like https://status.github.com/api/last-message.json
|
28
|
+
last_message: { },
|
29
|
+
|
30
|
+
# Format like https://status.github.com/api/messages.json
|
31
|
+
messages: { },
|
32
|
+
|
33
|
+
# Format like https://status.github.com/api/daily-summary.json
|
34
|
+
daily_summary: { }
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
For an explanation of the values, check out Github's [status API documentation](https://status.github.com/api)
|
39
|
+
|
40
|
+
|
41
|
+
If you want to pull just a few of the endpoints, end the previous step with an array of the data you want:
|
42
|
+
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
require "pushpop"
|
46
|
+
require "pushpop-github-status"
|
47
|
+
|
48
|
+
job "Github status job" do
|
49
|
+
every 5.minutes
|
50
|
+
|
51
|
+
step "set the endpoints I want" do
|
52
|
+
[:status, :last_message]
|
53
|
+
end
|
54
|
+
|
55
|
+
github_status
|
56
|
+
|
57
|
+
step "do something with the status" do |gs|
|
58
|
+
gs.status
|
59
|
+
end
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
The above code will only return the "status" and "last_message" endpoints.
|
64
|
+
|
65
|
+
|
66
|
+
### The MIT License (MIT)
|
67
|
+
|
68
|
+
Copyright (c) 2015 Will Barrett
|
69
|
+
|
70
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
71
|
+
of this software and associated documentation files (the "Software"), to deal
|
72
|
+
in the Software without restriction, including without limitation the rights
|
73
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
74
|
+
copies of the Software, and to permit persons to whom the Software is
|
75
|
+
furnished to do so, subject to the following conditions:
|
76
|
+
|
77
|
+
The above copyright notice and this permission notice shall be included in all
|
78
|
+
copies or substantial portions of the Software.
|
79
|
+
|
80
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
81
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
82
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
83
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
84
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
85
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
86
|
+
SOFTWARE.
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'pushpop'
|
2
|
+
require 'multi_json'
|
3
|
+
require 'http'
|
4
|
+
|
5
|
+
module Pushpop
|
6
|
+
|
7
|
+
class GithubStatus < Step
|
8
|
+
|
9
|
+
PLUGIN_NAME = 'github_status'
|
10
|
+
|
11
|
+
Pushpop::Job.register_plugin(GithubStatus::PLUGIN_NAME, GithubStatus)
|
12
|
+
|
13
|
+
BASE_URL = "https://status.github.com/api"
|
14
|
+
|
15
|
+
def run(last_response=nil, step_responses=nil)
|
16
|
+
if last_response == nil
|
17
|
+
last_response = [:status, :last_message, :messages, :daily_summary]
|
18
|
+
end
|
19
|
+
response = {}
|
20
|
+
last_response.each do |endpoint|
|
21
|
+
response[endpoint] = self.send(endpoint)
|
22
|
+
end
|
23
|
+
response
|
24
|
+
end
|
25
|
+
|
26
|
+
def status
|
27
|
+
MultiJson.load(HTTP.get(BASE_URL + "/status.json").to_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
def last_message
|
31
|
+
MultiJson.load(HTTP.get(BASE_URL + "/last-message.json").to_s)
|
32
|
+
end
|
33
|
+
|
34
|
+
def messages
|
35
|
+
MultiJson.load(HTTP.get(BASE_URL + "/messages.json").to_s)
|
36
|
+
end
|
37
|
+
|
38
|
+
def daily_summary
|
39
|
+
MultiJson.load(HTTP.get(BASE_URL + "/daily-summary.json").to_s)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'pushpop-github-status/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "pushpop-github-status"
|
7
|
+
s.version = Pushpop::GithubStatusVersion
|
8
|
+
s.authors = ["Will Barrett"]
|
9
|
+
s.email = "will@tallgreentree.com"
|
10
|
+
s.homepage = "https://github.com/willbarrett/pushpop-github-status"
|
11
|
+
s.summary = "Pushpop plugin for reading Github's status"
|
12
|
+
s.description = "A plugin for the pushpop integration system for reading Github's current status from status.github.com"
|
13
|
+
|
14
|
+
s.add_dependency "pushpop"
|
15
|
+
s.add_dependency "http"
|
16
|
+
s.add_dependency "multi_json", "~> 1.11"
|
17
|
+
|
18
|
+
s.add_development_dependency "rspec"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pushpop::GithubStatus do
|
4
|
+
|
5
|
+
describe '#run' do
|
6
|
+
it "should load all endpoints if none are specified" do
|
7
|
+
step = Pushpop::GithubStatus.new
|
8
|
+
resp = step.run
|
9
|
+
expect(resp[:status]).to_not be_nil
|
10
|
+
expect(resp[:last_message]).to_not be_nil
|
11
|
+
expect(resp[:messages]).to_not be_nil
|
12
|
+
expect(resp[:daily_summary]).to_not be_nil
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should load only the endpoints specified" do
|
16
|
+
step = Pushpop::GithubStatus.new
|
17
|
+
resp = step.run([:status, :last_message])
|
18
|
+
expect(resp[:status]).to_not be_nil
|
19
|
+
expect(resp[:last_message]).to_not be_nil
|
20
|
+
expect(resp[:messages]).to be_nil
|
21
|
+
expect(resp[:daily_summary]).to be_nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pushpop-github-status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Will Barrett
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: pushpop
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: http
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: multi_json
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.11'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.11'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: A plugin for the pushpop integration system for reading Github's current
|
79
|
+
status from status.github.com
|
80
|
+
email: will@tallgreentree.com
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- .gitignore
|
86
|
+
- Gemfile
|
87
|
+
- Gemfile.lock
|
88
|
+
- README.md
|
89
|
+
- lib/pushpop-github-status.rb
|
90
|
+
- lib/pushpop-github-status/version.rb
|
91
|
+
- pushpop-github-status.gemspec
|
92
|
+
- spec/pushpop-github-status_spec.rb
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
homepage: https://github.com/willbarrett/pushpop-github-status
|
95
|
+
licenses: []
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 1.8.23
|
115
|
+
signing_key:
|
116
|
+
specification_version: 3
|
117
|
+
summary: Pushpop plugin for reading Github's status
|
118
|
+
test_files: []
|
119
|
+
has_rdoc:
|