moonrope 1.3.3 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +9 -0
- data/Gemfile.lock +47 -0
- data/MIT-LICENCE +20 -0
- data/README.md +24 -0
- data/bin/moonrope +28 -0
- data/docs/authentication.md +114 -0
- data/docs/controllers.md +106 -0
- data/docs/exceptions.md +27 -0
- data/docs/introduction.md +29 -0
- data/docs/structures.md +214 -0
- data/example/authentication.rb +50 -0
- data/example/controllers/meta_controller.rb +14 -0
- data/example/controllers/users_controller.rb +92 -0
- data/example/structures/pet_structure.rb +12 -0
- data/example/structures/user_structure.rb +35 -0
- data/lib/moonrope.rb +5 -4
- data/lib/moonrope/action.rb +170 -40
- data/lib/moonrope/authenticator.rb +42 -0
- data/lib/moonrope/base.rb +67 -6
- data/lib/moonrope/controller.rb +4 -2
- data/lib/moonrope/doc_context.rb +94 -0
- data/lib/moonrope/doc_server.rb +123 -0
- data/lib/moonrope/dsl/action_dsl.rb +159 -9
- data/lib/moonrope/dsl/authenticator_dsl.rb +35 -0
- data/lib/moonrope/dsl/base_dsl.rb +21 -18
- data/lib/moonrope/dsl/controller_dsl.rb +60 -9
- data/lib/moonrope/dsl/filterable_dsl.rb +27 -0
- data/lib/moonrope/dsl/structure_dsl.rb +28 -2
- data/lib/moonrope/errors.rb +13 -0
- data/lib/moonrope/eval_environment.rb +82 -3
- data/lib/moonrope/eval_helpers.rb +47 -8
- data/lib/moonrope/eval_helpers/filter_helper.rb +82 -0
- data/lib/moonrope/guard.rb +35 -0
- data/lib/moonrope/html_generator.rb +65 -0
- data/lib/moonrope/param_set.rb +11 -1
- data/lib/moonrope/rack_middleware.rb +66 -37
- data/lib/moonrope/railtie.rb +31 -14
- data/lib/moonrope/request.rb +43 -15
- data/lib/moonrope/structure.rb +100 -18
- data/lib/moonrope/structure_attribute.rb +39 -0
- data/lib/moonrope/version.rb +1 -1
- data/moonrope.gemspec +21 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/specs/action_spec.rb +455 -0
- data/spec/specs/base_spec.rb +29 -0
- data/spec/specs/controller_spec.rb +31 -0
- data/spec/specs/param_set_spec.rb +31 -0
- data/templates/basic/_action_form.erb +77 -0
- data/templates/basic/_errors_table.erb +32 -0
- data/templates/basic/_structure_attributes_list.erb +55 -0
- data/templates/basic/action.erb +168 -0
- data/templates/basic/assets/lock.svg +3 -0
- data/templates/basic/assets/reset.css +101 -0
- data/templates/basic/assets/style.css +348 -0
- data/templates/basic/assets/tool.svg +4 -0
- data/templates/basic/assets/try.js +157 -0
- data/templates/basic/authenticator.erb +52 -0
- data/templates/basic/controller.erb +20 -0
- data/templates/basic/index.erb +114 -0
- data/templates/basic/layout.erb +46 -0
- data/templates/basic/structure.erb +23 -0
- data/test/test_helper.rb +81 -0
- data/test/tests/action_access_test.rb +63 -0
- data/test/tests/actions_test.rb +524 -0
- data/test/tests/authenticators_test.rb +87 -0
- data/test/tests/base_test.rb +35 -0
- data/test/tests/controllers_test.rb +49 -0
- data/test/tests/eval_environment_test.rb +136 -0
- data/test/tests/evel_helpers_test.rb +60 -0
- data/test/tests/examples_test.rb +11 -0
- data/test/tests/helpers_test.rb +97 -0
- data/test/tests/param_set_test.rb +44 -0
- data/test/tests/rack_middleware_test.rb +131 -0
- data/test/tests/request_test.rb +232 -0
- data/test/tests/structures_param_extensions_test.rb +159 -0
- data/test/tests/structures_test.rb +398 -0
- metadata +71 -56
@@ -0,0 +1,398 @@
|
|
1
|
+
class StructuresTest < Test::Unit::TestCase
|
2
|
+
|
3
|
+
def setup
|
4
|
+
@base = Moonrope::Base.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_structure_creation
|
8
|
+
structure = Moonrope::Structure.new(@base, :user) do
|
9
|
+
basic { {:id => o.id} }
|
10
|
+
full { {:username => o.username} }
|
11
|
+
end
|
12
|
+
assert_equal Moonrope::Structure, structure.class
|
13
|
+
assert structure.basic.is_a?(Proc)
|
14
|
+
assert structure.full.is_a?(Proc)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_structure_hash_with_basic_data
|
18
|
+
structure = Moonrope::Structure.new(@base, :user) do
|
19
|
+
basic { {:id => o.id} }
|
20
|
+
full { {:username => o.username} }
|
21
|
+
end
|
22
|
+
|
23
|
+
user = User.new(:id => 1, :username => 'adam')
|
24
|
+
|
25
|
+
hash = structure.hash(user)
|
26
|
+
assert_equal user.id, hash[:id]
|
27
|
+
assert_equal false, hash.keys.include?(:username)
|
28
|
+
|
29
|
+
hash = structure.hash(user, :full => true)
|
30
|
+
assert_equal user.id, hash[:id]
|
31
|
+
assert_equal user.username, hash[:username]
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_passing_the_version
|
35
|
+
structure = Moonrope::Structure.new(@base, :user) do
|
36
|
+
basic do
|
37
|
+
{
|
38
|
+
:id => o.id,
|
39
|
+
:username => (version == 1 ? o.username : "@#{o.username}")
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
user = User.new(:id => 1, :username => 'adam')
|
44
|
+
# check version 2
|
45
|
+
request = FakeRequest.new(:version => 2)
|
46
|
+
hash = structure.hash(user, :request => request)
|
47
|
+
assert_equal "@#{user.username}", hash[:username]
|
48
|
+
# check version 1
|
49
|
+
request = FakeRequest.new(:version => 1)
|
50
|
+
hash = structure.hash(user, :request => request)
|
51
|
+
assert_equal user.username, hash[:username]
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_structure_hash_with_expansions
|
55
|
+
user = User.new(:id => 1, :username => 'dave')
|
56
|
+
animal1 = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginder', :user => user)
|
57
|
+
animal2 = Animal.new(:id => 2, :name => 'Jess', :color => 'Black & White', :user => user)
|
58
|
+
user.animals << animal1
|
59
|
+
user.animals << animal2
|
60
|
+
|
61
|
+
base = Moonrope::Base.new do
|
62
|
+
structure :user do
|
63
|
+
basic { {:id => o.id, :username => o.username } }
|
64
|
+
expansion :animals do
|
65
|
+
o.animals.map { |a| structure(:animal, a) }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
structure :animal do
|
70
|
+
basic { {:id => o.id, :name => o.name} }
|
71
|
+
full { {:color => o.color, :user => structure(:user, o.user)} }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
animal_structure = base.structure(:animal)
|
76
|
+
|
77
|
+
# Test the full animal structure includes the user
|
78
|
+
hash = animal_structure.hash(animal1, :full => true)
|
79
|
+
assert_equal animal1.name, hash[:name]
|
80
|
+
assert_equal user.username, hash[:user][:username]
|
81
|
+
|
82
|
+
# Test that a user structure with expansions includes the
|
83
|
+
# animals which are included
|
84
|
+
user_structure = base.structure(:user)
|
85
|
+
hash = user_structure.hash(user, :expansions => true)
|
86
|
+
assert hash[:animals].is_a?(Array), "hash[:animals] is not an array"
|
87
|
+
assert_equal hash[:animals][0][:name], 'Fido'
|
88
|
+
assert_equal hash[:animals][1][:name], 'Jess'
|
89
|
+
|
90
|
+
# Test that when expansions was false
|
91
|
+
hash = user_structure.hash(user, :expansions => false)
|
92
|
+
assert_equal nil, hash[:animals], "hash[:animals] is present"
|
93
|
+
|
94
|
+
# Test cases when expansions are provided as an array
|
95
|
+
hash = user_structure.hash(user, :expansions => [:something, :else])
|
96
|
+
assert_equal nil, hash[:animals], "hash[:animals] is present"
|
97
|
+
hash = user_structure.hash(user, :expansions => [:animals])
|
98
|
+
assert_equal Array, hash[:animals].class, "hash[:animals] is present"
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_structured_structures
|
102
|
+
base = Moonrope::Base.new do
|
103
|
+
structure :animal do
|
104
|
+
basic :id, :description => "The ID of the aniaml object", :example => 1, :type => Integer
|
105
|
+
basic :name, :description => "The name of the animal", :example => "Boris", :type => String
|
106
|
+
full :hair_color, :description => "The color of the animal's hair", :example => "Blue", :type => String, :source_attribute => :color
|
107
|
+
expansion :user, :type => Hash, :structure => :user
|
108
|
+
|
109
|
+
group :colors do
|
110
|
+
basic :eye, :example => "Green", :type => String, :source_attribute => :color
|
111
|
+
full :hair, :example => "Blue", :type => String, :source_attribute => :color
|
112
|
+
expansion :owner, :structure => :user, :type => Hash, :source_attribute => :user
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
structure :user do
|
117
|
+
basic :id, :example => 1, :type => Integer
|
118
|
+
basic :username, :example => "adam", :type => String
|
119
|
+
expansion :animals, :type => Array, :structure => :animal, :structure_opts => {:full => true}
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
user = User.new(:id => 1, :username => 'adam', :private_code => 9876)
|
124
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger', :user => user)
|
125
|
+
user.animals << animal
|
126
|
+
animal2 = Animal.new(:id => 2, :name => 'Boris', :color => 'Black', :user => user)
|
127
|
+
user.animals << animal2
|
128
|
+
|
129
|
+
# a full hash with all expansions
|
130
|
+
hash = base.structure(:animal).hash(animal, :full => true, :expansions => true)
|
131
|
+
# standard attributes
|
132
|
+
assert_equal 1, hash[:id]
|
133
|
+
assert_equal 'Fido', hash[:name]
|
134
|
+
assert_equal 'Ginger', hash[:hair_color]
|
135
|
+
# expansion in a group
|
136
|
+
assert_equal Hash, hash[:colors][:owner].class
|
137
|
+
# normal expansion
|
138
|
+
assert_equal Hash, hash[:user].class
|
139
|
+
assert_equal 'adam', hash[:user][:username]
|
140
|
+
assert_equal nil, hash[:user][:animals]
|
141
|
+
# group
|
142
|
+
assert_equal Hash, hash[:colors].class
|
143
|
+
assert_equal 'Ginger', hash[:colors][:eye]
|
144
|
+
assert_equal 'Ginger', hash[:colors][:hair]
|
145
|
+
|
146
|
+
# basic hash
|
147
|
+
hash = base.structure(:animal).hash(animal)
|
148
|
+
# normal attributes
|
149
|
+
assert_equal 1, hash[:id]
|
150
|
+
assert_equal 'Fido', hash[:name]
|
151
|
+
# groups
|
152
|
+
assert_equal Hash, hash[:colors].class
|
153
|
+
assert_equal 'Ginger', hash[:colors][:eye]
|
154
|
+
assert_equal nil, hash[:colors][:hair]
|
155
|
+
|
156
|
+
# a full user hash with all expansions
|
157
|
+
hash = base.structure(:user).hash(user, :full => true, :expansions => true)
|
158
|
+
# arrays
|
159
|
+
assert_equal Array, hash[:animals].class
|
160
|
+
assert_equal 'Fido', hash[:animals][0][:name]
|
161
|
+
assert_equal 'Boris', hash[:animals][1][:name]
|
162
|
+
assert_equal 'Black', hash[:animals][1][:hair_color]
|
163
|
+
|
164
|
+
# a full user hash with named extensions
|
165
|
+
hash = base.structure(:user).hash(user, :full => true, :expansions => [:animals])
|
166
|
+
# arrays
|
167
|
+
assert_equal Array, hash[:animals].class
|
168
|
+
assert_equal 'Fido', hash[:animals][0][:name]
|
169
|
+
assert_equal 'Boris', hash[:animals][1][:name]
|
170
|
+
assert_equal 'Black', hash[:animals][1][:hair_color]
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_ifs
|
174
|
+
base = Moonrope::Base.new do
|
175
|
+
structure :animal do
|
176
|
+
condition Proc.new { true } do
|
177
|
+
basic :id1, :example => 1, :type => Integer, :source_attribute => :id
|
178
|
+
end
|
179
|
+
|
180
|
+
condition Proc.new { false } do
|
181
|
+
basic :id2, :example => 2, :type => Integer, :source_attribute => :id
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger')
|
187
|
+
hash = base.structure(:animal).hash(animal)
|
188
|
+
assert_equal 1, hash[:id1]
|
189
|
+
assert_equal nil, hash[:id2]
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_ifs_with_expansion
|
193
|
+
base = Moonrope::Base.new do
|
194
|
+
structure :animal do
|
195
|
+
condition Proc.new { true } do
|
196
|
+
expansion :example do
|
197
|
+
{:hello => 'world'}
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
condition Proc.new { false } do
|
202
|
+
expansion :example2 do
|
203
|
+
{:hello => 'land'}
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger')
|
210
|
+
hash = base.structure(:animal).hash(animal, :expansions => true)
|
211
|
+
assert_equal true, hash.keys.include?(:example)
|
212
|
+
assert_equal false, hash.keys.include?(:example2)
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_condition_with_description
|
216
|
+
base = Moonrope::Base.new do
|
217
|
+
structure :animal do
|
218
|
+
condition Proc.new { false }, "An example description" do
|
219
|
+
basic :id
|
220
|
+
expansion :example do
|
221
|
+
{:hello => 'land'}
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger')
|
228
|
+
hash = base.structure(:animal).hash(animal, :expansions => true)
|
229
|
+
assert_equal false, hash.keys.include?(:example)
|
230
|
+
assert_equal false, hash.keys.include?(:id)
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_condition_with_access_rule
|
234
|
+
base = Moonrope::Base.new do
|
235
|
+
authenticator :default do
|
236
|
+
lookup { true }
|
237
|
+
rule(:default, "NotPermitted") { true }
|
238
|
+
rule(:false_rule, "MustNotBeFalse") { false }
|
239
|
+
end
|
240
|
+
structure :animal do
|
241
|
+
condition :default => :false_rule do
|
242
|
+
basic :id
|
243
|
+
end
|
244
|
+
|
245
|
+
condition :default => :default do
|
246
|
+
basic :name
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger')
|
252
|
+
hash = base.structure(:animal).hash(animal, :expansions => true)
|
253
|
+
assert_equal false, hash.keys.include?(:id)
|
254
|
+
assert_equal true, hash.keys.include?(:name)
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_condition_with_access_rule_and_default_authenticator
|
258
|
+
base = Moonrope::Base.new do
|
259
|
+
authenticator :default do
|
260
|
+
lookup { true }
|
261
|
+
rule(:default, "NotPermitted") { true }
|
262
|
+
rule(:false_rule, "MustNotBeFalse") { false }
|
263
|
+
end
|
264
|
+
structure :animal do
|
265
|
+
condition :false_rule do
|
266
|
+
basic :id
|
267
|
+
end
|
268
|
+
|
269
|
+
condition :default do
|
270
|
+
basic :name
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger')
|
276
|
+
hash = base.structure(:animal).hash(animal, :expansions => true)
|
277
|
+
assert_equal false, hash.keys.include?(:id)
|
278
|
+
assert_equal true, hash.keys.include?(:name)
|
279
|
+
end
|
280
|
+
|
281
|
+
|
282
|
+
def test_scopes
|
283
|
+
base = Moonrope::Base.new do
|
284
|
+
structure :animal do
|
285
|
+
group :group1 do
|
286
|
+
basic :id
|
287
|
+
basic :name
|
288
|
+
group :group2 do
|
289
|
+
basic :id_g2, :source_attribute => :id
|
290
|
+
basic :name2, :source_attribute => :name
|
291
|
+
group :group3 do
|
292
|
+
basic :id_g3, :source_attribute => :id
|
293
|
+
basic :name3, :source_attribute => :name
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
condition Proc.new { false } do
|
299
|
+
basic :id2, :name => :id
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
303
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger')
|
304
|
+
hash = base.structure(:animal).hash(animal, :full => true)
|
305
|
+
|
306
|
+
assert_equal 1, hash[:group1][:id]
|
307
|
+
assert_equal 1, hash[:group1][:group2][:id_g2]
|
308
|
+
assert_equal 1, hash[:group1][:group2][:group3][:id_g3]
|
309
|
+
|
310
|
+
assert_equal 'Fido', hash[:group1][:name]
|
311
|
+
assert_equal 'Fido', hash[:group1][:group2][:name2]
|
312
|
+
assert_equal 'Fido', hash[:group1][:group2][:group3][:name3]
|
313
|
+
|
314
|
+
# id2 shouldn't exist because it's if block returns false
|
315
|
+
assert_equal false, hash.keys.include?(:id2)
|
316
|
+
end
|
317
|
+
|
318
|
+
def test_passing_values_from_the_definition
|
319
|
+
base = Moonrope::Base.new do
|
320
|
+
structure :animal do
|
321
|
+
basic :example, :value => 1234
|
322
|
+
basic :example_with_block, :value => Proc.new { "#{o.name}!!!" }
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
animal = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger')
|
327
|
+
hash = base.structure(:animal).hash(animal)
|
328
|
+
assert_equal 1234, hash[:example]
|
329
|
+
assert_equal "Fido!!!", hash[:example_with_block]
|
330
|
+
end
|
331
|
+
|
332
|
+
def test_creating_a_structure_with_description
|
333
|
+
base = Moonrope::Base.new do
|
334
|
+
structure :animal do
|
335
|
+
basic :example, "Hello there!", :value => 1234
|
336
|
+
basic :example2, :description => "Bananas!"
|
337
|
+
end
|
338
|
+
end
|
339
|
+
assert_equal "Hello there!", base.structure(:animal).attributes[:basic].select { |a| a.name == :example }.first.description
|
340
|
+
assert_equal "Bananas!", base.structure(:animal).attributes[:basic].select { |a| a.name == :example2 }.first.description
|
341
|
+
end
|
342
|
+
|
343
|
+
def test_mutating_values
|
344
|
+
base = Moonrope::Base.new do
|
345
|
+
structure :animal do
|
346
|
+
basic :name, :mutation => :downcase
|
347
|
+
end
|
348
|
+
end
|
349
|
+
assert_equal 'fido', base.structure(:animal).hash(Animal.new(:name => 'FIDO'))[:name]
|
350
|
+
end
|
351
|
+
|
352
|
+
def test_auto_mutating_values
|
353
|
+
base = Moonrope::Base.new do
|
354
|
+
structure :animal do
|
355
|
+
basic :name, :type => :unix_timestamp
|
356
|
+
end
|
357
|
+
end
|
358
|
+
assert_equal 1234567890, base.structure(:animal).hash(Animal.new(:name => Time.at(1234567890)))[:name]
|
359
|
+
end
|
360
|
+
|
361
|
+
def test_manually_selecting_attributes
|
362
|
+
base = Moonrope::Base.new do
|
363
|
+
structure :animal do
|
364
|
+
basic :id
|
365
|
+
basic :name
|
366
|
+
end
|
367
|
+
end
|
368
|
+
hash = base.structure(:animal).hash(Animal.new(:id => 12345, :name => "Fido"), :attributes => [:id])
|
369
|
+
assert_equal 12345, hash[:id]
|
370
|
+
assert_equal false, hash.has_key?(:name)
|
371
|
+
end
|
372
|
+
|
373
|
+
|
374
|
+
def test_setting_options_for_embedded_expansions
|
375
|
+
user = User.new(:id => 1, :username => 'dave')
|
376
|
+
animal1 = Animal.new(:id => 1, :name => 'Fido', :color => 'Ginger', :user => user)
|
377
|
+
animal2 = Animal.new(:id => 2, :name => 'Jess', :color => 'Black & White', :user => user)
|
378
|
+
user.animals << animal1
|
379
|
+
user.animals << animal2
|
380
|
+
|
381
|
+
base = Moonrope::Base.new do
|
382
|
+
structure :user do
|
383
|
+
basic { {:id => o.id, :username => o.username } }
|
384
|
+
expansion :animals, :structure => :animal
|
385
|
+
end
|
386
|
+
|
387
|
+
structure :animal do
|
388
|
+
basic :id
|
389
|
+
basic :name
|
390
|
+
full :color
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
hash = base.structure(:user).hash(user, :expansions => [{:animals => {:full => true}}])
|
395
|
+
assert_equal 'Ginger', hash[:animals][0][:color]
|
396
|
+
end
|
397
|
+
|
398
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moonrope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -56,81 +56,63 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.3'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.3'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: test-unit
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.5'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.5'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: yard
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.8'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.8'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rack-test
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
59
|
+
- - ">="
|
102
60
|
- !ruby/object:Gem::Version
|
103
61
|
version: '0'
|
104
62
|
type: :development
|
105
63
|
prerelease: false
|
106
64
|
version_requirements: !ruby/object:Gem::Requirement
|
107
65
|
requirements:
|
108
|
-
- - "
|
66
|
+
- - ">="
|
109
67
|
- !ruby/object:Gem::Version
|
110
68
|
version: '0'
|
111
69
|
description: A full library allowing you to create sexy DSLs to define your RPC-like
|
112
70
|
APIs.
|
113
71
|
email:
|
114
72
|
- adam@atechmedia.com
|
115
|
-
executables:
|
73
|
+
executables:
|
74
|
+
- moonrope
|
116
75
|
extensions: []
|
117
76
|
extra_rdoc_files: []
|
118
77
|
files:
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- MIT-LICENCE
|
81
|
+
- README.md
|
119
82
|
- Rakefile
|
83
|
+
- bin/moonrope
|
84
|
+
- docs/authentication.md
|
85
|
+
- docs/controllers.md
|
86
|
+
- docs/exceptions.md
|
87
|
+
- docs/introduction.md
|
88
|
+
- docs/structures.md
|
89
|
+
- example/authentication.rb
|
90
|
+
- example/controllers/meta_controller.rb
|
91
|
+
- example/controllers/users_controller.rb
|
92
|
+
- example/structures/pet_structure.rb
|
93
|
+
- example/structures/user_structure.rb
|
120
94
|
- lib/moonrope.rb
|
121
95
|
- lib/moonrope/action.rb
|
122
96
|
- lib/moonrope/action_result.rb
|
97
|
+
- lib/moonrope/authenticator.rb
|
123
98
|
- lib/moonrope/base.rb
|
124
99
|
- lib/moonrope/before_action.rb
|
125
100
|
- lib/moonrope/controller.rb
|
101
|
+
- lib/moonrope/doc_context.rb
|
102
|
+
- lib/moonrope/doc_server.rb
|
126
103
|
- lib/moonrope/dsl/action_dsl.rb
|
104
|
+
- lib/moonrope/dsl/authenticator_dsl.rb
|
127
105
|
- lib/moonrope/dsl/base_dsl.rb
|
128
106
|
- lib/moonrope/dsl/controller_dsl.rb
|
107
|
+
- lib/moonrope/dsl/filterable_dsl.rb
|
129
108
|
- lib/moonrope/dsl/structure_dsl.rb
|
130
109
|
- lib/moonrope/errors.rb
|
131
110
|
- lib/moonrope/eval_environment.rb
|
132
111
|
- lib/moonrope/eval_helpers.rb
|
112
|
+
- lib/moonrope/eval_helpers/filter_helper.rb
|
113
|
+
- lib/moonrope/guard.rb
|
133
114
|
- lib/moonrope/helper.rb
|
115
|
+
- lib/moonrope/html_generator.rb
|
134
116
|
- lib/moonrope/param_set.rb
|
135
117
|
- lib/moonrope/rack_middleware.rb
|
136
118
|
- lib/moonrope/railtie.rb
|
@@ -138,6 +120,41 @@ files:
|
|
138
120
|
- lib/moonrope/structure.rb
|
139
121
|
- lib/moonrope/structure_attribute.rb
|
140
122
|
- lib/moonrope/version.rb
|
123
|
+
- moonrope.gemspec
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- spec/specs/action_spec.rb
|
126
|
+
- spec/specs/base_spec.rb
|
127
|
+
- spec/specs/controller_spec.rb
|
128
|
+
- spec/specs/param_set_spec.rb
|
129
|
+
- templates/basic/_action_form.erb
|
130
|
+
- templates/basic/_errors_table.erb
|
131
|
+
- templates/basic/_structure_attributes_list.erb
|
132
|
+
- templates/basic/action.erb
|
133
|
+
- templates/basic/assets/lock.svg
|
134
|
+
- templates/basic/assets/reset.css
|
135
|
+
- templates/basic/assets/style.css
|
136
|
+
- templates/basic/assets/tool.svg
|
137
|
+
- templates/basic/assets/try.js
|
138
|
+
- templates/basic/authenticator.erb
|
139
|
+
- templates/basic/controller.erb
|
140
|
+
- templates/basic/index.erb
|
141
|
+
- templates/basic/layout.erb
|
142
|
+
- templates/basic/structure.erb
|
143
|
+
- test/test_helper.rb
|
144
|
+
- test/tests/action_access_test.rb
|
145
|
+
- test/tests/actions_test.rb
|
146
|
+
- test/tests/authenticators_test.rb
|
147
|
+
- test/tests/base_test.rb
|
148
|
+
- test/tests/controllers_test.rb
|
149
|
+
- test/tests/eval_environment_test.rb
|
150
|
+
- test/tests/evel_helpers_test.rb
|
151
|
+
- test/tests/examples_test.rb
|
152
|
+
- test/tests/helpers_test.rb
|
153
|
+
- test/tests/param_set_test.rb
|
154
|
+
- test/tests/rack_middleware_test.rb
|
155
|
+
- test/tests/request_test.rb
|
156
|
+
- test/tests/structures_param_extensions_test.rb
|
157
|
+
- test/tests/structures_test.rb
|
141
158
|
homepage: http://adamcooke.io
|
142
159
|
licenses:
|
143
160
|
- MIT
|
@@ -157,10 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
174
|
- !ruby/object:Gem::Version
|
158
175
|
version: '0'
|
159
176
|
requirements: []
|
160
|
-
|
161
|
-
rubygems_version: 2.2.2
|
177
|
+
rubygems_version: 3.0.3
|
162
178
|
signing_key:
|
163
179
|
specification_version: 4
|
164
180
|
summary: An API server DSL.
|
165
181
|
test_files: []
|
166
|
-
has_rdoc:
|