lita-down-for-everyone 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/down_for_everyone.rb +10 -1
- data/lita-down-for-everyone.gemspec +1 -1
- data/spec/lita/handlers/down_for_everyone_spec.rb +9 -3
- data/spec/spec_helper.rb +2 -0
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def0b6632d6cf89fa6ca0a7d388f7d9519e3b9c0
|
4
|
+
data.tar.gz: 61d89c537abca1b1b2285169a347ae22abb28d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be41ebe1a4221a4f95d0a57ba4f5f94e0ad4dfe63fbe73d1181854347fe6732cb806742cb51d973ada25c395be8582831db6259e0c01b6f98f0fe6a3314190d8
|
7
|
+
data.tar.gz: cf682dd065cc89998a25182b42bddfb0fa6c62afbdf3f49d0eeda55d6b27b25ccea66d2de00527d7e37520141e87e30239ecd77532d78adecfef2b0f251dc855
|
@@ -7,7 +7,8 @@ module Lita
|
|
7
7
|
|
8
8
|
def is_site_down(response)
|
9
9
|
site_url = response.matches[0][0]
|
10
|
-
|
10
|
+
site_url = sanitize(site_url) if site_url_from_slack?(site_url)
|
11
|
+
api_url = api_url(site_url)
|
11
12
|
username = response.user.name
|
12
13
|
|
13
14
|
response_html = http.get(api_url).body
|
@@ -24,6 +25,14 @@ module Lita
|
|
24
25
|
def api_url(site_url)
|
25
26
|
"http://isup.me/#{site_url}"
|
26
27
|
end
|
28
|
+
|
29
|
+
def sanitize(site_url)
|
30
|
+
URI.extract(site_url)[0].split("//")[1]
|
31
|
+
end
|
32
|
+
|
33
|
+
def site_url_from_slack?(site_url)
|
34
|
+
true if site_url.match(/</)
|
35
|
+
end
|
27
36
|
end
|
28
37
|
|
29
38
|
Lita.register_handler(DownForEveryone)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-down-for-everyone"
|
3
|
-
spec.version = "0.0.
|
3
|
+
spec.version = "0.0.4"
|
4
4
|
spec.authors = ["Jordan Killpack"]
|
5
5
|
spec.email = ["jordan@bignerdranch.com"]
|
6
6
|
spec.homepage = "http://www.github.com/killpack/lita-down-for-everyone"
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Lita::Handlers::DownForEveryone, lita_handler: true do
|
4
|
-
it {
|
5
|
-
it {
|
4
|
+
it { is_expected.to route_command("is heroku.com down").to :is_site_down }
|
5
|
+
it { is_expected.to route_command("is github.com down again").to :is_site_down }
|
6
|
+
it { is_expected.to route_command("is \"<http://github.com|github.com>\" down again").to :is_site_down }
|
6
7
|
|
7
8
|
describe "#is_site_down" do
|
8
9
|
context "when the site is down" do
|
@@ -65,7 +66,12 @@ HEREDOC
|
|
65
66
|
expect(replies.last).to include("Test User: It's just you: looks like github.com is up. http://isup.me/github.com")
|
66
67
|
end
|
67
68
|
end
|
68
|
-
|
69
|
+
context "when the url has been sent from slack" do
|
70
|
+
it "replies that the site is up" do
|
71
|
+
send_command("is \"<http://github.com|github.com>\" down?")
|
72
|
+
expect(replies.last).to include("Test User: It's just you: looks like github.com is up. http://isup.me/github.com")
|
73
|
+
end
|
74
|
+
end
|
69
75
|
context "when the given URL is invalid" do
|
70
76
|
let(:invalid_html) {
|
71
77
|
<<HEREDOC
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-down-for-everyone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Killpack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 3.0.0.beta2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.0.0.beta2
|
69
69
|
description: Lita, is github.com down?
|
@@ -73,7 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
77
77
|
- Gemfile
|
78
78
|
- LICENSE
|
79
79
|
- README.md
|
@@ -93,20 +93,21 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.4.2
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Lita, is github.com down?
|
110
110
|
test_files:
|
111
111
|
- spec/lita/handlers/down_for_everyone_spec.rb
|
112
112
|
- spec/spec_helper.rb
|
113
|
+
has_rdoc:
|