http_status_task 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +3 -0
- data/http_status_task.gemspec +26 -0
- data/lib/http_status_task.rb +4 -0
- data/lib/http_status_task/engine.rb +4 -0
- data/lib/tasks/http_status_task.rake +71 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b0d4d0ce79153bb63a8021f3e6231f3ef5697e0
|
4
|
+
data.tar.gz: 13b82d491643f6a0a1ea294514c7ffdb74932fd4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 13d53d74b521c173b5b5f2a3249985bed60d32da97de3c0f4bc137b26d7e681b7f8942e8ca2011d8fd333907528303543cdf172b3cc3a5c90be9325ad6f265d9
|
7
|
+
data.tar.gz: 925fe1c97efeac181650bf1cfb4dbb00ef3ba38fd58ed35954e356a58ac3eda5b6b48cfe6415a4cc293ff59345b9b625192911c53b09ea822c0eb79a0ec5ebea
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 muryoimpl
|
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,45 @@
|
|
1
|
+
# HttpStatusTask
|
2
|
+
|
3
|
+
`http_status_task` adds rake tasks which print HTTP status codes defined in Rack.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'http_status_task'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install http_status_task
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
$ bundle exec rake -T
|
23
|
+
|
24
|
+
rake http:status # Print HTTP status codes, descriptions and symbols
|
25
|
+
rake http:status:100 # Print HTTP status codes of 100 - 102
|
26
|
+
rake http:status:200 # Print HTTP status codes of 200 - 226
|
27
|
+
rake http:status:300 # Print HTTP status codes of 300 - 308
|
28
|
+
rake http:status:400 # Print HTTP status codes of 400 - 431
|
29
|
+
rake http:status:500 # Print HTTP status codes of 500 - 511
|
30
|
+
|
31
|
+
$ bundle exec rake http:status:100
|
32
|
+
|
33
|
+
code description symbol
|
34
|
+
100 Continue :continue
|
35
|
+
101 Switching Protocols :switching_protocols
|
36
|
+
102 Processing :processing
|
37
|
+
```
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it ( https://github.com/muryoimpl/http_status_task/fork )
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'http_status_task'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "http_status_task"
|
8
|
+
spec.version = HttpStatusTask::VERSION
|
9
|
+
spec.authors = ["muryoimpl"]
|
10
|
+
spec.email = ["muryoimpl@gmail.com"]
|
11
|
+
spec.summary = %q{This gem add rake tasks which print http status codes.}
|
12
|
+
spec.description = %q{This gem add rake tasks which print http status codes.}
|
13
|
+
spec.homepage = ""
|
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_development_dependency "bundler", "~> 1.7"
|
22
|
+
|
23
|
+
spec.add_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_dependency "rack"
|
25
|
+
spec.add_dependency "colorize"
|
26
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'rack/utils'
|
2
|
+
require 'colorize'
|
3
|
+
|
4
|
+
STATUS_CODE_TO_SYMBOL = Hash[Rack::Utils::SYMBOL_TO_STATUS_CODE.map {|symbol, code|
|
5
|
+
[code, symbol]
|
6
|
+
}]
|
7
|
+
|
8
|
+
namespace :http do
|
9
|
+
desc "Print HTTP status codes"
|
10
|
+
task :status do
|
11
|
+
print_header
|
12
|
+
|
13
|
+
Rack::Utils::HTTP_STATUS_CODES.each do |code, desc|
|
14
|
+
print_row code, desc
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :status do
|
19
|
+
desc 'Print HTTP status codes of 500 - 511'
|
20
|
+
task '500' do
|
21
|
+
print_header
|
22
|
+
print_row_status_codes_start_with 5
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Print HTTP status codes of 400 - 431'
|
26
|
+
task '400' do
|
27
|
+
print_header
|
28
|
+
print_row_status_codes_start_with 4
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Print HTTP status codes of 300 - 308'
|
32
|
+
task '300' do
|
33
|
+
print_header
|
34
|
+
print_row_status_codes_start_with 3
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Print HTTP status codes of 200 - 226'
|
38
|
+
task '200' do
|
39
|
+
print_header
|
40
|
+
print_row_status_codes_start_with 2
|
41
|
+
end
|
42
|
+
|
43
|
+
desc 'Print HTTP status codes of 100 - 102'
|
44
|
+
task '100' do
|
45
|
+
print_header
|
46
|
+
print_row_status_codes_start_with 1
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def max_desc_length
|
53
|
+
Rack::Utils::HTTP_STATUS_CODES.max_by {|code, desc| desc.size }.last.length
|
54
|
+
end
|
55
|
+
|
56
|
+
def print_header
|
57
|
+
puts "code #{'description'.ljust(max_desc_length)} symbol".colorize(:green).bold
|
58
|
+
end
|
59
|
+
|
60
|
+
def print_row(code, desc)
|
61
|
+
puts "#{code.to_s.ljust(4)} #{desc.ljust(max_desc_length)} :#{STATUS_CODE_TO_SYMBOL[code]}"
|
62
|
+
end
|
63
|
+
|
64
|
+
def print_row_status_codes_start_with(number)
|
65
|
+
Rack::Utils::HTTP_STATUS_CODES.find_all {|code, desc|
|
66
|
+
%r/\A#{number}/ === code.to_s
|
67
|
+
}.each {|(status_code, description)|
|
68
|
+
print_row status_code, description
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: http_status_task
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- muryoimpl
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: colorize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: This gem add rake tasks which print http status codes.
|
70
|
+
email:
|
71
|
+
- muryoimpl@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- http_status_task.gemspec
|
82
|
+
- lib/http_status_task.rb
|
83
|
+
- lib/http_status_task/engine.rb
|
84
|
+
- lib/tasks/http_status_task.rake
|
85
|
+
homepage: ''
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.2.2
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: This gem add rake tasks which print http status codes.
|
109
|
+
test_files: []
|