spontaneous 0.2.0.alpha2 → 0.2.0.alpha3
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.
- data/Gemfile +3 -40
- data/Rakefile +29 -41
- data/Readme.markdown +21 -8
- data/application/css/add_alias_dialogue.css.scss +79 -0
- data/application/css/{v2.scss → core.css.scss} +537 -550
- data/application/css/{definitions.scss → definitions.css.scss} +121 -33
- data/application/css/dialogue.css.scss +409 -0
- data/application/css/{editing.scss → editing.css.scss} +25 -262
- data/application/css/font.css.scss +8 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_222222_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_228ef1_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ef8c08_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffd27a_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffffff_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/ui-lightness.css.scss +565 -0
- data/application/css/{login.scss → login.css.scss} +4 -4
- data/application/css/meta.css.scss +331 -0
- data/application/css/{popover.scss → popover.css.scss} +9 -8
- data/application/css/{schema_error.scss → schema_error.css.scss} +4 -4
- data/application/css/spontaneous.css +5 -0
- data/application/css/unsupported.css.scss +42 -0
- data/application/js/add_alias_dialogue.js +72 -10
- data/application/js/ajax.js +50 -16
- data/application/js/compatibility.js +19 -15
- data/application/js/content.js +39 -36
- data/application/js/content_area.js +53 -5
- data/application/js/dialogue.js +17 -0
- data/application/js/dom.js +1 -1
- data/application/js/edit_panel.js +23 -8
- data/application/js/extensions.js +7 -2
- data/application/js/field_preview.js +2 -1
- data/application/js/field_types/date_field.js +11 -8
- data/application/js/field_types/file_field.js +188 -9
- data/application/js/field_types/image_field.js +46 -29
- data/application/js/field_types/markdown_field.js +57 -14
- data/application/js/field_types/select_field.js +72 -0
- data/application/js/field_types/string_field.js +8 -0
- data/application/js/field_types/webvideo_field.js +8 -0
- data/application/js/init.js +1 -7
- data/application/js/location.js +41 -13
- data/application/js/login.js +3 -0
- data/application/js/meta_view/user_admin.js +543 -0
- data/application/js/meta_view.js +1 -0
- data/application/js/metadata.js +20 -0
- data/application/js/page.js +17 -3
- data/application/js/page_browser.js +40 -30
- data/application/js/page_entry.js +4 -0
- data/application/js/panel/root_menu.js +66 -0
- data/application/js/popover.js +2 -2
- data/application/js/preview.js +1 -1
- data/application/js/publish.js +138 -30
- data/application/js/services.js +43 -0
- data/application/js/sharded_upload.js +2 -2
- data/application/js/spontaneous.js +64 -5
- data/application/js/state.js +20 -9
- data/application/js/top_bar.js +273 -150
- data/application/js/types.js +20 -15
- data/application/js/upload.js +1 -2
- data/application/js/user.js +18 -4
- data/application/js/vendor/date.js +104 -0
- data/application/js/vendor/jquery-ui-1.8.18.custom.min.js +356 -0
- data/application/js/views/box_view.js +15 -8
- data/application/js/views/page_piece_view.js +11 -8
- data/application/js/views/page_view.js +21 -3
- data/application/js/views/piece_view.js +19 -10
- data/application/js/views.js +3 -0
- data/application/static/chromelogo-200x52-45c7cbc93be080bea342df5fcda2ef8b.png +0 -0
- data/application/static/dot-texture-9eea29e4ac7ad9a772285252078ec127.png +0 -0
- data/application/static/editing-textarea-resize-s-b5af62365eb7e19ea4beccf7242d508e.png +0 -0
- data/application/static/editing-texture-1-42b06a3439752490988f30f2a06d5e7c.png +0 -0
- data/application/static/font/fontawesome-webfont-5c5c21100a346972a82c34c5e96ffcfe.ttf +0 -0
- data/application/static/loop_alt1-white-7894b458528e92216196cae26b4c2c96.svg +12 -0
- data/application/static/spontaneous-states-e91ec89db525c62da0105b97cdd781ce.png +0 -0
- data/application/views/index.erb +2 -2
- data/application/views/login.erb +4 -8
- data/application/views/schema_modification_error.html.erb +1 -4
- data/application/views/unsupported.erb +9 -7
- data/bin/spot +1 -1
- data/db/migrations/20110209152710_users_and_groups.rb +10 -10
- data/db/migrations/20120305112647_site_modification_time.rb +11 -0
- data/db/migrations/20120418153903_add_ownership_of_content.rb +14 -0
- data/db/migrations/20120423175416_add_pending_modifications.rb +21 -0
- data/db/migrations/20120525164947_add_field_versions.rb +27 -0
- data/lib/sequel/plugins/scoped_table_name.rb +10 -1
- data/lib/spontaneous/asset/file.rb +25 -0
- data/lib/spontaneous/asset/source.rb +28 -0
- data/lib/spontaneous/asset.rb +75 -0
- data/lib/spontaneous/box.rb +6 -4
- data/lib/spontaneous/capistrano/deploy.rb +47 -0
- data/lib/spontaneous/capistrano/sync.rb +81 -0
- data/lib/spontaneous/capistrano.rb +13 -0
- data/lib/spontaneous/change.rb +60 -68
- data/lib/spontaneous/cli/assets.rb +29 -0
- data/lib/spontaneous/cli/base.rb +0 -48
- data/lib/spontaneous/cli/console.rb +1 -1
- data/lib/spontaneous/cli/server.rb +6 -4
- data/lib/spontaneous/cli/site.rb +28 -17
- data/lib/spontaneous/cli/user.rb +107 -0
- data/lib/spontaneous/cli.rb +100 -4
- data/lib/spontaneous/collections/entry_set.rb +2 -2
- data/lib/spontaneous/collections/field_set.rb +48 -22
- data/lib/spontaneous/collections/prototype_set.rb +20 -13
- data/lib/spontaneous/constants.rb +3 -0
- data/lib/spontaneous/content.rb +22 -5
- data/lib/spontaneous/errors.rb +3 -3
- data/lib/spontaneous/extensions/array.rb +12 -0
- data/lib/spontaneous/extensions/enumerable.rb +30 -0
- data/lib/spontaneous/extensions/nil.rb +3 -1
- data/lib/spontaneous/extensions/string.rb +16 -0
- data/lib/spontaneous/field_types/date_field.rb +45 -2
- data/lib/spontaneous/field_types/field.rb +42 -9
- data/lib/spontaneous/field_types/file_field.rb +68 -0
- data/lib/spontaneous/field_types/image_field.rb +63 -0
- data/lib/spontaneous/field_types/select_field.rb +109 -0
- data/lib/spontaneous/field_types/string_field.rb +6 -1
- data/lib/spontaneous/field_types/webvideo_field.rb +85 -27
- data/lib/spontaneous/field_types.rb +1 -1
- data/lib/spontaneous/field_version.rb +8 -0
- data/lib/spontaneous/generators/page.rb +1 -1
- data/lib/spontaneous/generators/site/Capfile.tt +1 -4
- data/lib/spontaneous/generators/site/Gemfile.tt +13 -6
- data/lib/spontaneous/generators/site/config/deploy.rb.tt +28 -0
- data/lib/spontaneous/generators/site/config/environments/production.rb.tt +7 -2
- data/lib/spontaneous/generators/site.rb +1 -0
- data/lib/spontaneous/json.rb +34 -11
- data/lib/spontaneous/layout.rb +22 -0
- data/lib/spontaneous/media/file.rb +4 -0
- data/lib/spontaneous/output/assets/compression.rb +58 -0
- data/lib/spontaneous/output/assets.rb +32 -0
- data/lib/spontaneous/output/context.rb +179 -0
- data/lib/spontaneous/output/format/html.rb +5 -0
- data/lib/spontaneous/output/format/plain.rb +5 -0
- data/lib/spontaneous/output/format.rb +180 -0
- data/lib/spontaneous/output/helpers/classes_helper.rb +18 -0
- data/lib/spontaneous/{render/helpers/html_helper.rb → output/helpers/conditional_comment_helper.rb} +3 -12
- data/lib/spontaneous/output/helpers/script_helper.rb +73 -0
- data/lib/spontaneous/output/helpers/stylesheet_helper.rb +61 -0
- data/lib/spontaneous/output/helpers.rb +28 -0
- data/lib/spontaneous/output/template/engine.rb +59 -0
- data/lib/spontaneous/output/template/renderer.rb +153 -0
- data/lib/spontaneous/output/template.rb +21 -0
- data/lib/spontaneous/output.rb +163 -0
- data/lib/spontaneous/page.rb +2 -1
- data/lib/spontaneous/paths.rb +6 -1
- data/lib/spontaneous/permissions/access_key.rb +5 -5
- data/lib/spontaneous/permissions/user.rb +81 -35
- data/lib/spontaneous/permissions/user_level.rb +26 -22
- data/lib/spontaneous/plugins/aliases.rb +76 -12
- data/lib/spontaneous/plugins/allowed_types.rb +60 -18
- data/lib/spontaneous/plugins/application/paths.rb +0 -28
- data/lib/spontaneous/plugins/application/system.rb +35 -0
- data/lib/spontaneous/plugins/boxes.rb +4 -0
- data/lib/spontaneous/plugins/content_groups.rb +16 -0
- data/lib/spontaneous/plugins/entries.rb +50 -30
- data/lib/spontaneous/plugins/fields.rb +15 -0
- data/lib/spontaneous/plugins/layouts.rb +8 -2
- data/lib/spontaneous/plugins/modifications.rb +228 -0
- data/lib/spontaneous/plugins/page/formats.rb +67 -42
- data/lib/spontaneous/plugins/page/request.rb +10 -0
- data/lib/spontaneous/plugins/page/site_timestamps.rb +28 -0
- data/lib/spontaneous/plugins/paths.rb +15 -3
- data/lib/spontaneous/plugins/publishing.rb +124 -45
- data/lib/spontaneous/plugins/render.rb +13 -8
- data/lib/spontaneous/plugins/schema_hierarchy.rb +18 -6
- data/lib/spontaneous/plugins/site/helpers.rb +53 -0
- data/lib/spontaneous/plugins/site/hooks.rb +50 -0
- data/lib/spontaneous/plugins/site/map.rb +1 -1
- data/lib/spontaneous/plugins/site/paths.rb +13 -0
- data/lib/spontaneous/plugins/site/publishing.rb +6 -2
- data/lib/spontaneous/plugins/site/{revisions.rb → state.rb} +5 -1
- data/lib/spontaneous/plugins/site/storage.rb +4 -0
- data/lib/spontaneous/plugins/site/url.rb +15 -0
- data/lib/spontaneous/plugins/site_map.rb +13 -3
- data/lib/spontaneous/plugins/styles.rb +5 -1
- data/lib/spontaneous/plugins/visibility.rb +39 -12
- data/lib/spontaneous/prototypes/box_prototype.rb +4 -0
- data/lib/spontaneous/prototypes/field_prototype.rb +15 -10
- data/lib/spontaneous/publishing/event_client.rb +46 -0
- data/lib/spontaneous/publishing/immediate.rb +81 -44
- data/lib/spontaneous/publishing/simultaneous.rb +23 -6
- data/lib/spontaneous/publishing.rb +4 -3
- data/lib/spontaneous/rack/around_back.rb +1 -5
- data/lib/spontaneous/rack/around_front.rb +4 -4
- data/lib/spontaneous/rack/around_preview.rb +4 -3
- data/lib/spontaneous/rack/assets.rb +81 -54
- data/lib/spontaneous/rack/authentication.rb +0 -1
- data/lib/spontaneous/rack/back.rb +160 -72
- data/lib/spontaneous/rack/cookie_authentication.rb +2 -2
- data/lib/spontaneous/rack/css.rb +18 -15
- data/lib/spontaneous/rack/event_source.rb +9 -21
- data/lib/spontaneous/rack/fiber_pool.rb +26 -0
- data/lib/spontaneous/rack/front.rb +12 -4
- data/lib/spontaneous/rack/helpers.rb +35 -13
- data/lib/spontaneous/rack/js.rb +41 -0
- data/lib/spontaneous/rack/public.rb +34 -44
- data/lib/spontaneous/rack/sse.rb +18 -0
- data/lib/spontaneous/rack/static.rb +3 -0
- data/lib/spontaneous/rack/user_admin.rb +100 -0
- data/lib/spontaneous/rack/user_helpers.rb +1 -1
- data/lib/spontaneous/rack.rb +6 -2
- data/lib/spontaneous/schema.rb +31 -4
- data/lib/spontaneous/search/index.rb +19 -3
- data/lib/spontaneous/search/results.rb +1 -1
- data/lib/spontaneous/sequel.rb +17 -0
- data/lib/spontaneous/site.rb +11 -4
- data/lib/spontaneous/state.rb +11 -0
- data/lib/spontaneous/storage/cloud.rb +4 -0
- data/lib/spontaneous/storage/local.rb +11 -0
- data/lib/spontaneous/style.rb +2 -2
- data/lib/spontaneous/tasks/database.rake +21 -22
- data/lib/spontaneous/utils/database/mysql_dumper.rb +4 -0
- data/lib/spontaneous/utils/database/postgres_dumper.rb +78 -0
- data/lib/spontaneous/utils/database.rb +6 -3
- data/lib/spontaneous/utils/smart_quotes.rb +499 -0
- data/lib/spontaneous/utils/smush_it.rb +66 -0
- data/lib/spontaneous/utils.rb +3 -1
- data/lib/spontaneous/version.rb +2 -2
- data/lib/spontaneous.rb +25 -29
- data/spontaneous.gemspec +186 -106
- data/test/experimental/test_features.rb +1 -1
- data/test/fixtures/asset_pipeline/application/css/basic.css.scss +4 -0
- data/test/fixtures/asset_pipeline/application/css/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/css/spontaneous.css +7 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/library.css.scss +1 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/js/basic.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/login.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/require.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/spontaneous.js +5 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/library.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/vendor/jquery.js +1 -0
- data/test/fixtures/asset_pipeline/application/static/dot-texture.png +0 -0
- data/test/fixtures/asset_pipeline/application/static/subdir/px.gif +0 -0
- data/test/fixtures/assets/public1/css/a.scss +1 -0
- data/test/fixtures/assets/public1/js/a.js +1 -0
- data/test/fixtures/assets/public1/js/m.coffee +1 -0
- data/test/fixtures/assets/public2/css/b.scss +1 -0
- data/test/fixtures/assets/public2/css/c.css +1 -0
- data/test/fixtures/assets/public2/js/b.js +1 -0
- data/test/fixtures/assets/public2/js/c.js +1 -0
- data/test/fixtures/assets/public2/js/n.coffee +1 -0
- data/test/fixtures/back/config/user_levels.yml +3 -0
- data/test/fixtures/back/public/js/coffeescript.coffee +1 -0
- data/test/fixtures/back/templates/layouts/standard.css.cut +1 -0
- data/test/fixtures/back/templates/layouts/standard.js.cut +1 -0
- data/test/fixtures/example_application/config/database.yml +4 -4
- data/test/fixtures/helpers/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/helpers/templates/layouts/standard.mobile.cut +1 -0
- data/test/fixtures/images/vimlogo.pdf +0 -0
- data/test/fixtures/outputs/templates/layouts/standard.atom.cut +1 -0
- data/test/fixtures/permissions/config/user_levels.yml +6 -3
- data/test/fixtures/serialisation/class_hash.yaml.erb +1 -0
- data/test/fixtures/serialisation/root_hash.yaml.erb +2 -2
- data/test/fixtures/templates/extended/grandparent.html.cut +7 -7
- data/test/fixtures/templates/extended/main.html.cut +5 -5
- data/test/fixtures/templates/extended/parent.html.cut +8 -8
- data/test/fixtures/templates/extended/partial_with_locals.html.cut +1 -1
- data/test/fixtures/templates/extended/with_includes.html.cut +6 -6
- data/test/fixtures/templates/extended/with_includes_and_locals.html.cut +6 -7
- data/test/fixtures/templates/layouts/entries.html.cut +4 -4
- data/test/fixtures/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/templates/layouts/variables.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.rtf.cut +1 -0
- data/test/fixtures/templates/template_class/complex_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/complex_template.pdf.cut +2 -2
- data/test/fixtures/templates/template_class/default_template_style.html.cut +1 -1
- data/test/fixtures/templates/template_class/images_with_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.pdf.cut +2 -2
- data/test/fixtures/user_manager/config/user_levels.yml +9 -0
- data/test/functional/test_application.rb +7 -7
- data/test/functional/test_back.rb +352 -97
- data/test/functional/test_front.rb +71 -20
- data/test/functional/test_user_manager.rb +284 -0
- data/test/javascript/env.js +13505 -0
- data/test/javascript/test_markdown.rb +43 -3
- data/test/support/custom_matchers.rb +3 -2
- data/test/test_helper.rb +50 -9
- data/test/test_javascript.rb +13 -13
- data/test/ui_helper.rb +1 -1
- data/test/unit/test_alias.rb +79 -8
- data/test/unit/test_asset_bundler.rb +220 -0
- data/test/unit/test_assets.rb +213 -0
- data/test/unit/test_async.rb +55 -0
- data/test/unit/test_authentication.rb +52 -39
- data/test/unit/test_boxes.rb +20 -15
- data/test/unit/test_changesets.rb +261 -0
- data/test/unit/test_content.rb +73 -33
- data/test/unit/test_content_inheritance.rb +18 -18
- data/test/unit/test_extensions.rb +26 -0
- data/test/unit/test_fields.rb +303 -16
- data/test/unit/test_formats.rb +267 -34
- data/test/unit/test_helpers.rb +79 -2
- data/test/unit/test_images.rb +10 -0
- data/test/unit/test_layouts.rb +21 -13
- data/test/unit/test_modifications.rb +648 -0
- data/test/unit/test_page.rb +6 -2
- data/test/unit/test_permissions.rb +101 -27
- data/test/unit/test_piece.rb +4 -4
- data/test/unit/test_plugins.rb +3 -2
- data/test/unit/test_publishing.rb +332 -0
- data/test/unit/test_render.rb +118 -67
- data/test/unit/test_revisions.rb +546 -0
- data/test/unit/test_schema.rb +83 -1
- data/test/unit/test_search.rb +59 -0
- data/test/unit/test_serialisation.rb +2 -47
- data/test/unit/test_site.rb +217 -108
- data/test/unit/test_storage.rb +26 -0
- data/test/unit/test_structure.rb +2 -2
- data/test/unit/test_styles.rb +90 -75
- data/test/unit/test_table_scoping.rb +21 -17
- data/test/unit/test_templates.rb +75 -69
- data/test/{slow → unit}/test_visibility.rb +78 -22
- metadata +528 -221
- data/application/css/add_alias_dialogue.scss +0 -27
- data/application/css/min/14c2a35812c443001b15d8b12a4780f88c678035.css +0 -1
- data/application/css/min/565d4c25e82148acb01c45c8d675b37a08676d77.css +0 -1
- data/application/css/min/84dbe894ea96eafd321c30823d630817bfc4b03b.css +0 -1
- data/application/css/spontaneous.scss +0 -111
- data/application/css/unsupported.scss +0 -16
- data/application/css/variables.scss +0 -80
- data/application/js/min/2a0c2962537a3181fedfff5c92596ba6d3122dc9.js +0 -3
- data/application/js/min/4cf1c493d3379ecba5287758c61238034c0893f9.js +0 -2
- data/application/js/min/78ac6b99d96750bb6b9f9aad4cb9cd91cd03f391.js +0 -3
- data/application/js/min/b8abf302a824c35385ff517b34111e1710ff3b37.js +0 -2
- data/application/js/min/c8efb9b9f7c3f6613fcebc6be60f605b6570a382.js +0 -90
- data/application/static/diagonal-texture.png +0 -0
- data/application/static/editing-0-noise.png +0 -0
- data/application/static/editing-1-noise.png +0 -0
- data/application/static/editing-texture-1.png +0 -0
- data/application/static/editing-texture.png +0 -0
- data/application/static/editing-toolbar-shadow-bottom.png +0 -0
- data/application/static/editing-toolbar-shadow-top.png +0 -0
- data/application/static/inner-glow.png +0 -0
- data/application/static/item-buttons-highlight.png +0 -0
- data/application/static/item-buttons.png +0 -0
- data/application/static/paper-texture-dark.png +0 -0
- data/application/static/plus_alt.svg +0 -8
- data/application/static/select-arrow-root.png +0 -0
- data/application/static/slot-up-arrow.png +0 -0
- data/application/static/spontaneous.png +0 -0
- data/lib/cutaneous/context_helper.rb +0 -187
- data/lib/cutaneous/preview_context.rb +0 -32
- data/lib/cutaneous/preview_renderer.rb +0 -10
- data/lib/cutaneous/publish_context.rb +0 -10
- data/lib/cutaneous/publish_renderer.rb +0 -14
- data/lib/cutaneous/publish_template.rb +0 -62
- data/lib/cutaneous/publish_token_parser.rb +0 -8
- data/lib/cutaneous/renderer.rb +0 -124
- data/lib/cutaneous/request_context.rb +0 -9
- data/lib/cutaneous/request_renderer.rb +0 -15
- data/lib/cutaneous/request_template.rb +0 -11
- data/lib/cutaneous/request_token_parser.rb +0 -9
- data/lib/cutaneous/token_parser.rb +0 -125
- data/lib/cutaneous.rb +0 -48
- data/lib/spontaneous/render/context_base.rb +0 -143
- data/lib/spontaneous/render/development_renderer.rb +0 -14
- data/lib/spontaneous/render/engine.rb +0 -19
- data/lib/spontaneous/render/format/html.rb +0 -5
- data/lib/spontaneous/render/format.rb +0 -75
- data/lib/spontaneous/render/helpers/script_helper.rb +0 -17
- data/lib/spontaneous/render/helpers/stylesheet_helper.rb +0 -16
- data/lib/spontaneous/render/helpers.rb +0 -14
- data/lib/spontaneous/render/preview_context.rb +0 -8
- data/lib/spontaneous/render/preview_renderer.rb +0 -24
- data/lib/spontaneous/render/publish_context.rb +0 -22
- data/lib/spontaneous/render/published_renderer.rb +0 -53
- data/lib/spontaneous/render/publishing_renderer.rb +0 -16
- data/lib/spontaneous/render/render_cache.rb +0 -26
- data/lib/spontaneous/render/renderer.rb +0 -50
- data/lib/spontaneous/render/request_context.rb +0 -8
- data/lib/spontaneous/render.rb +0 -214
- data/test/experimental/test_cutaneous.rb +0 -309
- data/test/fixtures/application/css/test.less +0 -5
- data/test/slow/test_publishing.rb +0 -1006
- /data/application/css/{developer.scss → developer.css.scss} +0 -0
- /data/application/js/vendor/{jquery-1.7.1.min.js → jquery.js} +0 -0
- /data/application/static/{location-arrow.png → location-arrow-c1c1d3ca472481c61a0a5f8cb289d743.png} +0 -0
- /data/application/static/{missing.png → missing-911ce6dbd9f4602e0f3fbcd7e78846a2.png} +0 -0
- /data/application/static/{orange-down-arrow.png → orange-down-arrow-395ae1929e8662b2ff0977daf12c35bb.png} +0 -0
- /data/application/static/{page-browser-next.png → page-browser-next-ce781a242c23b980b99b9db7abc20b05.png} +0 -0
- /data/application/static/{plus-box.png → plus-box-dcde74a1e496f68298c9b443caa1c5d5.png} +0 -0
- /data/application/static/{select-arrow.png → select-arrow-6e7dd3745b00e934b0d7a3250c46558b.png} +0 -0
- /data/application/static/{slot-down-arrow.png → slot-down-arrow-59ad5f5ee5b52a7ebd00bca4b3104194.png} +0 -0
- /data/application/static/{splash.png → splash-65b493a714df9b8b3ab170103401b53d.png} +0 -0
- /data/application/static/{spot.png → spot-71fab1d2f065034f5fc15e7bea2ad36c.png} +0 -0
- /data/application/static/{spot.svg → spot-8505041082d8d3bbe8d34c29dddb3b7d.svg} +0 -0
- /data/application/static/{texture.png → texture-03f7627e8264b1d607113ab32c593a58.png} +0 -0
data/test/unit/test_formats.rb
CHANGED
|
@@ -6,6 +6,7 @@ class FormatsTest < MiniTest::Spec
|
|
|
6
6
|
context "Pages" do
|
|
7
7
|
setup do
|
|
8
8
|
@site = setup_site
|
|
9
|
+
@site.paths.add :templates, File.expand_path('../../fixtures/outputs/templates', __FILE__)
|
|
9
10
|
class Page < Spontaneous::Page; end
|
|
10
11
|
class FPage < Page; end
|
|
11
12
|
end
|
|
@@ -16,80 +17,290 @@ class FormatsTest < MiniTest::Spec
|
|
|
16
17
|
teardown_site
|
|
17
18
|
end
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
context "default output" do
|
|
21
|
+
should "be named :html" do
|
|
22
|
+
FPage.outputs.map(&:name).should == [:html]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
should "be html format" do
|
|
26
|
+
FPage.outputs.map(&:format).should == [:html]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
should "be public" do
|
|
30
|
+
FPage.outputs.map(&:private?).should == [false]
|
|
31
|
+
FPage.outputs.map(&:public?).should == [true]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
should "be static" do
|
|
35
|
+
FPage.outputs.map(&:dynamic?).should == [false]
|
|
36
|
+
end
|
|
21
37
|
end
|
|
22
38
|
|
|
23
|
-
should "have
|
|
24
|
-
FPage.
|
|
39
|
+
should "have tests for supported outputs" do
|
|
40
|
+
FPage.provides_output?(:html).should be_true
|
|
41
|
+
FPage.provides_output?(:rss).should be_false
|
|
25
42
|
end
|
|
26
43
|
|
|
27
|
-
should "
|
|
28
|
-
FPage.
|
|
29
|
-
FPage.provides_format?(:rss).should be_false
|
|
44
|
+
should "map an empty output onto the default one" do
|
|
45
|
+
FPage.provides_output?(nil).should be_true
|
|
30
46
|
end
|
|
31
47
|
|
|
32
|
-
should "return the mime-type for a
|
|
48
|
+
should "return the mime-type for a output" do
|
|
33
49
|
FPage.mime_type(:html).should == "text/html"
|
|
34
50
|
FPage.mime_type(:atom).should == "application/atom+xml"
|
|
35
51
|
end
|
|
36
52
|
|
|
37
53
|
|
|
54
|
+
should "return the output class for a named output" do
|
|
55
|
+
FPage.output(:html).must_be_instance_of(Class)
|
|
56
|
+
FPage.output(:html).ancestors.include?(S::Output::HTML).should be_true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
should "correctly determine mimetypes for new (known) formats" do
|
|
60
|
+
FPage.add_output :au
|
|
61
|
+
FPage.output(:au).mimetype.should == "audio/basic"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
should "dynamically generate output classes for unknown formats" do
|
|
65
|
+
FPage.add_output :fish, :format => :unknown
|
|
66
|
+
FPage.output(:fish).ancestors[1].should == S::Output::UNKNOWN
|
|
67
|
+
FPage.output(:fish).ancestors[2].should == S::Output::Plain
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
should "dynamically generate output classes based on HTML for outputs with unspecified formats" do
|
|
71
|
+
FPage.add_output :fish
|
|
72
|
+
FPage.output(:fish).ancestors[1].should == S::Output::HTML
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
should "return the format wrapper for a format name string" do
|
|
76
|
+
FPage.output("html").should == FPage.output(:html)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
should "give the default format for blank format names" do
|
|
80
|
+
html = FPage.output(:html)
|
|
81
|
+
FPage.output(nil).should == html
|
|
82
|
+
FPage.output.should == html
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
should "provide a symbol version of the output name" do
|
|
86
|
+
FPage.output(:html).to_sym.should == :html
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
should "provide the correct output extension for dynamic pages" do
|
|
90
|
+
FPage.output.extension(true).should == ".html.cut"
|
|
91
|
+
FPage.output.extension(true, "erb").should == ".html.erb"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
should "override an existing output if the format is the same" do
|
|
95
|
+
FPage.add_output :rss
|
|
96
|
+
FPage.outputs.length.should == 2
|
|
97
|
+
FPage.outputs.map(&:format).should == [:html, :rss]
|
|
98
|
+
format = FPage.outputs.first.format
|
|
99
|
+
FPage.add_output format, :dynamic => true
|
|
100
|
+
FPage.outputs.length.should == 2
|
|
101
|
+
FPage.outputs.map(&:format).should == [:html, :rss]
|
|
102
|
+
FPage.output(format).dynamic?.should be_true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
should "correctly set the format from the output name if it's recognised" do
|
|
106
|
+
FPage.add_output :pdf
|
|
107
|
+
FPage.output(:pdf).format.should == :pdf
|
|
108
|
+
FPage.output(:pdf).mimetype.should == "application/pdf"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
should "default to a format of html for unknown output formats" do
|
|
112
|
+
FPage.outputs [:xyzz]
|
|
113
|
+
FPage.default_output.format.should == :html
|
|
114
|
+
FPage.output(:xyzz).format.should == :html
|
|
115
|
+
FPage.output(:xyzz).mimetype.should == "text/html"
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
should "allow the setting of a default format for an output" do
|
|
119
|
+
FPage.add_output :rss, :format => :html
|
|
120
|
+
FPage.output(:rss).format.should == :html
|
|
121
|
+
FPage.output(:rss).mimetype.should == "text/html"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
should "allow for custom mimetypes" do
|
|
125
|
+
FPage.add_output :rss, :format => :html, :mimetype => "application/xhtml+xml"
|
|
126
|
+
FPage.output(:rss).format.should == :html
|
|
127
|
+
FPage.output(:rss).mimetype.should == "application/xhtml+xml"
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
should "allow for marking an output as 'private'" do
|
|
131
|
+
FPage.add_output :rss, :private => true
|
|
132
|
+
FPage.output(:rss).public?.should be_false
|
|
133
|
+
FPage.output(:rss).private?.should be_true
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
should "provide the correct output extension for static pages" do
|
|
137
|
+
FPage.output(:html).extension.should == ".html"
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
should "provide the correct output extension for static pages of non-html formats" do
|
|
141
|
+
FPage.add_output :pdf
|
|
142
|
+
FPage.output(:pdf).extension.should == ".pdf"
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
should "name the output according to the format" do
|
|
146
|
+
FPage.add_output :atom, :format => :html
|
|
147
|
+
FPage.output(:atom).extension.should == ".atom"
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
should "name the output using the configured extension" do
|
|
151
|
+
FPage.add_output :atom, :format => :html, :extension => "rss"
|
|
152
|
+
FPage.output(:atom).extension.should == ".rss"
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
should "allow for complex custom file extensions" do
|
|
156
|
+
FPage.add_output :rss, :extension => ".rss.xml.php"
|
|
157
|
+
FPage.output(:rss).extension.should == ".rss.xml.php"
|
|
158
|
+
FPage.output(:rss).extension(true).should == ".rss.xml.php"
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# not sure I need this. The dynamic? flag is either set to always true in the output defn
|
|
162
|
+
# in which case you can use the :extension setting to just absolutely set the final output
|
|
163
|
+
# extension, or the rendered page is detected as dynamic by the templating system in which
|
|
164
|
+
# case it's most likely that the output language is the same as the templating system.
|
|
165
|
+
should "allow for setting a custom dynamic extension" do
|
|
166
|
+
FPage.add_output :fish, :format => :html, :dynamic => true, :language => "php"
|
|
167
|
+
FPage.output(:fish).extension.should == ".fish.php"
|
|
168
|
+
FPage.add_output :foul, :format => :html, :language => "php"
|
|
169
|
+
FPage.output(:foul).extension(true).should == ".foul.php"
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# What would be more useful perhaps is a way to define a custom, per output, test for "dynamicness"
|
|
173
|
+
should "allow for a custom test for dynamicness"
|
|
174
|
+
|
|
175
|
+
should "override extension even for dynamic outputs" do
|
|
176
|
+
FPage.add_output :fish, :dynamic => true, :extension => "php"
|
|
177
|
+
FPage.output(:fish).extension(true).should == ".php"
|
|
178
|
+
FPage.add_output :foul, :dynamic => true, :extension => ".php"
|
|
179
|
+
FPage.output(:foul).extension(true).should == ".php"
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
context "format classes" do
|
|
183
|
+
should "enable new formats" do
|
|
184
|
+
S::Output.unknown_format?(:fishhtml).should be_true
|
|
185
|
+
class FishHTMLFormat < S::Output::HTML
|
|
186
|
+
provides_format :fishhtml
|
|
187
|
+
end
|
|
188
|
+
S::Output.unknown_format?(:fishhtml).should be_false
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
should "inherit helper classes from their superclass" do
|
|
192
|
+
module CustomHelper1
|
|
193
|
+
def here_is_my_custom_helper1; end
|
|
194
|
+
end
|
|
195
|
+
Site.register_helper CustomHelper1, :newhtml
|
|
196
|
+
|
|
197
|
+
class NewHTMLFormat < S::Output::HTML
|
|
198
|
+
provides_format :newhtml
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
FPage.add_output :newhtml
|
|
202
|
+
page = FPage.new
|
|
203
|
+
output = page.output(:newhtml)
|
|
204
|
+
newhtml_context = output.context
|
|
205
|
+
html_context_ancestors = page.output(:html).context.ancestors[1..-1]
|
|
206
|
+
Set.new(newhtml_context.ancestors[1..-1]).should == Set.new(html_context_ancestors + [CustomHelper1])
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
38
210
|
context "instances" do
|
|
39
211
|
setup do
|
|
212
|
+
FPage.add_output :pdf, :dynamic => true
|
|
40
213
|
@page = FPage.new
|
|
41
214
|
end
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@page.
|
|
45
|
-
|
|
215
|
+
|
|
216
|
+
should "generate a list of output instances tied to the page" do
|
|
217
|
+
outputs = @page.outputs
|
|
218
|
+
outputs.map(&:class).should == [FPage.output(:html), FPage.output(:pdf)]
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
should "generate output instances tied to the page" do
|
|
222
|
+
@page.outputs.map(&:format).should == [:html, :pdf]
|
|
223
|
+
@page.default_output.format.should == :html
|
|
224
|
+
|
|
225
|
+
output = @page.output(:html)
|
|
226
|
+
output.must_be_instance_of FPage.output(:html)
|
|
227
|
+
output.page.should == @page
|
|
228
|
+
output.format.should == :html
|
|
229
|
+
output.dynamic?.should be_false
|
|
230
|
+
output.extension.should == ".html"
|
|
231
|
+
|
|
232
|
+
@page.output(:pdf).dynamic?.should be_true
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
should "provide a default output instance" do
|
|
236
|
+
output = @page.default_output
|
|
237
|
+
output.must_be_instance_of FPage.output(:html)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
should "know that they provide a certain format" do
|
|
241
|
+
@page.provides_output?(:html).should be_true
|
|
242
|
+
@page.provides_output?(:pdf).should be_true
|
|
243
|
+
@page.provides_output?(:xyz).should be_false
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
should "provide a symbol version of the output name" do
|
|
247
|
+
@page.output(:html).to_sym.should == :html
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
should "return the output instance if used as an output request" do
|
|
251
|
+
output = @page.output(:html)
|
|
252
|
+
@page.output(output).should == output
|
|
46
253
|
end
|
|
47
254
|
end
|
|
48
255
|
|
|
49
256
|
context "with custom formats" do
|
|
50
257
|
setup do
|
|
51
|
-
FPage.
|
|
258
|
+
FPage.outputs :rss, :html, :json
|
|
52
259
|
end
|
|
53
260
|
|
|
54
261
|
should "be able to define their supported formats" do
|
|
55
|
-
FPage.
|
|
262
|
+
FPage.outputs.map(&:format).should == [:rss, :html, :json]
|
|
56
263
|
end
|
|
57
264
|
|
|
58
265
|
should "re-define the default format" do
|
|
59
|
-
FPage.
|
|
266
|
+
FPage.default_output.format.should == :rss
|
|
60
267
|
end
|
|
61
268
|
|
|
62
269
|
should "have tests for supported formats" do
|
|
63
|
-
FPage.
|
|
64
|
-
FPage.
|
|
65
|
-
FPage.
|
|
66
|
-
FPage.
|
|
270
|
+
FPage.provides_output?(:html).should be_true
|
|
271
|
+
FPage.provides_output?(:rss).should be_true
|
|
272
|
+
FPage.provides_output?(:json).should be_true
|
|
273
|
+
FPage.provides_output?(:xyz).should be_false
|
|
67
274
|
end
|
|
68
275
|
|
|
69
|
-
should "raise an error if trying to use an unknown format without specifying a mime-type" do
|
|
70
|
-
lambda { FPage.formats [:xyz] }.must_raise(Spontaneous::UnknownFormatException)
|
|
71
|
-
end
|
|
72
276
|
|
|
73
277
|
should "accept new formats when accompanied by a mime-type" do
|
|
74
|
-
FPage.
|
|
278
|
+
FPage.outputs [:xyz, {:mimetype => "application/xyz"}]
|
|
75
279
|
end
|
|
76
280
|
|
|
77
281
|
should "allow addition of a single format" do
|
|
78
|
-
FPage.
|
|
79
|
-
FPage.
|
|
282
|
+
FPage.add_output :atom
|
|
283
|
+
FPage.outputs.map(&:format).should == [:rss, :html, :json, :atom]
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
should "allow custom post-processing of render" do
|
|
287
|
+
FPage.add_output :atom, :postprocess => lambda { |page, output| output.gsub(/a/, 'x') }
|
|
288
|
+
page = FPage.new
|
|
289
|
+
page.render(:atom).should =~ /<xtom>/
|
|
80
290
|
end
|
|
81
291
|
end
|
|
82
292
|
|
|
83
293
|
context "with custom mime-types" do
|
|
84
294
|
setup do
|
|
85
|
-
FPage.
|
|
295
|
+
FPage.outputs [ :html, {:mimetype => "application/xhtml+xml"}], [:js, {:mimetype => "application/json"} ]
|
|
86
296
|
end
|
|
87
297
|
|
|
88
298
|
should "still provide the correct default format" do
|
|
89
|
-
FPage.
|
|
299
|
+
FPage.default_output.format.should == :html
|
|
300
|
+
FPage.default_output.name.should == :html
|
|
90
301
|
end
|
|
91
302
|
|
|
92
|
-
should "return the custom mime-type for a
|
|
303
|
+
should "return the custom mime-type for a output" do
|
|
93
304
|
FPage.mime_type(:html).should == "application/xhtml+xml"
|
|
94
305
|
FPage.mime_type(:js).should == "application/json"
|
|
95
306
|
FPage.mime_type(:atom).should == "application/atom+xml"
|
|
@@ -100,9 +311,9 @@ class FormatsTest < MiniTest::Spec
|
|
|
100
311
|
page.mime_type(:html).should == "application/xhtml+xml"
|
|
101
312
|
end
|
|
102
313
|
|
|
103
|
-
should "allow addition of a single custom
|
|
104
|
-
FPage.
|
|
105
|
-
FPage.
|
|
314
|
+
should "allow addition of a single custom output" do
|
|
315
|
+
FPage.add_output :ddd, :mimetype => "application/ddd"
|
|
316
|
+
FPage.outputs.map(&:format).should == [:html, :js, :ddd]
|
|
106
317
|
page = FPage.new
|
|
107
318
|
page.mime_type(:ddd).should == "application/ddd"
|
|
108
319
|
end
|
|
@@ -110,7 +321,7 @@ class FormatsTest < MiniTest::Spec
|
|
|
110
321
|
|
|
111
322
|
context "with subclasses" do
|
|
112
323
|
setup do
|
|
113
|
-
FPage.
|
|
324
|
+
FPage.outputs :html, :rss, [:xxx, { :mimetype => "application/xxx" }]
|
|
114
325
|
class FSubPage < FPage
|
|
115
326
|
end
|
|
116
327
|
end
|
|
@@ -119,13 +330,35 @@ class FormatsTest < MiniTest::Spec
|
|
|
119
330
|
self.class.send(:remove_const, :FSubPage) rescue nil
|
|
120
331
|
end
|
|
121
332
|
|
|
122
|
-
should "inherit the list of provided
|
|
123
|
-
FSubPage.
|
|
333
|
+
should "inherit the list of provided outputs" do
|
|
334
|
+
FSubPage.outputs.should == FPage.outputs
|
|
124
335
|
end
|
|
336
|
+
|
|
125
337
|
should "inherit any custom mimetypes" do
|
|
126
338
|
FPage.mime_type(:xxx).should == "application/xxx"
|
|
127
339
|
FSubPage.mime_type(:xxx).should == "application/xxx"
|
|
128
340
|
end
|
|
129
341
|
end
|
|
342
|
+
|
|
343
|
+
context "that generate dynamic outputs" do
|
|
344
|
+
should "be able to specify that a output is always dynamic" do
|
|
345
|
+
FPage.add_output :rss, :dynamic => true
|
|
346
|
+
FPage.output(:rss).dynamic?.should be_true
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
should "be able to specify that a output with custom mimetype is always dynamic" do
|
|
350
|
+
FPage.add_output :mako, :mimetype => "application/x-mako", :dynamic => true
|
|
351
|
+
FPage.output(:mako).mime_type.should == "application/x-mako"
|
|
352
|
+
FPage.output(:mako).dynamic?.should be_true
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
should "be able to override the default dynamic extension" do
|
|
356
|
+
FPage.add_output :html, :dynamic => true, :language => "mako"
|
|
357
|
+
FPage.add_output :alternate, :mimetype => "text/html", :dynamic => true, :language => "mako"
|
|
358
|
+
FPage.output(:html).dynamic?.should be_true
|
|
359
|
+
FPage.output(:html).extension.should == ".html.mako"
|
|
360
|
+
FPage.output(:alternate).extension.should == ".alternate.mako"
|
|
361
|
+
end
|
|
362
|
+
end
|
|
130
363
|
end
|
|
131
364
|
end
|
data/test/unit/test_helpers.rb
CHANGED
|
@@ -4,9 +4,80 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
|
4
4
|
|
|
5
5
|
class HelpersTest < MiniTest::Spec
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
def setup
|
|
8
|
+
@site = setup_site
|
|
9
|
+
@site.paths.add :templates, File.expand_path("../../fixtures/helpers/templates", __FILE__)
|
|
10
|
+
@renderer = S::Output::Template::Renderer.new(false)
|
|
11
|
+
S::Output.renderer = @renderer
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def teardown
|
|
16
|
+
teardown_site
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context "Helpers" do
|
|
20
|
+
should "be assignable to a particular format" do
|
|
21
|
+
CustomHelper1 = Site.helper :html do
|
|
22
|
+
def here_is_my_custom_helper1; end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
included_helpers = [
|
|
26
|
+
CustomHelper1,
|
|
27
|
+
Spontaneous::Output::Helpers::ConditionalCommentHelper,
|
|
28
|
+
Spontaneous::Output::Helpers::ClassesHelper,
|
|
29
|
+
Spontaneous::Output::Helpers::ScriptHelper,
|
|
30
|
+
Spontaneous::Output::Helpers::StylesheetHelper
|
|
31
|
+
]
|
|
32
|
+
helper_module = Site.context :html
|
|
33
|
+
join = included_helpers & helper_module.ancestors
|
|
34
|
+
Set.new(join).should == Set.new(included_helpers)
|
|
35
|
+
helper_module.respond_to?(:here_is_my_custom_helper1).should be_true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
should "be assigned to all formats if none given" do
|
|
39
|
+
CustomHelper2 = Site.helper do
|
|
40
|
+
extend self
|
|
41
|
+
def here_is_my_custom_helper2; end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
assert CustomHelper2.respond_to?(:here_is_my_custom_helper2)
|
|
45
|
+
|
|
46
|
+
helper_module = Site.context :html
|
|
47
|
+
helper_module.ancestors.include?(CustomHelper2).should be_true
|
|
48
|
+
|
|
49
|
+
helper_module = Site.context :pdf
|
|
50
|
+
helper_module.ancestors.include?(CustomHelper2).should be_true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
should "be available during the render step" do
|
|
54
|
+
class Page < Spontaneous::Page
|
|
55
|
+
add_output :mobile
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
Site.helper :html do
|
|
59
|
+
def here_is_my_custom_helper3
|
|
60
|
+
"here_is_my_custom_helper3"
|
|
61
|
+
end
|
|
62
|
+
extend self
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Site.helper :mobile do
|
|
66
|
+
def here_is_my_custom_helper4
|
|
67
|
+
"here_is_my_custom_helper4"
|
|
68
|
+
end
|
|
69
|
+
extend self
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
page = Page.new
|
|
73
|
+
page.render(:html).should == "<here_is_my_custom_helper3>\n"
|
|
74
|
+
page.render(:mobile).should == "<here_is_my_custom_helper4>\n"
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context "Classes helper" do
|
|
8
79
|
setup do
|
|
9
|
-
@helper = Spontaneous::
|
|
80
|
+
@helper = Spontaneous::Output::Helpers::ClassesHelper
|
|
10
81
|
end
|
|
11
82
|
should "enable easy addition of classes" do
|
|
12
83
|
classes = @helper.classes("a", "b", "c", :active => false, :invisible => true)
|
|
@@ -28,6 +99,12 @@ class HelpersTest < MiniTest::Spec
|
|
|
28
99
|
classes = @helper.classes("a b c", :active => false, :invisible => true)
|
|
29
100
|
classes.should == %(class="a b c invisible")
|
|
30
101
|
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
context "ConditionalComment helper" do
|
|
105
|
+
setup do
|
|
106
|
+
@helper = Spontaneous::Output::Helpers::ConditionalCommentHelper
|
|
107
|
+
end
|
|
31
108
|
|
|
32
109
|
should "provide a wrapper around IE conditional comments" do
|
|
33
110
|
@helper.ie_only.should == "<!--[if IE]>"
|
data/test/unit/test_images.rb
CHANGED
|
@@ -55,6 +55,7 @@ class ImagesTest < MiniTest::Spec
|
|
|
55
55
|
class ::ResizingImageField < FieldTypes::ImageField
|
|
56
56
|
size :preview do
|
|
57
57
|
width 200
|
|
58
|
+
optimize!
|
|
58
59
|
end
|
|
59
60
|
size :tall do
|
|
60
61
|
height 200
|
|
@@ -113,6 +114,15 @@ class ImagesTest < MiniTest::Spec
|
|
|
113
114
|
@image.reformatted.src.should =~ /\.png$/
|
|
114
115
|
end
|
|
115
116
|
end
|
|
117
|
+
|
|
118
|
+
context "with optimization xxx" do
|
|
119
|
+
should "run jpegoptim" do
|
|
120
|
+
Spontaneous.expects(:system).with(regexp_matches(/jpegoptim/)).at_least_once
|
|
121
|
+
Spontaneous.expects(:system).with(regexp_matches(/jpegtran/)).at_least_once
|
|
122
|
+
@image.value = @origin_image.to_s
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
116
126
|
context "in templates" do
|
|
117
127
|
|
|
118
128
|
should "render an <img/> tag in HTML format" do
|
data/test/unit/test_layouts.rb
CHANGED
|
@@ -5,9 +5,9 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
|
5
5
|
class LayoutsTest < MiniTest::Spec
|
|
6
6
|
|
|
7
7
|
def setup
|
|
8
|
-
|
|
9
|
-
self.template_root = ::File.expand_path('../../fixtures/layouts', __FILE__)
|
|
8
|
+
@template_root = ::File.expand_path('../../fixtures/layouts', __FILE__)
|
|
10
9
|
@site = setup_site
|
|
10
|
+
@site.paths.add(:templates, @template_root)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def teardown
|
|
@@ -37,7 +37,7 @@ class LayoutsTest < MiniTest::Spec
|
|
|
37
37
|
end
|
|
38
38
|
should "default to layouts/standard.html... if nothing defined" do
|
|
39
39
|
page = LayoutPage.new
|
|
40
|
-
assert_correct_template(page, 'layouts/standard')
|
|
40
|
+
assert_correct_template(page, @template_root / 'layouts/standard')
|
|
41
41
|
page.render.should == "layouts/standard.html.cut\n"
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -45,14 +45,14 @@ class LayoutsTest < MiniTest::Spec
|
|
|
45
45
|
LayoutPage.layout :custom1
|
|
46
46
|
LayoutPage.layout :custom2
|
|
47
47
|
page = LayoutPage.new
|
|
48
|
-
assert_correct_template(page, 'layouts/custom1')
|
|
48
|
+
assert_correct_template(page, @template_root / 'layouts/custom1')
|
|
49
49
|
page.render.should == "layouts/custom1.html.cut\n"
|
|
50
50
|
end
|
|
51
51
|
should "return the layout declared default" do
|
|
52
52
|
LayoutPage.layout :custom1
|
|
53
53
|
LayoutPage.layout :custom2, :default => true
|
|
54
54
|
page = LayoutPage.new
|
|
55
|
-
assert_correct_template(page, 'layouts/custom2')
|
|
55
|
+
assert_correct_template(page, @template_root / 'layouts/custom2')
|
|
56
56
|
page.render.should == "layouts/custom2.html.cut\n"
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -60,7 +60,7 @@ class LayoutsTest < MiniTest::Spec
|
|
|
60
60
|
LayoutPage.layout :custom1
|
|
61
61
|
LayoutPage.layout :custom2, :default => true
|
|
62
62
|
page = SubPage.new
|
|
63
|
-
assert_correct_template(page, 'layouts/custom2')
|
|
63
|
+
assert_correct_template(page, @template_root / 'layouts/custom2')
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
should "be able to overwrite inherited templates from superclass" do
|
|
@@ -69,17 +69,17 @@ class LayoutsTest < MiniTest::Spec
|
|
|
69
69
|
SubPage.layout :custom3
|
|
70
70
|
page = SubPage.new
|
|
71
71
|
# page.layout.template.should == 'layouts/custom2'
|
|
72
|
-
assert_correct_template(page, 'layouts/custom2')
|
|
72
|
+
assert_correct_template(page, @template_root / 'layouts/custom2')
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
should "allow setting of style used" do
|
|
76
76
|
LayoutPage.layout :custom1
|
|
77
77
|
LayoutPage.layout :custom2
|
|
78
78
|
page = LayoutPage.new
|
|
79
|
-
assert_correct_template(page, 'layouts/custom1')
|
|
79
|
+
assert_correct_template(page, @template_root / 'layouts/custom1')
|
|
80
80
|
# page.layout.template.should == 'layouts/custom1'
|
|
81
81
|
page.layout = :custom2
|
|
82
|
-
assert_correct_template(page, 'layouts/custom2')
|
|
82
|
+
assert_correct_template(page, @template_root / 'layouts/custom2')
|
|
83
83
|
# page.layout.template.should == 'layouts/custom2'
|
|
84
84
|
end
|
|
85
85
|
|
|
@@ -89,9 +89,9 @@ class LayoutsTest < MiniTest::Spec
|
|
|
89
89
|
SubPage.layout :custom3
|
|
90
90
|
SubPage.layout :custom4
|
|
91
91
|
page = SubPage.new
|
|
92
|
-
assert_correct_template(page, 'layouts/custom3')
|
|
92
|
+
assert_correct_template(page, @template_root / 'layouts/custom3')
|
|
93
93
|
page.layout = :custom2
|
|
94
|
-
assert_correct_template(page, 'layouts/custom2')
|
|
94
|
+
assert_correct_template(page, @template_root / 'layouts/custom2')
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
should "allow defining of default layout in sub-classes" do
|
|
@@ -100,11 +100,19 @@ class LayoutsTest < MiniTest::Spec
|
|
|
100
100
|
SubPage.layout :custom3
|
|
101
101
|
SubPage.layout :custom4, :default => true
|
|
102
102
|
page = SubPage.new
|
|
103
|
-
assert_correct_template(page, 'layouts/custom4')
|
|
103
|
+
assert_correct_template(page, @template_root / 'layouts/custom4')
|
|
104
104
|
page.layout = :custom3
|
|
105
|
-
assert_correct_template(page, 'layouts/custom3')
|
|
105
|
+
assert_correct_template(page, @template_root / 'layouts/custom3')
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
should "support blocks to set simple templates" do
|
|
109
|
+
LayoutPage.field :title
|
|
110
|
+
LayoutPage.layout do
|
|
111
|
+
"${ title }!"
|
|
112
|
+
end
|
|
113
|
+
page = LayoutPage.new(:title => "john")
|
|
114
|
+
page.render.should == "john!"
|
|
115
|
+
end
|
|
108
116
|
# should "raise error when setting unknown layout" do
|
|
109
117
|
# LayoutPage.layout :custom1
|
|
110
118
|
# LayoutPage.layout :custom2
|