nephos-server 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 109c4c4ca9d472b6b5f0dd35a2bf6588faacbf52
4
- data.tar.gz: a1fc6c4863ca689e02bb6f777bd24dbbacf5de1b
3
+ metadata.gz: 9c11b4d5d944f6cce30fbcda25510e5f6aba72c0
4
+ data.tar.gz: c12a3b132cfdea4075469c53d14e79b851058c78
5
5
  SHA512:
6
- metadata.gz: b9c9fad3377f4107a74a3ecf94ee52b05d69b8b8b2c69d17083afcca5f0daaef7ab85bf0160092dc080326e95cd388126d2dfd7e64012fee45029bf3b190413a
7
- data.tar.gz: c63beb9a5addc4f40bddb07628738765344ff56181782de060210caad96ebb814086a5a63e3d9a655f05baddcf2f5efeda7d7074c232480d3d73c3cf94126a3c
6
+ metadata.gz: 2f51af907c046e17a3f1845a95af7eba1c593225dcfe8061f57aa2c9c5a029850642845ebd179c09caf15ed3d0a3ec77a4f7c037aa06cae900c0439569e15e37
7
+ data.tar.gz: 3fd178f54482d3ead7a413302e1677a3095fa35f426001e2cc83d766ed7864f48603609235a48dd4ffb2043285b9b63eaa3fa21918198531ac99c5a36973470a
@@ -0,0 +1,34 @@
1
+ def route_prefix
2
+ @route_prefix ||= []
3
+ File.join(["/"] + @route_prefix)
4
+ end
5
+
6
+ def add_route(what, verb)
7
+ raise InvalidRoute unless what.is_a? Hash
8
+ what[:url] = File.expand_path File.join(route_prefix, what[:url])
9
+ Nephos::Router.check!(what)
10
+ Nephos::Router.add_params!(what)
11
+ Nephos::Router.add(what, verb)
12
+ end
13
+
14
+ # @param what [Hash]
15
+ def get what
16
+ add_route what, "GET"
17
+ end
18
+
19
+ # @param what [Hash]
20
+ def post what
21
+ add_route what, "POST"
22
+ end
23
+
24
+ # @param what [Hash]
25
+ def put what
26
+ add_route what, "PUT"
27
+ end
28
+
29
+ def resource(name, &block)
30
+ @route_prefix ||= []
31
+ @route_prefix << name
32
+ block.call
33
+ @route_prefix.pop
34
+ end
@@ -17,6 +17,7 @@ lib/nephos-server/server/main.rb
17
17
  lib/nephos-server/server/responder.rb
18
18
  lib/nephos-server/router/main.rb
19
19
  lib/nephos-server/router/load.rb
20
+ lib/nephos-server/router/helpers.rb
20
21
  README.md
21
22
  Rakefile
22
23
  Procfile
data/test/test.rb CHANGED
@@ -8,3 +8,4 @@ require_relative 'responder'
8
8
  require_relative 'router'
9
9
  require_relative 'controller'
10
10
  require_relative 'params'
11
+ require_relative 'generator'
data/version CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nephos-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-29 00:00:00.000000000 Z
11
+ date: 2015-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nomorebeer
@@ -64,6 +64,7 @@ email:
64
64
  - lib/nephos-server/server/responder.rb
65
65
  - lib/nephos-server/router/main.rb
66
66
  - lib/nephos-server/router/load.rb
67
+ - lib/nephos-server/router/helpers.rb
67
68
  - README.md
68
69
  - Rakefile
69
70
  - Procfile
@@ -102,6 +103,7 @@ files:
102
103
  - lib/nephos-server/basic_errors.rb
103
104
  - lib/nephos-server/controller.rb
104
105
  - lib/nephos-server/params.rb
106
+ - lib/nephos-server/router/helpers.rb
105
107
  - lib/nephos-server/router/load.rb
106
108
  - lib/nephos-server/router/main.rb
107
109
  - lib/nephos-server/server/main.rb