push_type_core 0.6.0.beta.2 → 0.6.0.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/fields/push_type/matrix_field.rb +3 -1
  3. data/app/fields/push_type/structure_field.rb +7 -1
  4. data/app/models/push_type/structure.rb +1 -4
  5. data/lib/generators/push_type/structure/USAGE +8 -0
  6. data/lib/generators/push_type/structure/structure_generator.rb +18 -0
  7. data/lib/generators/push_type/structure/templates/structure.rb +10 -0
  8. data/lib/push_type/core/engine.rb +1 -0
  9. data/lib/push_type/testing/common_rake.rb +2 -0
  10. data/lib/push_type/testing/setup.rb +1 -1
  11. data/lib/push_type/version.rb +1 -1
  12. data/test/dummy/app/models/location.rb +6 -0
  13. data/test/dummy/config/initializers/push_type.rb +1 -1
  14. data/test/dummy/config/secrets.yml +2 -2
  15. data/test/dummy/db/schema.rb +1 -1
  16. data/test/dummy/log/test.log +11730 -11550
  17. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0ANSDcZJu9gPyqtYPIW729qm1kriQ29Vn9LU8T2SGQU.cache +0 -0
  18. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/_d65qW7wxRtKVSYpmfSenECz5QUWVI9pppUgV7TA1Rk.cache +0 -0
  19. data/test/dummy/tmp/generators/app/fields/rich_text_field.rb +15 -0
  20. data/test/fields/push_type/structure_field_test.rb +8 -0
  21. data/test/lib/generators/push_type/structure_generator_test.rb +18 -0
  22. data/test/models/concerns/push_type/presentable_test.rb +8 -2
  23. metadata +28 -24
  24. data/lib/generators/push_type/dummy/templates/page.rb +0 -6
  25. data/test/dummy/tmp/generators/app/models/category.rb +0 -7
  26. data/test/dummy/tmp/generators/app/views/taxonomies/category.html.erb +0 -3
  27. /data/test/dummy/db/migrate/{20151102165837_create_push_type_users.push_type.rb → 20151102202715_create_push_type_users.push_type.rb} +0 -0
  28. /data/test/dummy/db/migrate/{20151102165838_create_push_type_nodes.push_type.rb → 20151102202716_create_push_type_nodes.push_type.rb} +0 -0
  29. /data/test/dummy/db/migrate/{20151102165839_create_push_type_node_hierarchies.push_type.rb → 20151102202717_create_push_type_node_hierarchies.push_type.rb} +0 -0
  30. /data/test/dummy/db/migrate/{20151102165840_create_push_type_assets.push_type.rb → 20151102202718_create_push_type_assets.push_type.rb} +0 -0
  31. /data/test/dummy/db/migrate/{20151102165841_create_push_type_taxonomies.push_type.rb → 20151102202719_create_push_type_taxonomies.push_type.rb} +0 -0
  32. /data/test/dummy/db/migrate/{20151102165842_create_push_type_taxonomy_hierarchies.push_type.rb → 20151102202720_create_push_type_taxonomy_hierarchies.push_type.rb} +0 -0
  33. /data/test/dummy/db/migrate/{20151102165843_add_field_store_default_values.push_type.rb → 20151102202721_add_field_store_default_values.push_type.rb} +0 -0
  34. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{idBOP3HLwMKqIi2fmJ86l7s0AJCQq-p3JBAe01H630c.cache → 6jsgv3ntDkti59be5oRYC_iAKKBc6jXnUhiRtR5B3mY.cache} +0 -0
  35. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{aTa2i4fIuP1rB3Te3BmhxVW3c0wwyYQtTIQW710wrm0.cache → Am5-YNurKjuaBZepBbaF-WarxmMoFaQFl7aXtNOYO7w.cache} +0 -0
@@ -0,0 +1,15 @@
1
+ class RichTextField < PushType::FieldType::Base
2
+
3
+ # Override built-in methods to extend functionality
4
+ # See PushType::FieldType Rdoc for methods to Override
5
+
6
+ # Example:
7
+ # def form_helper
8
+ # :date_field
9
+ # end
10
+
11
+ # def from_json(val)
12
+ # val.to_date
13
+ # end
14
+
15
+ end
@@ -8,6 +8,8 @@ module PushType
8
8
  field :key, :string
9
9
  field :val, :text
10
10
  end
11
+ field :location, :structure
12
+ field :bar, :structure, class: :location
11
13
  end
12
14
 
13
15
  let(:node) { TestPage.create FactoryGirl.attributes_for(:node, foo: val) }
@@ -23,5 +25,11 @@ module PushType
23
25
  it { field.value.key.must_equal 'a' }
24
26
  it { field.value.val.must_equal 'b' }
25
27
 
28
+ it { node.foo.class.ancestors.must_include PushType::Structure }
29
+ it { node.location.must_be_instance_of Location }
30
+ it { node.bar.must_be_instance_of Location }
31
+ it { node.location.class.ancestors.must_include PushType::Structure }
32
+ it { node.bar.class.ancestors.must_include PushType::Structure }
33
+
26
34
  end
27
35
  end
@@ -0,0 +1,18 @@
1
+ require 'test_helper'
2
+ require "generators/push_type/structure/structure_generator"
3
+
4
+ module PushType
5
+ class StructureGeneratorTest < Rails::Generators::TestCase
6
+ tests StructureGenerator
7
+ destination Rails.root.join('tmp/generators')
8
+
9
+ before :all do
10
+ prepare_destination
11
+ run_generator ['location', 'foo', 'bar:text']
12
+ end
13
+
14
+ it { assert_file 'app/models/location.rb', %r{class Location < PushType::Structure} }
15
+ it { assert_file 'app/models/location.rb', %r{field :foo, :string} }
16
+ it { assert_file 'app/models/location.rb', %r{field :bar, :text} }
17
+ end
18
+ end
@@ -3,16 +3,22 @@ require 'test_helper'
3
3
  module PushType
4
4
  class PresentableTest < ActiveSupport::TestCase
5
5
 
6
+ class TestPage < PushType::Node
7
+ field :location, :structure
8
+ end
9
+
6
10
  describe 'class methods' do
7
11
  it { Page.presenter_class_name.must_equal 'PagePresenter' }
12
+ it { Location.presenter_class_name.must_equal 'LocationPresenter' }
8
13
  it { Page.presenter_class.must_be_instance_of Class }
9
14
  end
10
15
 
11
16
  describe 'instance methods' do
12
- let(:page) { Page.new FactoryGirl.attributes_for(:node) }
17
+ let(:page) { TestPage.new FactoryGirl.attributes_for(:node) }
13
18
  it { page.presenter_class.must_be_instance_of Class }
14
- it { page.present!.must_be_instance_of Page }
19
+ it { page.location.presenter_class.must_be_instance_of Class }
15
20
  it { page.present!.class.ancestors.must_include PushType::Presenter }
21
+ it { page.location.present!.class.ancestors.must_include PushType::Presenter }
16
22
  end
17
23
 
18
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: push_type_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.beta.2
4
+ version: 0.6.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Russell
@@ -197,7 +197,6 @@ files:
197
197
  - lib/generators/push_type/dummy/dummy_generator.rb
198
198
  - lib/generators/push_type/dummy/templates/application.rb
199
199
  - lib/generators/push_type/dummy/templates/boot.rb
200
- - lib/generators/push_type/dummy/templates/page.rb
201
200
  - lib/generators/push_type/field/USAGE
202
201
  - lib/generators/push_type/field/field_generator.rb
203
202
  - lib/generators/push_type/field/templates/field.rb
@@ -210,6 +209,9 @@ files:
210
209
  - lib/generators/push_type/presenter/USAGE
211
210
  - lib/generators/push_type/presenter/presenter_generator.rb
212
211
  - lib/generators/push_type/presenter/templates/presenter.rb
212
+ - lib/generators/push_type/structure/USAGE
213
+ - lib/generators/push_type/structure/structure_generator.rb
214
+ - lib/generators/push_type/structure/templates/structure.rb
213
215
  - lib/generators/push_type/taxonomy/USAGE
214
216
  - lib/generators/push_type/taxonomy/taxonomy_generator.rb
215
217
  - lib/generators/push_type/taxonomy/templates/taxonomy.html.erb
@@ -248,6 +250,7 @@ files:
248
250
  - test/dummy/app/controllers/application_controller.rb
249
251
  - test/dummy/app/helpers/application_helper.rb
250
252
  - test/dummy/app/models/category.rb
253
+ - test/dummy/app/models/location.rb
251
254
  - test/dummy/app/models/page.rb
252
255
  - test/dummy/app/views/layouts/application.html.erb
253
256
  - test/dummy/app/views/nodes/page.html.erb
@@ -276,13 +279,13 @@ files:
276
279
  - test/dummy/config/locales/en.yml
277
280
  - test/dummy/config/routes.rb
278
281
  - test/dummy/config/secrets.yml
279
- - test/dummy/db/migrate/20151102165837_create_push_type_users.push_type.rb
280
- - test/dummy/db/migrate/20151102165838_create_push_type_nodes.push_type.rb
281
- - test/dummy/db/migrate/20151102165839_create_push_type_node_hierarchies.push_type.rb
282
- - test/dummy/db/migrate/20151102165840_create_push_type_assets.push_type.rb
283
- - test/dummy/db/migrate/20151102165841_create_push_type_taxonomies.push_type.rb
284
- - test/dummy/db/migrate/20151102165842_create_push_type_taxonomy_hierarchies.push_type.rb
285
- - test/dummy/db/migrate/20151102165843_add_field_store_default_values.push_type.rb
282
+ - test/dummy/db/migrate/20151102202715_create_push_type_users.push_type.rb
283
+ - test/dummy/db/migrate/20151102202716_create_push_type_nodes.push_type.rb
284
+ - test/dummy/db/migrate/20151102202717_create_push_type_node_hierarchies.push_type.rb
285
+ - test/dummy/db/migrate/20151102202718_create_push_type_assets.push_type.rb
286
+ - test/dummy/db/migrate/20151102202719_create_push_type_taxonomies.push_type.rb
287
+ - test/dummy/db/migrate/20151102202720_create_push_type_taxonomy_hierarchies.push_type.rb
288
+ - test/dummy/db/migrate/20151102202721_add_field_store_default_values.push_type.rb
286
289
  - test/dummy/db/schema.rb
287
290
  - test/dummy/db/seeds.rb
288
291
  - test/dummy/log/test.log
@@ -294,13 +297,12 @@ files:
294
297
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/0ANSDcZJu9gPyqtYPIW729qm1kriQ29Vn9LU8T2SGQU.cache
295
298
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/3T6ioyhwSsEzte_a9viHBvfmuKgORQ019srIEoUYkVs.cache
296
299
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache
300
+ - test/dummy/tmp/cache/assets/test/sprockets/v3.0/6jsgv3ntDkti59be5oRYC_iAKKBc6jXnUhiRtR5B3mY.cache
301
+ - test/dummy/tmp/cache/assets/test/sprockets/v3.0/Am5-YNurKjuaBZepBbaF-WarxmMoFaQFl7aXtNOYO7w.cache
297
302
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/IYzwMwq7DWWSuojH6oXsrP__pcD7O8TQieMFSzQiwnc.cache
298
303
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache
299
304
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/_d65qW7wxRtKVSYpmfSenECz5QUWVI9pppUgV7TA1Rk.cache
300
- - test/dummy/tmp/cache/assets/test/sprockets/v3.0/aTa2i4fIuP1rB3Te3BmhxVW3c0wwyYQtTIQW710wrm0.cache
301
- - test/dummy/tmp/cache/assets/test/sprockets/v3.0/idBOP3HLwMKqIi2fmJ86l7s0AJCQq-p3JBAe01H630c.cache
302
- - test/dummy/tmp/generators/app/models/category.rb
303
- - test/dummy/tmp/generators/app/views/taxonomies/category.html.erb
305
+ - test/dummy/tmp/generators/app/fields/rich_text_field.rb
304
306
  - test/fields/push_type/asset_field_test.rb
305
307
  - test/fields/push_type/date_field_test.rb
306
308
  - test/fields/push_type/markdown_field_test.rb
@@ -324,6 +326,7 @@ files:
324
326
  - test/lib/generators/push_type/install_generator_test.rb
325
327
  - test/lib/generators/push_type/node_generator_test.rb
326
328
  - test/lib/generators/push_type/presenter_generator_test.rb
329
+ - test/lib/generators/push_type/structure_generator_test.rb
327
330
  - test/lib/generators/push_type/taxonomy_generator_test.rb
328
331
  - test/lib/push_type/core_test.rb
329
332
  - test/lib/push_type/field_type_test.rb
@@ -378,6 +381,7 @@ test_files:
378
381
  - test/dummy/app/controllers/application_controller.rb
379
382
  - test/dummy/app/helpers/application_helper.rb
380
383
  - test/dummy/app/models/category.rb
384
+ - test/dummy/app/models/location.rb
381
385
  - test/dummy/app/models/page.rb
382
386
  - test/dummy/app/views/layouts/application.html.erb
383
387
  - test/dummy/app/views/nodes/page.html.erb
@@ -406,13 +410,13 @@ test_files:
406
410
  - test/dummy/config/routes.rb
407
411
  - test/dummy/config/secrets.yml
408
412
  - test/dummy/config.ru
409
- - test/dummy/db/migrate/20151102165837_create_push_type_users.push_type.rb
410
- - test/dummy/db/migrate/20151102165838_create_push_type_nodes.push_type.rb
411
- - test/dummy/db/migrate/20151102165839_create_push_type_node_hierarchies.push_type.rb
412
- - test/dummy/db/migrate/20151102165840_create_push_type_assets.push_type.rb
413
- - test/dummy/db/migrate/20151102165841_create_push_type_taxonomies.push_type.rb
414
- - test/dummy/db/migrate/20151102165842_create_push_type_taxonomy_hierarchies.push_type.rb
415
- - test/dummy/db/migrate/20151102165843_add_field_store_default_values.push_type.rb
413
+ - test/dummy/db/migrate/20151102202715_create_push_type_users.push_type.rb
414
+ - test/dummy/db/migrate/20151102202716_create_push_type_nodes.push_type.rb
415
+ - test/dummy/db/migrate/20151102202717_create_push_type_node_hierarchies.push_type.rb
416
+ - test/dummy/db/migrate/20151102202718_create_push_type_assets.push_type.rb
417
+ - test/dummy/db/migrate/20151102202719_create_push_type_taxonomies.push_type.rb
418
+ - test/dummy/db/migrate/20151102202720_create_push_type_taxonomy_hierarchies.push_type.rb
419
+ - test/dummy/db/migrate/20151102202721_add_field_store_default_values.push_type.rb
416
420
  - test/dummy/db/schema.rb
417
421
  - test/dummy/db/seeds.rb
418
422
  - test/dummy/log/test.log
@@ -426,13 +430,12 @@ test_files:
426
430
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/0ANSDcZJu9gPyqtYPIW729qm1kriQ29Vn9LU8T2SGQU.cache
427
431
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/3T6ioyhwSsEzte_a9viHBvfmuKgORQ019srIEoUYkVs.cache
428
432
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache
433
+ - test/dummy/tmp/cache/assets/test/sprockets/v3.0/6jsgv3ntDkti59be5oRYC_iAKKBc6jXnUhiRtR5B3mY.cache
429
434
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/_d65qW7wxRtKVSYpmfSenECz5QUWVI9pppUgV7TA1Rk.cache
430
- - test/dummy/tmp/cache/assets/test/sprockets/v3.0/aTa2i4fIuP1rB3Te3BmhxVW3c0wwyYQtTIQW710wrm0.cache
431
- - test/dummy/tmp/cache/assets/test/sprockets/v3.0/idBOP3HLwMKqIi2fmJ86l7s0AJCQq-p3JBAe01H630c.cache
435
+ - test/dummy/tmp/cache/assets/test/sprockets/v3.0/Am5-YNurKjuaBZepBbaF-WarxmMoFaQFl7aXtNOYO7w.cache
432
436
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/IYzwMwq7DWWSuojH6oXsrP__pcD7O8TQieMFSzQiwnc.cache
433
437
  - test/dummy/tmp/cache/assets/test/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache
434
- - test/dummy/tmp/generators/app/models/category.rb
435
- - test/dummy/tmp/generators/app/views/taxonomies/category.html.erb
438
+ - test/dummy/tmp/generators/app/fields/rich_text_field.rb
436
439
  - test/fields/push_type/asset_field_test.rb
437
440
  - test/fields/push_type/date_field_test.rb
438
441
  - test/fields/push_type/markdown_field_test.rb
@@ -456,6 +459,7 @@ test_files:
456
459
  - test/lib/generators/push_type/install_generator_test.rb
457
460
  - test/lib/generators/push_type/node_generator_test.rb
458
461
  - test/lib/generators/push_type/presenter_generator_test.rb
462
+ - test/lib/generators/push_type/structure_generator_test.rb
459
463
  - test/lib/generators/push_type/taxonomy_generator_test.rb
460
464
  - test/lib/push_type/core_test.rb
461
465
  - test/lib/push_type/field_type_test.rb
@@ -1,6 +0,0 @@
1
- class Page < PushType::Node
2
-
3
- field :description
4
- field :body, :text, validates: { presence: true }
5
-
6
- end
@@ -1,7 +0,0 @@
1
- class Category < PushType::Taxonomy
2
-
3
- # The default prefix for a taxonomy term's permalink can be
4
- # overridden be setting the base slug.
5
- # base_slug :category
6
-
7
- end
@@ -1,3 +0,0 @@
1
- <h1><%= @taxonomy.title %></h1>
2
- <p>This is a generated Category template.</p>
3
- <p>Find me at: app/views/taxonomies/category.html.erb</p>