httpstatus 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +65 -0
- data/VERSION +1 -1
- data/httpstatus.gemspec +5 -5
- data/lib/httpstatus.rb +35 -1
- metadata +67 -52
- data/README.rdoc +0 -19
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
httpstatus
|
2
|
+
============================
|
3
|
+
|
4
|
+
httpstatus shows meaning of given HTTP status code.
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
exact match
|
9
|
+
|
10
|
+
$ httpstatus 404
|
11
|
+
404: Not Found
|
12
|
+
|
13
|
+
show status code starts with 40
|
14
|
+
|
15
|
+
$ httpstatus 40
|
16
|
+
400: Bad Request
|
17
|
+
401: Unauthorized
|
18
|
+
402: Payment Required
|
19
|
+
403: Forbidden
|
20
|
+
404: Not Found
|
21
|
+
405: Method Not Allowed
|
22
|
+
406: Not Acceptable
|
23
|
+
407: Proxy Authentication Required
|
24
|
+
408: Request Timeout
|
25
|
+
409: Conflict
|
26
|
+
|
27
|
+
find by meaning
|
28
|
+
|
29
|
+
$ httpstatus request
|
30
|
+
400: Bad Request
|
31
|
+
408: Request Timeout
|
32
|
+
413: Request Entity Too Large
|
33
|
+
414: Request-URI Too Large
|
34
|
+
416: Request Range Not Satisfiable
|
35
|
+
429: Too Many Requests
|
36
|
+
431: Request Header Fields Too Large
|
37
|
+
|
38
|
+
show all statuses
|
39
|
+
|
40
|
+
$ httpstatus
|
41
|
+
100: Continue
|
42
|
+
101: Switching Protocols
|
43
|
+
102: Processing
|
44
|
+
200: OK
|
45
|
+
...
|
46
|
+
|
47
|
+
## Install
|
48
|
+
|
49
|
+
$ gem install httpstatus
|
50
|
+
|
51
|
+
## Contributing to httpstatus
|
52
|
+
|
53
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
54
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
55
|
+
* Fork the project.
|
56
|
+
* Start a feature/bugfix branch.
|
57
|
+
* Commit and push until you are happy with your contribution.
|
58
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
59
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
60
|
+
|
61
|
+
## Copyright
|
62
|
+
|
63
|
+
Copyright (c) 2013 daixque. See LICENSE.txt for
|
64
|
+
further details.
|
65
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/httpstatus.gemspec
CHANGED
@@ -5,17 +5,17 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "httpstatus"
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["daixque"]
|
12
|
-
s.date = "2013-02-
|
12
|
+
s.date = "2013-02-22"
|
13
13
|
s.description = "httpstatus shows meaning of given HTTP status code"
|
14
14
|
s.email = "daixque@gmail.com"
|
15
15
|
s.executables = ["httpstatus", "httpstatus"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
18
|
-
"README.
|
18
|
+
"README.md"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"Gemfile",
|
24
24
|
"Gemfile.lock",
|
25
25
|
"LICENSE.txt",
|
26
|
-
"README.
|
26
|
+
"README.md",
|
27
27
|
"Rakefile",
|
28
28
|
"VERSION",
|
29
29
|
"bin/httpstatus",
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.homepage = "http://github.com/daixque/httpstatus"
|
36
36
|
s.licenses = ["MIT"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = "1.8.
|
38
|
+
s.rubygems_version = "1.8.24"
|
39
39
|
s.summary = "dictionary of HTTP status code"
|
40
40
|
|
41
41
|
if s.respond_to? :specification_version then
|
data/lib/httpstatus.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
|
1
6
|
class HttpStatus
|
2
7
|
def initialize
|
3
8
|
@statuses = {
|
@@ -62,10 +67,38 @@ class HttpStatus
|
|
62
67
|
}
|
63
68
|
end
|
64
69
|
|
70
|
+
def usage
|
71
|
+
usage_text = <<-"USAGE"
|
72
|
+
httpstatus shows meaning of HTTP status code.
|
73
|
+
Usage:
|
74
|
+
httpstatus [statuscode_or_keyword]
|
75
|
+
|
76
|
+
Options:
|
77
|
+
-v, [--version] show version
|
78
|
+
-h, [--help] show usage
|
79
|
+
USAGE
|
80
|
+
end
|
81
|
+
|
82
|
+
def parse_opts(argv)
|
83
|
+
OptionParser.new { |opt|
|
84
|
+
opt.on("-v", "--version") {
|
85
|
+
version = File.read File.join(File.dirname(__FILE__), "../VERSION")
|
86
|
+
puts "httpstatus #{version}"
|
87
|
+
exit(0)
|
88
|
+
}
|
89
|
+
opt.on("-h", "--help") {
|
90
|
+
puts usage
|
91
|
+
exit(0)
|
92
|
+
}
|
93
|
+
|
94
|
+
opt.parse! argv
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
65
98
|
def lookup(code)
|
66
99
|
results = []
|
67
100
|
@statuses.each do |c, m|
|
68
|
-
if c.start_with?(code) || m.downcase.match(code.downcase)
|
101
|
+
if !code || c.start_with?(code) || m.downcase.match(code.downcase)
|
69
102
|
results << "#{c}: #{m}"
|
70
103
|
end
|
71
104
|
end
|
@@ -73,6 +106,7 @@ class HttpStatus
|
|
73
106
|
end
|
74
107
|
|
75
108
|
def run(args)
|
109
|
+
parse_opts(args)
|
76
110
|
code = args.shift
|
77
111
|
results = lookup code
|
78
112
|
puts results
|
metadata
CHANGED
@@ -1,77 +1,95 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpstatus
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- daixque
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
18
|
+
requirements:
|
20
19
|
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
22
21
|
version: 2.8.0
|
23
22
|
type: :development
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.8.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
27
31
|
name: rdoc
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
|
-
requirements:
|
34
|
+
requirements:
|
31
35
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version:
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.12'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.12'
|
46
|
+
- !ruby/object:Gem::Dependency
|
38
47
|
name: bundler
|
39
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
40
49
|
none: false
|
41
|
-
requirements:
|
50
|
+
requirements:
|
42
51
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
52
|
+
- !ruby/object:Gem::Version
|
44
53
|
version: 1.0.0
|
45
54
|
type: :development
|
46
55
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
49
63
|
name: jeweler
|
50
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
51
65
|
none: false
|
52
|
-
requirements:
|
66
|
+
requirements:
|
53
67
|
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
68
|
+
- !ruby/object:Gem::Version
|
55
69
|
version: 1.8.3
|
56
70
|
type: :development
|
57
71
|
prerelease: false
|
58
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.3
|
59
78
|
description: httpstatus shows meaning of given HTTP status code
|
60
79
|
email: daixque@gmail.com
|
61
|
-
executables:
|
80
|
+
executables:
|
62
81
|
- httpstatus
|
63
82
|
extensions: []
|
64
|
-
|
65
|
-
extra_rdoc_files:
|
83
|
+
extra_rdoc_files:
|
66
84
|
- LICENSE.txt
|
67
|
-
- README.
|
68
|
-
files:
|
85
|
+
- README.md
|
86
|
+
files:
|
69
87
|
- .document
|
70
88
|
- .rspec
|
71
89
|
- Gemfile
|
72
90
|
- Gemfile.lock
|
73
91
|
- LICENSE.txt
|
74
|
-
- README.
|
92
|
+
- README.md
|
75
93
|
- Rakefile
|
76
94
|
- VERSION
|
77
95
|
- bin/httpstatus
|
@@ -80,34 +98,31 @@ files:
|
|
80
98
|
- spec/httpstatus_spec.rb
|
81
99
|
- spec/spec_helper.rb
|
82
100
|
homepage: http://github.com/daixque/httpstatus
|
83
|
-
licenses:
|
101
|
+
licenses:
|
84
102
|
- MIT
|
85
103
|
post_install_message:
|
86
104
|
rdoc_options: []
|
87
|
-
|
88
|
-
require_paths:
|
105
|
+
require_paths:
|
89
106
|
- lib
|
90
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
108
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
segments:
|
97
114
|
- 0
|
98
|
-
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
hash: 4514478392528253030
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
117
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version:
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
105
122
|
requirements: []
|
106
|
-
|
107
123
|
rubyforge_project:
|
108
|
-
rubygems_version: 1.8.
|
124
|
+
rubygems_version: 1.8.24
|
109
125
|
signing_key:
|
110
126
|
specification_version: 3
|
111
127
|
summary: dictionary of HTTP status code
|
112
128
|
test_files: []
|
113
|
-
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= httpstatus
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to httpstatus
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
-
* Fork the project.
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2013 daixque. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|