crystal-ext 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Rakefile +66 -0
- data/lib/abstract_interface/controller_helper.rb +30 -0
- data/lib/abstract_interface/form_builders/abstract_form_builder.rb +79 -0
- data/lib/abstract_interface/form_builders/themed_form_builder.rb +46 -0
- data/lib/abstract_interface/form_builders/themed_form_tag_builder.rb +13 -0
- data/lib/abstract_interface/haml_builder.rb +56 -0
- data/lib/abstract_interface/model_stub.rb +20 -0
- data/lib/abstract_interface/support.rb +56 -0
- data/lib/abstract_interface/theme.rb +37 -0
- data/lib/abstract_interface/view_builder.rb +158 -0
- data/lib/abstract_interface/view_helper.rb +31 -0
- data/lib/abstract_interface.rb +78 -0
- data/lib/common_interface/MIT-LICENSE +20 -0
- data/lib/common_interface/README.md +51 -0
- data/lib/common_interface/app/controllers/theme_controller.rb +65 -0
- data/lib/common_interface/app/controllers/theme_site_controller.rb +2 -0
- data/lib/common_interface/app/views/layouts/theme.html.erb +1 -0
- data/lib/common_interface/app/views/layouts/theme.js.erb +11 -0
- data/lib/common_interface/app/views/theme/_dialog.html.haml +7 -0
- data/lib/common_interface/app/views/theme/_popup.html.haml +4 -0
- data/lib/common_interface/app/views/theme/aspects.html.haml +32 -0
- data/lib/common_interface/app/views/theme/basic.html.haml +123 -0
- data/lib/common_interface/app/views/theme/dialog.js.erb +1 -0
- data/lib/common_interface/app/views/theme/folder.html.haml +45 -0
- data/lib/common_interface/app/views/theme/help.html.haml +7 -0
- data/lib/common_interface/app/views/theme/index.html.haml +24 -0
- data/lib/common_interface/app/views/theme/items.html.haml +91 -0
- data/lib/common_interface/app/views/theme/list.html.haml +23 -0
- data/lib/common_interface/app/views/theme/page/_folder.html.haml +10 -0
- data/lib/common_interface/app/views/theme/page/_note.html.haml +4 -0
- data/lib/common_interface/app/views/theme/page/_toolbar.html.haml +5 -0
- data/lib/common_interface/app/views/theme/page.html.haml +19 -0
- data/lib/common_interface/app/views/theme/popup.js.erb +1 -0
- data/lib/common_interface/app/views/theme/selector.html.haml +38 -0
- data/lib/common_interface/app/views/theme/style.html.erb +113 -0
- data/lib/common_interface/app/views/theme/tmp.html.erb +31 -0
- data/lib/common_interface/app/views/theme/user.html.haml +16 -0
- data/lib/common_interface/app/views/theme_shared/_comments.html.haml +11 -0
- data/lib/common_interface/app/views/theme_shared/_core_tools.html.haml +6 -0
- data/lib/common_interface/app/views/theme_shared/_line_previews.html.haml +39 -0
- data/lib/common_interface/app/views/theme_shared/_paginator.html.haml +7 -0
- data/lib/common_interface/app/views/theme_shared/_tools.html.haml +27 -0
- data/lib/common_interface/app/views/theme_shared/_top_navigation_bottom.html.haml +32 -0
- data/lib/common_interface/app/views/theme_site/blog.html.haml +13 -0
- data/lib/common_interface/app/views/theme_site/home.html.haml +9 -0
- data/lib/common_interface/app/views/theme_site/post.html.haml +11 -0
- data/lib/common_interface/app/views/theme_site/style.html.haml +9 -0
- data/lib/common_interface/app/views/themes/default/_application_t.html.haml +29 -0
- data/lib/common_interface/app/views/themes/default/_help_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/aspects/_comment_t.html.haml +14 -0
- data/lib/common_interface/app/views/themes/default/aspects/_controls_t.html.haml +3 -0
- data/lib/common_interface/app/views/themes/default/aspects/_details_t.html.haml +6 -0
- data/lib/common_interface/app/views/themes/default/aspects/_discussion_t.html.haml +9 -0
- data/lib/common_interface/app/views/themes/default/aspects/_paginator_t.html.haml +8 -0
- data/lib/common_interface/app/views/themes/default/aspects/_tag_selector_t.html.haml +11 -0
- data/lib/common_interface/app/views/themes/default/basic/_bottom_panel_t.html.haml +9 -0
- data/lib/common_interface/app/views/themes/default/basic/_dialog_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/basic/_divider_t.html.haml +2 -0
- data/lib/common_interface/app/views/themes/default/basic/_html_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/basic/_inplace_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/basic/_message_t.html.haml +3 -0
- data/lib/common_interface/app/views/themes/default/basic/_more_t.html.haml +5 -0
- data/lib/common_interface/app/views/themes/default/basic/_narrow_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/basic/_navigation_t.html.haml +9 -0
- data/lib/common_interface/app/views/themes/default/basic/_popup_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/basic/_text_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/basic/_title_t.html.haml +3 -0
- data/lib/common_interface/app/views/themes/default/basic/_tool_t.html.haml +4 -0
- data/lib/common_interface/app/views/themes/default/basic/_top_panel_t.html.haml +18 -0
- data/lib/common_interface/app/views/themes/default/components/_basic_list_item_t.html.haml +4 -0
- data/lib/common_interface/app/views/themes/default/components/_basic_list_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/components/_table_row_t.html.haml +5 -0
- data/lib/common_interface/app/views/themes/default/components/_table_t.html.haml +12 -0
- data/lib/common_interface/app/views/themes/default/components/_tabs_item_t.html.haml +4 -0
- data/lib/common_interface/app/views/themes/default/components/_tabs_t.html.haml +4 -0
- data/lib/common_interface/app/views/themes/default/components/_toolbar_t.html.haml +14 -0
- data/lib/common_interface/app/views/themes/default/forms/_begin_t.html.erb +3 -0
- data/lib/common_interface/app/views/themes/default/forms/_end_t.html.erb +3 -0
- data/lib/common_interface/app/views/themes/default/forms/_errors_t.html.haml +5 -0
- data/lib/common_interface/app/views/themes/default/forms/_field_t.html.haml +19 -0
- data/lib/common_interface/app/views/themes/default/forms/_line_t.html.haml +6 -0
- data/lib/common_interface/app/views/themes/default/items/_file_t.html.haml +19 -0
- data/lib/common_interface/app/views/themes/default/items/_folder_t.html.haml +23 -0
- data/lib/common_interface/app/views/themes/default/items/_line_t.html.haml +34 -0
- data/lib/common_interface/app/views/themes/default/items/_list_item_t.html.haml +16 -0
- data/lib/common_interface/app/views/themes/default/items/_list_t.html.haml +35 -0
- data/lib/common_interface/app/views/themes/default/items/_note_t.html.haml +16 -0
- data/lib/common_interface/app/views/themes/default/items/_page_t.html.haml +29 -0
- data/lib/common_interface/app/views/themes/default/items/_selector_t.html.haml +18 -0
- data/lib/common_interface/app/views/themes/default/items/_thumb_t.html.haml +12 -0
- data/lib/common_interface/app/views/themes/default/items/_user_t.html.haml +12 -0
- data/lib/common_interface/app/views/themes/default/layout_templates/_dashboard_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/default/layout_templates/_default_t.html.haml +11 -0
- data/lib/common_interface/app/views/themes/default/metadata.rb +117 -0
- data/lib/common_interface/app/views/themes/simple_organization/_application_js_t.html.erb +12 -0
- data/lib/common_interface/app/views/themes/simple_organization/_application_t.html.erb +45 -0
- data/lib/common_interface/app/views/themes/simple_organization/_help_t.html.erb +1 -0
- data/lib/common_interface/app/views/themes/simple_organization/aspects/_comment_t.html.haml +21 -0
- data/lib/common_interface/app/views/themes/simple_organization/aspects/_discussion_t.html.haml +14 -0
- data/lib/common_interface/app/views/themes/simple_organization/aspects/_paginator_t.html.haml +5 -0
- data/lib/common_interface/app/views/themes/simple_organization/aspects/_tag_selector_t.html.haml +10 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_bottom_panel_t.html.erb +12 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_divider_t.html.erb +3 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_message_t.html.erb +7 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_more_t.html.haml +5 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_navigation_t.html.erb +15 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_text_t.html.haml +1 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_tool_t.html.erb +9 -0
- data/lib/common_interface/app/views/themes/simple_organization/basic/_top_panel_t.html.erb +14 -0
- data/lib/common_interface/app/views/themes/simple_organization/items/_line_t.html.haml +17 -0
- data/lib/common_interface/app/views/themes/simple_organization/items/_note_t.html.haml +16 -0
- data/lib/common_interface/app/views/themes/simple_organization/items/_selector_t.html.haml +11 -0
- data/lib/common_interface/app/views/themes/simple_organization/layout_templates/_default_t.html.erb +20 -0
- data/lib/common_interface/app/views/themes/simple_organization/layout_templates/_home_t.html.erb +14 -0
- data/lib/common_interface/app/views/themes/simple_organization/metadata.rb +193 -0
- data/lib/common_interface/asset_packages.yml +89 -0
- data/lib/common_interface/init.rb +21 -0
- data/lib/common_interface/lib/common_interface_helper.rb +49 -0
- data/lib/common_interface/public/common_interface/images/img1.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img1_200.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img1_icon.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img1_thumb.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img2.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img2_200.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img2_icon.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img2_thumb.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img3.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img3_200.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img3_icon.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/img3_thumb.jpg +0 -0
- data/lib/common_interface/public/common_interface/images/video_icon.png +0 -0
- data/lib/common_interface/public/common_interface/js/aspects.js +0 -0
- data/lib/common_interface/public/common_interface/js/basic.js +229 -0
- data/lib/common_interface/public/common_interface/js/files_upload.js +115 -0
- data/lib/common_interface/public/common_interface/js/items.js +118 -0
- data/lib/common_interface/public/common_interface/js/style.js +50 -0
- data/lib/common_interface/public/common_interface/lib/jquery.elastic.js +117 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/blank.gif +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_close.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_loading.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_nav_left.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_nav_right.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_e.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_n.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_ne.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_nw.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_s.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_se.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_sw.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_w.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_left.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_main.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_over.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_right.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancybox-x.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancybox-y.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancybox.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.easing-1.3.pack.js +72 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.fancybox-1.3.1.js +1077 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.fancybox.css +363 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.fancybox.js +44 -0
- data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.mousewheel-3.0.2.pack.js +13 -0
- data/lib/common_interface/public/common_interface/lib/jquery.form.js +660 -0
- data/lib/common_interface/public/common_interface/lib/jquery.hoverIntent.js +111 -0
- data/lib/common_interface/public/common_interface/lib/jquery.jgrowl/jquery.jgrowl.css +128 -0
- data/lib/common_interface/public/common_interface/lib/jquery.jgrowl/jquery.jgrowl.js +307 -0
- data/lib/common_interface/public/common_interface/lib/jquery.js +4376 -0
- data/lib/common_interface/public/common_interface/lib/jquery.json.js +178 -0
- data/lib/common_interface/public/common_interface/lib/jquery.swfupload/cancel.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.swfupload/jquery.swfupload.js +64 -0
- data/lib/common_interface/public/common_interface/lib/jquery.swfupload/style.css +8 -0
- data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/swfupload.js +980 -0
- data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/swfupload.queue.js +98 -0
- data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/swfupload.swf +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/wdp_buttons_upload_61x22.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.template.js +255 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_222222_256x240.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_228ef1_256x240.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_ef8c08_256x240.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_ffd27a_256x240.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/jquery.ui.css +406 -0
- data/lib/common_interface/public/common_interface/lib/jquery.ui/jquery.ui.js +71 -0
- data/lib/common_interface/public/common_interface/themes/default/_aspects.scss +58 -0
- data/lib/common_interface/public/common_interface/themes/default/_basic.scss +228 -0
- data/lib/common_interface/public/common_interface/themes/default/_components.scss +151 -0
- data/lib/common_interface/public/common_interface/themes/default/_custom_reset.scss +12 -0
- data/lib/common_interface/public/common_interface/themes/default/_elastic.scss +72 -0
- data/lib/common_interface/public/common_interface/themes/default/_items.scss +88 -0
- data/lib/common_interface/public/common_interface/themes/default/_mixins.scss +39 -0
- data/lib/common_interface/public/common_interface/themes/default/_special.scss +34 -0
- data/lib/common_interface/public/common_interface/themes/default/_variables.scss +15 -0
- data/lib/common_interface/public/common_interface/themes/default/_yui_reset.scss +127 -0
- data/lib/common_interface/public/common_interface/themes/default/elastic.js +307 -0
- data/lib/common_interface/public/common_interface/themes/default/elastic.print.css +8 -0
- data/lib/common_interface/public/common_interface/themes/default/reset.css +157 -0
- data/lib/common_interface/public/common_interface/themes/default/reset.scss +5 -0
- data/lib/common_interface/public/common_interface/themes/default/style.css +580 -0
- data/lib/common_interface/public/common_interface/themes/default/style.js +84 -0
- data/lib/common_interface/public/common_interface/themes/default/style.scss +11 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/_fixes.scss +130 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/_original.scss +852 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/comment-arrow.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/comment-gravatar.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/comment-reply.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/logo-small.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/logo.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/main-two-columns-left.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/main-two-columns.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-event.jpg +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-gravatar.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-image.jpg +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-thumbnail.jpg +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/archives.html +389 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/comments.html +486 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/empty-page.html +107 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/comment-arrow.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/comment-gravatar.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/comment-reply.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/logo-small.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/logo.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/main-two-columns-left.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/main-two-columns.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-event.jpg +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-gravatar.gif +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-image.jpg +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-thumbnail.jpg +0 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/index.html +307 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/left-sidebar.html +307 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/no-subnavigation.html +290 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/single-column.html +209 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/style-demo.html +355 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/original/style.css +658 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/style.css +965 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/style.scss +2 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/tmp/comments.html +486 -0
- data/lib/common_interface/public/common_interface/themes/simple_organization/tmp/tmp.html +307 -0
- data/lib/common_interface/spec/controllers/theme_controller_spec.rb +50 -0
- data/lib/common_interface/spec/spec.opts +4 -0
- data/lib/common_interface/spec/spec_helper.rb +1 -0
- data/lib/common_interface/tmp/html.html +39 -0
- data/lib/common_interface/tmp/js.js +78 -0
- data/lib/mongo_mapper_ext/db_config.rb +76 -0
- data/lib/mongo_mapper_ext/hacks/fixes.rb +32 -0
- data/lib/mongo_mapper_ext/hacks/time_measuring.rb +44 -0
- data/lib/mongo_mapper_ext/micelaneous.rb +9 -0
- data/lib/mongo_mapper_ext/migrate.rake +33 -0
- data/lib/mongo_mapper_ext/migration.rb +108 -0
- data/lib/mongo_mapper_ext/mongo_mapper.rb +25 -0
- data/lib/mongo_mapper_ext/plugins/attributes_cache.rb +22 -0
- data/lib/mongo_mapper_ext/plugins/default_scope.rb +76 -0
- data/lib/mongo_mapper_ext/plugins/micelaneous.rb +81 -0
- data/lib/mongo_mapper_ext/spec_helper.rb +10 -0
- data/lib/mongo_mapper_ext/view_helpers.rb +10 -0
- data/lib/mongo_mapper_ext.rb +29 -0
- data/lib/rails_ext/README.markdown +13 -0
- data/lib/rails_ext/action_controller/global_path_prefix.rb +56 -0
- data/lib/rails_ext/action_controller/micelaneous.rb +118 -0
- data/lib/rails_ext/action_controller/persistent_params.rb +96 -0
- data/lib/rails_ext/action_controller/redirect_helper.rb +14 -0
- data/lib/rails_ext/action_controller/reload_page.rb +7 -0
- data/lib/rails_ext/action_controller.rb +19 -0
- data/lib/rails_ext/action_view/common_helper.rb +96 -0
- data/lib/rails_ext/action_view/ruby_template.rb +13 -0
- data/lib/rails_ext/action_view.rb +5 -0
- data/lib/rails_ext/active_record/merge_default_scope/hash_poser.rb +40 -0
- data/lib/rails_ext/active_record/merge_default_scope.rb +16 -0
- data/lib/rails_ext/active_record/micelaneous.rb +14 -0
- data/lib/rails_ext/active_record.rb +7 -0
- data/lib/rails_ext/active_support/micelaneous.rb +7 -0
- data/lib/rails_ext/active_support.rb +1 -0
- data/lib/rails_ext/asset_packager/action_view.rb +47 -0
- data/lib/rails_ext/asset_packager/asset_packager.rb +112 -0
- data/lib/rails_ext/asset_packager/jsmin.rb +205 -0
- data/lib/rails_ext/asset_packager/tasks.rb +27 -0
- data/lib/rails_ext/asset_packager.rb +4 -0
- data/lib/rails_ext/basic/handy_environment.rb +45 -0
- data/lib/rails_ext/basic/user_error.rb +12 -0
- data/lib/rails_ext/basic.rb +6 -0
- data/lib/rails_ext/hacks/ajax_flash.rb +9 -0
- data/lib/rails_ext/hacks/ajax_redirect_to.rb +19 -0
- data/lib/rails_ext/hacks/defer_static_javascripts.rb +18 -0
- data/lib/rails_ext/hacks/global_path_prefix.rb +33 -0
- data/lib/rails_ext/hacks/link_to.rb +105 -0
- data/lib/rails_ext/hacks/merge_default_scope.rb +20 -0
- data/lib/rails_ext/hacks/persistent_params.rb +16 -0
- data/lib/rails_ext/hacks/rjs_layout.rb +2 -0
- data/lib/rails_ext/micelaneous/addressable_uri.rb +45 -0
- data/lib/rails_ext/micelaneous/config_files.rb +18 -0
- data/lib/rails_ext/micelaneous/create_public_symlinks.rb +11 -0
- data/lib/rails_ext/micelaneous/defer_static_javascripts.rb +50 -0
- data/lib/rails_ext/micelaneous/email_config.rb +8 -0
- data/lib/rails_ext/micelaneous/i18n_helper.rb +143 -0
- data/lib/rails_ext/micelaneous/rails_require.rb +4 -0
- data/lib/rails_ext/micelaneous/safe_hash.rb +104 -0
- data/lib/rails_ext/micelaneous.rb +17 -0
- data/lib/rails_ext/public/rails_ext/rails_ext.css +2 -0
- data/lib/rails_ext/public/rails_ext/rails_ext.js +283 -0
- data/lib/rails_ext/spec/mongo_mapper_ext/micelaneous_plugin_spec.rb +56 -0
- data/lib/rails_ext/spec/mongo_mapper_ext/micelaneous_spec.rb +51 -0
- data/lib/rails_ext/spec/mongo_mapper_ext/mongo_mapper_migration_spec.rb +76 -0
- data/lib/rails_ext/spec/mongo_mapper_ext/scope_spec.rb +125 -0
- data/lib/rails_ext/spec/rails_ext/haml_builder_spec.rb +136 -0
- data/lib/rails_ext/spec/rails_ext/safe_hash_spec.rb +71 -0
- data/lib/rails_ext/spec/spec.opts +3 -0
- data/lib/sunspot/mongo_mapper/adapters.rb +79 -0
- data/lib/sunspot/mongo_mapper/searchable.rb +409 -0
- data/lib/sunspot/spec_helper.rb +11 -0
- data/readme.md +1 -0
- data/spec/mongo_mapper_ext/micelaneous_plugin_spec.rb +56 -0
- data/spec/mongo_mapper_ext/micelaneous_spec.rb +51 -0
- data/spec/mongo_mapper_ext/mongo_mapper_migration_spec.rb +76 -0
- data/spec/mongo_mapper_ext/scope_spec.rb +125 -0
- data/spec/rails_ext/haml_builder_spec.rb +136 -0
- data/spec/rails_ext/safe_hash_spec.rb +71 -0
- data/spec/spec.opts +4 -0
- metadata +405 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
module CommonHelper
|
2
|
+
# Initialize JavaScripts variables, needed to rails_ext.js works properly.
|
3
|
+
def initialize_js_commons
|
4
|
+
javascript_tag %{\
|
5
|
+
$.authenticity_token = "#{form_authenticity_token}";}
|
6
|
+
end
|
7
|
+
|
8
|
+
# Prepends content to 'content_for'
|
9
|
+
def prepend_to name, content = nil, &block
|
10
|
+
ivar = "@content_for_#{name}"
|
11
|
+
content = capture(&block) if block_given?
|
12
|
+
content ||= ""
|
13
|
+
stored_content = instance_variable_get(ivar) || ""
|
14
|
+
instance_variable_set(ivar, content + stored_content)
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
# Wraps content for 'content_for'
|
19
|
+
def wrap_content_for name, &block
|
20
|
+
block.should_not! :be_nil
|
21
|
+
|
22
|
+
ivar = "@content_for_#{name}"
|
23
|
+
content = capture(instance_variable_get(ivar) || "", &block)
|
24
|
+
instance_variable_set(ivar, content || "")
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# Has content for 'content_for'
|
29
|
+
def has_content_for? name
|
30
|
+
ivar = "@content_for_#{name}"
|
31
|
+
!instance_variable_get(ivar).blank?
|
32
|
+
end
|
33
|
+
|
34
|
+
# Escape JS
|
35
|
+
def js *args, &block
|
36
|
+
escape_javascript *args, &block
|
37
|
+
end
|
38
|
+
|
39
|
+
# def js_template content, opt, &block
|
40
|
+
# opt[:class] ||= ''
|
41
|
+
# opt[:class] += ' hidden'
|
42
|
+
#
|
43
|
+
# html = content || capture(&block)
|
44
|
+
#
|
45
|
+
# concat %{\
|
46
|
+
# <textarea class='#{opt[:class]}'>
|
47
|
+
# #{html}
|
48
|
+
# </textarea>}
|
49
|
+
# end
|
50
|
+
# prepare_arguments_for :js_template, {:type => :object, :range => :except_last_hash}, :hash
|
51
|
+
|
52
|
+
# def autohide
|
53
|
+
# # request.format == Mime::JS ? 'hidden' : ''
|
54
|
+
# Thread.current[:autohide] ? 'hidden' : ''
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# def render_hidden *args, &block
|
58
|
+
# begin
|
59
|
+
# Thread.current[:autohide] = true
|
60
|
+
# render *args, &block
|
61
|
+
# ensure
|
62
|
+
# Thread.current[:autohide] = false
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
|
66
|
+
def tidy_html html
|
67
|
+
require 'tidy'
|
68
|
+
|
69
|
+
Tidy.path = '/usr/lib/libtidy.dylib' # depends on platform!
|
70
|
+
options = {
|
71
|
+
:indent => true,
|
72
|
+
:char_encoding => 'utf8',
|
73
|
+
:wrap => 0,
|
74
|
+
:output_xhtml => true,
|
75
|
+
:show_errors => 6,
|
76
|
+
:show_warnings => true,
|
77
|
+
:tab_size => 2,
|
78
|
+
:vertical_space => true,
|
79
|
+
:new_inline_tags => "script"
|
80
|
+
}
|
81
|
+
|
82
|
+
Tidy.open options do |tidy|
|
83
|
+
xml = tidy.clean(html)
|
84
|
+
|
85
|
+
# puts " Tidy Messages:"
|
86
|
+
# puts tidy.errors
|
87
|
+
# puts tidy.diagnostics
|
88
|
+
# puts
|
89
|
+
|
90
|
+
# xml.gsub(">\n</script>", "></script>") # tidy makes it newline
|
91
|
+
xml
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
ActionController::Base.send :helper, CommonHelper
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Usage: ActionView::Template.register_template_handler :rb, RubyTemplate
|
2
|
+
|
3
|
+
class RubyTemplate < ActionView::TemplateHandler
|
4
|
+
include ActionView::TemplateHandlers::Compilable
|
5
|
+
|
6
|
+
def compile(template)
|
7
|
+
# "_set_controller_content_type(Mime::XML);" +
|
8
|
+
# "xml = ::Builder::XmlMarkup.new(:indent => 2);" +
|
9
|
+
# "self.output_buffer = xml.target!;" +
|
10
|
+
"self.output_buffer = '';\n" + template.source
|
11
|
+
# ";xml.target!;"
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Hack to use dynamic default_scope
|
2
|
+
class HashPoser < Proc
|
3
|
+
include Enumerable
|
4
|
+
|
5
|
+
attr_accessor :proc
|
6
|
+
|
7
|
+
def initialize &b
|
8
|
+
@proc = b
|
9
|
+
super &b
|
10
|
+
end
|
11
|
+
|
12
|
+
def [](key)
|
13
|
+
call[key]
|
14
|
+
end
|
15
|
+
|
16
|
+
def each(*a, &b)
|
17
|
+
call.each(*a, &b)
|
18
|
+
end
|
19
|
+
|
20
|
+
def fetch(key)
|
21
|
+
call.fetch(key)
|
22
|
+
end
|
23
|
+
|
24
|
+
def keys
|
25
|
+
call.keys
|
26
|
+
end
|
27
|
+
|
28
|
+
def merge(*a, &b)
|
29
|
+
call.merge(*a, &b)
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_hash
|
33
|
+
call
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_s
|
37
|
+
"#<HashPoser: #{call.inspect}>"
|
38
|
+
end
|
39
|
+
alias_method :inspect, :to_s
|
40
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Merges default_scopes and accepts blocks
|
2
|
+
if defined?(ActiveRecord)
|
3
|
+
ActiveRecord::Base.class_eval do
|
4
|
+
class_inheritable_accessor :merged_default_scopes
|
5
|
+
self.merged_default_scopes = []
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def default_scope options = nil, &block
|
9
|
+
self.merged_default_scopes << (options || block).should_not!(:be_nil)
|
10
|
+
end
|
11
|
+
|
12
|
+
# open with_exclusive_scope
|
13
|
+
public :with_exclusive_scope
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
if defined?(ActiveRecord)
|
2
|
+
ActiveRecord::Base.send :class_eval do
|
3
|
+
|
4
|
+
def dom_id
|
5
|
+
new_record? ? "new_#{self.class.name.underscore}" : "#{self.class.name.underscore}_#{id}"
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
#
|
10
|
+
# handy accessor for @attributes_cache
|
11
|
+
#
|
12
|
+
attr_reader :attributes_cache
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'rails_ext/active_support/micelaneous'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
ActionView::Base.class_eval do
|
2
|
+
def merged_javascripts *package_names
|
3
|
+
merged_packages 'javascripts', package_names
|
4
|
+
end
|
5
|
+
|
6
|
+
def merged_stylesheets *package_names
|
7
|
+
merged_packages 'stylesheets', package_names
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
# TODO3 cache it
|
12
|
+
def merged_packages thetype, package_names
|
13
|
+
found_packages = {}
|
14
|
+
|
15
|
+
package_names.each do |pname|
|
16
|
+
AssetPackager.definitions.each do |path, package_types|
|
17
|
+
package_types.each do |type, packages|
|
18
|
+
next unless type == thetype
|
19
|
+
packages.each do |name, files|
|
20
|
+
found_packages[name] = files if name == pname.to_s
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
package_names.each{|name| found_packages.should! :include, name.to_s}
|
27
|
+
|
28
|
+
if AssetPackager.merge_environments.include? Rails.env
|
29
|
+
found_packages.collect do |name, files|
|
30
|
+
AssetPackager.filename_for_builded_package thetype, name
|
31
|
+
end
|
32
|
+
else
|
33
|
+
list = []
|
34
|
+
found_packages.each do |name, files|
|
35
|
+
files.each do |fname|
|
36
|
+
fname = if fname =~ /\A\//
|
37
|
+
fname
|
38
|
+
else
|
39
|
+
"/#{fname}"
|
40
|
+
end
|
41
|
+
list.push fname
|
42
|
+
end
|
43
|
+
end
|
44
|
+
list
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module AssetPackager
|
2
|
+
class << self
|
3
|
+
def add yaml_file_path, asset_path
|
4
|
+
definition = YAML.load File.read(yaml_file_path)
|
5
|
+
definition.should! :be_a, Hash
|
6
|
+
self.definitions[asset_path] = definition
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_all
|
10
|
+
definitions.each do |path, package_types|
|
11
|
+
package_types.each do |type, package|
|
12
|
+
package.each do |name, files|
|
13
|
+
build = self.send "build_#{type}", path, name, files
|
14
|
+
dir = "#{public_root}/#{type}"
|
15
|
+
FileUtils.mkdir_p dir unless File.exist? dir
|
16
|
+
fname = public_root + filename_for_builded_package(type, name)
|
17
|
+
File.open(fname, "w"){|f| f.write(build)}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def delete_all
|
24
|
+
definitions.each do |path, package_types|
|
25
|
+
package_types.each do |type, package|
|
26
|
+
package.each do |name, files|
|
27
|
+
fname = public_root + filename_for_builded_package(type, name)
|
28
|
+
File.delete fname if File.exist? fname
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def filename_for_builded_package type, package
|
35
|
+
type = type.to_s
|
36
|
+
"/#{type}/#{package}_packaged.#{AssetPackager.resources_extensions[type]}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def definitions
|
40
|
+
@definitions ||= {}
|
41
|
+
end
|
42
|
+
|
43
|
+
def merge_environments
|
44
|
+
@merge_environments ||= ["production"]
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
def public_root
|
49
|
+
"#{Rails.root}/public"
|
50
|
+
end
|
51
|
+
|
52
|
+
def tmp_path
|
53
|
+
"#{Rails.root}/tmp"
|
54
|
+
end
|
55
|
+
|
56
|
+
def resources_extensions
|
57
|
+
@resources_extensions ||= {
|
58
|
+
'javascripts' => 'js',
|
59
|
+
'stylesheets' => 'css'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def build_javascripts path_to_files, package, files
|
64
|
+
merged = merge_file path_to_files, files
|
65
|
+
|
66
|
+
# write out to a temp file
|
67
|
+
tmp_file = "#{tmp_path}/#{package}_packaged"
|
68
|
+
File.open("#{tmp_file}_uncompressed.js", "w"){|f| f.write(merged)}
|
69
|
+
|
70
|
+
# compress file with JSMin library
|
71
|
+
jsmin = "#{File.dirname(__FILE__)}/jsmin.rb"
|
72
|
+
`ruby #{jsmin} <#{tmp_file}_uncompressed.js >#{tmp_file}_compressed.js \n`
|
73
|
+
|
74
|
+
# read it back in and trim it
|
75
|
+
result = ""
|
76
|
+
File.open("#{tmp_file}_compressed.js", "r") { |f| result += f.read.strip }
|
77
|
+
|
78
|
+
# delete temp files if they exist
|
79
|
+
File.delete("#{tmp_file}_uncompressed.js") if File.exists?("#{tmp_file}_uncompressed.js")
|
80
|
+
File.delete("#{tmp_file}_compressed.js") if File.exists?("#{tmp_file}_compressed.js")
|
81
|
+
|
82
|
+
result
|
83
|
+
end
|
84
|
+
|
85
|
+
def build_stylesheets path_to_files, package, files
|
86
|
+
merged = merge_file path_to_files, files
|
87
|
+
|
88
|
+
merged.gsub!(/\s+/, " ") # collapse space
|
89
|
+
merged.gsub!(/\/\*(.*?)\*\//, "") # remove comments - caution, might want to remove this if using css hacks
|
90
|
+
merged.gsub!(/\} /, "}\n") # add line breaks
|
91
|
+
merged.gsub!(/\n$/, "") # remove last break
|
92
|
+
merged.gsub!(/ \{ /, " {") # trim inside brackets
|
93
|
+
merged.gsub!(/; \}/, "}") # trim inside brackets
|
94
|
+
merged
|
95
|
+
end
|
96
|
+
|
97
|
+
def merge_file path_to_files, files
|
98
|
+
merged_file = ""
|
99
|
+
files.each do |fname|
|
100
|
+
full_path = if fname =~ /\A\//
|
101
|
+
"#{public_root}#{fname}"
|
102
|
+
else
|
103
|
+
"#{path_to_files}/#{fname}"
|
104
|
+
end
|
105
|
+
File.open(full_path, "r") do |f|
|
106
|
+
merged_file += f.read + "\n"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
merged_file
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# jsmin.rb 2007-07-20
|
3
|
+
# Author: Uladzislau Latynski
|
4
|
+
# This work is a translation from C to Ruby of jsmin.c published by
|
5
|
+
# Douglas Crockford. Permission is hereby granted to use the Ruby
|
6
|
+
# version under the same conditions as the jsmin.c on which it is
|
7
|
+
# based.
|
8
|
+
#
|
9
|
+
# /* jsmin.c
|
10
|
+
# 2003-04-21
|
11
|
+
#
|
12
|
+
# Copyright (c) 2002 Douglas Crockford (www.crockford.com)
|
13
|
+
#
|
14
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
15
|
+
# this software and associated documentation files (the "Software"), to deal in
|
16
|
+
# the Software without restriction, including without limitation the rights to
|
17
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
18
|
+
# of the Software, and to permit persons to whom the Software is furnished to do
|
19
|
+
# so, subject to the following conditions:
|
20
|
+
#
|
21
|
+
# The above copyright notice and this permission notice shall be included in all
|
22
|
+
# copies or substantial portions of the Software.
|
23
|
+
#
|
24
|
+
# The Software shall be used for Good, not Evil.
|
25
|
+
#
|
26
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
27
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
28
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
29
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
30
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
31
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
32
|
+
# SOFTWARE.
|
33
|
+
|
34
|
+
EOF = -1
|
35
|
+
$theA = ""
|
36
|
+
$theB = ""
|
37
|
+
|
38
|
+
# isAlphanum -- return true if the character is a letter, digit, underscore,
|
39
|
+
# dollar sign, or non-ASCII character
|
40
|
+
def isAlphanum(c)
|
41
|
+
return false if !c || c == EOF
|
42
|
+
return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
|
43
|
+
(c >= 'A' && c <= 'Z') || c == '_' || c == '$' ||
|
44
|
+
c == '\\' || c[0] > 126)
|
45
|
+
end
|
46
|
+
|
47
|
+
# get -- return the next character from stdin. Watch out for lookahead. If
|
48
|
+
# the character is a control character, translate it to a space or linefeed.
|
49
|
+
def get()
|
50
|
+
c = $stdin.getc
|
51
|
+
return EOF if(!c)
|
52
|
+
c = c.chr
|
53
|
+
return c if (c >= " " || c == "\n" || c.unpack("c") == EOF)
|
54
|
+
return "\n" if (c == "\r")
|
55
|
+
return " "
|
56
|
+
end
|
57
|
+
|
58
|
+
# Get the next character without getting it.
|
59
|
+
def peek()
|
60
|
+
lookaheadChar = $stdin.getc
|
61
|
+
$stdin.ungetc(lookaheadChar)
|
62
|
+
return lookaheadChar.chr
|
63
|
+
end
|
64
|
+
|
65
|
+
# mynext -- get the next character, excluding comments.
|
66
|
+
# peek() is used to see if a '/' is followed by a '/' or '*'.
|
67
|
+
def mynext()
|
68
|
+
c = get
|
69
|
+
if (c == "/")
|
70
|
+
if(peek == "/")
|
71
|
+
while(true)
|
72
|
+
c = get
|
73
|
+
if (c <= "\n")
|
74
|
+
return c
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
if(peek == "*")
|
79
|
+
get
|
80
|
+
while(true)
|
81
|
+
case get
|
82
|
+
when "*"
|
83
|
+
if (peek == "/")
|
84
|
+
get
|
85
|
+
return " "
|
86
|
+
end
|
87
|
+
when EOF
|
88
|
+
raise "Unterminated comment"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
return c
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
# action -- do something! What you do is determined by the argument: 1
|
98
|
+
# Output A. Copy B to A. Get the next B. 2 Copy B to A. Get the next B.
|
99
|
+
# (Delete A). 3 Get the next B. (Delete B). action treats a string as a
|
100
|
+
# single character. Wow! action recognizes a regular expression if it is
|
101
|
+
# preceded by ( or , or =.
|
102
|
+
def action(a)
|
103
|
+
if(a==1)
|
104
|
+
$stdout.write $theA
|
105
|
+
end
|
106
|
+
if(a==1 || a==2)
|
107
|
+
$theA = $theB
|
108
|
+
if ($theA == "\'" || $theA == "\"")
|
109
|
+
while (true)
|
110
|
+
$stdout.write $theA
|
111
|
+
$theA = get
|
112
|
+
break if ($theA == $theB)
|
113
|
+
raise "Unterminated string literal" if ($theA <= "\n")
|
114
|
+
if ($theA == "\\")
|
115
|
+
$stdout.write $theA
|
116
|
+
$theA = get
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
if(a==1 || a==2 || a==3)
|
122
|
+
$theB = mynext
|
123
|
+
if ($theB == "/" && ($theA == "(" || $theA == "," || $theA == "=" ||
|
124
|
+
$theA == ":" || $theA == "[" || $theA == "!" ||
|
125
|
+
$theA == "&" || $theA == "|" || $theA == "?" ||
|
126
|
+
$theA == "{" || $theA == "}" || $theA == ";" ||
|
127
|
+
$theA == "\n"))
|
128
|
+
$stdout.write $theA
|
129
|
+
$stdout.write $theB
|
130
|
+
while (true)
|
131
|
+
$theA = get
|
132
|
+
if ($theA == "/")
|
133
|
+
break
|
134
|
+
elsif ($theA == "\\")
|
135
|
+
$stdout.write $theA
|
136
|
+
$theA = get
|
137
|
+
elsif ($theA <= "\n")
|
138
|
+
raise "Unterminated RegExp Literal"
|
139
|
+
end
|
140
|
+
$stdout.write $theA
|
141
|
+
end
|
142
|
+
$theB = mynext
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# jsmin -- Copy the input to the output, deleting the characters which are
|
148
|
+
# insignificant to JavaScript. Comments will be removed. Tabs will be
|
149
|
+
# replaced with spaces. Carriage returns will be replaced with linefeeds.
|
150
|
+
# Most spaces and linefeeds will be removed.
|
151
|
+
def jsmin
|
152
|
+
$theA = "\n"
|
153
|
+
action(3)
|
154
|
+
while ($theA != EOF)
|
155
|
+
case $theA
|
156
|
+
when " "
|
157
|
+
if (isAlphanum($theB))
|
158
|
+
action(1)
|
159
|
+
else
|
160
|
+
action(2)
|
161
|
+
end
|
162
|
+
when "\n"
|
163
|
+
case ($theB)
|
164
|
+
when "{","[","(","+","-"
|
165
|
+
action(1)
|
166
|
+
when " "
|
167
|
+
action(3)
|
168
|
+
else
|
169
|
+
if (isAlphanum($theB))
|
170
|
+
action(1)
|
171
|
+
else
|
172
|
+
action(2)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else
|
176
|
+
case ($theB)
|
177
|
+
when " "
|
178
|
+
if (isAlphanum($theA))
|
179
|
+
action(1)
|
180
|
+
else
|
181
|
+
action(3)
|
182
|
+
end
|
183
|
+
when "\n"
|
184
|
+
case ($theA)
|
185
|
+
when "}","]",")","+","-","\"","\\", "'", '"'
|
186
|
+
action(1)
|
187
|
+
else
|
188
|
+
if (isAlphanum($theA))
|
189
|
+
action(1)
|
190
|
+
else
|
191
|
+
action(3)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
else
|
195
|
+
action(1)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
ARGV.each do |anArg|
|
202
|
+
$stdout.write "// #{anArg}\n"
|
203
|
+
end
|
204
|
+
|
205
|
+
jsmin
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Doesn't works if it's included in Rails, should be explicitly copied to tasks folder.
|
2
|
+
|
3
|
+
namespace :asset do
|
4
|
+
namespace :packager do
|
5
|
+
|
6
|
+
desc "Merge and compress assets"
|
7
|
+
task :build_all => :environment do
|
8
|
+
require 'yaml'
|
9
|
+
require 'asset_packager/asset_packager'
|
10
|
+
|
11
|
+
AssetPackager.build_all
|
12
|
+
|
13
|
+
puts "Asset builded"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Delete all asset builds"
|
17
|
+
task :delete_all do
|
18
|
+
require 'yaml'
|
19
|
+
require 'asset_packager/asset_packager'
|
20
|
+
|
21
|
+
AssetPackager.delete_all
|
22
|
+
|
23
|
+
puts "Asset Builds deleted"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Rails
|
2
|
+
class << self
|
3
|
+
def development?
|
4
|
+
RAILS_ENV == 'development'
|
5
|
+
end
|
6
|
+
|
7
|
+
def test?
|
8
|
+
RAILS_ENV == 'test'
|
9
|
+
end
|
10
|
+
|
11
|
+
def production?
|
12
|
+
RAILS_ENV == 'production'
|
13
|
+
end
|
14
|
+
|
15
|
+
def development *args, &block
|
16
|
+
if development?
|
17
|
+
if block
|
18
|
+
block.call
|
19
|
+
else
|
20
|
+
return *args
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test *args, &block
|
26
|
+
if test?
|
27
|
+
if block
|
28
|
+
block.call
|
29
|
+
else
|
30
|
+
return *args
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def production *args, &block
|
36
|
+
if production?
|
37
|
+
if block
|
38
|
+
block.call
|
39
|
+
else
|
40
|
+
return *args
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#
|
2
|
+
# ordinary and ajax flash[:info] (othervise it appears twice with ajax requests)
|
3
|
+
#
|
4
|
+
ActionController::Base.class_eval do
|
5
|
+
def flash_with_ajax
|
6
|
+
(request.xhr? or request.format == 'js') ? flash_without_ajax.now : flash_without_ajax
|
7
|
+
end
|
8
|
+
alias_method_chain :flash, :ajax
|
9
|
+
end
|