is_it_up 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODNmYjA1NjgzMjllY2RmNjU1Mzc1ZjRkY2RiOGNmNDEzYThhMjA2MA==
5
+ data.tar.gz: !binary |-
6
+ Mjc2YWJlZDdkNWU5YjNhYmUyYmQwMmQ5ODVlNGZkZTVkM2U5Njc4MQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YjJhOTUxNDcwMTBlOWUyMTU2Zjk2M2U3OTdmYzY4MGM1NjUzNmY5MTA1MTZl
10
+ ZTk0ZDU4NGVjY2FmZmNhMjhmMThjZGY3ZTdlZTRjMTFiY2VkOTJiYjkwMjcw
11
+ OTYzYjU3NjZmOGU5ZWI1YjYwYTZmOWZkODFmNzQ1ZmMxM2NmYjM=
12
+ data.tar.gz: !binary |-
13
+ ZmZmMWQyYTY4ZTRjMDEwMTFjNzdhZjJiMGIyMWVjOTQwZjMzMTQyYjJiN2E0
14
+ NjA1MDEwYmE5ZWJmY2ZiNmE3ZDcxODRiNmU0ZGIxN2VhMDQ0OGZiM2QxNDZj
15
+ ZWU3MDU0OWRiMjc2NTg0ODQxYWMwOTkxOGQwNTc4MTc0N2JjMDk=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in is_it_up.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 CustomInk
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.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Is It Up?
2
+
3
+ A Ruby gem that adds a simple endpoint to see if your application "is
4
+ up". The endpoint is handled via Rack middleware. A Railtie is provided
5
+ for simple integration with Ruby on Rails apps.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'is_it_up'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install is_it_up
20
+
21
+ ## Usage
22
+
23
+ IsItUp provides one monitoring URI that returns a plain text response:
24
+
25
+ ```ruby
26
+ % curl your-domain/is_it_up
27
+ It is up.
28
+ ```
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it ( http://github.com/customink/is_it_up/fork )
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
37
+
38
+ ## Kudos
39
+
40
+ Various ideas borrowed from:
41
+
42
+ * [is_it_up](https://github.com/andhapp/is_it_up), a similar rack middleware.
43
+ * [fitter_happer](https://github.com/atmos/fitter_happier), a similar Rails plugin.
44
+
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ Bundler.require
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs = ['lib','test']
7
+ t.pattern = 'test/**/*_test.rb'
8
+ t.verbose = true
9
+ end
10
+
11
+ task :default => :test
data/is_it_up.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'is_it_up/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "is_it_up"
8
+ spec.version = IsItUp::VERSION
9
+ spec.authors = ["Christopher R. Murphy"]
10
+ spec.email = ["cmurphy@customink.com"]
11
+ spec.summary = %q{A Ruby gem for adding a simple endpoint to see if your application "is up".}
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://github.com/customink/is_it_up"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rack"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "minitest", "~> 5.0"
25
+ end
@@ -0,0 +1,19 @@
1
+ module IsItUp
2
+ # If you are using Ruby on Rails, you do not need to manually insert this
3
+ # middleware into your middleware stack. See railtie.rb.
4
+ class Middleware
5
+ def initialize(app)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ status, header, response =
11
+ if env['PATH_INFO'] == "/is_it_up"
12
+ [200, { "Content-Type" => "text/plain" }, ["It is up."]]
13
+ else
14
+ @app.call(env)
15
+ end
16
+ [status, header, response]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ module IsItUp
2
+ class Railtie < Rails::Railtie
3
+ initializer "is_it_up.configure_rails_initialization" do
4
+ Rails.application.middleware.use IsItUp::Middleware
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module IsItUp
2
+ VERSION = "0.0.1"
3
+ end
data/lib/is_it_up.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "rack"
2
+ require "is_it_up/version"
3
+ require "is_it_up/middleware"
4
+ require 'is_it_up/railtie' if defined?(Rails::Railtie)
5
+
6
+ module IsItUp
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module IsItUp
4
+ class IsItUpTest < TestCase
5
+ it "must define the version" do
6
+ VERSION.wont_be_nil
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ require 'test_helper'
2
+
3
+ module IsItUp
4
+ class MiddlewareTest < TestCase
5
+
6
+ let(:rack_app) do
7
+ @app =
8
+ Rack::Builder.new do
9
+ use IsItUp::Middleware
10
+ run lambda {|env| [200, {"Content-type" => "text/html"}, ["A response"]] }
11
+ end
12
+ end
13
+
14
+ describe "When the request path contains '/is_it_up'" do
15
+ it "must render 'It is up.'" do
16
+ response = Rack::MockRequest.new(rack_app).get("/is_it_up")
17
+ response.body.must_equal "It is up."
18
+ end
19
+ end
20
+
21
+ describe "When the request path does not contain '/is_it_up'" do
22
+ it "must not render 'It is up.'" do
23
+ response = Rack::MockRequest.new(rack_app).get("/not_is_it_up")
24
+ response.body.must_equal "A response"
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,9 @@
1
+ require "bundler" ; Bundler.require :development, :test
2
+ require "is_it_up"
3
+ require "minitest/autorun"
4
+ require "minitest/pride"
5
+
6
+ module IsItUp
7
+ class TestCase < Minitest::Spec
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: is_it_up
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Christopher R. Murphy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: A Ruby gem for adding a simple endpoint to see if your application "is
70
+ up".
71
+ email:
72
+ - cmurphy@customink.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - is_it_up.gemspec
83
+ - lib/is_it_up.rb
84
+ - lib/is_it_up/middleware.rb
85
+ - lib/is_it_up/railtie.rb
86
+ - lib/is_it_up/version.rb
87
+ - test/cases/is_it_up_test.rb
88
+ - test/cases/middleware_test.rb
89
+ - test/test_helper.rb
90
+ homepage: https://github.com/customink/is_it_up
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.2.2
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: A Ruby gem for adding a simple endpoint to see if your application "is up".
114
+ test_files:
115
+ - test/cases/is_it_up_test.rb
116
+ - test/cases/middleware_test.rb
117
+ - test/test_helper.rb