rack-jsonz 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/jsonz/cpu.rb +13 -0
- data/lib/rack/jsonz/version.rb +5 -0
- data/lib/rack/jsonz.rb +17 -4
- data/rack-jsonz.gemspec +3 -1
- metadata +31 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b1f9796c7d7c2369e61b3bcfa76b8fd5fbcc066
|
4
|
+
data.tar.gz: 1ac20d51ba18127c8cd8cc0745ad345d464735c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9df32dd5874e08cec19f1bceacbf6867770b0592fd924c8378f1448c4a08baaf4543d4b84dda608cd8464cd132eac5e2f91d923cb389605827b4ef6feff916f
|
7
|
+
data.tar.gz: d9c4d9b3e3e2865087e8e164f59ab6948dbe931b71b19febe9e28148e12221e31577360d61f96e1ca0a9eec9ceb345a88215031f045714c2beb5e2641143fc25
|
data/lib/rack/jsonz.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
require "rack/jsonz/version"
|
2
|
+
require "rack/jsonz/cpu"
|
3
|
+
|
1
4
|
module Rack
|
2
5
|
class Jsonz
|
3
|
-
VERSION = "0.0.1"
|
4
|
-
|
5
6
|
def initialize(app)
|
6
7
|
@app = app
|
7
8
|
end
|
@@ -10,12 +11,24 @@ module Rack
|
|
10
11
|
if env["PATH_INFO"].eql? "/jsonz"
|
11
12
|
[
|
12
13
|
200,
|
13
|
-
{ "Content-Type" => "
|
14
|
-
[
|
14
|
+
{ "Content-Type" => "application/json" },
|
15
|
+
[self.data.to_json]
|
15
16
|
]
|
16
17
|
else
|
17
18
|
@app.call(env)
|
18
19
|
end
|
19
20
|
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
def data
|
24
|
+
ret = {}
|
25
|
+
|
26
|
+
cpu = CPU.new
|
27
|
+
cpu.metrics.each_pair do |k, v|
|
28
|
+
ret["/cpu/#{k}"] = v
|
29
|
+
end
|
30
|
+
|
31
|
+
return ret
|
32
|
+
end
|
20
33
|
end
|
21
34
|
end
|
data/rack-jsonz.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'rack/jsonz'
|
4
|
+
require 'rack/jsonz/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "rack-jsonz"
|
@@ -18,7 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_dependency "oj"
|
21
22
|
spec.add_dependency "rack"
|
23
|
+
spec.add_dependency "system"
|
22
24
|
|
23
25
|
spec.add_development_dependency "bundler", "~> 1.5"
|
24
26
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-jsonz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Welch
|
@@ -10,6 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oj
|
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'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rack
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,6 +38,20 @@ dependencies:
|
|
24
38
|
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: system
|
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'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: bundler
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,6 +93,8 @@ files:
|
|
65
93
|
- README.md
|
66
94
|
- Rakefile
|
67
95
|
- lib/rack/jsonz.rb
|
96
|
+
- lib/rack/jsonz/cpu.rb
|
97
|
+
- lib/rack/jsonz/version.rb
|
68
98
|
- rack-jsonz.gemspec
|
69
99
|
homepage: http://github.com/icco/rack-jsonz
|
70
100
|
licenses:
|