alf-rest 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +71 -0
- data/LICENCE.md +22 -0
- data/Manifest.txt +12 -0
- data/README.md +11 -0
- data/Rakefile +11 -0
- data/lib/alf-rest.rb +1 -0
- data/lib/alf/rest.rb +30 -0
- data/lib/alf/rest/alf-ext/renderer.rb +16 -0
- data/lib/alf/rest/alf-ext/unit_of_work.rb +3 -0
- data/lib/alf/rest/alf-ext/unit_of_work/delete.rb +21 -0
- data/lib/alf/rest/alf-ext/unit_of_work/insert.rb +22 -0
- data/lib/alf/rest/alf-ext/unit_of_work/update.rb +22 -0
- data/lib/alf/rest/config.rb +55 -0
- data/lib/alf/rest/errors.rb +5 -0
- data/lib/alf/rest/helpers.rb +68 -0
- data/lib/alf/rest/loader.rb +5 -0
- data/lib/alf/rest/middleware.rb +19 -0
- data/lib/alf/rest/payload.rb +12 -0
- data/lib/alf/rest/payload/client.rb +22 -0
- data/lib/alf/rest/request.rb +43 -0
- data/lib/alf/rest/response.rb +21 -0
- data/lib/alf/rest/test.rb +16 -0
- data/lib/alf/rest/test/client.rb +83 -0
- data/lib/alf/rest/test/ext.rb +7 -0
- data/lib/alf/rest/test/steps.rb +286 -0
- data/lib/alf/rest/version.rb +16 -0
- data/lib/sinatra/alf-rest.rb +73 -0
- data/spec/fixtures/sap.db +0 -0
- data/spec/integration/sinatra/rest_get/test_accept.rb +98 -0
- data/spec/integration/spec_helper.rb +27 -0
- data/spec/test_rest.rb +10 -0
- data/spec/unit/config/test_database.rb +28 -0
- data/spec/unit/config/test_viewpoint.rb +18 -0
- data/spec/unit/ext/renderer/test_from_http_accept.rb +50 -0
- data/spec/unit/ext/renderer/test_supported_media_types.rb +10 -0
- data/spec/unit/middleware/test_behavior.rb +55 -0
- data/spec/unit/request/test_to_relation.rb +56 -0
- data/spec/unit/spec_helper.rb +35 -0
- data/spec/unit/test_rest.rb +10 -0
- data/tasks/gem.rake +8 -0
- data/tasks/test.rake +17 -0
- metadata +251 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
|
2
|
+
require 'alf-rest'
|
3
|
+
require 'rspec'
|
4
|
+
require 'path'
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
module Helpers
|
8
|
+
|
9
|
+
def env_for(*args)
|
10
|
+
Rack::MockRequest.env_for(*args)
|
11
|
+
end
|
12
|
+
|
13
|
+
def json_post_env(tuples)
|
14
|
+
env = env_for("/foo", method: 'POST', input: JSON.dump(tuples))
|
15
|
+
env.merge('CONTENT_TYPE' => 'application/json;charset=UTF-8')
|
16
|
+
end
|
17
|
+
|
18
|
+
def json_post_request(tuples)
|
19
|
+
Rack::Request.new(json_post_env(tuples))
|
20
|
+
end
|
21
|
+
|
22
|
+
def mock_app(&bl)
|
23
|
+
Class.new(Sinatra::Base){
|
24
|
+
register Alf::Rest
|
25
|
+
instance_eval(&bl)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
RSpec.configure do |c|
|
32
|
+
c.include Helpers
|
33
|
+
c.extend Helpers
|
34
|
+
c.filter_run_excluding :ruby19 => (RUBY_VERSION < "1.9")
|
35
|
+
end
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'rubygems/package_task'
|
2
|
+
gemspec_file = File.expand_path('../../alf-rest.gemspec', __FILE__)
|
3
|
+
gemspec = Kernel.eval(File.read(gemspec_file))
|
4
|
+
Gem::PackageTask.new(gemspec) do |t|
|
5
|
+
t.name = gemspec.name
|
6
|
+
t.version = gemspec.version
|
7
|
+
t.package_files = gemspec.files
|
8
|
+
end
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rspec/core/rake_task"
|
2
|
+
|
3
|
+
desc "Run unit tests"
|
4
|
+
RSpec::Core::RakeTask.new(:"test:unit") do |t|
|
5
|
+
t.ruby_opts = ["-I spec/unit"]
|
6
|
+
t.rspec_opts = ["--color", "--backtrace"]
|
7
|
+
t.pattern = "spec/unit/**/test_*.rb"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Run integration tests"
|
11
|
+
RSpec::Core::RakeTask.new(:"test:integration") do |t|
|
12
|
+
t.ruby_opts = ["-Ilib", "-I spec/integration"]
|
13
|
+
t.rspec_opts = ["--color", "--backtrace"]
|
14
|
+
t.pattern = "spec/integration/**/test_*.rb"
|
15
|
+
end
|
16
|
+
|
17
|
+
task :test => [:"test:unit", :"test:integration"]
|
metadata
ADDED
@@ -0,0 +1,251 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alf-rest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.14.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bernard Lambeau
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '10.0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '10.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.12'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.12'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rack-test
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.6.1
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.1
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: cucumber
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.2'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.2'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: alf-sequel
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.13.0
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.13.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: sqlite3
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.3'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.3'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: jdbc-sqlite3
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '3.7'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: alf-core
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 0.14.0
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 0.14.0
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: sinatra
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ~>
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.3'
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '1.3'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: rack-accept
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ~>
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 0.4.5
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.4.5
|
174
|
+
description: Provides a RESTful interface for relational databases.
|
175
|
+
email:
|
176
|
+
- blambeau at gmail.com
|
177
|
+
executables: []
|
178
|
+
extensions: []
|
179
|
+
extra_rdoc_files: []
|
180
|
+
files:
|
181
|
+
- CHANGELOG.md
|
182
|
+
- Gemfile
|
183
|
+
- Gemfile.lock
|
184
|
+
- lib/alf/rest/alf-ext/renderer.rb
|
185
|
+
- lib/alf/rest/alf-ext/unit_of_work/delete.rb
|
186
|
+
- lib/alf/rest/alf-ext/unit_of_work/insert.rb
|
187
|
+
- lib/alf/rest/alf-ext/unit_of_work/update.rb
|
188
|
+
- lib/alf/rest/alf-ext/unit_of_work.rb
|
189
|
+
- lib/alf/rest/config.rb
|
190
|
+
- lib/alf/rest/errors.rb
|
191
|
+
- lib/alf/rest/helpers.rb
|
192
|
+
- lib/alf/rest/loader.rb
|
193
|
+
- lib/alf/rest/middleware.rb
|
194
|
+
- lib/alf/rest/payload/client.rb
|
195
|
+
- lib/alf/rest/payload.rb
|
196
|
+
- lib/alf/rest/request.rb
|
197
|
+
- lib/alf/rest/response.rb
|
198
|
+
- lib/alf/rest/test/client.rb
|
199
|
+
- lib/alf/rest/test/ext.rb
|
200
|
+
- lib/alf/rest/test/steps.rb
|
201
|
+
- lib/alf/rest/test.rb
|
202
|
+
- lib/alf/rest/version.rb
|
203
|
+
- lib/alf/rest.rb
|
204
|
+
- lib/alf-rest.rb
|
205
|
+
- lib/sinatra/alf-rest.rb
|
206
|
+
- LICENCE.md
|
207
|
+
- Manifest.txt
|
208
|
+
- Rakefile
|
209
|
+
- README.md
|
210
|
+
- spec/fixtures/sap.db
|
211
|
+
- spec/integration/sinatra/rest_get/test_accept.rb
|
212
|
+
- spec/integration/spec_helper.rb
|
213
|
+
- spec/test_rest.rb
|
214
|
+
- spec/unit/config/test_database.rb
|
215
|
+
- spec/unit/config/test_viewpoint.rb
|
216
|
+
- spec/unit/ext/renderer/test_from_http_accept.rb
|
217
|
+
- spec/unit/ext/renderer/test_supported_media_types.rb
|
218
|
+
- spec/unit/middleware/test_behavior.rb
|
219
|
+
- spec/unit/request/test_to_relation.rb
|
220
|
+
- spec/unit/spec_helper.rb
|
221
|
+
- spec/unit/test_rest.rb
|
222
|
+
- tasks/gem.rake
|
223
|
+
- tasks/test.rake
|
224
|
+
homepage: http://github.com/blambeau/alf
|
225
|
+
licenses: []
|
226
|
+
post_install_message:
|
227
|
+
rdoc_options: []
|
228
|
+
require_paths:
|
229
|
+
- lib
|
230
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
231
|
+
none: false
|
232
|
+
requirements:
|
233
|
+
- - ! '>='
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0'
|
236
|
+
segments:
|
237
|
+
- 0
|
238
|
+
hash: 603192601427028343
|
239
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
|
+
none: false
|
241
|
+
requirements:
|
242
|
+
- - ! '>='
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: '0'
|
245
|
+
requirements: []
|
246
|
+
rubyforge_project:
|
247
|
+
rubygems_version: 1.8.25
|
248
|
+
signing_key:
|
249
|
+
specification_version: 3
|
250
|
+
summary: Put your relational database on the web quickly, simply, safely.
|
251
|
+
test_files: []
|