dfeojm 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,22 @@
1
+ Copyright (c) 2011 Barry Allard
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.
@@ -0,0 +1,24 @@
1
+ DownForEveryoneOrJustMe.com CLI and Ruby API
2
+ =============================
3
+
4
+ This is an unofficial gem and in no way connected with DownForEveryoneOrJustMe.com.
5
+
6
+ Setup
7
+ -----
8
+ [sudo] gem install dfeojm
9
+
10
+ Hacking
11
+ -------
12
+ Please fork and create a topical branch similar to yournickname-feature-applies_to_version.
13
+
14
+ Issues
15
+ ------
16
+ Use the github issue tracker.
17
+
18
+ License
19
+ -------
20
+
21
+ Released under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
22
+
23
+ Created by Barry Allard
24
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
+
6
+ require 'dfeojm/util/command_line'
7
+ DFEOJM::Util::CommandLine.new.exec
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # External runtime dependencies
4
+ require 'nokogiri'
5
+ require 'trollop'
6
+
7
+ # System libraries
8
+ require 'open-uri'
9
+
10
+ module DFEOJM
11
+ class DFEOJM
12
+ attr_reader :site
13
+
14
+ def initialize(site)
15
+ # Remove the protocol part
16
+ @site = site.gsub(/.*:\/\//, '')
17
+ check
18
+ end
19
+
20
+ # Go fetch the status document.
21
+ def check
22
+ result = false
23
+ @doc = Nokogiri::HTML(open('http://www.downforeveryoneorjustme.com/'+site))
24
+ @doc.css('div#container').each do |dom|
25
+ result = dom.content.index 'is up'
26
+ end
27
+ result
28
+ end
29
+
30
+ # Return a human-friendly representation.
31
+ def to_s()
32
+ "#{site} #{check ? 'is up' : 'looks down'}"
33
+ end
34
+ end # class DFEOJM
35
+ end # module DFEOJM
@@ -0,0 +1,34 @@
1
+ require 'dfeojm'
2
+ require 'dfeojm/version'
3
+ require 'trollop'
4
+
5
+ module DFEOJM
6
+ module Util
7
+ class CommandLine
8
+ def exec
9
+ begin
10
+ opts = Trollop::options do
11
+ version "DownForEveryoneOrJustMe (tm) unofficial ruby utility #{::DFEOJM::VERSION} (c) 2011 Barry Allard"
12
+ banner <<-EOS
13
+ DownForEveryoneOrJustMe (tm) unofficial ruby utility #{::DFEOJM::VERSION} (c) 2011 Barry Allard
14
+
15
+
16
+ Usage:
17
+ dfeojm hostname.com
18
+
19
+
20
+ EOS
21
+ end
22
+ Trollop::die "hostname must be present" if ARGV.empty? # show help screen
23
+
24
+ app = DFEOJM.new ARGV[0]
25
+ puts app.to_s
26
+ rescue => e
27
+ # puts e
28
+ # exit 1
29
+ raise e
30
+ end
31
+ end # def exec
32
+ end # class CommandLine
33
+ end # module Util
34
+ end # module DFEOJM
@@ -0,0 +1,11 @@
1
+ module DFEOJM
2
+ VERSION = '0.0.1'
3
+
4
+ def self.bump_revision
5
+ found = false
6
+ File.rewrite(__FILE__).each do |line|
7
+ # retain the major and minor version, but increment the release.
8
+ line.sub(/([0-9]*\.[0-9]*\.)([0-9]*).*$/) { found = true ; $1 + "#{$2.to_i+1}" } unless found
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dfeojm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Barry Allard (steakknife)
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-19 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: &70204613491120 !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: *70204613491120
25
+ - !ruby/object:Gem::Dependency
26
+ name: trollop
27
+ requirement: &70204613490660 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70204613490660
36
+ - !ruby/object:Gem::Dependency
37
+ name: bundler
38
+ requirement: &70204613490160 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70204613490160
47
+ description: See http://downforeveryoneorjustme.com
48
+ email: barry@barryallard.name
49
+ executables:
50
+ - dfeojm
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - lib/dfeojm/util/command_line.rb
55
+ - lib/dfeojm/version.rb
56
+ - lib/dfeojm.rb
57
+ - bin/dfeojm
58
+ - LICENSE
59
+ - README.md
60
+ homepage: https://github.com/steakknife/dfeojm
61
+ licenses:
62
+ - MIT
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: 1.3.6
79
+ requirements: []
80
+ rubyforge_project: dfeojm
81
+ rubygems_version: 1.8.11
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Unofficial Ruby interface and command-line to DownForEveryoneOrJustMe.com
85
+ test_files: []