smokeit 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
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 smokeit.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Timon Vonk
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,20 @@
1
+ # Smokeit
2
+
3
+ A simple tool for smoketesting urls, breaks if response code is not
4
+ expected
5
+
6
+ ## Installation
7
+
8
+ $ gem install smokeit
9
+
10
+ ## Usage
11
+
12
+ ```smokeit <url> <expected response_code>```
13
+
14
+ ## Contributing
15
+
16
+ 1. Fork it
17
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
18
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
19
+ 4. Push to the branch (`git push origin my-new-feature`)
20
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/smokeit ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require 'smokeit'
3
+
4
+
5
+ server = ARGV[0]
6
+ res_code = ARGV[1]
7
+
8
+ Smokeit::Base.smoke!(server, res_code) ? exit(0) : exit(1)
data/lib/smokeit.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "smokeit/version"
2
+ require "smokeit/base"
@@ -0,0 +1,10 @@
1
+ require 'net/http'
2
+
3
+ module Smokeit
4
+ class Base
5
+ def self.smoke!(server, res_code)
6
+ response = Net::HTTP.get_response(URI(server))
7
+ response.code == String(res_code)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Smokeit
2
+ VERSION = "0.0.3"
3
+ end
data/smokeit.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/smokeit/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Timon Vonk"]
6
+ gem.email = ["timonv@gmail.com"]
7
+ gem.description = %q{Easy simple smoketests}
8
+ gem.summary = %q{Easy simple smoketests}
9
+ gem.homepage = "http://www.github.com/timonv/smokeit"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "smokeit"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Smokeit::VERSION
17
+
18
+ gem.add_development_dependency "test-unit"
19
+ gem.add_development_dependency "rake"
20
+ end
@@ -0,0 +1,25 @@
1
+ require 'test/unit'
2
+ require 'smokeit'
3
+
4
+ class TestSmokeit < Test::Unit::TestCase
5
+ def test_ok
6
+ res = Smokeit::Base.smoke!("http://www.google.com", 302)
7
+ assert res
8
+ end
9
+
10
+ def test_false
11
+ res = Smokeit::Base.smoke!("http://www.google.com", 500)
12
+ assert !res
13
+ end
14
+
15
+ def test_cli_ok
16
+ `bin/smokeit "http://www.google.com" 302`
17
+ assert_equal $?.to_i, 0
18
+ end
19
+
20
+ def test_cli_false
21
+ `bin/smokeit "http://www.google.com" 301`
22
+ assert_equal $?.to_i, 1
23
+ end
24
+ end
25
+
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smokeit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Timon Vonk
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: test-unit
16
+ requirement: &70138655052800 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70138655052800
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70138655051760 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70138655051760
36
+ description: Easy simple smoketests
37
+ email:
38
+ - timonv@gmail.com
39
+ executables:
40
+ - smokeit
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE
47
+ - README.md
48
+ - Rakefile
49
+ - bin/smokeit
50
+ - lib/smokeit.rb
51
+ - lib/smokeit/base.rb
52
+ - lib/smokeit/version.rb
53
+ - smokeit.gemspec
54
+ - test/smokeit_test.rb
55
+ homepage: http://www.github.com/timonv/smokeit
56
+ licenses: []
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ segments:
68
+ - 0
69
+ hash: 2464485273894320861
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ segments:
77
+ - 0
78
+ hash: 2464485273894320861
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.8.16
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Easy simple smoketests
85
+ test_files:
86
+ - test/smokeit_test.rb