kojac 0.13.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -213,21 +213,9 @@ module Kojac
213
213
  def results
214
214
  @results ||= {}
215
215
  end
216
-
217
- def deduce_model_class
218
- KojacUtils.model_class_for_key(self.kojac_resource)
219
- end
220
-
221
- def kojac_resource
222
- self.class.to_s.chomp('Controller').snake_case
223
- end
224
-
225
- def kojac_current_user
226
- self.current_user
227
- end
228
-
216
+
229
217
  def current_ring
230
- kojac_current_user.try(:ring).to_i
218
+ current_user.try(:ring).to_i
231
219
  end
232
220
 
233
221
  def create_on_association(aItem,aAssoc,aValues,aRing)
@@ -235,7 +223,7 @@ module Kojac
235
223
 
236
224
  return nil unless ma = aItem.class.reflect_on_association(aAssoc.to_sym)
237
225
  a_model_class = ma.klass
238
- policy = Kojac.policy!(kojac_current_user,a_model_class)
226
+ policy = Pundit.policy!(current_user,a_model_class)
239
227
 
240
228
  aValues = KojacUtils.upgrade_hashes_to_params(aValues || {})
241
229
 
@@ -277,71 +265,108 @@ module Kojac
277
265
  #end
278
266
  end
279
267
 
268
+ # Unknown resource :
269
+ # CREATE: already there with given id => error
270
+ # READ: isn't there, or we don't have access => nil
271
+ # UPDATE: isn't there, or we don't have access => nil
272
+ # DESTROY: isn't there, or we don't have access => nil
273
+
280
274
  def create_op
281
275
  ring = current_ring
282
- op = params[:op]
276
+ op = (self.respond_to?(:op) && self.op || params[:op])
277
+ #op = params[:op] unless self.respond_to? :op
283
278
  options = op[:options] || {}
284
- model_class = deduce_model_class
285
279
  resource,id,assoc = op['key'].split_kojac_key
286
- if assoc # create operation on an association eg. {verb: "CREATE", key: "order.items"}
287
- raise "User does not have permission for #{op[:verb]} operation on #{model_class.to_s}.#{assoc}" unless model_class.ring_can?(ring,:create_on,assoc.to_sym)
288
- item = KojacUtils.model_for_key(key_join(resource,id))
289
- ma = model_class.reflect_on_association(assoc.to_sym)
290
- a_value = op[:value] # get data for this association, assume {}
291
- raise "create multiple not yet implemented for associations" unless a_value.is_a?(Hash)
292
-
293
- a_model_class = ma.klass
294
- policy = Kojac.policy!(kojac_current_user,a_model_class)
295
- p_fields = policy.permitted_fields(:write)
296
- fields = a_value.permit( *p_fields )
297
- new_sub_item = nil
298
- case ma.macro
299
- when :has_many
300
- a_model_class.write_op_filter(current_user,fields,a_value) if a_model_class.respond_to? :write_op_filter
301
- new_sub_item = item.send(assoc.to_sym).create(fields)
280
+ if model_class = KojacUtils.model_class_for_key(resource)
281
+ if assoc # create operation on an association eg. {verb: "CREATE", key: "order.items"}
282
+ if model_class.ring_can?(ring,:create_on,assoc.to_sym)
283
+ item = KojacUtils.model_for_key(key_join(resource,id))
284
+ ma = model_class.reflect_on_association(assoc.to_sym)
285
+ a_value = op[:value] # get data for this association, assume {}
286
+ raise "create multiple not yet implemented for associations" unless a_value.is_a?(Hash)
287
+
288
+ a_model_class = ma.klass
289
+ policy = Pundit.policy!(current_user,a_model_class)
290
+ p_fields = policy.permitted_fields(:write)
291
+ fields = a_value.permit( *p_fields )
292
+ new_sub_item = nil
293
+ case ma.macro
294
+ when :has_many
295
+ a_model_class.write_op_filter(current_user,fields,a_value) if a_model_class.respond_to? :write_op_filter
296
+ new_sub_item = item.send(assoc.to_sym).create(fields)
297
+ else
298
+ raise "#{ma.macro} association unsupported in CREATE"
299
+ end
300
+ result_key = op[:result_key] || new_sub_item.kojac_key
301
+ merge_model_into_results(new_sub_item)
302
302
  else
303
- raise "#{ma.macro} association unsupported in CREATE"
304
- end
305
- result_key = op[:result_key] || new_sub_item.kojac_key
306
- merge_model_into_results(new_sub_item)
307
- else # create operation on a resource eg. {verb: "CREATE", key: "order_items"} but may have embedded association values
308
- raise "User does not have permission for #{op[:verb]} operation on #{model_class.to_s}" unless model_class.ring_can?(:create,ring)
309
- policy = Kojac.policy!(kojac_current_user,model_class)
310
- p_fields = policy.permitted_fields(:write)
311
-
312
- p_fields = op[:value].permit( *p_fields )
313
- model_class.write_op_filter(current_user,p_fields,op[:value]) if model_class.respond_to? :write_op_filter
314
- item = model_class.create!(p_fields)
315
-
316
- options_include = options['include'] || []
317
- included_assocs = []
318
- p_assocs = policy.permitted_associations(:write)
319
- if p_assocs
320
- p_assocs.each do |a|
321
- next unless (a_value = op[:value][a]) || options_include.include?(a.to_s)
322
- create_on_association(item,a,a_value,ring)
323
- included_assocs << a.to_sym
303
+ error = {
304
+ code: 403,
305
+ status: "Forbidden",
306
+ message: "User does not have permission for #{op[:verb]} operation on #{model_class.to_s}.#{assoc}"
307
+ }
308
+ end
309
+ else # create operation on a resource eg. {verb: "CREATE", key: "order_items"} but may have embedded association values
310
+ if model_class.ring_can?(:create,ring)
311
+ policy = Pundit.policy!(current_user,model_class)
312
+ p_fields = policy.permitted_fields(:write)
313
+
314
+ p_fields = op[:value].permit( *p_fields )
315
+ model_class.write_op_filter(current_user,p_fields,op[:value]) if model_class.respond_to? :write_op_filter
316
+ item = model_class.create!(p_fields)
317
+
318
+ options_include = options['include'] || []
319
+ included_assocs = []
320
+ p_assocs = policy.permitted_associations(:write)
321
+ if p_assocs
322
+ p_assocs.each do |a|
323
+ next unless (a_value = op[:value][a]) || options_include.include?(a.to_s)
324
+ create_on_association(item,a,a_value,ring)
325
+ included_assocs << a.to_sym
326
+ end
327
+ end
328
+ item.save!
329
+ result_key = op[:result_key] || item.kojac_key
330
+ merge_model_into_results(item,result_key,:include => included_assocs)
331
+ else
332
+ error = {
333
+ code: 403,
334
+ status: "Forbidden",
335
+ message: "User does not have permission for #{op[:verb]} operation on #{model_class.to_s}"
336
+ }
324
337
  end
325
338
  end
326
- item.save!
327
- result_key = op[:result_key] || item.kojac_key
328
- merge_model_into_results(item,result_key,:include => included_assocs)
339
+ else
340
+ error = {
341
+ code: 501,
342
+ status: "Not Implemented",
343
+ message: "model class not found"
344
+ }
329
345
  end
330
- {
346
+ response = {
331
347
  key: op[:key],
332
348
  verb: op[:verb],
333
- result_key: result_key,
334
- results: results
335
349
  }
350
+ if error
351
+ response[:error] = error
352
+ else
353
+ response[:results] = results
354
+ response[:result_key] = result_key
355
+ end
356
+ response
336
357
  end
337
358
 
338
359
  protected
339
360
 
361
+ def rails_controller?
362
+ self.is_a? ActionController::Base
363
+ end
364
+
340
365
  def merge_model_into_results(aItem,aResultKey=nil,aOptions=nil)
341
366
  ring = current_ring
342
- aResultKey ||= aItem.g? :kojac_key
343
- results[aResultKey] = (aItem && KojacUtils.to_jsono(aItem,scope: kojac_current_user))
344
- if policy = Kojac.policy!(kojac_current_user,aItem)
367
+ aResultKey ||= aItem.g?(:kojac_key)
368
+ results[aResultKey] = (aItem && KojacUtils.to_jsono(aItem,scope: current_user))
369
+ if policy = Pundit.policy!(current_user,aItem)
345
370
  aOptions ||= {}
346
371
  if included_assocs = aOptions[:include]
347
372
  included_assocs = included_assocs.split(',') if included_assocs.is_a?(String)
@@ -360,10 +385,10 @@ module Kojac
360
385
  if a_contents.is_a? Array
361
386
  contents_h = []
362
387
  a_contents.each do |sub_item|
363
- results[sub_item.kojac_key] = KojacUtils.to_jsono(sub_item,scope: kojac_current_user)
388
+ results[sub_item.kojac_key] = KojacUtils.to_jsono(sub_item,scope: current_user)
364
389
  end
365
390
  else
366
- results[a_contents.kojac_key] = KojacUtils.to_jsono(a_contents,scope: kojac_current_user)
391
+ results[a_contents.kojac_key] = KojacUtils.to_jsono(a_contents,scope: current_user)
367
392
  end
368
393
  end
369
394
  end
@@ -372,41 +397,56 @@ module Kojac
372
397
  results
373
398
  end
374
399
 
400
+
375
401
  public
376
402
 
403
+ def kojac_setup(aCurrentUser,aOp)
404
+ self.current_user = aCurrentUser if self.respond_to? :current_user
405
+ self.op = aOp if self.respond_to? :op
406
+ self.verb = aOp['verb'] if self.respond_to? :verb
407
+ self.key = aOp['key'] if self.respond_to? :key
408
+ self.value = aOp['value'] if self.respond_to? :value
409
+ self.params = aOp['params'] || {} if self.respond_to? :params
410
+ self.options = aOp['options'] || {} if self.respond_to? :options
411
+ self.error = aOp['error'] if self.respond_to? :error
412
+ self
413
+ end
414
+
377
415
  def read_op
378
- op = params[:op]
416
+ op = (self.respond_to?(:op) && self.op || params[:op])
379
417
  key = op[:key]
380
418
  result_key = nil
419
+ error = nil
381
420
  resource,id = key.split '__'
382
- model = deduce_model_class
383
- scope = Kojac.policy_scope(current_user, model, op) || model
384
- if id # item
385
- if scope
386
- item = scope.load_by_key(key,op)
387
- #item = item.first
388
- #item.prepare(key,op) if item.respond_to? :prepare
389
- result_key = op[:result_key] || (item && item.kojac_key) || op[:key]
390
- merge_model_into_results(item,result_key,op[:options])
391
- else
392
- result_key = op[:result_key] || op[:key]
393
- results[result_key] = null
394
- end
395
- else # collection
396
- result_key = op[:result_key] || op[:key]
397
- results[result_key] = []
398
- if scope
399
- items = scope
400
- items = send(:after_scope,items,op) if respond_to? :after_scope
401
- items = items.load_by_key(key,op)
402
- #items = scope.by_key(key,op)
403
- #items = items.all
404
- items.each do |item|
405
- item.prepare(key,op) if item.respond_to? :prepare
421
+ model = KojacUtils.model_class_for_key(key)
422
+ #raise "model class not found" unless
423
+ if scope = Pundit.policy_scope(current_user, model) || model
424
+ if id # item
425
+ scope = scope.where(id: id)
426
+ scope = after_scope(scope) if respond_to?(:after_scope)
427
+ if item = scope.first
428
+ #item.prepare(key,op) if item.respond_to? :prepare
429
+ result_key = op[:result_key] || (item && item.kojac_key) || op[:key]
430
+ merge_model_into_results(item,result_key,op[:options])
431
+ else
432
+ result_key = op[:result_key] || op[:key]
433
+ results[result_key] = nil
434
+ end
435
+ else # collection
436
+ if rails_controller? # deprecated
437
+ items = scope.respond_to?(:all) ? scope.all : scope.to_a
438
+ result_key = op[:result_key] || op[:key]
439
+ results[result_key] = []
440
+ items = after_scope(items) if respond_to?(:after_scope)
441
+ else
442
+ scope = after_scope(scope) if respond_to?(:after_scope)
443
+ items = scope.respond_to?(:all) ? scope.all : scope.to_a
444
+ result_key = op[:result_key] || op[:key]
445
+ results[result_key] = []
406
446
  end
407
447
  if op[:options] and op[:options][:atomise]==false
408
448
  items_json = []
409
- items_json = items.map {|i| KojacUtils.to_jsono(i,scope: kojac_current_user) }
449
+ items_json = items.map {|i| KojacUtils.to_jsono(i,scope: current_user) }
410
450
  results[result_key] = items_json
411
451
  else
412
452
  items.each do |m|
@@ -416,27 +456,37 @@ module Kojac
416
456
  end
417
457
  end
418
458
  end
459
+ else
460
+ error = {
461
+ code: 501,
462
+ status: "Not Implemented",
463
+ message: "model class not found"
464
+ }
419
465
  end
420
- {
466
+ response = {
421
467
  key: op[:key],
422
468
  verb: op[:verb],
423
- results: results,
424
- result_key: result_key
425
469
  }
470
+ if error
471
+ response[:error] = error
472
+ else
473
+ response[:results] = results
474
+ response[:result_key] = result_key
475
+ end
476
+ response
426
477
  end
427
478
 
428
479
  def update_op
429
480
  result = nil
430
481
  ring = current_ring
431
- op = params[:op]
482
+ op = (self.respond_to?(:op) && self.op || params[:op])
432
483
  result_key = nil
433
- model = deduce_model_class
434
- scope = Kojac.policy_scope(current_user, model, op) || model
435
-
436
- if item = scope.load_by_key(op[:key],op)
437
-
484
+ model = KojacUtils.model_class_for_key(op[:key].base_key)
485
+ scope = Pundit.policy_scope(current_user, model) || model
486
+ scope = after_scope(scope) if scope && respond_to?(:after_scope)
487
+ if scope and item = scope.load_by_key(op[:key],op)
438
488
  #run_callbacks :update_op do
439
- policy = Kojac.policy!(kojac_current_user,item,op)
489
+ policy = Pundit.policy!(current_user,item)
440
490
  item.update_permitted_attributes!(op[:value], policy)
441
491
 
442
492
  associations = policy.permitted_associations(:write)
@@ -446,14 +496,13 @@ module Kojac
446
496
  case assoc.macro
447
497
  when :belongs_to
448
498
  if leaf = (item.send(k) || item.send("build_#{k}".to_sym))
449
- policy = Kojac.policy!(kojac_current_user,leaf)
499
+ policy = Pundit.policy!(current_user,leaf)
450
500
  leaf.update_permitted_attributes!(op[:value][k], policy)
451
501
  end
452
502
  end
453
503
  end
454
504
 
455
- result_key = item.kojac_key
456
- #results[result_key] = item
505
+ result_key = op[:result_key] || (item && item.kojac_key) || op[:key]
457
506
  merge_model_into_results(item,result_key,op[:options])
458
507
 
459
508
  associations.each do |a|
@@ -463,6 +512,9 @@ module Kojac
463
512
  merge_model_into_results(assoc_item,key)
464
513
  end
465
514
  #end
515
+ else
516
+ result_key = op[:result_key] || op[:key]
517
+ results[result_key] = nil
466
518
  end
467
519
  {
468
520
  key: op[:key],
@@ -474,10 +526,19 @@ module Kojac
474
526
 
475
527
  def destroy_op
476
528
  ring = current_ring
477
- op = params[:op]
529
+ op = (self.respond_to?(:op) && self.op || params[:op])
478
530
  result_key = op[:result_key] || op[:key]
479
- item = KojacUtils.model_for_key(op[:key])
480
- item.destroy if item
531
+ # item = KojacUtils.model_for_key(op[:key])
532
+ # item.destroy if item
533
+ r,id,a = op[:key].split_kojac_key
534
+
535
+ if id
536
+ model = KojacUtils.model_class_for_key(op[:key].base_key)
537
+ scope = Pundit.policy_scope(current_user, model) || model
538
+ scope = after_scope(scope) if scope && respond_to?(:after_scope)
539
+ item = scope.where(id: id).first
540
+ item.destroy if item
541
+ end
481
542
  results[result_key] = nil
482
543
  {
483
544
  key: op[:key],
@@ -493,8 +554,8 @@ module Kojac
493
554
 
494
555
  def add_op
495
556
  ring = current_ring
496
- op = params[:op]
497
- model = deduce_model_class
557
+ op = (self.respond_to?(:op) && self.op || params[:op])
558
+ model = KojacUtils.model_class_for_key(op[:key].base_key)
498
559
  raise "ADD only supports associated collections at present eg order.items" unless op[:key].index('.')
499
560
 
500
561
  item = KojacUtils.model_for_key(op[:key].base_key)
@@ -526,8 +587,8 @@ module Kojac
526
587
 
527
588
  def remove_op
528
589
  ring = current_ring
529
- op = params[:op]
530
- model = deduce_model_class
590
+ op = (self.respond_to?(:op) && self.op || params[:op])
591
+ model = KojacUtils.model_class_for_key(op[:key].base_key)
531
592
  raise "REMOVE only supports associated collections at present eg order.items" unless op[:key].key_assoc
532
593
 
533
594
  item = KojacUtils.model_for_key(op[:key].base_key)
@@ -559,22 +620,23 @@ module Kojac
559
620
  end
560
621
 
561
622
  def execute_op
562
- op = params[:op]
623
+ op = (self.respond_to?(:op) && self.op || params[:op])
563
624
  resource,action = op[:key].split_kojac_key
564
625
  raise "action not given" unless action.is_a? String
565
- action = "execute_#{action}"
626
+ action = rails_controller? ? "execute_#{action}" : "execute__#{action}"
566
627
  raise "action #{action} not implemented on #{resource}" unless respond_to? action.to_sym
567
- result = send(action.to_sym,op)
568
- if op[:error]
628
+ result = rails_controller? ? send(action.to_sym,op) : send(action)
629
+ error = rails_controller? ? op[:error] : (respond_to?(:error).to_nil && send(:error))
630
+ if error
569
631
  {
570
632
  key: op[:key],
571
633
  verb: op[:verb],
572
- error: op[:error]
634
+ error: error
573
635
  }
574
636
  else
575
637
  result_key = op[:result_key] || op[:key]
576
638
  results = op[:results] || {} # look at op[:results][result_key]. If empty, fill with returned value from action
577
- results[result_key] = KojacUtils.to_jsono(result,scope: kojac_current_user) unless results.has_key? result_key
639
+ results[result_key] = KojacUtils.to_jsono(result,scope: current_user) unless results.has_key? result_key
578
640
  {
579
641
  key: op[:key],
580
642
  verb: op[:verb],
data/lib/kojac/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kojac
2
- VERSION = "0.13.0"
2
+ VERSION = "0.15.0"
3
3
  end
data/lib/kojac.rb CHANGED
@@ -1,4 +1,9 @@
1
- Dir.chdir(File.dirname(__FILE__)) { Dir['kojac/*'] }.each {|f| require f }
1
+ #Dir.chdir(File.dirname(__FILE__)) { Dir['kojac/*'] }.each {|f| require f }
2
+ #require 'kojac/app_serialize'
3
+ require 'kojac/version'
4
+ require 'kojac/concentric'
5
+ require 'kojac/kojac_rails'
6
+ require 'kojac/kojac_controller'
2
7
 
3
8
  module Kojac
4
9
  module Rails
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Reorder generators
5
+ 2. Remove generators
6
+ 3. Add installed generators
7
+ To add new installed generators automatically delete this file and reload the project.
8
+ --><GeneratorsGroup><Generator name="assets" /><Generator name="controller" /><Generator name="factory_girl:model" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="pundit:install" /><Generator name="pundit:policy" /><Generator name="resource" /><Generator name="responders:install" /><Generator name="responders_controller" /><Generator name="rspec:install" /><Generator name="rspec:observer" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="serializer" /><Generator name="task" /><Generator name="test_unit:controller" /><Generator name="test_unit:generator" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:job" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /></GeneratorsGroup></Settings>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="List versions of all Rails frameworks and the environment" fullCmd="about" taksId="about" /><RakeGroup description="" fullCmd="" taksId="assets"><RakeTask description="Remove old compiled assets" fullCmd="assets:clean[keep]" taksId="clean[keep]" /><RakeTask description="Remove compiled assets" fullCmd="assets:clobber" taksId="clobber" /><RakeTask description="Load asset compile environment" fullCmd="assets:environment" taksId="environment" /><RakeTask description="Compile all the assets named in config.assets.precompile" fullCmd="assets:precompile" taksId="precompile" /><RakeTask description="" fullCmd="assets:clean" taksId="clean" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="cache_digests"><RakeTask description="Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)" fullCmd="cache_digests:dependencies" taksId="dependencies" /><RakeTask description="Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)" fullCmd="cache_digests:nested_dependencies" taksId="nested_dependencies" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="db"><RakeTask description="Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config)" fullCmd="db:create" taksId="create" /><RakeTask description="Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config)" fullCmd="db:drop" taksId="drop" /><RakeTask description="Drop all tables" fullCmd="db:drop_tables" taksId="drop_tables" /><RakeGroup description="" fullCmd="" taksId="fixtures"><RakeTask description="Load fixtures into the current environment's database" fullCmd="db:fixtures:load" taksId="load" /><RakeTask description="" fullCmd="db:fixtures:identify" taksId="identify" /></RakeGroup><RakeTask description="Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)" fullCmd="db:migrate" taksId="migrate" /><RakeGroup description="" fullCmd="" taksId="migrate"><RakeTask description="Display status of migrations" fullCmd="db:migrate:status" taksId="status" /><RakeTask description="" fullCmd="db:migrate:down" taksId="down" /><RakeTask description="" fullCmd="db:migrate:redo" taksId="redo" /><RakeTask description="" fullCmd="db:migrate:reset" taksId="reset" /><RakeTask description="" fullCmd="db:migrate:up" taksId="up" /></RakeGroup><RakeTask description="Rolls the schema back to the previous version (specify steps w/ STEP=n)" fullCmd="db:rollback" taksId="rollback" /><RakeGroup description="" fullCmd="" taksId="schema"><RakeGroup description="" fullCmd="" taksId="cache"><RakeTask description="Clear a db/schema_cache.dump file" fullCmd="db:schema:cache:clear" taksId="clear" /><RakeTask description="Create a db/schema_cache.dump file" fullCmd="db:schema:cache:dump" taksId="dump" /></RakeGroup><RakeTask description="Create a db/schema.rb file that is portable against any DB supported by AR" fullCmd="db:schema:dump" taksId="dump" /><RakeTask description="Load a schema.rb file into the database" fullCmd="db:schema:load" taksId="load" /><RakeTask description="" fullCmd="db:schema:load_if_ruby" taksId="load_if_ruby" /></RakeGroup><RakeTask description="Load the seed data from db/seeds.rb" fullCmd="db:seed" taksId="seed" /><RakeTask description="Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)" fullCmd="db:setup" taksId="setup" /><RakeGroup description="" fullCmd="" taksId="structure"><RakeTask description="Dump the database structure to db/structure.sql" fullCmd="db:structure:dump" taksId="dump" /><RakeTask description="Recreate the databases from the structure.sql file" fullCmd="db:structure:load" taksId="load" /><RakeTask description="" fullCmd="db:structure:load_if_sql" taksId="load_if_sql" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="Prepare test db by migrating" fullCmd="db:test:clone_structure" taksId="clone_structure" /><RakeTask description="" fullCmd="db:test:clone" taksId="clone" /><RakeTask description="" fullCmd="db:test:clone_schema" taksId="clone_schema" /><RakeTask description="" fullCmd="db:test:deprecated" taksId="deprecated" /><RakeTask description="" fullCmd="db:test:load" taksId="load" /><RakeTask description="" fullCmd="db:test:load_schema" taksId="load_schema" /><RakeTask description="" fullCmd="db:test:load_structure" taksId="load_structure" /><RakeTask description="" fullCmd="db:test:prepare" taksId="prepare" /><RakeTask description="" fullCmd="db:test:purge" taksId="purge" /></RakeGroup><RakeTask description="Retrieves the current schema version number" fullCmd="db:version" taksId="version" /><RakeTask description="" fullCmd="db:_dump" taksId="_dump" /><RakeTask description="" fullCmd="db:abort_if_pending_migrations" taksId="abort_if_pending_migrations" /><RakeTask description="" fullCmd="db:charset" taksId="charset" /><RakeTask description="" fullCmd="db:collation" taksId="collation" /><RakeGroup description="" fullCmd="" taksId="create"><RakeTask description="" fullCmd="db:create:all" taksId="all" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="drop"><RakeTask description="" fullCmd="db:drop:all" taksId="all" /></RakeGroup><RakeTask description="" fullCmd="db:forward" taksId="forward" /><RakeTask description="" fullCmd="db:load_config" taksId="load_config" /><RakeTask description="" fullCmd="db:purge" taksId="purge" /><RakeGroup description="" fullCmd="" taksId="purge"><RakeTask description="" fullCmd="db:purge:all" taksId="all" /></RakeGroup><RakeTask description="" fullCmd="db:reset" taksId="reset" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="doc"><RakeTask description="Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE=&quot;Custom Title&quot;)" fullCmd="doc:app" taksId="app" /><RakeTask description="" fullCmd="doc:clobber" taksId="clobber" /><RakeTask description="" fullCmd="doc:clobber_app" taksId="clobber_app" /><RakeTask description="" fullCmd="doc:clobber_rails" taksId="clobber_rails" /><RakeTask description="" fullCmd="doc:guides" taksId="guides" /><RakeTask description="" fullCmd="doc:rails" taksId="rails" /><RakeTask description="" fullCmd="doc:reapp" taksId="reapp" /><RakeTask description="" fullCmd="doc:rerails" taksId="rerails" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="log"><RakeTask description="Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)" fullCmd="log:clear" taksId="clear" /></RakeGroup><RakeTask description="Prints out your Rack middleware stack" fullCmd="middleware" taksId="middleware" /><RakeTask description="Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)" fullCmd="notes" taksId="notes" /><RakeGroup description="" fullCmd="" taksId="notes"><RakeTask description="Enumerate a custom annotation, specify with ANNOTATION=CUSTOM" fullCmd="notes:custom" taksId="custom" /><RakeTask description="" fullCmd="notes:fixme" taksId="fixme" /><RakeTask description="" fullCmd="notes:optimize" taksId="optimize" /><RakeTask description="" fullCmd="notes:todo" taksId="todo" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="rails"><RakeTask description="Applies the template supplied by LOCATION=(/path/to/template) or URL" fullCmd="rails:template" taksId="template" /><RakeTask description="Update configs and some other initially generated files (or use just update:configs or update:bin)" fullCmd="rails:update" taksId="update" /><RakeGroup description="" fullCmd="" taksId="templates"><RakeTask description="" fullCmd="rails:templates:copy" taksId="copy" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="update"><RakeTask description="" fullCmd="rails:update:bin" taksId="bin" /><RakeTask description="" fullCmd="rails:update:configs" taksId="configs" /></RakeGroup></RakeGroup><RakeTask description="Print out all defined routes in match order, with names" fullCmd="routes" taksId="routes" /><RakeTask description="Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)" fullCmd="secret" taksId="secret" /><RakeTask description="Run all specs in spec directory (excluding plugin specs)" fullCmd="spec" taksId="spec" /><RakeGroup description="" fullCmd="" taksId="spec"><RakeTask description="Run the code examples in spec/controllers" fullCmd="spec:controllers" taksId="controllers" /><RakeTask description="Run the code examples in spec/features" fullCmd="spec:features" taksId="features" /><RakeTask description="Run the code examples in spec/models" fullCmd="spec:models" taksId="models" /><RakeTask description="" fullCmd="spec:prepare" taksId="prepare" /><RakeTask description="" fullCmd="spec:statsetup" taksId="statsetup" /></RakeGroup><RakeTask description="Report code statistics (KLOCs, etc) from the application or engine" fullCmd="stats" taksId="stats" /><RakeTask description="Runs all tests in test folder" fullCmd="test" taksId="test" /><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="Run tests quickly by merging all types and not resetting db" fullCmd="test:all" taksId="all" /><RakeGroup description="" fullCmd="" taksId="all"><RakeTask description="Run tests quickly, but also reset db" fullCmd="test:all:db" taksId="db" /></RakeGroup><RakeTask description="Run tests quickly, but also reset db" fullCmd="test:db" taksId="db" /><RakeTask description="" fullCmd="test:controllers" taksId="controllers" /><RakeTask description="" fullCmd="test:deprecate_all" taksId="deprecate_all" /><RakeTask description="" fullCmd="test:functionals" taksId="functionals" /><RakeTask description="" fullCmd="test:generators" taksId="generators" /><RakeTask description="" fullCmd="test:helpers" taksId="helpers" /><RakeTask description="" fullCmd="test:integration" taksId="integration" /><RakeTask description="" fullCmd="test:jobs" taksId="jobs" /><RakeTask description="" fullCmd="test:mailers" taksId="mailers" /><RakeTask description="" fullCmd="test:models" taksId="models" /><RakeTask description="" fullCmd="test:prepare" taksId="prepare" /><RakeTask description="" fullCmd="test:run" taksId="run" /><RakeTask description="" fullCmd="test:single" taksId="single" /><RakeTask description="" fullCmd="test:units" taksId="units" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="time"><RakeGroup description="" fullCmd="" taksId="zones"><RakeTask description="Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6" fullCmd="time:zones:all" taksId="all" /><RakeTask description="" fullCmd="time:zones:local" taksId="local" /><RakeTask description="" fullCmd="time:zones:us" taksId="us" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="tmp"><RakeTask description="Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)" fullCmd="tmp:clear" taksId="clear" /><RakeTask description="Creates tmp directories for sessions, cache, sockets, and pids" fullCmd="tmp:create" taksId="create" /><RakeGroup description="" fullCmd="" taksId="cache"><RakeTask description="" fullCmd="tmp:cache:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="pids"><RakeTask description="" fullCmd="tmp:pids:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="sessions"><RakeTask description="" fullCmd="tmp:sessions:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="sockets"><RakeTask description="" fullCmd="tmp:sockets:clear" taksId="clear" /></RakeGroup></RakeGroup><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="doc" taksId="doc" /><RakeTask description="" fullCmd="doc/app" taksId="doc/app" /><RakeTask description="" fullCmd="doc/app/created.rid" taksId="doc/app/created.rid" /><RakeTask description="" fullCmd="environment" taksId="environment" /><RakeTask description="" fullCmd="html" taksId="html" /><RakeTask description="" fullCmd="html/created.rid" taksId="html/created.rid" /><RakeGroup description="" fullCmd="" taksId="railties"><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="" fullCmd="railties:install:migrations" taksId="migrations" /></RakeGroup></RakeGroup><RakeTask description="" fullCmd="tmp" taksId="tmp" /><RakeTask description="" fullCmd="tmp/cache" taksId="tmp/cache" /><RakeTask description="" fullCmd="tmp/cache/assets" taksId="tmp/cache/assets" /><RakeTask description="" fullCmd="tmp/cache/assets/development" taksId="tmp/cache/assets/development" /><RakeTask description="" fullCmd="tmp/cache/assets/production" taksId="tmp/cache/assets/production" /><RakeTask description="" fullCmd="tmp/cache/assets/test" taksId="tmp/cache/assets/test" /><RakeTask description="" fullCmd="tmp/pids" taksId="tmp/pids" /><RakeTask description="" fullCmd="tmp/sessions" taksId="tmp/sessions" /><RakeTask description="" fullCmd="tmp/sockets" taksId="tmp/sockets" /></RakeGroup></Settings>
@@ -1 +1 @@
1
- ruby-2.1.5
1
+ ruby-2.2.2
data/spec/demo/Gemfile CHANGED
@@ -2,7 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
4
  #ruby '2.0.0'
5
- gem 'rails', '4.0.1'
5
+ gem 'rails', '~> 4.2'
6
+
7
+ gem 'responders', '~> 2.0'
6
8
 
7
9
  # Use sqlite3 as the database for Active Record
8
10
  gem 'sqlite3'
@@ -51,9 +53,12 @@ gem 'buzztools', '~> 0.0.8' # :github => 'buzzware/buzztools', :ref => 'a403e6fa
51
53
  #gem 'kojac', :git => 'http://github.com/buzzware/KOJAC', :ref => '467817b22ebe5802323006746845a1d14764e00a'
52
54
  gem 'kojac', :path => '../..'
53
55
  gem "active_model_serializers", '= 0.9.0.alpha1' #git: "http://github.com/rails-api/active_model_serializers"
54
- gem 'rspec-rails', :group => [:development,:test]
56
+ gem 'rspec-rails', '~> 2.14', :group => [:development,:test]
55
57
  #gem 'database_cleaner', :group => :test
56
58
  #gem "show_me_the_cookies", :group => :test
57
59
  #gem "faker", :group => [:development,:test]
60
+
61
+ gem 'psych', '=2.0.4' # 2.0.5 causes some crash in the IDEA debugger, related to fakers
62
+
58
63
  gem "faker"
59
64
  gem "factory_girl_rails", :group => [:test, :development]