spontaneous 0.2.0.alpha7 → 0.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -4
- data/Readme.markdown +1 -1
- data/application/css/definitions.css.scss +5 -0
- data/application/css/dialogue.css.scss +62 -0
- data/application/js/content.js +1 -1
- data/application/js/dom.js +1 -1
- data/application/js/event_source.js +3 -0
- data/application/js/{field_types/date_field.js → field/date.js} +2 -2
- data/application/js/{field_types/file_field.js → field/file.js} +2 -2
- data/application/js/{field_types/image_field.js → field/image.js} +54 -20
- data/application/js/{field_types/long_string_field.js → field/long_string.js} +2 -2
- data/application/js/{field_types/markdown_field.js → field/markdown.js} +2 -2
- data/application/js/{field_types/select_field.js → field/select.js} +2 -2
- data/application/js/{field_types/string_field.js → field/string.js} +21 -7
- data/application/js/{field_types/webvideo_field.js → field/webvideo.js} +2 -2
- data/application/js/field.js +2 -2
- data/application/js/publish.js +99 -19
- data/application/js/spontaneous.js +8 -8
- data/application/js/top_bar.js +6 -4
- data/db/migrations/20130109125023_add_page_publish_lock.rb +17 -0
- data/db/migrations/20130111161934_convert_bcrypt_passwords.rb +22 -0
- data/db/migrations/20130114120000_create_revision_tables.rb +106 -0
- data/db/migrations/20130116220423_add_index_to_archive.rb +9 -0
- data/lib/spontaneous/box.rb +53 -18
- data/lib/spontaneous/box_style.rb +2 -3
- data/lib/spontaneous/change.rb +39 -13
- data/lib/spontaneous/cli/fields.rb +29 -0
- data/lib/spontaneous/cli/init.rb +2 -2
- data/lib/spontaneous/cli/migrate.rb +0 -1
- data/lib/spontaneous/cli/server.rb +14 -10
- data/lib/spontaneous/cli/site.rb +20 -9
- data/lib/spontaneous/cli.rb +8 -6
- data/lib/spontaneous/collections/box_set.rb +11 -0
- data/lib/spontaneous/collections/field_set.rb +24 -1
- data/lib/spontaneous/concern.rb +37 -0
- data/lib/spontaneous/config.rb +3 -4
- data/lib/spontaneous/crypt/version.rb +130 -0
- data/lib/spontaneous/crypt.rb +84 -0
- data/lib/spontaneous/data_mapper/content_model/associations.rb +199 -0
- data/lib/spontaneous/data_mapper/content_model/column_accessors.rb +52 -0
- data/lib/spontaneous/data_mapper/content_model/instance_hooks.rb +34 -0
- data/lib/spontaneous/data_mapper/content_model/serialization.rb +54 -0
- data/lib/spontaneous/data_mapper/content_model/timestamps.rb +39 -0
- data/lib/spontaneous/data_mapper/content_model.rb +343 -0
- data/lib/spontaneous/data_mapper/content_table.rb +103 -0
- data/lib/spontaneous/data_mapper/dataset.rb +194 -0
- data/lib/spontaneous/data_mapper/scope.rb +195 -0
- data/lib/spontaneous/data_mapper.rb +161 -0
- data/lib/spontaneous/facet.rb +2 -2
- data/lib/spontaneous/field/base.rb +418 -0
- data/lib/spontaneous/field/date.rb +54 -0
- data/lib/spontaneous/{field_version.rb → field/field_version.rb} +1 -1
- data/lib/spontaneous/field/file.rb +100 -0
- data/lib/spontaneous/{field_types/image_field.rb → field/image.rb} +33 -33
- data/lib/spontaneous/{field_types/location_field.rb → field/location.rb} +2 -2
- data/lib/spontaneous/{field_types/long_string_field.rb → field/long_string.rb} +3 -3
- data/lib/spontaneous/field/markdown.rb +36 -0
- data/lib/spontaneous/{field_types/select_field.rb → field/select.rb} +4 -5
- data/lib/spontaneous/field/string.rb +17 -0
- data/lib/spontaneous/field/update.rb +156 -0
- data/lib/spontaneous/field/webvideo.rb +310 -0
- data/lib/spontaneous/field.rb +80 -0
- data/lib/spontaneous/generators/site/Gemfile.tt +2 -2
- data/lib/spontaneous/generators/site/config/environments/development.rb.tt +1 -1
- data/lib/spontaneous/generators/site/config/environments/production.rb.tt +1 -1
- data/lib/spontaneous/generators/site/lib/content.rb.tt +6 -0
- data/lib/spontaneous/generators/site/schema/box.rb.tt +3 -2
- data/lib/spontaneous/generators/site/schema/page.rb.tt +3 -1
- data/lib/spontaneous/generators/site/schema/piece.rb.tt +3 -1
- data/lib/spontaneous/generators/site/templates/layouts/standard.html.cut.tt +3 -1
- data/lib/spontaneous/generators/site.rb +4 -3
- data/lib/spontaneous/image_size.rb +8 -1
- data/lib/spontaneous/layout.rb +5 -1
- data/lib/spontaneous/loader.rb +2 -5
- data/lib/spontaneous/media/file.rb +11 -2
- data/lib/spontaneous/media/temp_file.rb +23 -0
- data/lib/spontaneous/media.rb +20 -39
- data/lib/spontaneous/{plugins → model/box}/allowed_types.rb +38 -17
- data/lib/spontaneous/model/box.rb +18 -0
- data/lib/spontaneous/{plugins → model/core}/aliases.rb +10 -14
- data/lib/spontaneous/{plugins → model/core}/boxes.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/content_groups.rb +2 -2
- data/lib/spontaneous/model/core/editor_class.rb +4 -0
- data/lib/spontaneous/{plugins → model/core}/entries.rb +19 -7
- data/lib/spontaneous/{plugins → model/core}/entry.rb +3 -3
- data/lib/spontaneous/{plugins → model/core}/fields.rb +38 -5
- data/lib/spontaneous/{plugins → model/core}/instance_code.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/media.rb +2 -12
- data/lib/spontaneous/{plugins → model/core}/modifications.rb +7 -6
- data/lib/spontaneous/model/core/page_search.rb +36 -0
- data/lib/spontaneous/{plugins → model/core}/permissions.rb +4 -4
- data/lib/spontaneous/{plugins → model/core}/prototypes.rb +4 -4
- data/lib/spontaneous/{plugins → model/core}/publishing.rb +93 -115
- data/lib/spontaneous/{plugins → model/core}/render.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/schema_hierarchy.rb +7 -11
- data/lib/spontaneous/model/core/schema_id.rb +65 -0
- data/lib/spontaneous/{plugins → model/core}/schema_title.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/serialisation.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/styles.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/supertype.rb +2 -2
- data/lib/spontaneous/{plugins → model/core}/visibility.rb +7 -48
- data/lib/spontaneous/model/core.rb +143 -0
- data/lib/spontaneous/{plugins → model/page}/controllers.rb +3 -3
- data/lib/spontaneous/{plugins → model}/page/formats.rb +2 -2
- data/lib/spontaneous/{plugins → model/page}/layouts.rb +2 -2
- data/lib/spontaneous/model/page/locks.rb +14 -0
- data/lib/spontaneous/{plugins → model/page}/page_tree.rb +3 -3
- data/lib/spontaneous/{plugins → model/page}/paths.rb +30 -12
- data/lib/spontaneous/{plugins → model}/page/request.rb +2 -2
- data/lib/spontaneous/{plugins → model/page}/site_map.rb +2 -2
- data/lib/spontaneous/model/page/site_timestamps.rb +44 -0
- data/lib/spontaneous/{page.rb → model/page.rb} +49 -28
- data/lib/spontaneous/{piece.rb → model/piece.rb} +7 -6
- data/lib/spontaneous/model.rb +97 -0
- data/lib/spontaneous/output/context.rb +1 -1
- data/lib/spontaneous/output/format.rb +4 -0
- data/lib/spontaneous/output/template/renderer.rb +2 -2
- data/lib/spontaneous/output.rb +2 -2
- data/lib/spontaneous/page_lock.rb +62 -0
- data/lib/spontaneous/page_piece.rb +1 -1
- data/lib/spontaneous/permissions/access_key.rb +9 -4
- data/lib/spontaneous/permissions/user.rb +19 -9
- data/lib/spontaneous/permissions.rb +2 -5
- data/lib/spontaneous/plugins/application/facets.rb +1 -2
- data/lib/spontaneous/plugins/application/features.rb +1 -1
- data/lib/spontaneous/plugins/application/paths.rb +1 -1
- data/lib/spontaneous/plugins/application/render.rb +1 -1
- data/lib/spontaneous/plugins/application/serialisation.rb +1 -1
- data/lib/spontaneous/plugins/application/state.rb +30 -1
- data/lib/spontaneous/plugins/application/system.rb +12 -12
- data/lib/spontaneous/prototypes/box_prototype.rb +1 -1
- data/lib/spontaneous/prototypes/field_prototype.rb +3 -6
- data/lib/spontaneous/prototypes/style_prototype.rb +1 -1
- data/lib/spontaneous/publishing/immediate.rb +77 -49
- data/lib/spontaneous/publishing/revision.rb +355 -0
- data/lib/spontaneous/publishing/simultaneous.rb +10 -49
- data/lib/spontaneous/publishing.rb +1 -0
- data/lib/spontaneous/rack/around_back.rb +1 -1
- data/lib/spontaneous/rack/around_front.rb +2 -4
- data/lib/spontaneous/rack/around_preview.rb +1 -1
- data/lib/spontaneous/rack/back.rb +80 -63
- data/lib/spontaneous/rack/cacheable_file.rb +2 -2
- data/lib/spontaneous/rack/cookie_authentication.rb +1 -1
- data/lib/spontaneous/rack/front.rb +1 -1
- data/lib/spontaneous/rack/helpers.rb +8 -9
- data/lib/spontaneous/{page_controller.rb → rack/page_controller.rb} +1 -1
- data/lib/spontaneous/rack/public.rb +3 -3
- data/lib/spontaneous/rack.rb +15 -15
- data/lib/spontaneous/schema/uid.rb +4 -1
- data/lib/spontaneous/schema.rb +57 -24
- data/lib/spontaneous/search/database.rb +12 -1
- data/lib/spontaneous/search/index.rb +34 -6
- data/lib/spontaneous/search/results.rb +1 -1
- data/lib/spontaneous/server.rb +3 -3
- data/lib/spontaneous/simultaneous.rb +53 -0
- data/lib/spontaneous/{plugins/site → site}/features.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/helpers.rb +2 -3
- data/lib/spontaneous/{plugins/site → site}/hooks.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/instance.rb +4 -6
- data/lib/spontaneous/{plugins/site → site}/level.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/map.rb +4 -4
- data/lib/spontaneous/{plugins/site → site}/paths.rb +2 -2
- data/lib/spontaneous/site/publishing.rb +89 -0
- data/lib/spontaneous/{plugins/site → site}/schema.rb +4 -4
- data/lib/spontaneous/{plugins/site → site}/search.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/selectors.rb +15 -7
- data/lib/spontaneous/{plugins/site → site}/state.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/storage.rb +2 -2
- data/lib/spontaneous/{plugins/site → site}/url.rb +2 -2
- data/lib/spontaneous/site.rb +31 -14
- data/lib/spontaneous/state.rb +5 -6
- data/lib/spontaneous/style.rb +3 -2
- data/lib/spontaneous/utils/database/mysql_dumper.rb +13 -0
- data/lib/spontaneous/utils/database/postgres_dumper.rb +5 -0
- data/lib/spontaneous/version.rb +1 -1
- data/lib/spontaneous.rb +34 -89
- data/spontaneous.gemspec +112 -114
- data/test/experimental/test_crypt.rb +158 -0
- data/test/experimental/test_features.rb +3 -3
- data/test/fixtures/example_application/config/environments/development.rb +1 -1
- data/test/fixtures/example_application/lib/content.rb +5 -0
- data/test/fixtures/example_application/schema/page.rb +2 -1
- data/test/fixtures/example_application/schema/piece.rb +3 -2
- data/test/fixtures/serialisation/class_hash.yaml.erb +5 -5
- data/test/fixtures/serialisation/root_hash.yaml.erb +8 -0
- data/test/functional/test_application.rb +12 -1
- data/test/functional/test_back.rb +80 -48
- data/test/functional/test_front.rb +39 -46
- data/test/functional/test_user_manager.rb +3 -9
- data/test/javascript/test_markdown.rb +2 -2
- data/test/test_helper.rb +78 -23
- data/test/unit/test_alias.rb +21 -15
- data/test/unit/test_asset_bundler.rb +3 -3
- data/test/unit/test_assets.rb +2 -2
- data/test/unit/test_async.rb +7 -6
- data/test/unit/test_authentication.rb +43 -37
- data/test/unit/test_boxes.rb +46 -21
- data/test/unit/test_changesets.rb +65 -20
- data/test/unit/test_config.rb +9 -9
- data/test/unit/test_content.rb +50 -51
- data/test/unit/test_content_inheritance.rb +6 -20
- data/test/unit/test_datamapper.rb +1330 -0
- data/test/unit/test_datamapper_content.rb +214 -0
- data/test/unit/test_fields.rb +543 -54
- data/test/unit/test_formats.rb +2 -3
- data/test/unit/test_generators.rb +6 -6
- data/test/unit/test_helpers.rb +1 -1
- data/test/unit/test_image_size.rb +10 -5
- data/test/unit/test_images.rb +17 -18
- data/test/unit/test_layouts.rb +18 -3
- data/test/unit/test_media.rb +74 -49
- data/test/unit/test_modifications.rb +43 -43
- data/test/unit/test_page.rb +7 -10
- data/test/unit/test_permissions.rb +3 -10
- data/test/unit/test_piece.rb +5 -6
- data/test/unit/test_plugins.rb +7 -14
- data/test/unit/test_prototypes.rb +3 -3
- data/test/unit/test_publishing.rb +49 -27
- data/test/unit/test_render.rb +46 -15
- data/test/unit/test_revisions.rb +124 -127
- data/test/unit/test_schema.rb +53 -58
- data/test/unit/test_search.rb +64 -16
- data/test/unit/test_serialisation.rb +4 -11
- data/test/unit/test_site.rb +11 -12
- data/test/unit/test_structure.rb +2 -5
- data/test/unit/test_styles.rb +22 -24
- data/test/unit/test_type_hierarchy.rb +7 -5
- data/test/unit/test_visibility.rb +79 -55
- metadata +128 -102
- data/lib/sequel/plugins/content_table_inheritance.rb +0 -203
- data/lib/sequel/plugins/scoped_table_name.rb +0 -54
- data/lib/spontaneous/content.rb +0 -129
- data/lib/spontaneous/field_types/date_field.rb +0 -56
- data/lib/spontaneous/field_types/field.rb +0 -302
- data/lib/spontaneous/field_types/file_field.rb +0 -68
- data/lib/spontaneous/field_types/markdown_field.rb +0 -38
- data/lib/spontaneous/field_types/string_field.rb +0 -19
- data/lib/spontaneous/field_types/webvideo_field.rb +0 -313
- data/lib/spontaneous/field_types.rb +0 -38
- data/lib/spontaneous/generators/site/lib/site.rb.tt +0 -4
- data/lib/spontaneous/plugins/field/editor_class.rb +0 -13
- data/lib/spontaneous/plugins/page/site_timestamps.rb +0 -28
- data/lib/spontaneous/plugins/page_search.rb +0 -63
- data/lib/spontaneous/plugins/schema_id.rb +0 -68
- data/lib/spontaneous/plugins/site/publishing.rb +0 -75
- data/lib/spontaneous/rack/fiber_pool.rb +0 -26
- data/test/unit/test_table_scoping.rb +0 -80
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spontaneous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.beta1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.1.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bcrypt-ruby
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.0.1
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.1
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: bundler
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,7 +240,7 @@ dependencies:
|
|
224
240
|
requirement: !ruby/object:Gem::Requirement
|
225
241
|
none: false
|
226
242
|
requirements:
|
227
|
-
- -
|
243
|
+
- - '='
|
228
244
|
- !ruby/object:Gem::Version
|
229
245
|
version: 1.4.1
|
230
246
|
type: :runtime
|
@@ -232,25 +248,9 @@ dependencies:
|
|
232
248
|
version_requirements: !ruby/object:Gem::Requirement
|
233
249
|
none: false
|
234
250
|
requirements:
|
235
|
-
- -
|
251
|
+
- - '='
|
236
252
|
- !ruby/object:Gem::Version
|
237
253
|
version: 1.4.1
|
238
|
-
- !ruby/object:Gem::Dependency
|
239
|
-
name: rack-fiber_pool
|
240
|
-
requirement: !ruby/object:Gem::Requirement
|
241
|
-
none: false
|
242
|
-
requirements:
|
243
|
-
- - ~>
|
244
|
-
- !ruby/object:Gem::Version
|
245
|
-
version: 0.9.2
|
246
|
-
type: :runtime
|
247
|
-
prerelease: false
|
248
|
-
version_requirements: !ruby/object:Gem::Requirement
|
249
|
-
none: false
|
250
|
-
requirements:
|
251
|
-
- - ~>
|
252
|
-
- !ruby/object:Gem::Version
|
253
|
-
version: 0.9.2
|
254
254
|
- !ruby/object:Gem::Dependency
|
255
255
|
name: rake
|
256
256
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,17 +304,17 @@ dependencies:
|
|
304
304
|
requirement: !ruby/object:Gem::Requirement
|
305
305
|
none: false
|
306
306
|
requirements:
|
307
|
-
- -
|
307
|
+
- - ~>
|
308
308
|
- !ruby/object:Gem::Version
|
309
|
-
version: 3.
|
309
|
+
version: 3.43.0
|
310
310
|
type: :runtime
|
311
311
|
prerelease: false
|
312
312
|
version_requirements: !ruby/object:Gem::Requirement
|
313
313
|
none: false
|
314
314
|
requirements:
|
315
|
-
- -
|
315
|
+
- - ~>
|
316
316
|
- !ruby/object:Gem::Version
|
317
|
-
version: 3.
|
317
|
+
version: 3.43.0
|
318
318
|
- !ruby/object:Gem::Dependency
|
319
319
|
name: shine
|
320
320
|
requirement: !ruby/object:Gem::Requirement
|
@@ -338,7 +338,7 @@ dependencies:
|
|
338
338
|
requirements:
|
339
339
|
- - ~>
|
340
340
|
- !ruby/object:Gem::Version
|
341
|
-
version: 0.4.
|
341
|
+
version: 0.4.2
|
342
342
|
type: :runtime
|
343
343
|
prerelease: false
|
344
344
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -346,7 +346,7 @@ dependencies:
|
|
346
346
|
requirements:
|
347
347
|
- - ~>
|
348
348
|
- !ruby/object:Gem::Version
|
349
|
-
version: 0.4.
|
349
|
+
version: 0.4.2
|
350
350
|
- !ruby/object:Gem::Dependency
|
351
351
|
name: sinatra
|
352
352
|
requirement: !ruby/object:Gem::Requirement
|
@@ -727,15 +727,15 @@ files:
|
|
727
727
|
- application/js/event_source.js
|
728
728
|
- application/js/extensions.js
|
729
729
|
- application/js/field.js
|
730
|
+
- application/js/field/date.js
|
731
|
+
- application/js/field/file.js
|
732
|
+
- application/js/field/image.js
|
733
|
+
- application/js/field/long_string.js
|
734
|
+
- application/js/field/markdown.js
|
735
|
+
- application/js/field/select.js
|
736
|
+
- application/js/field/string.js
|
737
|
+
- application/js/field/webvideo.js
|
730
738
|
- application/js/field_preview.js
|
731
|
-
- application/js/field_types/date_field.js
|
732
|
-
- application/js/field_types/file_field.js
|
733
|
-
- application/js/field_types/image_field.js
|
734
|
-
- application/js/field_types/long_string_field.js
|
735
|
-
- application/js/field_types/markdown_field.js
|
736
|
-
- application/js/field_types/select_field.js
|
737
|
-
- application/js/field_types/string_field.js
|
738
|
-
- application/js/field_types/webvideo_field.js
|
739
739
|
- application/js/image.js
|
740
740
|
- application/js/init.js
|
741
741
|
- application/js/load.js
|
@@ -847,9 +847,11 @@ files:
|
|
847
847
|
- db/migrations/20120418153903_add_ownership_of_content.rb
|
848
848
|
- db/migrations/20120423175416_add_pending_modifications.rb
|
849
849
|
- db/migrations/20120525164947_add_field_versions.rb
|
850
|
+
- db/migrations/20130109125023_add_page_publish_lock.rb
|
851
|
+
- db/migrations/20130111161934_convert_bcrypt_passwords.rb
|
852
|
+
- db/migrations/20130114120000_create_revision_tables.rb
|
853
|
+
- db/migrations/20130116220423_add_index_to_archive.rb
|
850
854
|
- docs/recipe-interface-screenshot.png
|
851
|
-
- lib/sequel/plugins/content_table_inheritance.rb
|
852
|
-
- lib/sequel/plugins/scoped_table_name.rb
|
853
855
|
- lib/spontaneous.rb
|
854
856
|
- lib/spontaneous/application.rb
|
855
857
|
- lib/spontaneous/application/feature.rb
|
@@ -866,6 +868,7 @@ files:
|
|
866
868
|
- lib/spontaneous/cli.rb
|
867
869
|
- lib/spontaneous/cli/assets.rb
|
868
870
|
- lib/spontaneous/cli/console.rb
|
871
|
+
- lib/spontaneous/cli/fields.rb
|
869
872
|
- lib/spontaneous/cli/generate.rb
|
870
873
|
- lib/spontaneous/cli/init.rb
|
871
874
|
- lib/spontaneous/cli/media.rb
|
@@ -880,10 +883,22 @@ files:
|
|
880
883
|
- lib/spontaneous/collections/field_set.rb
|
881
884
|
- lib/spontaneous/collections/prototype_set.rb
|
882
885
|
- lib/spontaneous/collections/style_set.rb
|
886
|
+
- lib/spontaneous/concern.rb
|
883
887
|
- lib/spontaneous/config.rb
|
884
888
|
- lib/spontaneous/constants.rb
|
885
|
-
- lib/spontaneous/content.rb
|
886
889
|
- lib/spontaneous/content_query.rb
|
890
|
+
- lib/spontaneous/crypt.rb
|
891
|
+
- lib/spontaneous/crypt/version.rb
|
892
|
+
- lib/spontaneous/data_mapper.rb
|
893
|
+
- lib/spontaneous/data_mapper/content_model.rb
|
894
|
+
- lib/spontaneous/data_mapper/content_model/associations.rb
|
895
|
+
- lib/spontaneous/data_mapper/content_model/column_accessors.rb
|
896
|
+
- lib/spontaneous/data_mapper/content_model/instance_hooks.rb
|
897
|
+
- lib/spontaneous/data_mapper/content_model/serialization.rb
|
898
|
+
- lib/spontaneous/data_mapper/content_model/timestamps.rb
|
899
|
+
- lib/spontaneous/data_mapper/content_table.rb
|
900
|
+
- lib/spontaneous/data_mapper/dataset.rb
|
901
|
+
- lib/spontaneous/data_mapper/scope.rb
|
887
902
|
- lib/spontaneous/errors.rb
|
888
903
|
- lib/spontaneous/extensions/array.rb
|
889
904
|
- lib/spontaneous/extensions/class.rb
|
@@ -896,18 +911,19 @@ files:
|
|
896
911
|
- lib/spontaneous/extensions/object_space.rb
|
897
912
|
- lib/spontaneous/extensions/string.rb
|
898
913
|
- lib/spontaneous/facet.rb
|
899
|
-
- lib/spontaneous/
|
900
|
-
- lib/spontaneous/
|
901
|
-
- lib/spontaneous/
|
902
|
-
- lib/spontaneous/
|
903
|
-
- lib/spontaneous/
|
904
|
-
- lib/spontaneous/
|
905
|
-
- lib/spontaneous/
|
906
|
-
- lib/spontaneous/
|
907
|
-
- lib/spontaneous/
|
908
|
-
- lib/spontaneous/
|
909
|
-
- lib/spontaneous/
|
910
|
-
- lib/spontaneous/
|
914
|
+
- lib/spontaneous/field.rb
|
915
|
+
- lib/spontaneous/field/base.rb
|
916
|
+
- lib/spontaneous/field/date.rb
|
917
|
+
- lib/spontaneous/field/field_version.rb
|
918
|
+
- lib/spontaneous/field/file.rb
|
919
|
+
- lib/spontaneous/field/image.rb
|
920
|
+
- lib/spontaneous/field/location.rb
|
921
|
+
- lib/spontaneous/field/long_string.rb
|
922
|
+
- lib/spontaneous/field/markdown.rb
|
923
|
+
- lib/spontaneous/field/select.rb
|
924
|
+
- lib/spontaneous/field/string.rb
|
925
|
+
- lib/spontaneous/field/update.rb
|
926
|
+
- lib/spontaneous/field/webvideo.rb
|
911
927
|
- lib/spontaneous/generators.rb
|
912
928
|
- lib/spontaneous/generators/page.rb
|
913
929
|
- lib/spontaneous/generators/page/inline.html.cut
|
@@ -929,7 +945,7 @@ files:
|
|
929
945
|
- lib/spontaneous/generators/site/config/indexes.rb.tt
|
930
946
|
- lib/spontaneous/generators/site/config/schema.yml
|
931
947
|
- lib/spontaneous/generators/site/config/user_levels.yml
|
932
|
-
- lib/spontaneous/generators/site/lib/
|
948
|
+
- lib/spontaneous/generators/site/lib/content.rb.tt
|
933
949
|
- lib/spontaneous/generators/site/lib/tasks/site.rake.tt
|
934
950
|
- lib/spontaneous/generators/site/public/css/site.scss
|
935
951
|
- lib/spontaneous/generators/site/public/favicon.ico
|
@@ -948,6 +964,44 @@ files:
|
|
948
964
|
- lib/spontaneous/logger.rb
|
949
965
|
- lib/spontaneous/media.rb
|
950
966
|
- lib/spontaneous/media/file.rb
|
967
|
+
- lib/spontaneous/media/temp_file.rb
|
968
|
+
- lib/spontaneous/model.rb
|
969
|
+
- lib/spontaneous/model/box.rb
|
970
|
+
- lib/spontaneous/model/box/allowed_types.rb
|
971
|
+
- lib/spontaneous/model/core.rb
|
972
|
+
- lib/spontaneous/model/core/aliases.rb
|
973
|
+
- lib/spontaneous/model/core/boxes.rb
|
974
|
+
- lib/spontaneous/model/core/content_groups.rb
|
975
|
+
- lib/spontaneous/model/core/editor_class.rb
|
976
|
+
- lib/spontaneous/model/core/entries.rb
|
977
|
+
- lib/spontaneous/model/core/entry.rb
|
978
|
+
- lib/spontaneous/model/core/fields.rb
|
979
|
+
- lib/spontaneous/model/core/instance_code.rb
|
980
|
+
- lib/spontaneous/model/core/media.rb
|
981
|
+
- lib/spontaneous/model/core/modifications.rb
|
982
|
+
- lib/spontaneous/model/core/page_search.rb
|
983
|
+
- lib/spontaneous/model/core/permissions.rb
|
984
|
+
- lib/spontaneous/model/core/prototypes.rb
|
985
|
+
- lib/spontaneous/model/core/publishing.rb
|
986
|
+
- lib/spontaneous/model/core/render.rb
|
987
|
+
- lib/spontaneous/model/core/schema_hierarchy.rb
|
988
|
+
- lib/spontaneous/model/core/schema_id.rb
|
989
|
+
- lib/spontaneous/model/core/schema_title.rb
|
990
|
+
- lib/spontaneous/model/core/serialisation.rb
|
991
|
+
- lib/spontaneous/model/core/styles.rb
|
992
|
+
- lib/spontaneous/model/core/supertype.rb
|
993
|
+
- lib/spontaneous/model/core/visibility.rb
|
994
|
+
- lib/spontaneous/model/page.rb
|
995
|
+
- lib/spontaneous/model/page/controllers.rb
|
996
|
+
- lib/spontaneous/model/page/formats.rb
|
997
|
+
- lib/spontaneous/model/page/layouts.rb
|
998
|
+
- lib/spontaneous/model/page/locks.rb
|
999
|
+
- lib/spontaneous/model/page/page_tree.rb
|
1000
|
+
- lib/spontaneous/model/page/paths.rb
|
1001
|
+
- lib/spontaneous/model/page/request.rb
|
1002
|
+
- lib/spontaneous/model/page/site_map.rb
|
1003
|
+
- lib/spontaneous/model/page/site_timestamps.rb
|
1004
|
+
- lib/spontaneous/model/piece.rb
|
951
1005
|
- lib/spontaneous/output.rb
|
952
1006
|
- lib/spontaneous/output/assets.rb
|
953
1007
|
- lib/spontaneous/output/assets/compression.rb
|
@@ -963,8 +1017,7 @@ files:
|
|
963
1017
|
- lib/spontaneous/output/template.rb
|
964
1018
|
- lib/spontaneous/output/template/engine.rb
|
965
1019
|
- lib/spontaneous/output/template/renderer.rb
|
966
|
-
- lib/spontaneous/
|
967
|
-
- lib/spontaneous/page_controller.rb
|
1020
|
+
- lib/spontaneous/page_lock.rb
|
968
1021
|
- lib/spontaneous/page_piece.rb
|
969
1022
|
- lib/spontaneous/paths.rb
|
970
1023
|
- lib/spontaneous/permissions.rb
|
@@ -972,9 +1025,6 @@ files:
|
|
972
1025
|
- lib/spontaneous/permissions/access_key.rb
|
973
1026
|
- lib/spontaneous/permissions/user.rb
|
974
1027
|
- lib/spontaneous/permissions/user_level.rb
|
975
|
-
- lib/spontaneous/piece.rb
|
976
|
-
- lib/spontaneous/plugins/aliases.rb
|
977
|
-
- lib/spontaneous/plugins/allowed_types.rb
|
978
1028
|
- lib/spontaneous/plugins/application/facets.rb
|
979
1029
|
- lib/spontaneous/plugins/application/features.rb
|
980
1030
|
- lib/spontaneous/plugins/application/paths.rb
|
@@ -982,49 +1032,6 @@ files:
|
|
982
1032
|
- lib/spontaneous/plugins/application/serialisation.rb
|
983
1033
|
- lib/spontaneous/plugins/application/state.rb
|
984
1034
|
- lib/spontaneous/plugins/application/system.rb
|
985
|
-
- lib/spontaneous/plugins/boxes.rb
|
986
|
-
- lib/spontaneous/plugins/content_groups.rb
|
987
|
-
- lib/spontaneous/plugins/controllers.rb
|
988
|
-
- lib/spontaneous/plugins/entries.rb
|
989
|
-
- lib/spontaneous/plugins/entry.rb
|
990
|
-
- lib/spontaneous/plugins/field/editor_class.rb
|
991
|
-
- lib/spontaneous/plugins/fields.rb
|
992
|
-
- lib/spontaneous/plugins/instance_code.rb
|
993
|
-
- lib/spontaneous/plugins/layouts.rb
|
994
|
-
- lib/spontaneous/plugins/media.rb
|
995
|
-
- lib/spontaneous/plugins/modifications.rb
|
996
|
-
- lib/spontaneous/plugins/page/formats.rb
|
997
|
-
- lib/spontaneous/plugins/page/request.rb
|
998
|
-
- lib/spontaneous/plugins/page/site_timestamps.rb
|
999
|
-
- lib/spontaneous/plugins/page_search.rb
|
1000
|
-
- lib/spontaneous/plugins/page_tree.rb
|
1001
|
-
- lib/spontaneous/plugins/paths.rb
|
1002
|
-
- lib/spontaneous/plugins/permissions.rb
|
1003
|
-
- lib/spontaneous/plugins/prototypes.rb
|
1004
|
-
- lib/spontaneous/plugins/publishing.rb
|
1005
|
-
- lib/spontaneous/plugins/render.rb
|
1006
|
-
- lib/spontaneous/plugins/schema_hierarchy.rb
|
1007
|
-
- lib/spontaneous/plugins/schema_id.rb
|
1008
|
-
- lib/spontaneous/plugins/schema_title.rb
|
1009
|
-
- lib/spontaneous/plugins/serialisation.rb
|
1010
|
-
- lib/spontaneous/plugins/site/features.rb
|
1011
|
-
- lib/spontaneous/plugins/site/helpers.rb
|
1012
|
-
- lib/spontaneous/plugins/site/hooks.rb
|
1013
|
-
- lib/spontaneous/plugins/site/instance.rb
|
1014
|
-
- lib/spontaneous/plugins/site/level.rb
|
1015
|
-
- lib/spontaneous/plugins/site/map.rb
|
1016
|
-
- lib/spontaneous/plugins/site/paths.rb
|
1017
|
-
- lib/spontaneous/plugins/site/publishing.rb
|
1018
|
-
- lib/spontaneous/plugins/site/schema.rb
|
1019
|
-
- lib/spontaneous/plugins/site/search.rb
|
1020
|
-
- lib/spontaneous/plugins/site/selectors.rb
|
1021
|
-
- lib/spontaneous/plugins/site/state.rb
|
1022
|
-
- lib/spontaneous/plugins/site/storage.rb
|
1023
|
-
- lib/spontaneous/plugins/site/url.rb
|
1024
|
-
- lib/spontaneous/plugins/site_map.rb
|
1025
|
-
- lib/spontaneous/plugins/styles.rb
|
1026
|
-
- lib/spontaneous/plugins/supertype.rb
|
1027
|
-
- lib/spontaneous/plugins/visibility.rb
|
1028
1035
|
- lib/spontaneous/prototypes/box_prototype.rb
|
1029
1036
|
- lib/spontaneous/prototypes/field_prototype.rb
|
1030
1037
|
- lib/spontaneous/prototypes/layout_prototype.rb
|
@@ -1032,6 +1039,7 @@ files:
|
|
1032
1039
|
- lib/spontaneous/publishing.rb
|
1033
1040
|
- lib/spontaneous/publishing/event_client.rb
|
1034
1041
|
- lib/spontaneous/publishing/immediate.rb
|
1042
|
+
- lib/spontaneous/publishing/revision.rb
|
1035
1043
|
- lib/spontaneous/publishing/simultaneous.rb
|
1036
1044
|
- lib/spontaneous/publishing/threaded.rb
|
1037
1045
|
- lib/spontaneous/rack.rb
|
@@ -1045,12 +1053,12 @@ files:
|
|
1045
1053
|
- lib/spontaneous/rack/cookie_authentication.rb
|
1046
1054
|
- lib/spontaneous/rack/css.rb
|
1047
1055
|
- lib/spontaneous/rack/event_source.rb
|
1048
|
-
- lib/spontaneous/rack/fiber_pool.rb
|
1049
1056
|
- lib/spontaneous/rack/front.rb
|
1050
1057
|
- lib/spontaneous/rack/helpers.rb
|
1051
1058
|
- lib/spontaneous/rack/http.rb
|
1052
1059
|
- lib/spontaneous/rack/js.rb
|
1053
1060
|
- lib/spontaneous/rack/media.rb
|
1061
|
+
- lib/spontaneous/rack/page_controller.rb
|
1054
1062
|
- lib/spontaneous/rack/public.rb
|
1055
1063
|
- lib/spontaneous/rack/query_authentication.rb
|
1056
1064
|
- lib/spontaneous/rack/reloader.rb
|
@@ -1071,7 +1079,22 @@ files:
|
|
1071
1079
|
- lib/spontaneous/search/results.rb
|
1072
1080
|
- lib/spontaneous/sequel.rb
|
1073
1081
|
- lib/spontaneous/server.rb
|
1082
|
+
- lib/spontaneous/simultaneous.rb
|
1074
1083
|
- lib/spontaneous/site.rb
|
1084
|
+
- lib/spontaneous/site/features.rb
|
1085
|
+
- lib/spontaneous/site/helpers.rb
|
1086
|
+
- lib/spontaneous/site/hooks.rb
|
1087
|
+
- lib/spontaneous/site/instance.rb
|
1088
|
+
- lib/spontaneous/site/level.rb
|
1089
|
+
- lib/spontaneous/site/map.rb
|
1090
|
+
- lib/spontaneous/site/paths.rb
|
1091
|
+
- lib/spontaneous/site/publishing.rb
|
1092
|
+
- lib/spontaneous/site/schema.rb
|
1093
|
+
- lib/spontaneous/site/search.rb
|
1094
|
+
- lib/spontaneous/site/selectors.rb
|
1095
|
+
- lib/spontaneous/site/state.rb
|
1096
|
+
- lib/spontaneous/site/storage.rb
|
1097
|
+
- lib/spontaneous/site/url.rb
|
1075
1098
|
- lib/spontaneous/state.rb
|
1076
1099
|
- lib/spontaneous/storage.rb
|
1077
1100
|
- lib/spontaneous/storage/backend.rb
|
@@ -1089,6 +1112,7 @@ files:
|
|
1089
1112
|
- lib/spontaneous/version.rb
|
1090
1113
|
- spontaneous.gemspec
|
1091
1114
|
- test/disabled/test_slots.rb
|
1115
|
+
- test/experimental/test_crypt.rb
|
1092
1116
|
- test/experimental/test_features.rb
|
1093
1117
|
- test/fixtures/application/js/test.js
|
1094
1118
|
- test/fixtures/application/static/favicon.ico
|
@@ -1151,6 +1175,7 @@ files:
|
|
1151
1175
|
- test/fixtures/example_application/config/schema.yml
|
1152
1176
|
- test/fixtures/example_application/config/unicorn.rb
|
1153
1177
|
- test/fixtures/example_application/config/user_levels.yml
|
1178
|
+
- test/fixtures/example_application/lib/content.rb
|
1154
1179
|
- test/fixtures/example_application/public/css/test.css
|
1155
1180
|
- test/fixtures/example_application/public/favicon.ico
|
1156
1181
|
- test/fixtures/example_application/public/js/test.js
|
@@ -1336,6 +1361,8 @@ files:
|
|
1336
1361
|
- test/unit/test_config.rb
|
1337
1362
|
- test/unit/test_content.rb
|
1338
1363
|
- test/unit/test_content_inheritance.rb
|
1364
|
+
- test/unit/test_datamapper.rb
|
1365
|
+
- test/unit/test_datamapper_content.rb
|
1339
1366
|
- test/unit/test_extensions.rb
|
1340
1367
|
- test/unit/test_fields.rb
|
1341
1368
|
- test/unit/test_formats.rb
|
@@ -1363,11 +1390,10 @@ files:
|
|
1363
1390
|
- test/unit/test_storage.rb
|
1364
1391
|
- test/unit/test_structure.rb
|
1365
1392
|
- test/unit/test_styles.rb
|
1366
|
-
- test/unit/test_table_scoping.rb
|
1367
1393
|
- test/unit/test_templates.rb
|
1368
1394
|
- test/unit/test_type_hierarchy.rb
|
1369
1395
|
- test/unit/test_visibility.rb
|
1370
|
-
homepage: http://
|
1396
|
+
homepage: http://spontaneous.io
|
1371
1397
|
licenses: []
|
1372
1398
|
post_install_message:
|
1373
1399
|
rdoc_options:
|
@@ -1379,7 +1405,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1379
1405
|
requirements:
|
1380
1406
|
- - ! '>='
|
1381
1407
|
- !ruby/object:Gem::Version
|
1382
|
-
version: 1.9.
|
1408
|
+
version: 1.9.3
|
1383
1409
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1384
1410
|
none: false
|
1385
1411
|
requirements:
|
@@ -1,203 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Sequel
|
4
|
-
module Plugins
|
5
|
-
# The single_table_inheritance plugin allows storing all objects
|
6
|
-
# in the same class hierarchy in the same table. It makes it so
|
7
|
-
# subclasses of this model only load rows related to the subclass,
|
8
|
-
# and when you retrieve rows from the main class, you get instances
|
9
|
-
# of the subclasses (if the rows should use the subclasses's class).
|
10
|
-
#
|
11
|
-
# By default, the plugin assumes that the +sti_key+ column (the first
|
12
|
-
# argument to the plugin) holds the class name as a string. However,
|
13
|
-
# you can override this by using the <tt>:model_map</tt> option and/or
|
14
|
-
# the <tt>:key_map</tt> option.
|
15
|
-
#
|
16
|
-
# You should only load this plugin in the parent class, not in the subclasses.
|
17
|
-
#
|
18
|
-
# You shouldn't call set_dataset in the model after applying this
|
19
|
-
# plugin, otherwise subclasses might use the wrong dataset. You should
|
20
|
-
# make sure this plugin is loaded before the subclasses. Note that since you
|
21
|
-
# need to load the plugin before the subclasses are created, you can't use
|
22
|
-
# direct class references in the plugin class. You should specify subclasses
|
23
|
-
# in the plugin call using class name strings or symbols, see usage below.
|
24
|
-
#
|
25
|
-
# Usage:
|
26
|
-
#
|
27
|
-
# # Use the default of storing the class name in the sti_key
|
28
|
-
# # column (:kind in this case)
|
29
|
-
# Employee.plugin :single_table_inheritance, :kind
|
30
|
-
#
|
31
|
-
# # Using integers to store the class type, with a :model_map hash
|
32
|
-
# # and an sti_key of :type
|
33
|
-
# Employee.plugin :single_table_inheritance, :type,
|
34
|
-
# :model_map=>{1=>:Staff, 2=>:Manager}
|
35
|
-
#
|
36
|
-
# # Using non-class name strings
|
37
|
-
# Employee.plugin :single_table_inheritance, :type,
|
38
|
-
# :model_map=>{'line staff'=>:Staff, 'supervisor'=>:Manager}
|
39
|
-
#
|
40
|
-
# # Using custom procs, with :model_map taking column values
|
41
|
-
# # and yielding either a class, string, symbol, or nil,
|
42
|
-
# # and :key_map taking a class object and returning the column
|
43
|
-
# # value to use
|
44
|
-
# Employee.plugin :single_table_inheritance, :type,
|
45
|
-
# :model_map=>proc{|v| v.reverse},
|
46
|
-
# :key_map=>proc{|klass| klass.name.reverse}
|
47
|
-
#
|
48
|
-
# One minor issue to note is that if you specify the <tt>:key_map</tt>
|
49
|
-
# option as a hash, instead of having it inferred from the <tt>:model_map</tt>,
|
50
|
-
# you should only use class name strings as keys, you should not use symbols
|
51
|
-
# as keys.
|
52
|
-
module ContentTableInheritance
|
53
|
-
# Setup the necessary STI variables, see the module RDoc for SingleTableInheritance
|
54
|
-
def self.configure(model, key, opts={})
|
55
|
-
model.instance_eval do
|
56
|
-
@sti_dataset_root = model
|
57
|
-
@sti_model_map = lambda { |id| Spontaneous.schema[id] }
|
58
|
-
@sti_key_map = lambda { |klass| klass.schema_id.to_s }
|
59
|
-
@sti_key_array = nil
|
60
|
-
@sti_subclasses_array = [sti_key_map[model]]
|
61
|
-
@sti_key = key
|
62
|
-
@sti_dataset = dataset
|
63
|
-
@is_content_inheritance_root = false
|
64
|
-
@is_site_inheritance_root = false
|
65
|
-
dataset.row_proc = lambda{|r| model.sti_load(r)}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
module ClassMethods
|
70
|
-
attr_reader :sti_dataset_root
|
71
|
-
|
72
|
-
# The base dataset for STI, to which filters are added to get
|
73
|
-
# only the models for the specific STI subclass.
|
74
|
-
attr_reader :sti_dataset
|
75
|
-
|
76
|
-
# The column name holding the STI key for this model
|
77
|
-
attr_reader :sti_key
|
78
|
-
|
79
|
-
# Array holding keys for all subclasses of this class, used for the
|
80
|
-
# dataset filter in subclasses. Nil in the main class.
|
81
|
-
attr_reader :sti_key_array
|
82
|
-
|
83
|
-
# A hash/proc with class keys and column value values, mapping
|
84
|
-
# the the class to a particular value given to the sti_key column.
|
85
|
-
# Used to set the column value when creating objects, and for the
|
86
|
-
# filter when retrieving objects in subclasses.
|
87
|
-
attr_reader :sti_key_map
|
88
|
-
|
89
|
-
# A hash/proc with column value keys and class values, mapping
|
90
|
-
# the value of the sti_key column to the appropriate class to use.
|
91
|
-
attr_reader :sti_model_map
|
92
|
-
|
93
|
-
attr_reader :sti_subclasses_array
|
94
|
-
|
95
|
-
attr_reader :is_site_inheritance_root
|
96
|
-
|
97
|
-
# Copy the necessary attributes to the subclasses, and filter the
|
98
|
-
# subclass's dataset based on the sti_kep_map entry for the class.
|
99
|
-
def inherited(subclass)
|
100
|
-
super
|
101
|
-
sk = sti_key
|
102
|
-
sd = sti_dataset
|
103
|
-
sdr = sti_dataset_root
|
104
|
-
skm = sti_key_map
|
105
|
-
smm = sti_model_map
|
106
|
-
key = skm[subclass]
|
107
|
-
ska = [key].reject { |k| k.blank? }
|
108
|
-
subclass.instance_eval do
|
109
|
-
@sti_key = sk
|
110
|
-
@sti_key_array = ska
|
111
|
-
@sti_subclasses_array = [skm[subclass]]
|
112
|
-
@sti_dataset = sd
|
113
|
-
@sti_key_map = skm
|
114
|
-
@sti_model_map = smm
|
115
|
-
@simple_table = nil
|
116
|
-
@sti_dataset_root = sdr
|
117
|
-
end
|
118
|
-
sti_subclass_added(key, subclass)
|
119
|
-
end
|
120
|
-
|
121
|
-
# used by Page and Piece classes to control the subclasses used in searches
|
122
|
-
# see 'test_content_inheritance.rb'
|
123
|
-
def set_inheritance_root
|
124
|
-
@is_content_inheritance_root = true
|
125
|
-
dataset.row_proc = Spontaneous::Content.dataset.row_proc
|
126
|
-
end
|
127
|
-
|
128
|
-
def set_site_inheritance_root
|
129
|
-
@is_site_inheritance_root = true
|
130
|
-
dataset.row_proc = Spontaneous::Content.dataset.row_proc
|
131
|
-
end
|
132
|
-
|
133
|
-
def unset_site_inheritance_root
|
134
|
-
@is_site_inheritance_root = false
|
135
|
-
end
|
136
|
-
|
137
|
-
# Return an instance of the class specified by sti_key,
|
138
|
-
# used by the row_proc.
|
139
|
-
def sti_load(r)
|
140
|
-
sti_class(sti_model_map[r[sti_key]]).load(r)
|
141
|
-
end
|
142
|
-
|
143
|
-
# Make sure that all subclasses of the parent class correctly include
|
144
|
-
# keys for all of their descendant classes.
|
145
|
-
# Subclasses of Spontaneous::[Page, Piece] as well as ::Page & ::Piece are treated specially
|
146
|
-
# they only return instances of that one class as this is the intuitively correct result
|
147
|
-
# The top level Page & Piece classes return all sub-classes
|
148
|
-
def sti_subclass_added(key, subclass = nil)
|
149
|
-
if sti_key_array
|
150
|
-
if subclass && subclass.name
|
151
|
-
# alright, so this is a bit of a hack
|
152
|
-
# we want the site defined ::Page, ::Piece classes to work like Spot::[Page,Piece]
|
153
|
-
# but we don't want generic subclasses of Spot::[Page, Piece] to do so
|
154
|
-
if subclass.name.demodulize == self.name.demodulize && @is_content_inheritance_root
|
155
|
-
subclass.set_site_inheritance_root
|
156
|
-
end
|
157
|
-
end
|
158
|
-
unless key.blank?
|
159
|
-
if @is_site_inheritance_root or @is_content_inheritance_root
|
160
|
-
sti_key_array << key unless sti_key_array.include?(key)
|
161
|
-
end
|
162
|
-
sti_subclasses_array << key
|
163
|
-
end
|
164
|
-
superclass.sti_subclass_added(key)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
def dataset
|
169
|
-
return super if self == sti_dataset_root
|
170
|
-
sti_dataset_root.dataset.filter(SQL::QualifiedIdentifier.new(sti_dataset_root.table_name, sti_key)=>sti_key_array)
|
171
|
-
end
|
172
|
-
|
173
|
-
private
|
174
|
-
|
175
|
-
# Return a class object. If a class is given, return it directly.
|
176
|
-
# Treat strings and symbols as class names. If nil is given or
|
177
|
-
# an invalid class name string or symbol is used, return self.
|
178
|
-
# Raise an error for other types.
|
179
|
-
def sti_class(v)
|
180
|
-
case v
|
181
|
-
when String, Symbol
|
182
|
-
constantize(v) rescue self
|
183
|
-
when nil
|
184
|
-
self
|
185
|
-
when Class
|
186
|
-
v
|
187
|
-
else
|
188
|
-
raise(Error, "Invalid class type used: #{v.inspect}")
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|
193
|
-
|
194
|
-
module InstanceMethods
|
195
|
-
# Set the sti_key column based on the sti_key_map.
|
196
|
-
def before_create
|
197
|
-
send("#{model.sti_key}=", model.sti_key_map[model]) unless self[model.sti_key]
|
198
|
-
super
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Sequel::Plugins
|
4
|
-
# Provides models with a mechanism for changing the table name used by queries
|
5
|
-
# within a particular block
|
6
|
-
module ScopedTableName
|
7
|
-
def self.configure(model)
|
8
|
-
model.class_variable_set :"@@unscoped_table_name", model.dataset.opts[:from].first
|
9
|
-
end
|
10
|
-
|
11
|
-
module ClassMethods
|
12
|
-
def unscoped_table_name
|
13
|
-
class_variable_get :"@@unscoped_table_name"
|
14
|
-
end
|
15
|
-
|
16
|
-
def fast_instance_delete_sql
|
17
|
-
nil
|
18
|
-
end
|
19
|
-
|
20
|
-
def primary_key_lookup(pk)
|
21
|
-
dataset[primary_key_hash(pk)]
|
22
|
-
end
|
23
|
-
|
24
|
-
def with_table(table_name, &block)
|
25
|
-
@dataset.with_table(unscoped_table_name, table_name, &block)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
module DatasetMethods
|
30
|
-
# set up a mapping from the datasets original name to the one that should be used
|
31
|
-
# in the current scope.
|
32
|
-
# called from the model class this
|
33
|
-
def with_table(original_table_name, current_table_name)
|
34
|
-
saved_table_name = table_mappings[original_table_name]
|
35
|
-
table_mappings[original_table_name] = current_table_name.to_s
|
36
|
-
|
37
|
-
yield if block_given?
|
38
|
-
ensure
|
39
|
-
table_mappings[original_table_name] = saved_table_name
|
40
|
-
end
|
41
|
-
|
42
|
-
# use the table_mappings to convert the original table name to the current version
|
43
|
-
def quote_identifier_append(sql, name)
|
44
|
-
name = (table_mappings[name.to_sym] || name) if name.respond_to?(:to_sym)
|
45
|
-
super(sql, name)
|
46
|
-
end
|
47
|
-
|
48
|
-
# the table name mappings are shared across all dataset instances
|
49
|
-
def table_mappings
|
50
|
-
Thread.current[:scoped_table_names] ||= {}
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|