nephos-server 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/lib/nephos-server/controller.rb +3 -3
- data/lib/nephos-server/router/main.rb +3 -2
- data/test/controller.rb +7 -7
- data/version +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c35f4d2f0547725d90cc6f979151bc978d41670
|
4
|
+
data.tar.gz: c65b023117aa32ab0ce732b9c0073f315b50ce5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63d465d46581d22542a6dbfd4a7d7caf159080ef7e1d5d0a2e732bb774c86d1b9b2f53ce27140054a10301061c04d89a92cf41f41603cb86aa4ab470008b5033
|
7
|
+
data.tar.gz: 146add81a36a974479ab84d57be331c8e48e2e1137c84cdd1c860a66c1d727b166649a582d316b0b57cd4f31086b2a76ac0f5adc4bd9a794b44d5f9b0fd4c3ed
|
data/CHANGELOG
CHANGED
@@ -5,17 +5,17 @@ module Nephos
|
|
5
5
|
|
6
6
|
# @param env [Hash] env extracted from the http request
|
7
7
|
# @param parsed [Hash] pre-parsed env with parameters, ...
|
8
|
-
def initialize env={}, parsed={path: [],
|
8
|
+
def initialize env={}, parsed={path: [], params: {}}, callpath={params: []}
|
9
9
|
raise ArgumentError, "env must be a Hash" unless env.is_a? Hash
|
10
10
|
raise ArgumentError, "parsed must be a Hash" unless parsed.is_a? Hash
|
11
11
|
raise ArgumentError, "callpath must be a Hash" unless callpath.is_a? Hash
|
12
12
|
raise ArgumentError, "Invalid Parsed. :path must be associated with an Array" unless parsed[:path].is_a? Array
|
13
|
-
raise ArgumentError, "Invalid Parsed. :
|
13
|
+
raise ArgumentError, "Invalid Parsed. :params must be associated with a Hash" unless parsed[:params].is_a? Hash
|
14
14
|
raise ArgumentError, "Invalid Callpath. :params must be associated with an Array" unless callpath[:params].is_a? Array
|
15
15
|
@env= env
|
16
16
|
@infos= parsed
|
17
17
|
@callpath= callpath
|
18
|
-
@params= parsed[:
|
18
|
+
@params= parsed[:params]
|
19
19
|
@params.merge! Hash[callpath[:params].zip @infos[:path]]
|
20
20
|
@params.select!{|k,v| not k.to_s.empty?}
|
21
21
|
@params = Params.new(@params)
|
@@ -25,8 +25,9 @@ module Nephos
|
|
25
25
|
verb = env["REQUEST_METHOD"]
|
26
26
|
from = env["REMOTE_ADDR"]
|
27
27
|
path = route.path.split("/").select{|e|not e.to_s.empty?}
|
28
|
-
|
29
|
-
|
28
|
+
params = Rack::Request.new(env).params
|
29
|
+
# Hash[route.query.to_s.split("&").map{|e| e.split("=")}]
|
30
|
+
return {route: route, verb: verb, from: from, path: path, params: params}
|
30
31
|
end
|
31
32
|
|
32
33
|
def self.error(code, err=nil)
|
data/test/controller.rb
CHANGED
@@ -2,22 +2,22 @@ class TestNephosServerController < Test::Unit::TestCase
|
|
2
2
|
|
3
3
|
def test_initialize_success
|
4
4
|
assert Nephos::Controller.new()
|
5
|
-
assert Nephos::Controller.new(env={}, {path: [],
|
5
|
+
assert Nephos::Controller.new(env={}, {path: [], params: {}}, {params: []})
|
6
6
|
end
|
7
7
|
|
8
8
|
def test_initialize_failure
|
9
9
|
assert_raise do Nephos::Controller.new({}, {}, {}) end
|
10
10
|
assert_raise do Nephos::Controller.new({}, {path: nil}, {}) end
|
11
11
|
assert_raise do Nephos::Controller.new({}, {path: []}, {}) end
|
12
|
-
assert_raise do Nephos::Controller.new({}, {path: [],
|
13
|
-
assert_raise do Nephos::Controller.new({}, {path: [],
|
14
|
-
assert_raise do Nephos::Controller.new({}, {path: nil,
|
15
|
-
assert_raise do Nephos::Controller.new({}, {path: nil,
|
16
|
-
assert_raise do Nephos::Controller.new({}, {path: [],
|
12
|
+
assert_raise do Nephos::Controller.new({}, {path: [], params: {}}, {}) end
|
13
|
+
assert_raise do Nephos::Controller.new({}, {path: [], params: {}}, {params: nil}) end
|
14
|
+
assert_raise do Nephos::Controller.new({}, {path: nil, params: nil}, params: nil) end
|
15
|
+
assert_raise do Nephos::Controller.new({}, {path: nil, params: {}}, {params: {}}) end
|
16
|
+
assert_raise do Nephos::Controller.new({}, {path: [], params: nil}, {params: {}}) end
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_controller_params
|
20
|
-
c = Nephos::Controller.new(env={}, {path: ["value"],
|
20
|
+
c = Nephos::Controller.new(env={}, {path: ["value"], params: {}}, {params: ["param"]})
|
21
21
|
assert_equal "value", c.params[:param]
|
22
22
|
assert_equal "value", c.params["param"]
|
23
23
|
end
|
data/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.8
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nephos-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poulet_a
|
@@ -162,6 +162,5 @@ rubyforge_project:
|
|
162
162
|
rubygems_version: 2.4.8
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
|
-
summary: "*
|
166
|
-
web server * add environments"
|
165
|
+
summary: "* fix parameters"
|
167
166
|
test_files: []
|