cinch-downforeveryone 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 by Dominik Honnef
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # Down for everyone or just me? plugin
2
+
3
+ This plugin uses downforeveryoneorjustme.com to check if a website is
4
+ up or down.
5
+
6
+ ## Installation
7
+ First install the gem by running:
8
+ [sudo] gem install cinch-downforeveryone
9
+
10
+ Then load it in your bot:
11
+ require "cinch"
12
+ require "cinch/plugins/downforeveryone"
13
+
14
+ bot = Cinch::Bot.new do
15
+ configure do |c|
16
+ # add all required options here
17
+ c.plugins.plugins = [Cinch::Plugins::DownForEveryone] # optionally add more plugins
18
+ end
19
+ end
20
+
21
+ bot.start
22
+
23
+ ## Commands
24
+ ### isitdown/isitup <url>
25
+ Check if a website is up or down.
26
+
27
+ ## Options
28
+ None.
@@ -0,0 +1,31 @@
1
+ require "mechanize"
2
+ module Cinch
3
+ module Plugins
4
+ class DownForEveryone
5
+ include Cinch::Plugin
6
+
7
+ def initialize(*args)
8
+ super
9
+
10
+ @agent = Mechanize.new
11
+ @agent.user_agent_alias = "Linux Mozilla"
12
+ end
13
+
14
+ match(/isit(?:down|up)\?? (.+)/)
15
+ def execute(m, url)
16
+ if up?(url)
17
+ m.reply "It's just you. #{url} is up."
18
+ else
19
+ m.reply "It's not just you! #{url} looks down from here."
20
+ end
21
+ end
22
+
23
+ private
24
+ def up?(url)
25
+ url = url.gsub(/^https?:\/\//, '')
26
+ page = @agent.get("http://downforeveryoneorjustme.com/#{url}")
27
+ !!(page.title.split(" -> ").first =~ / Up$/)
28
+ end
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cinch-downforeveryone
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Dominik Honnef
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-30 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: cinch
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 0
31
+ version: "1.0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: mechanize
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :runtime
46
+ version_requirements: *id002
47
+ description: Check if a website is up, using downforeveryoneorjustme.com
48
+ email:
49
+ - dominikh@fork-bomb.org
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files: []
55
+
56
+ files:
57
+ - LICENSE
58
+ - README.md
59
+ - lib/cinch/plugins/downforeveryone.rb
60
+ has_rdoc: true
61
+ homepage: http://rubydoc.info/github/cinchrb/cinch-downforeveryone
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options: []
66
+
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 1
76
+ - 9
77
+ - 1
78
+ version: 1.9.1
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project:
90
+ rubygems_version: 1.3.7
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: Check if a website is up, using downforeveryoneorjustme.com
94
+ test_files: []
95
+