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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5cdb63c4682b1cd87780fb04fc81bcccd4c5c1f
4
- data.tar.gz: dc56c848210b39e40ccaff8cff20cbed3ef8ac5b
3
+ metadata.gz: def0b6632d6cf89fa6ca0a7d388f7d9519e3b9c0
4
+ data.tar.gz: 61d89c537abca1b1b2285169a347ae22abb28d94
5
5
  SHA512:
6
- metadata.gz: 44cf4072661c80b4c57ab6b2f66f3129f0417f0d53b89c6a61e699e49552e656fbe48ac72337bd11d5ad13f85eaf8a73f67d88e2fc27396a9c1b578128c2ba5b
7
- data.tar.gz: 981a1ea59f91688a1063ee095f80d8bee5ac6bcbe9dc3676508288668807567cd012e714dd7c48dedb698a44a2a773232aef873e9bb0931b34e107b4ceed91d7
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
- api_url = api_url(response.matches[0][0])
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"
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 { routes_command("is heroku.com down").to :is_site_down }
5
- it { routes_command("is github.com down again").to :is_site_down }
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
@@ -1,2 +1,4 @@
1
1
  require "lita-down-for-everyone"
2
2
  require "lita/rspec"
3
+
4
+ Lita.version_3_compatibility_mode = false
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.3
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: 2014-03-11 00:00:00.000000000 Z
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.0.3
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: