ananke 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ananke/helpers.rb +0 -3
- data/lib/ananke/routing.rb +14 -0
- data/lib/version.rb +1 -1
- data/spec/lib/ananke_spec.rb +10 -0
- metadata +17 -17
data/lib/ananke/helpers.rb
CHANGED
@@ -15,9 +15,6 @@ module Ananke
|
|
15
15
|
if obj.nil?
|
16
16
|
out :error, "#{path} - No return object"
|
17
17
|
''
|
18
|
-
elsif !obj.respond_to?(:to_json)
|
19
|
-
out :error, "#{path} - Return object cannot be converted to JSON"
|
20
|
-
''
|
21
18
|
else
|
22
19
|
root_path = path.to_s.split('/')[0]
|
23
20
|
dic = {root_path.to_sym => obj}
|
data/lib/ananke/routing.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
module Ananke
|
2
|
+
public
|
3
|
+
class << self
|
4
|
+
attr_accessor :routes
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
@routes = {}
|
9
|
+
|
10
|
+
def add_route(name, method)
|
11
|
+
Ananke.routes[name.to_sym] ||= []
|
12
|
+
Ananke.routes[name.to_sym] << method.to_sym
|
13
|
+
end
|
14
|
+
|
2
15
|
def build_route(mod, mod_method, verb, route, &block)
|
3
16
|
if mod.respond_to? mod_method
|
17
|
+
add_route(route.split('/')[1], mod_method)
|
4
18
|
Sinatra::Base.send verb, "#{route}", do
|
5
19
|
instance_eval(&block)
|
6
20
|
end
|
data/lib/version.rb
CHANGED
data/spec/lib/ananke_spec.rb
CHANGED
@@ -51,6 +51,16 @@ describe 'Basic Ananke REST' do
|
|
51
51
|
Sinatra::Base.routes["DELETE"][-1][0].inspect.include?('user').should == true
|
52
52
|
end
|
53
53
|
|
54
|
+
it """
|
55
|
+
Should expose routes registered
|
56
|
+
""" do
|
57
|
+
Ananke.routes[:user].should include :one
|
58
|
+
Ananke.routes[:user].should include :all
|
59
|
+
Ananke.routes[:user].should include :add
|
60
|
+
Ananke.routes[:user].should include :edit
|
61
|
+
Ananke.routes[:user].should include :delete
|
62
|
+
end
|
63
|
+
|
54
64
|
#----------------------------BASIC--------------------------------------
|
55
65
|
it """
|
56
66
|
GET /user
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ananke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andries Coetzee
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-02-
|
13
|
+
date: 2011-02-15 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -100,23 +100,23 @@ extra_rdoc_files:
|
|
100
100
|
- README.rdoc
|
101
101
|
files:
|
102
102
|
- lib/ananke.rb
|
103
|
-
- lib/version.rb
|
104
103
|
- lib/ananke/settings.rb
|
104
|
+
- lib/ananke/helpers.rb
|
105
105
|
- lib/ananke/linking.rb
|
106
|
-
- lib/ananke/routing.rb
|
107
106
|
- lib/ananke/validation.rb
|
108
|
-
- lib/ananke/
|
107
|
+
- lib/ananke/routing.rb
|
108
|
+
- lib/version.rb
|
109
|
+
- spec/nice_formatter.rb
|
110
|
+
- spec/call_chain.rb
|
109
111
|
- spec/dumping.rb
|
110
112
|
- spec/cov_adapter.rb
|
111
113
|
- spec/lib/ananke_spec.rb
|
112
|
-
- spec/lib/validation_spec.rb
|
113
|
-
- spec/lib/out_spec.rb
|
114
|
-
- spec/lib/link_to_spec.rb
|
115
114
|
- spec/lib/route_for_spec.rb
|
115
|
+
- spec/lib/out_spec.rb
|
116
|
+
- spec/lib/validation_spec.rb
|
116
117
|
- spec/lib/linked_spec.rb
|
118
|
+
- spec/lib/link_to_spec.rb
|
117
119
|
- spec/spec_helper.rb
|
118
|
-
- spec/call_chain.rb
|
119
|
-
- spec/nice_formatter.rb
|
120
120
|
- Gemfile
|
121
121
|
- Rakefile
|
122
122
|
- README.rdoc
|
@@ -127,7 +127,7 @@ licenses: []
|
|
127
127
|
post_install_message: |
|
128
128
|
**************************************************
|
129
129
|
|
130
|
-
Thank you for installing ananke-0.0.
|
130
|
+
Thank you for installing ananke-0.0.8
|
131
131
|
|
132
132
|
Please be sure to look at README.rdoc to see what might have changed
|
133
133
|
since the last release and how to use this GEM.
|
@@ -156,16 +156,16 @@ rubyforge_project:
|
|
156
156
|
rubygems_version: 1.5.0
|
157
157
|
signing_key:
|
158
158
|
specification_version: 3
|
159
|
-
summary: ananke-0.0.
|
159
|
+
summary: ananke-0.0.8
|
160
160
|
test_files:
|
161
|
+
- spec/nice_formatter.rb
|
162
|
+
- spec/call_chain.rb
|
161
163
|
- spec/dumping.rb
|
162
164
|
- spec/cov_adapter.rb
|
163
165
|
- spec/lib/ananke_spec.rb
|
164
|
-
- spec/lib/validation_spec.rb
|
165
|
-
- spec/lib/out_spec.rb
|
166
|
-
- spec/lib/link_to_spec.rb
|
167
166
|
- spec/lib/route_for_spec.rb
|
167
|
+
- spec/lib/out_spec.rb
|
168
|
+
- spec/lib/validation_spec.rb
|
168
169
|
- spec/lib/linked_spec.rb
|
170
|
+
- spec/lib/link_to_spec.rb
|
169
171
|
- spec/spec_helper.rb
|
170
|
-
- spec/call_chain.rb
|
171
|
-
- spec/nice_formatter.rb
|