net_status 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +11 -0
- data/.travis.yml +11 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +27 -0
- data/Rakefile +6 -0
- data/lib/net_status.rb +4 -0
- data/lib/net_status/exception.rb +18 -0
- data/lib/net_status/mixin.rb +16 -0
- data/lib/net_status/version.rb +3 -0
- data/net_status.gemspec +26 -0
- data/spec/net_status_spec.rb +7 -0
- data/spec/spec_helper.rb +5 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MDNkY2ZjNDNlZmY3ODQyZTUxYTY5NDA4MTE2N2E3NGM3ZjU4OTI2Nw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmI5NzRiOWE4YTA5MzIyMzUwOWU0ZjdhNTRiYWU0ODU0ZTU5Y2U0Yg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjczNDAxNTAxZGMwZTJiNjI0Y2UxOTg4NWFkYmFkYTdlM2NiZmJjZTRhM2M5
|
10
|
+
NzcxNTIwNGZhNmRjMWNlMTZhOTNhZGJkNWEzN2YxMWNiMTc2ZTBlMjlhZmE4
|
11
|
+
NzNkY2Y5MTFjNTRhMGNhYjdjNDQ1ZmMwNmJhNzk2N2E3MzY2OTA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDRmMjA1NWZkZWUzY2VmYjY5MjRlZmFjZjM1ZTc3NWFkZWY1ZjU3ZDVlZWIy
|
14
|
+
ZDRlMTkzYzdiOTYzMzJjZDE3ZDRiMjM5ZDQwNzBjNTY2NTJkMTgxOTQwMGQx
|
15
|
+
MjAzNDZlOGQyYzE3YjNiNTMzYjcwOThkODg1NzEzOWZkZTBiM2Q=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.2.1
|
4
|
+
deploy:
|
5
|
+
provider: rubygems
|
6
|
+
api_key:
|
7
|
+
secure: ooI10ZieDzVtg3aIPN3v7HZrJsd7nOFOZ9tH0+l4p3+Nrdvtt+ycAEo5tsPk27/JY2rjkxBDFgZ5GWRlrx5Ls9Px2sGqzpf9FM9T5mM6NrgmctfGPxajAd6OybeCrp+K6wG0F/2GLINd6uoju9yviGSEyIAsN4IhU49I27Je04wwJewiC+pAtesIsaGbCJMQ9Y6XAAHETms6mv7Vnm+jVlpVm2jZIgRQBRWfZdVBjvqlP/RZrRYvXGp4Th7wAJRz4d93UlvyE4xYkPBWNWBddnMyyhWQIjy2yBQ+PF1lYVehmrkhj8lFjn8AxZYwuAjijeRuhiCCEB9kacrLm6xkkDJ4UXd383vg5gS4yCp1V6u3dAvsl4sh56coM0c8gtDZG0o7oSMvRSV1W4Xw0KIIM7JVCn1DDGYD7Mlmx+QDOGI9YQ62AioHKfoAzARwq1wB5JjjOnI/lDkHqGbswC2vHX285+t1Ve9/bu69xtMJxdgij0c//V5IaQJitSd+X5eS+t7omQC/YorBu1MletOan8mj0kSu7nFUlCelbwxe5JGvykQFShvr5y9EGCIb/cp2EcfoYvO7kqsexPcEAkE81qygQRqFnFtuNF/2pxv808PGyNAW+gb50TE7YnCNFk6VL5OD1vKfafSYTBqzsZafHSaAEyiPF+1qUI0qylv2LPU=
|
8
|
+
gem: net_status
|
9
|
+
on:
|
10
|
+
#tags: true
|
11
|
+
repo: flant/net_status
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Alexey Igrychev
|
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,27 @@
|
|
1
|
+
# NetStatus
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/net_status`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'net_status'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install net_status
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
|
data/Rakefile
ADDED
data/lib/net_status.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
class NetStatus::Exception < Exception
|
2
|
+
def initialize(net_status={})
|
3
|
+
@net_status = net_status
|
4
|
+
@net_status[:error] ||= :error
|
5
|
+
super()
|
6
|
+
end
|
7
|
+
|
8
|
+
def net_status
|
9
|
+
@net_status.dup.tap do |res|
|
10
|
+
res[:data] = (res[:data] || {}).dup
|
11
|
+
res[:data][:backtrace] ||= self.backtrace
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def message
|
16
|
+
net_status_short.to_s
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module NetStatus::Exception::Mixin
|
2
|
+
def net_status
|
3
|
+
{ error: :error, code: :exception, message: self.message, data: { backtrace: self.backtrace } }
|
4
|
+
end
|
5
|
+
|
6
|
+
def net_status_short
|
7
|
+
net_status.dup.tap do |res|
|
8
|
+
if res[:data]
|
9
|
+
res[:data] = res[:data].dup
|
10
|
+
res[:data].delete(:backtrace)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
::Exception.send(:include, NetStatus::Exception::Mixin)
|
data/net_status.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'net_status/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "net_status"
|
7
|
+
spec.version = NetStatus::VERSION
|
8
|
+
spec.authors = ["Alexey Igrychev"]
|
9
|
+
spec.email = ["alexey.igrychev@flant.ru"]
|
10
|
+
spec.summary = "Net status return codes"
|
11
|
+
spec.description = "#{spec.summary}."
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.homepage = "https://github.com/flant/net_status"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.required_ruby_version = '>= 2.2.1'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
|
25
|
+
spec.add_development_dependency 'travis', '~> 1.8', '>= 1.8.2'
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: net_status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexey Igrychev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-02 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: :development
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.4.0
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3.4'
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.4.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: travis
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.8'
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.8.2
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.8'
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.8.2
|
81
|
+
description: Net status return codes.
|
82
|
+
email:
|
83
|
+
- alexey.igrychev@flant.ru
|
84
|
+
executables: []
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
88
|
+
- .gitignore
|
89
|
+
- .travis.yml
|
90
|
+
- Gemfile
|
91
|
+
- LICENSE.txt
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- lib/net_status.rb
|
95
|
+
- lib/net_status/exception.rb
|
96
|
+
- lib/net_status/mixin.rb
|
97
|
+
- lib/net_status/version.rb
|
98
|
+
- net_status.gemspec
|
99
|
+
- spec/net_status_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
homepage: https://github.com/flant/net_status
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 2.2.1
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.4.5
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Net status return codes
|
125
|
+
test_files:
|
126
|
+
- spec/net_status_spec.rb
|
127
|
+
- spec/spec_helper.rb
|