spontaneous 0.2.0.alpha2 → 0.2.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'sprockets'
|
2
|
+
require 'uglifier'
|
3
|
+
require 'sass'
|
4
|
+
|
5
|
+
module Spontaneous
|
6
|
+
module Asset
|
7
|
+
autoload :Source, "spontaneous/asset/source"
|
8
|
+
autoload :File, "spontaneous/asset/file"
|
9
|
+
|
10
|
+
# Takes assets from a source directory & compiles them to some destination directory.
|
11
|
+
# This is deliberatly dumb about the path to the
|
12
|
+
class AppCompiler
|
13
|
+
attr_reader :environment, :manifest
|
14
|
+
|
15
|
+
def initialize(gem_path, dest_path, options = {})
|
16
|
+
@options = {:compress => true}.merge(options)
|
17
|
+
@gem_path = gem_path
|
18
|
+
@dest_path = dest_path
|
19
|
+
@environment = Sprockets::Environment.new(gem_path / "application" )
|
20
|
+
@manifest = Sprockets::Manifest.new(@environment, @dest_path / "public/@spontaneous/assets")
|
21
|
+
|
22
|
+
@environment.append_path(gem_path / "application/js")
|
23
|
+
@environment.append_path(gem_path / "application/css")
|
24
|
+
|
25
|
+
if @options[:compress]
|
26
|
+
@environment.register_bundle_processor "application/javascript", :uglifier do |context, data|
|
27
|
+
Uglifier.compile(data)
|
28
|
+
end
|
29
|
+
|
30
|
+
@environment.register_bundle_processor "text/css", :sass_compressor do |context, css|
|
31
|
+
# By this point the SCSS has already been compiled, so SASS is merely a CSS compressor
|
32
|
+
# and I can ignore crap around loadpaths or filenames.
|
33
|
+
engine = ::Sass::Engine.new(css, :style => :compressed, :syntax => :scss, :quiet => true, :custom => { :resolver => self })
|
34
|
+
engine.render
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def compile
|
41
|
+
# @environment.each_logical_path.select { |path| path =~ /^static/ }.each do |path|
|
42
|
+
# puts path
|
43
|
+
# # @manifest.compile(path)
|
44
|
+
# end
|
45
|
+
|
46
|
+
@manifest.compile("spontaneous.js", "login.js", "require.js", "vendor/jquery.js", "spontaneous.css")
|
47
|
+
end
|
48
|
+
|
49
|
+
def image_path(path)
|
50
|
+
path
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
# module Spontaneous
|
56
|
+
# module Sass
|
57
|
+
# module Helpers
|
58
|
+
# def image_url(asset)
|
59
|
+
# ::Sass::Script::String.new "url(" + resolver.image_path(asset.value) + ")"
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# def resolver
|
63
|
+
# p options#[:quiet]
|
64
|
+
# options[:custom][:resolver]
|
65
|
+
# end
|
66
|
+
# end
|
67
|
+
# end
|
68
|
+
# end
|
69
|
+
# module Sass
|
70
|
+
# module Script
|
71
|
+
# module Functions
|
72
|
+
# include Spontaneous::Sass::Helpers
|
73
|
+
# end
|
74
|
+
# end
|
75
|
+
# end
|
data/lib/spontaneous/box.rb
CHANGED
@@ -140,7 +140,7 @@ module Spontaneous
|
|
140
140
|
field_store = []
|
141
141
|
default_values.each do |field_name, value|
|
142
142
|
if self.field?(field_name)
|
143
|
-
field = self.class.field_prototypes[field_name].to_field
|
143
|
+
field = self.class.field_prototypes[field_name].to_field(self)
|
144
144
|
field.unprocessed_value = value
|
145
145
|
field_store << field.serialize_db
|
146
146
|
end
|
@@ -212,7 +212,7 @@ module Spontaneous
|
|
212
212
|
@modified = true
|
213
213
|
# piece = contents[new_position]
|
214
214
|
# new_position = owner.pieces.index(piece)
|
215
|
-
owner.
|
215
|
+
owner.contents.set_position(entry, new_position)
|
216
216
|
end
|
217
217
|
|
218
218
|
def modified?
|
@@ -220,10 +220,12 @@ module Spontaneous
|
|
220
220
|
end
|
221
221
|
|
222
222
|
def contents
|
223
|
-
owner.
|
223
|
+
owner.contents.for_box(self)
|
224
224
|
end
|
225
225
|
|
226
|
-
|
226
|
+
def pieces
|
227
|
+
contents.select { |e| e.is_a?(Spontaneous::Piece) }
|
228
|
+
end
|
227
229
|
|
228
230
|
def [](index)
|
229
231
|
contents[index]
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
set :normalize_asset_timestamps, false
|
4
|
+
|
5
|
+
set :bundle_cmd, "bundle"
|
6
|
+
set :bundle_flags, "--deployment --quiet --binstubs --shebang ruby-local-exec"
|
7
|
+
|
8
|
+
# Remove tmp/pids from list of shared dirs that get symlinked into the release
|
9
|
+
set :shared_children, %w(public/system log)
|
10
|
+
|
11
|
+
set :media_dir, lambda { "#{deploy_to}/media" }
|
12
|
+
set :revision_dir, lambda { "#{deploy_to}/revisions" }
|
13
|
+
set :upload_dir, lambda { "#{deploy_to}/uploadcache" }
|
14
|
+
|
15
|
+
namespace :spot do
|
16
|
+
task :symlink_cache do
|
17
|
+
cache_dir = File.join(latest_release, 'cache')
|
18
|
+
run "mkdir #{cache_dir}; ln -s #{deploy_to}/media #{cache_dir}; ln -s #{deploy_to}/revisions #{cache_dir}; ln -s #{deploy_to}/uploadcache #{cache_dir}/tmp"
|
19
|
+
end
|
20
|
+
|
21
|
+
task :symlink_application do
|
22
|
+
run "cd #{release_path} && ln -s `bundle show spontaneous`/application public/.spontaneous"
|
23
|
+
end
|
24
|
+
|
25
|
+
# Capistrano automatically creates a tmp directory - I don't like that
|
26
|
+
# and would prefer to share tmp between instances
|
27
|
+
task :symlink_tmpdir do
|
28
|
+
run "cd #{release_path} && rmdir tmp ; ln -nfs #{deploy_to}/shared/tmp ."
|
29
|
+
end
|
30
|
+
|
31
|
+
task :bundle_assets do
|
32
|
+
run "cd #{release_path} && bundle exec spot assets:compile --destination=#{release_path}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
namespace :deploy do
|
37
|
+
task :migrate, :roles => :db do
|
38
|
+
spot_env = fetch(:spot_env, "production")
|
39
|
+
run "cd #{latest_release} && SPOT_ENV=#{spot_env} ./bin/spot migrate"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
after 'deploy:finalize_update', 'spot:symlink_cache'
|
44
|
+
after 'deploy:finalize_update', 'spot:symlink_tmpdir'
|
45
|
+
after 'bundle:install', 'spot:symlink_application'
|
46
|
+
after 'bundle:install', 'spot:bundle_assets'
|
47
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
# TODO: make opts take a list of excludes and turn this into params for the rsync
|
4
|
+
def rsync(origin, destination, opts = {})
|
5
|
+
cmd = %(rsync -rtDzv --chmod=ugo=rwX -e 'ssh -p #{ssh_options[:port]}' --force #{origin}/ #{destination})
|
6
|
+
system cmd
|
7
|
+
end
|
8
|
+
|
9
|
+
def remote_directory(server, path)
|
10
|
+
"#{user}@#{server}:#{path}"
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :sync do
|
14
|
+
desc "Sync the local version to the remote one"
|
15
|
+
task :default do
|
16
|
+
down
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Sync the remote system to the local one"
|
20
|
+
task :up do
|
21
|
+
database.up
|
22
|
+
media.up
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Sync the local version to the remote one"
|
26
|
+
task :down do
|
27
|
+
database.down
|
28
|
+
media.down
|
29
|
+
end
|
30
|
+
|
31
|
+
namespace :database do
|
32
|
+
desc "Sync the local database to the server version"
|
33
|
+
task :default do
|
34
|
+
down
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Sync the local database to the server version"
|
38
|
+
task :down do
|
39
|
+
puts "syncing database DOWN"
|
40
|
+
dumpfilename = ENV['dumpfile'] || "#{Time.now.to_i}.mysql.gz"
|
41
|
+
run %(cd #{current_path} && ./bin/rake db:dump dumpfile=#{dumpfilename} )
|
42
|
+
dump_file = "tmp/#{dumpfilename}"
|
43
|
+
top.download(File.join(current_path, dump_file), dump_file)
|
44
|
+
system "bundle exec rake db:load dumpfile=#{dump_file}"
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Sync the server's version of the database to the local one"
|
48
|
+
task :up do
|
49
|
+
puts "syncing database UP"
|
50
|
+
dumpfilename = ENV['dumpfile'] || "#{Time.now.to_i}.mysql.gz"
|
51
|
+
dump_file = "tmp/#{dumpfilename}"
|
52
|
+
dumper = ::Spontaneous::Utils::Database.dumper_for_database
|
53
|
+
dumper.dump(dump_file)
|
54
|
+
remote_dump_file = File.join(deploy_to, dumpfilename)
|
55
|
+
top.upload(dump_file, remote_dump_file)
|
56
|
+
run %(cd #{current_path} && bundle exec rake db:load dumpfile=#{remote_dump_file} )
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
namespace :media do
|
61
|
+
desc ""
|
62
|
+
task :default do
|
63
|
+
down
|
64
|
+
end
|
65
|
+
|
66
|
+
desc ""
|
67
|
+
task :down do
|
68
|
+
roles[:media].each do |server|
|
69
|
+
top.rsync(remote_directory(server, media_dir), "cache/media/")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
desc ""
|
74
|
+
task :up do
|
75
|
+
roles[:media].each do |server|
|
76
|
+
top.rsync("cache/media", remote_directory(server, media_dir))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Load Spontaneous specific deployment tasks
|
2
|
+
%w(deploy sync).each do |task|
|
3
|
+
load File.expand_path("../capistrano/#{task}.rb", __FILE__)
|
4
|
+
end
|
5
|
+
|
6
|
+
# Fix for ActiveSupport breaking Capistrano's #capture method.
|
7
|
+
# See this thread:
|
8
|
+
# https://github.com/capistrano/capistrano/issues/168
|
9
|
+
Capistrano::Configuration::Namespaces::Namespace.class_eval do
|
10
|
+
def capture(*args)
|
11
|
+
parent.capture *args
|
12
|
+
end
|
13
|
+
end
|
data/lib/spontaneous/change.rb
CHANGED
@@ -1,66 +1,26 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Spontaneous
|
4
|
-
class Change
|
5
|
-
class << self
|
6
|
-
alias_method :sequel_plugin, :plugin
|
7
|
-
end
|
8
|
-
|
9
|
-
sequel_plugin :serialization, :yajl, :modified_list
|
4
|
+
class Change
|
10
5
|
|
11
|
-
@@instance = nil
|
12
6
|
|
13
7
|
class << self
|
14
|
-
def
|
15
|
-
|
16
|
-
@@instance ||= self.new(:modified_list => [])
|
17
|
-
yield if block_given?
|
18
|
-
ensure
|
19
|
-
if entry_point and !@@instance.modified_list.empty?
|
20
|
-
@@instance.save
|
21
|
-
end
|
22
|
-
@@instance = nil if entry_point
|
23
|
-
end
|
24
|
-
|
25
|
-
def recording?
|
26
|
-
!@@instance.nil?
|
27
|
-
end
|
28
|
-
|
29
|
-
def push(page)
|
30
|
-
if @@instance
|
31
|
-
@@instance.push(page)
|
32
|
-
end
|
8
|
+
def outstanding
|
9
|
+
unpublished_changes
|
33
10
|
end
|
34
11
|
|
35
|
-
def
|
36
|
-
|
37
|
-
dependencies.map { |d| Spontaneous::Collections::ChangeSet.new(d) }
|
12
|
+
def unpublished_changes
|
13
|
+
changes = unpublished_pages.map { |page| Change.new(page) }
|
38
14
|
end
|
39
15
|
|
40
|
-
def
|
41
|
-
|
42
|
-
begin
|
43
|
-
modified = false
|
44
|
-
grouped_changes.each_with_index do |inner, i|
|
45
|
-
inner_ids = inner.map { |c| c.modified_list }.flatten
|
46
|
-
grouped_changes[(i+1)..-1].each_with_index do |outer, j|
|
47
|
-
outer_ids = outer.map { |c| c.modified_list }.flatten
|
48
|
-
unless (inner_ids & outer_ids).empty?
|
49
|
-
modified = true
|
50
|
-
grouped_changes.delete(outer)
|
51
|
-
grouped_changes[i] += outer
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end while modified
|
56
|
-
|
57
|
-
grouped_changes
|
16
|
+
def unpublished_pages
|
17
|
+
S::Page.filter { (modified_at > last_published_at) | {:first_published_at => nil} }.order(:modified_at.desc).all
|
58
18
|
end
|
59
19
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
|
20
|
+
def include_dependencies(page_list)
|
21
|
+
changes = page_list.map { |page| Change.new(page) }
|
22
|
+
pages = changes.map { |change| change.all_pages }.flatten.uniq
|
23
|
+
pages
|
64
24
|
end
|
65
25
|
|
66
26
|
def export
|
@@ -72,36 +32,68 @@ module Spontaneous
|
|
72
32
|
end
|
73
33
|
end
|
74
34
|
|
35
|
+
attr_reader :page
|
75
36
|
|
76
|
-
def
|
77
|
-
|
78
|
-
self.modified_list ||= []
|
37
|
+
def initialize(page)
|
38
|
+
@page = page
|
79
39
|
end
|
80
40
|
|
81
|
-
def
|
82
|
-
|
41
|
+
def all_pages
|
42
|
+
[page].concat(dependent)
|
83
43
|
end
|
84
44
|
|
85
|
-
|
86
|
-
|
45
|
+
# Calculates all the pages we would have to publish along with this in order to root
|
46
|
+
# this page into the site hierarchy.
|
47
|
+
#
|
48
|
+
# Returns: a list of dependent pages in ancestor order (ascending depth with root first)
|
49
|
+
def dependent
|
50
|
+
@dependent ||= page.ancestors.reverse.take_while { |ancestor| ancestor.never_published? }.reverse
|
87
51
|
end
|
88
52
|
|
89
|
-
def
|
90
|
-
|
53
|
+
def page_id
|
54
|
+
page.id
|
91
55
|
end
|
92
56
|
|
93
|
-
|
57
|
+
def export_page(page)
|
58
|
+
{ :id => page.id,
|
59
|
+
:title => page.title.to_s,
|
60
|
+
:depth => page.depth,
|
61
|
+
:url => page.path,
|
62
|
+
:side_effects => export_side_effects(page),
|
63
|
+
:published_at => export_timestamp(page.last_published_at),
|
64
|
+
:modified_at => export_timestamp(page.modified_at) }
|
65
|
+
end
|
66
|
+
|
67
|
+
def export_side_effects(page)
|
68
|
+
side_effects = Hash.new { |h, k| h[k] = [] }
|
69
|
+
page.pending_modifications.map do |modification|
|
70
|
+
side_effects[modification.type] << {
|
71
|
+
:count => modification.count,
|
72
|
+
:created_at => export_timestamp(modification.created_at),
|
73
|
+
:old_value => modification.old_value,
|
74
|
+
:new_value => modification.new_value
|
75
|
+
}
|
76
|
+
end
|
77
|
+
side_effects
|
78
|
+
end
|
94
79
|
|
95
|
-
def
|
96
|
-
|
80
|
+
def modified_at
|
81
|
+
page.modified_at
|
82
|
+
end
|
83
|
+
|
84
|
+
def export_timestamp(timestamp)
|
85
|
+
return nil if timestamp.nil?
|
86
|
+
timestamp.httpdate
|
97
87
|
end
|
98
88
|
|
99
89
|
def export
|
100
|
-
{
|
101
|
-
:
|
102
|
-
|
103
|
-
|
104
|
-
|
90
|
+
export_page(page).merge({
|
91
|
+
:dependent => dependent.map { |p| export_page(p) }
|
92
|
+
})
|
93
|
+
end
|
94
|
+
|
95
|
+
def inspect
|
96
|
+
%(#<Spontaneous::Change page=#{page.id} dependent=#{dependent.map(&:id).inspect}>)
|
105
97
|
end
|
106
98
|
end
|
107
99
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Spontaneous
|
2
|
+
module Cli
|
3
|
+
class Assets < ::Spontaneous::Cli::Thor
|
4
|
+
Spontaneous = ::Spontaneous
|
5
|
+
namespace :assets
|
6
|
+
default_task :compile
|
7
|
+
|
8
|
+
|
9
|
+
# class Up < SyncTask
|
10
|
+
# desc "Syncs up"
|
11
|
+
# end
|
12
|
+
|
13
|
+
desc "#{namespace}:compile", "Compiles assets for the Spontaneous UI"
|
14
|
+
method_option :destination, :type => :string, :aliases => "-d", :required => true, :desc => "Compile assets into DESTINATION"
|
15
|
+
def compile
|
16
|
+
prepare(:compile)
|
17
|
+
# options[:mode] = :console
|
18
|
+
# Find path to install of Spontaneous using bundler and then
|
19
|
+
# use this path as params to compiler
|
20
|
+
spec = Bundler.load.specs.find{|s| s.name == "spontaneous" }
|
21
|
+
p spec.full_gem_path
|
22
|
+
|
23
|
+
compiler = Spontaneous::Asset::AppCompiler.new(spec.full_gem_path, options.destination)
|
24
|
+
compiler.compile
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/lib/spontaneous/cli/base.rb
CHANGED
@@ -127,54 +127,6 @@ module Spontaneous
|
|
127
127
|
say " >> Done"
|
128
128
|
end
|
129
129
|
|
130
|
-
desc :adduser, "Add a user"
|
131
|
-
def adduser
|
132
|
-
prepare :adduser
|
133
|
-
boot!
|
134
|
-
users = Spontaneous::Permissions::User.count
|
135
|
-
attrs = {}
|
136
|
-
width = 12
|
137
|
-
valid_login = /^[a-z0-9_]{3,}$/
|
138
|
-
levels = Spontaneous::Permissions::UserLevel.all.map(&:to_s)
|
139
|
-
level = nil
|
140
|
-
|
141
|
-
say("\nAll fields are required:\n", :green)
|
142
|
-
begin
|
143
|
-
attrs[:login] = ask "Login : ".rjust(width, " ")
|
144
|
-
say("Login must consist of at least 3 letters, numbers and underscores", :red) unless valid_login === attrs[:login]
|
145
|
-
end while attrs[:login] !~ valid_login
|
146
|
-
|
147
|
-
attrs[:name] = ask "Name : ".rjust(width, " ")
|
148
|
-
attrs[:email] = ask "Email : ".rjust(width, " ")
|
149
|
-
|
150
|
-
begin
|
151
|
-
attrs[:password] = ask "Password : ".rjust(width, " ")
|
152
|
-
say("Password must be at least 6 characters long", :red) unless attrs[:password].length > 5
|
153
|
-
end while attrs[:password].length < 6
|
154
|
-
|
155
|
-
if users == 0
|
156
|
-
level = "root"
|
157
|
-
else
|
158
|
-
begin
|
159
|
-
level = ask("User level [#{levels.join(', ')}] : ")
|
160
|
-
say("Invalid level '#{level}'", :red) unless levels.include?(level)
|
161
|
-
end while !levels.include?(level)
|
162
|
-
end
|
163
|
-
|
164
|
-
attrs[:password_confirmation] = attrs[:password]
|
165
|
-
user = Spontaneous::Permissions::User.new(attrs)
|
166
|
-
|
167
|
-
if user.save
|
168
|
-
user.update(:level => level)
|
169
|
-
say("\nUser '#{user.login}' created with level '#{user.level}'", :green)
|
170
|
-
else
|
171
|
-
errors = user.errors.map do | a, e |
|
172
|
-
" - '#{a.to_s.capitalize}' #{e.first}"
|
173
|
-
end.join("\n")
|
174
|
-
say("\nInvalid user details:\n"+errors, :red)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
130
|
private
|
179
131
|
|
180
132
|
|
@@ -13,12 +13,12 @@ module Spontaneous
|
|
13
13
|
|
14
14
|
class_option :no_browser, :type => :boolean, :default => false, :aliases => "-b", :desc => "Don't launch browser"
|
15
15
|
|
16
|
-
desc "#{namespace}:start", "Starts
|
16
|
+
desc "#{namespace}:start", "Starts Spontaneous in development mode"
|
17
17
|
def start
|
18
18
|
File.open(".Procfile", 'wb') do |procfile|
|
19
|
-
procfile.write(%(back: #{binary} server:back\n))
|
20
|
-
procfile.write(%(front: #{binary} server:front\n))
|
21
|
-
procfile.write(%(simultaneous: #{binary} server:simultaneous\n))
|
19
|
+
procfile.write(%(back: #{binary} server:back --root=#{options.site}\n))
|
20
|
+
procfile.write(%(front: #{binary} server:front --root=#{options.site}\n))
|
21
|
+
procfile.write(%(simultaneous: #{binary} server:simultaneous --root=#{options.site}\n))
|
22
22
|
procfile.flush
|
23
23
|
engine = ::Foreman::Engine.new(procfile.path)
|
24
24
|
engine.start
|
@@ -48,8 +48,10 @@ module Spontaneous
|
|
48
48
|
boot!
|
49
49
|
connection = options[:connection] || ::Spontaneous.config.simultaneous_connection
|
50
50
|
fork {
|
51
|
+
ENV.delete("BUNDLE_GEMFILE")
|
51
52
|
puts("#{Simultaneous.server_binary} -c #{connection} --debug")
|
52
53
|
exec("#{Simultaneous.server_binary} -c #{connection} --debug")
|
54
|
+
# sleep 10
|
53
55
|
}
|
54
56
|
Process.wait
|
55
57
|
end
|
data/lib/spontaneous/cli/site.rb
CHANGED
@@ -3,16 +3,15 @@ require 'spontaneous/cli'
|
|
3
3
|
module Spontaneous
|
4
4
|
module Cli
|
5
5
|
class Site < ::Spontaneous::Cli::Thor
|
6
|
-
Spontaneous = ::Spontaneous
|
7
6
|
namespace :site
|
8
7
|
|
9
8
|
default_task :browse
|
10
9
|
|
11
|
-
|
10
|
+
module DumpTask
|
12
11
|
protected
|
13
12
|
|
14
13
|
def db_adapter
|
15
|
-
::Spontaneous::Utils::Database.dumper_for_database(database)
|
14
|
+
@db_adapter ||= ::Spontaneous::Utils::Database.dumper_for_database(database)
|
16
15
|
end
|
17
16
|
|
18
17
|
def sqldump(path)
|
@@ -32,11 +31,11 @@ module Spontaneous
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def database_dumpfile
|
35
|
-
dump_path / "database.
|
34
|
+
dump_path / "database.#{db_adapter.name}.gz"
|
36
35
|
end
|
37
36
|
|
38
37
|
def database
|
39
|
-
Spontaneous.database
|
38
|
+
::Spontaneous.database
|
40
39
|
end
|
41
40
|
|
42
41
|
def dump_path
|
@@ -44,16 +43,19 @@ module Spontaneous
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def dump_root
|
47
|
-
Spontaneous.cache_dir('dump')
|
46
|
+
::Spontaneous.cache_dir('dump')
|
48
47
|
end
|
49
48
|
|
50
49
|
def relative_dir(path)
|
51
50
|
path = Pathname.new(path)
|
52
|
-
path.relative_path_from(Pathname.new(Spontaneous.root)).to_s
|
51
|
+
path.relative_path_from(Pathname.new(::Spontaneous.root)).to_s
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
56
|
-
|
55
|
+
|
56
|
+
class Dump < ::Thor::Group
|
57
|
+
include DumpTask
|
58
|
+
|
57
59
|
def create_dump_dir
|
58
60
|
::FileUtils.mkdir_p(dump_path)
|
59
61
|
end
|
@@ -64,15 +66,17 @@ module Spontaneous
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def archive_media
|
67
|
-
tmp = relative_dir(Spontaneous.media_dir('tmp'))
|
68
|
-
src = relative_dir(Spontaneous.media_dir)
|
69
|
+
tmp = relative_dir(::Spontaneous.media_dir('tmp'))
|
70
|
+
src = relative_dir(::Spontaneous.media_dir)
|
69
71
|
say "Creating media archive at '#{relative_dir(media_archive)}'", :green
|
70
72
|
cmd = %(tar czf #{media_archive} --exclude #{tmp} #{src})
|
71
73
|
system(cmd)
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
75
|
-
class Load <
|
77
|
+
class Load < ::Thor::Group
|
78
|
+
include DumpTask
|
79
|
+
|
76
80
|
def find_latest_dump
|
77
81
|
root = Pathname.new(dump_root)
|
78
82
|
@id = root.entries.
|
@@ -109,24 +113,31 @@ module Spontaneous
|
|
109
113
|
end
|
110
114
|
|
111
115
|
desc "#{namespace}:publish", "Publishes the site"
|
112
|
-
method_option :
|
116
|
+
method_option :pages, :type => :array, :desc => "List of pages to publish"
|
113
117
|
method_option :logfile, :type => :string, :desc => "Location of logfile"
|
114
118
|
def publish
|
115
119
|
prepare :publish
|
116
|
-
# TODO: set up logging
|
117
120
|
boot!
|
118
121
|
::Site.publishing_method = :immediate
|
119
|
-
Spontaneous::Logger.setup(:logfile => options.logfile) if options.logfile
|
122
|
+
::Spontaneous::Logger.setup(:logfile => options.logfile) if options.logfile
|
120
123
|
say "Creating revision #{::Site.revision}", :green, true
|
121
|
-
if options.
|
122
|
-
say "> Publishing
|
123
|
-
::Site.
|
124
|
+
if options.pages
|
125
|
+
say "> Publishing pages #{options.pages.inspect}", :green, true
|
126
|
+
::Site.publish_pages(options.pages)
|
124
127
|
else
|
125
128
|
say "> Publishing all", :green, true
|
126
129
|
::Site.publish_all
|
127
130
|
end
|
128
131
|
end
|
129
132
|
|
133
|
+
desc "#{namespace}:render", "Re-renders the current content"
|
134
|
+
def render
|
135
|
+
prepare :render
|
136
|
+
boot!
|
137
|
+
::Site.publishing_method = :immediate
|
138
|
+
::Site.rerender
|
139
|
+
end
|
140
|
+
|
130
141
|
desc "#{namespace}:revision", "Shows the site status"
|
131
142
|
def revision
|
132
143
|
prepare :revision
|