restrack 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/restrack +1 -0
- data/lib/restrack/generator/config.ru.erb +2 -2
- data/lib/restrack/resource_request.rb +6 -4
- data/lib/restrack/version.rb +1 -1
- metadata +98 -150
- data/restrack.komodoproject +0 -7
data/bin/restrack
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
#
|
2
|
-
require 'loader'
|
1
|
+
# rackup config.ru
|
2
|
+
require File.join(File.dirname(__FILE__),'loader')
|
3
3
|
run <%= @service_name.camelize %>::WebService.new
|
@@ -12,12 +12,12 @@ module RESTRack
|
|
12
12
|
# Write input details to logs
|
13
13
|
RESTRack.request_log.info "{#{@request_id}} #{@request.path_info} requested from #{@request.ip}"
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def fulfill
|
17
17
|
self.prepare
|
18
18
|
return self.response
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def prepare
|
22
22
|
# Pull input data from POST body
|
23
23
|
@input = parse_body( @request )
|
@@ -42,7 +42,7 @@ module RESTRack
|
|
42
42
|
end
|
43
43
|
if @active_resource_name.nil? or not RESTRack.controller_exists?(@active_resource_name)
|
44
44
|
raise HTTP404ResourceNotFound unless RESTRack::CONFIG[:DEFAULT_RESOURCE]
|
45
|
-
@active_resource_name = RESTRack::CONFIG[:DEFAULT_RESOURCE]
|
45
|
+
@active_resource_name = RESTRack::CONFIG[:DEFAULT_RESOURCE]
|
46
46
|
end
|
47
47
|
raise HTTP403Forbidden unless RESTRack::CONFIG[:ROOT_RESOURCE_ACCEPT].blank? or RESTRack::CONFIG[:ROOT_RESOURCE_ACCEPT].include?(@active_resource_name)
|
48
48
|
raise HTTP403Forbidden if not RESTRack::CONFIG[:ROOT_RESOURCE_DENY].blank? and RESTRack::CONFIG[:ROOT_RESOURCE_DENY].include?(@active_resource_name)
|
@@ -89,7 +89,7 @@ module RESTRack
|
|
89
89
|
RESTRack.log.debug "{#{@request_id}} #{request_mime_type.to_s} data in:\n" + input.pretty_inspect
|
90
90
|
input
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
def get_params(request)
|
94
94
|
params = request.GET
|
95
95
|
end
|
@@ -126,6 +126,8 @@ module RESTRack
|
|
126
126
|
elsif @mime_type.like?( RESTRack.mime_type_for( :XML ) )
|
127
127
|
if File.exists? builder_file
|
128
128
|
@output = builder_up(data)
|
129
|
+
elsif data.respond_to?(:to_xml)
|
130
|
+
@output = data.to_xml
|
129
131
|
else
|
130
132
|
@output = XmlSimple.xml_out(data, 'AttrPrefix' => true, 'XmlDeclaration' => true, 'NoIndent' => true)
|
131
133
|
end
|
data/lib/restrack/version.rb
CHANGED
metadata
CHANGED
@@ -1,125 +1,122 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: restrack
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.2
|
4
5
|
prerelease:
|
5
|
-
version: 1.1.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Chris St. John
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-08 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rack
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &17758880 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rack-test
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *17758880
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rack-test
|
27
|
+
requirement: &17758460 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
36
33
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: i18n
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *17758460
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: i18n
|
38
|
+
requirement: &17758040 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
47
44
|
type: :runtime
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: json
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *17758040
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: json
|
49
|
+
requirement: &17757620 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
58
55
|
type: :runtime
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: xml-simple
|
62
56
|
prerelease: false
|
63
|
-
|
57
|
+
version_requirements: *17757620
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: xml-simple
|
60
|
+
requirement: &17757120 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
68
65
|
version: 1.0.13
|
69
66
|
type: :runtime
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: builder
|
73
67
|
prerelease: false
|
74
|
-
|
68
|
+
version_requirements: *17757120
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: builder
|
71
|
+
requirement: &17756700 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
80
77
|
type: :runtime
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: activesupport
|
84
78
|
prerelease: false
|
85
|
-
|
79
|
+
version_requirements: *17756700
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: activesupport
|
82
|
+
requirement: &17756240 !ruby/object:Gem::Requirement
|
86
83
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version:
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
91
88
|
type: :runtime
|
92
|
-
version_requirements: *id007
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: mime-types
|
95
89
|
prerelease: false
|
96
|
-
|
90
|
+
version_requirements: *17756240
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: mime-types
|
93
|
+
requirement: &17755820 !ruby/object:Gem::Requirement
|
97
94
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version:
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
102
99
|
type: :runtime
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
\
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *17755820
|
102
|
+
description: ! "\nRESTRack is a Rack-based MVC framework that makes it extremely easy
|
103
|
+
to develop RESTful data services. It is inspired by\nRails, and follows a few of
|
104
|
+
its conventions. But it has no routes file, routing relationships are done through\nsupplying
|
105
|
+
custom code blocks to class methods such as \"has_relationship_to\" or \"has_mapped_relationships_to\".\n\nRESTRack
|
106
|
+
aims at being lightweight and easy to use. It will automatically render JSON and
|
107
|
+
XML for the data\nstructures you return in your actions (any structure parsable
|
108
|
+
by the \"json\" and\n\"xml-simple\" gems, respectively).\n\nIf you supply a view
|
109
|
+
for a controller action, you do that using a builder file. Builder files are stored
|
110
|
+
in the\nview directory grouped by controller name subdirectories (`view/<controller>/<action>.xml.builder`).
|
111
|
+
\ XML format\nrequests will then render the view template with the builder gem,
|
112
|
+
rather than generating XML with XmlSimple.\n "
|
113
|
+
email:
|
115
114
|
- chris@stjohnstudios.com
|
116
|
-
executables:
|
115
|
+
executables:
|
117
116
|
- restrack
|
118
117
|
extensions: []
|
119
|
-
|
120
118
|
extra_rdoc_files: []
|
121
|
-
|
122
|
-
files:
|
119
|
+
files:
|
123
120
|
- Gemfile
|
124
121
|
- README.markdown
|
125
122
|
- README.markdown.html
|
@@ -139,7 +136,6 @@ files:
|
|
139
136
|
- lib/restrack/version.rb
|
140
137
|
- lib/restrack/web_service.rb
|
141
138
|
- restrack.gemspec
|
142
|
-
- restrack.komodoproject
|
143
139
|
- test/sample_app_1/config.ru
|
144
140
|
- test/sample_app_1/config/constants.yaml
|
145
141
|
- test/sample_app_1/controllers/bat_controller.rb
|
@@ -185,77 +181,29 @@ files:
|
|
185
181
|
- test/sample_app_4/views/alphatest.png
|
186
182
|
- test/test_support.rb
|
187
183
|
- test/test_web_service.rb
|
188
|
-
has_rdoc: true
|
189
184
|
homepage: http://github.com/stjohncj/RESTRack
|
190
185
|
licenses: []
|
191
|
-
|
192
186
|
post_install_message:
|
193
187
|
rdoc_options: []
|
194
|
-
|
195
|
-
require_paths:
|
188
|
+
require_paths:
|
196
189
|
- lib
|
197
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
198
191
|
none: false
|
199
|
-
requirements:
|
200
|
-
- -
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
version:
|
203
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ! '>='
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
197
|
none: false
|
205
|
-
requirements:
|
206
|
-
- -
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version:
|
198
|
+
requirements:
|
199
|
+
- - ! '>='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
209
202
|
requirements: []
|
210
|
-
|
211
203
|
rubyforge_project: restrack
|
212
|
-
rubygems_version: 1.
|
204
|
+
rubygems_version: 1.8.6
|
213
205
|
signing_key:
|
214
206
|
specification_version: 3
|
215
|
-
summary: A lightweight MVC framework developed specifically for JSON (and XML) REST
|
216
|
-
|
217
|
-
|
218
|
-
- test/sample_app_1/config/constants.yaml
|
219
|
-
- test/sample_app_1/controllers/bat_controller.rb
|
220
|
-
- test/sample_app_1/controllers/bata_controller.rb
|
221
|
-
- test/sample_app_1/controllers/baz_controller.rb
|
222
|
-
- test/sample_app_1/controllers/baza_controller.rb
|
223
|
-
- test/sample_app_1/controllers/bazu_controller.rb
|
224
|
-
- test/sample_app_1/controllers/foo_bar_controller.rb
|
225
|
-
- test/sample_app_1/loader.rb
|
226
|
-
- test/sample_app_1/test/test_controller_actions.rb
|
227
|
-
- test/sample_app_1/test/test_controller_inputs.rb
|
228
|
-
- test/sample_app_1/test/test_controller_modifiers.rb
|
229
|
-
- test/sample_app_1/test/test_formats.rb
|
230
|
-
- test/sample_app_1/test/test_resource_request.rb
|
231
|
-
- test/sample_app_1/test/test_web_service.rb
|
232
|
-
- test/sample_app_1/views/foo_bar/show.xml.builder
|
233
|
-
- test/sample_app_2/config/constants.yaml
|
234
|
-
- test/sample_app_2/controllers/bat_controller.rb
|
235
|
-
- test/sample_app_2/controllers/baz_controller.rb
|
236
|
-
- test/sample_app_2/controllers/baza_controller.rb
|
237
|
-
- test/sample_app_2/controllers/bazu_controller.rb
|
238
|
-
- test/sample_app_2/controllers/foo_bar_controller.rb
|
239
|
-
- test/sample_app_2/loader.rb
|
240
|
-
- test/sample_app_2/test/test_controller_modifiers.rb
|
241
|
-
- test/sample_app_2/test/test_resource_request.rb
|
242
|
-
- test/sample_app_2/views/foo_bar/show.xml.builder
|
243
|
-
- test/sample_app_3/config/constants.yaml
|
244
|
-
- test/sample_app_3/controllers/bat_controller.rb
|
245
|
-
- test/sample_app_3/controllers/baz_controller.rb
|
246
|
-
- test/sample_app_3/controllers/baza_controller.rb
|
247
|
-
- test/sample_app_3/controllers/bazu_controller.rb
|
248
|
-
- test/sample_app_3/controllers/foo_bar_controller.rb
|
249
|
-
- test/sample_app_3/loader.rb
|
250
|
-
- test/sample_app_3/test/test_resource_request.rb
|
251
|
-
- test/sample_app_3/views/foo_bar/show.xml.builder
|
252
|
-
- test/sample_app_4/config/constants.yaml
|
253
|
-
- test/sample_app_4/controllers/bar_controller.rb
|
254
|
-
- test/sample_app_4/controllers/baz_controller.rb
|
255
|
-
- test/sample_app_4/controllers/foo_controller.rb
|
256
|
-
- test/sample_app_4/loader.rb
|
257
|
-
- test/sample_app_4/test/test_controller_modifiers.rb
|
258
|
-
- test/sample_app_4/test/test_formats.rb
|
259
|
-
- test/sample_app_4/views/alphatest.png
|
260
|
-
- test/test_support.rb
|
261
|
-
- test/test_web_service.rb
|
207
|
+
summary: A lightweight MVC framework developed specifically for JSON (and XML) REST
|
208
|
+
services.
|
209
|
+
test_files: []
|
data/restrack.komodoproject
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!-- Komodo Project File - DO NOT EDIT -->
|
3
|
-
<project id="1b07bef2-e0ab-1142-afc9-806da10889c5" kpf_version="5" name="restrack.komodoproject">
|
4
|
-
<preference-set idref="1b07bef2-e0ab-1142-afc9-806da10889c5">
|
5
|
-
<boolean id="import_live">1</boolean>
|
6
|
-
</preference-set>
|
7
|
-
</project>
|