adva_cms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/NOTES +132 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/adva_cms.gemspec +22 -0
- data/app/assets/images/adva_cms/admin/header_bg.png +0 -0
- data/app/assets/images/adva_cms/admin/section_menu_bg.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_action_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_main_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_sidebar_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_top_active.png +0 -0
- data/app/assets/images/adva_cms/asset_selected.png +0 -0
- data/app/assets/images/adva_cms/avatar.gif +0 -0
- data/app/assets/images/adva_cms/filter-bg.png +0 -0
- data/app/assets/images/adva_cms/icons/accept.png +0 -0
- data/app/assets/images/adva_cms/icons/add.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross_2.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross_3.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_up_down.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/audio.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/doc.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/pdf.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/video.png +0 -0
- data/app/assets/images/adva_cms/icons/attach.png +0 -0
- data/app/assets/images/adva_cms/icons/bin.png +0 -0
- data/app/assets/images/adva_cms/icons/bin_closed.png +0 -0
- data/app/assets/images/adva_cms/icons/bin_empty.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_black.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_error.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_go.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_red.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_white.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_yellow.png +0 -0
- data/app/assets/images/adva_cms/icons/cancel.png +0 -0
- data/app/assets/images/adva_cms/icons/comment.gif +0 -0
- data/app/assets/images/adva_cms/icons/comment.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_add.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_blue.gif +0 -0
- data/app/assets/images/adva_cms/icons/comment_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_yellow.gif +0 -0
- data/app/assets/images/adva_cms/icons/cross.png +0 -0
- data/app/assets/images/adva_cms/icons/delete.png +0 -0
- data/app/assets/images/adva_cms/icons/eye.png +0 -0
- data/app/assets/images/adva_cms/icons/favorites.png +0 -0
- data/app/assets/images/adva_cms/icons/help.png +0 -0
- data/app/assets/images/adva_cms/icons/hourglass.png +0 -0
- data/app/assets/images/adva_cms/icons/icon_attachment.gif +0 -0
- data/app/assets/images/adva_cms/icons/icon_padlock.gif +0 -0
- data/app/assets/images/adva_cms/icons/link.png +0 -0
- data/app/assets/images/adva_cms/icons/lock.png +0 -0
- data/app/assets/images/adva_cms/icons/magnifier.png +0 -0
- data/app/assets/images/adva_cms/icons/minus.gif +0 -0
- data/app/assets/images/adva_cms/icons/page_add.png +0 -0
- data/app/assets/images/adva_cms/icons/page_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/page_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/page_favorites.png +0 -0
- data/app/assets/images/adva_cms/icons/page_go.png +0 -0
- data/app/assets/images/adva_cms/icons/page_green.png +0 -0
- data/app/assets/images/adva_cms/icons/page_red.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_add.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_go.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_link.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_magnify.png +0 -0
- data/app/assets/images/adva_cms/icons/pencil.png +0 -0
- data/app/assets/images/adva_cms/icons/star.png +0 -0
- data/app/assets/images/adva_cms/icons/stop.png +0 -0
- data/app/assets/images/adva_cms/icons/tag_green.png +0 -0
- data/app/assets/images/adva_cms/icons/tick.png +0 -0
- data/app/assets/images/adva_cms/icons/zoom.png +0 -0
- data/app/assets/images/adva_cms/indicator.gif +0 -0
- data/app/assets/images/adva_cms/preview.png +0 -0
- data/app/assets/images/adva_cms/rails.png +0 -0
- data/app/assets/images/adva_cms/sortable_tree/drag.png +0 -0
- data/app/assets/images/adva_cms/theme_selected.png +0 -0
- data/app/assets/javascripts/admin.js +1 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.admin.js +23 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.article.js +22 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.cached_pages.js +14 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.table_tree.js +7 -0
- data/app/assets/javascripts/adva_cms/application.js +14 -0
- data/app/assets/javascripts/adva_cms/base.js +4 -0
- data/app/assets/javascripts/adva_cms/cookie.js +49 -0
- data/app/assets/javascripts/adva_cms/jquery.common.js +41 -0
- data/app/assets/javascripts/adva_cms/jquery.dates.js +51 -0
- data/app/assets/javascripts/adva_cms/jquery.flash.js +57 -0
- data/app/assets/javascripts/adva_cms/jquery.roles.js +25 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery-lowpro.js +224 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.qtip.js +2085 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.table_tree.js +307 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.tablednd_0_5.js +386 -0
- data/app/assets/javascripts/adva_cms/json.js +139 -0
- data/app/assets/stylesheets/admin.css +1 -0
- data/app/assets/stylesheets/adva_cms/admin.css +16 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/common.css +76 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/forms.css +121 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/header.css +125 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/layout.css +103 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/lists.css +153 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/sidebar.css +65 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/top.css +123 -0
- data/app/assets/stylesheets/adva_cms/admin/common.css +76 -0
- data/app/assets/stylesheets/adva_cms/admin/content.css +11 -0
- data/app/assets/stylesheets/adva_cms/admin/forms.css +116 -0
- data/app/assets/stylesheets/adva_cms/admin/header.css +114 -0
- data/app/assets/stylesheets/adva_cms/admin/helptip.css +35 -0
- data/app/assets/stylesheets/adva_cms/admin/layout.css +56 -0
- data/app/assets/stylesheets/adva_cms/admin/lists.css +152 -0
- data/app/assets/stylesheets/adva_cms/admin/projection.css +118 -0
- data/app/assets/stylesheets/adva_cms/admin/reset.css +25 -0
- data/app/assets/stylesheets/adva_cms/admin/screen/top.css +8 -0
- data/app/assets/stylesheets/adva_cms/admin/sidebar.css +67 -0
- data/app/assets/stylesheets/adva_cms/admin/themes.css +49 -0
- data/app/assets/stylesheets/adva_cms/admin/top.css +83 -0
- data/app/assets/stylesheets/adva_cms/admin/users.css +40 -0
- data/app/assets/stylesheets/adva_cms/common.css +49 -0
- data/app/assets/stylesheets/adva_cms/default.css +201 -0
- data/app/assets/stylesheets/adva_cms/forms.css +60 -0
- data/app/assets/stylesheets/adva_cms/jquery/alternate/jquery.tooltip.css +13 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/jquery-ui.css +406 -0
- data/app/assets/stylesheets/adva_cms/jquery/jquery.tooltip.css +10 -0
- data/app/assets/stylesheets/adva_cms/layout/login.css +8 -0
- data/app/assets/stylesheets/adva_cms/layout/simple.css +8 -0
- data/app/assets/stylesheets/adva_cms/menu.css +129 -0
- data/app/assets/stylesheets/adva_cms/reset.css +25 -0
- data/app/controllers/admin/base_controller.rb +101 -0
- data/app/controllers/admin/categories_controller.rb +3 -0
- data/app/controllers/admin/install_controller.rb +61 -0
- data/app/controllers/admin/page/articles_controller.rb +150 -0
- data/app/controllers/admin/page/categories_controller.rb +62 -0
- data/app/controllers/admin/page/contents_controller.rb +52 -0
- data/app/controllers/admin/page/links_controller.rb +69 -0
- data/app/controllers/admin/pages_controller.rb +2 -0
- data/app/controllers/admin/plugins_controller.rb +40 -0
- data/app/controllers/admin/sections_controller.rb +91 -0
- data/app/controllers/admin/sites_controller.rb +99 -0
- data/app/controllers/articles_controller.rb +81 -0
- data/app/controllers/base_controller.rb +82 -0
- data/app/helpers/admin/base_helper.rb +106 -0
- data/app/helpers/base_helper.rb +56 -0
- data/app/helpers/content_helper.rb +90 -0
- data/app/helpers/resource_helper.rb +127 -0
- data/app/models/article.rb +40 -0
- data/app/models/categorization.rb +4 -0
- data/app/models/category.rb +60 -0
- data/app/models/content.rb +155 -0
- data/app/models/event.rb +34 -0
- data/app/models/link.rb +4 -0
- data/app/models/page.rb +36 -0
- data/app/models/section.rb +126 -0
- data/app/models/site.rb +104 -0
- data/app/views/admin/cached_pages/_filter.html.erb +8 -0
- data/app/views/admin/cached_pages/destroy.js.erb +18 -0
- data/app/views/admin/cached_pages/index.html.erb +26 -0
- data/app/views/admin/install/confirmation.html.erb +10 -0
- data/app/views/admin/install/index.html.erb +38 -0
- data/app/views/admin/page/articles/_form.html.erb +40 -0
- data/app/views/admin/page/articles/_options.html.erb +20 -0
- data/app/views/admin/page/articles/edit.html.erb +15 -0
- data/app/views/admin/page/articles/new.html.erb +12 -0
- data/app/views/admin/page/categories/edit.html.erb +22 -0
- data/app/views/admin/page/categories/index.html.erb +23 -0
- data/app/views/admin/page/categories/new.html.erb +19 -0
- data/app/views/admin/page/contents/index.html.erb +40 -0
- data/app/views/admin/page/links/_form.html.erb +26 -0
- data/app/views/admin/page/links/_options.html.erb +23 -0
- data/app/views/admin/page/links/edit.html.erb +12 -0
- data/app/views/admin/page/links/new.html.erb +12 -0
- data/app/views/admin/plugins/_form.html.erb +11 -0
- data/app/views/admin/plugins/index.html.erb +16 -0
- data/app/views/admin/plugins/show.html.erb +43 -0
- data/app/views/admin/sections/_form.html.haml +20 -0
- data/app/views/admin/sections/edit.html.haml +6 -0
- data/app/views/admin/sections/index.html.erb +27 -0
- data/app/views/admin/sections/new.html.erb +29 -0
- data/app/views/admin/sections/settings/_page.html.haml +10 -0
- data/app/views/admin/shared/_header.html.erb +18 -0
- data/app/views/admin/shared/_language_select.html.erb +6 -0
- data/app/views/admin/shared/_section.html.erb +8 -0
- data/app/views/admin/shared/_section_summary.html.erb +23 -0
- data/app/views/admin/shared/_section_tree.html.erb +23 -0
- data/app/views/admin/sites/_email_notifications.html.erb +9 -0
- data/app/views/admin/sites/_form.html.erb +15 -0
- data/app/views/admin/sites/_recent_users.html.erb +11 -0
- data/app/views/admin/sites/_sections.html.erb +10 -0
- data/app/views/admin/sites/_unapproved_comments.html.erb +10 -0
- data/app/views/admin/sites/edit.html.erb +4 -0
- data/app/views/admin/sites/index.html.erb +21 -0
- data/app/views/admin/sites/multi_sites_disabled.html.erb +11 -0
- data/app/views/admin/sites/new.html.erb +21 -0
- data/app/views/admin/sites/show.html.erb +16 -0
- data/app/views/categories/_checkboxes.html.erb +12 -0
- data/app/views/layouts/admin.html.haml +50 -0
- data/app/views/layouts/default.html.erb +38 -0
- data/app/views/layouts/simple.html.erb +22 -0
- data/app/views/pages/articles/index.html.erb +10 -0
- data/app/views/pages/articles/show.html.erb +17 -0
- data/app/views/shared/_flash.html.erb +3 -0
- data/app/views/shared/_footer.html.erb +4 -0
- data/app/views/shared/_menu.html.erb +10 -0
- data/app/views/shared/_sidebar.html.erb +19 -0
- data/app/views/shared/messages/insufficient_permissions.html.erb +4 -0
- data/config/environment.rb +21 -0
- data/config/initializers/has_options.rb +2 -0
- data/config/initializers/has_permalink.rb +27 -0
- data/config/initializers/mailer.rb +12 -0
- data/config/initializers/menus.rb +184 -0
- data/config/initializers/roles.rb +91 -0
- data/config/initializers/settings.rb +26 -0
- data/config/initializers/site.rb +5 -0
- data/config/initializers/translations_are_a_pain.rb +9 -0
- data/config/locales/en.yml +1295 -0
- data/config/routes.rb +47 -0
- data/db/migrate/20080401000001_create_sites_table.rb +28 -0
- data/db/migrate/20080401000002_create_sections_table.rb +25 -0
- data/db/migrate/20080401000003_create_contents_table.rb +35 -0
- data/db/migrate/20080401000004_create_categories_table.rb +17 -0
- data/db/migrate/20080401000005_create_category_assignments.rb +12 -0
- data/db/migrate/20080401000006_create_taggable_tables.rb +26 -0
- data/db/migrate/20080710000000_create_plugin_configs.rb +13 -0
- data/db/migrate/20080715131051_plugin_owner_column.rb +13 -0
- data/db/migrate/20081208161500_add_content_type_to_join_tables.rb +10 -0
- data/db/migrate/20090216114034_rename_category_assignment_to_categorization.rb +13 -0
- data/db/migrate/20090305123429_move_sections_to_pages.rb +9 -0
- data/db/migrate/20090519132700_add_published_at_to_sections.rb +10 -0
- data/db/migrate/20090702085459_create_section_translations.rb +9 -0
- data/db/migrate/20090702200226_create_category_translations.rb +9 -0
- data/db/migrate/20090707171100_upgrade_paperclip_paths.rb +31 -0
- data/db/migrate/20090709111934_add_email_notification_to_site.rb +12 -0
- data/db/migrate/20091026000906_add_nesting_to_articles.rb +26 -0
- data/db/migrate/20140721000000_add_title_to_contents.rb +7 -0
- data/lib/adva_cms.rb +50 -0
- data/lib/adva_cms/version.rb +3 -0
- data/lib/core_ext.rb +7 -0
- data/lib/extensible_forms.rb +283 -0
- data/lib/has_options.rb +46 -0
- data/lib/html_diff.rb +48 -0
- data/lib/rails_ext.rb +15 -0
- data/lib/rails_ext/action_controller/cacheable_flash.rb +30 -0
- data/lib/rails_ext/action_controller/content_for_assignments.rb +105 -0
- data/lib/rails_ext/action_controller/default_params.rb +19 -0
- data/lib/rails_ext/action_controller/event_helper.rb +18 -0
- data/lib/rails_ext/action_controller/page_caching.rb +23 -0
- data/lib/rails_ext/action_controller/render_with_error_proc.rb +46 -0
- data/lib/rails_ext/action_controller/responds_to_parent.rb +46 -0
- data/lib/rails_ext/action_controller/url_for_returning.rb +12 -0
- data/lib/rails_ext/active_record/exists.rb +5 -0
- data/lib/rails_ext/active_record/sti_instantiation.rb +35 -0
- data/lib/rails_ext/active_record/sticky_changes.rb +30 -0
- data/lib/rails_ext/railties/plugin.rb +58 -0
- data/lib/rails_ext/railties/plugin_configuration.rb +72 -0
- data/lib/rails_ext/railties/plugin_initializers.rb +25 -0
- data/lib/registry.rb +49 -0
- data/lib/tasks/adva_cms.rake +178 -0
- data/lib/tasks/translation.rake +69 -0
- data/lib/time_hacks.rb +57 -0
- data/lib/webrat_patch.rb +11 -0
- data/locale/rails/fr.yml +123 -0
- data/test/NOTES +56 -0
- data/test/contexts.rb +365 -0
- data/test/fixtures.rb +190 -0
- data/test/fixtures/templates/alternative_templates/index.html.erb +1 -0
- data/test/fixtures/templates/context_templates_test/index.html.erb +1 -0
- data/test/fixtures/templates/context_templates_test/show.html.erb +0 -0
- data/test/fixtures/templates/layouts/alternative.html.erb +0 -0
- data/test/fixtures/templates/layouts/default.html.erb +0 -0
- data/test/fixtures/templates/menu/shared/_menu.html.erb +8 -0
- data/test/functional/admin/articles_controller_test.rb +329 -0
- data/test/functional/admin/base_controller_test.rb +68 -0
- data/test/functional/admin/cached_pages_controller_test.rb +66 -0
- data/test/functional/admin/categories_controller_test.rb +164 -0
- data/test/functional/admin/cells_controller_spec.rb +32 -0
- data/test/functional/admin/install_controller_test.rb +89 -0
- data/test/functional/admin/plugins_controller_test.rb +93 -0
- data/test/functional/admin/sections_controller_test.rb +201 -0
- data/test/functional/admin/sites_controller_test.rb +240 -0
- data/test/functional/asset_tag_expansions_test.rb +82 -0
- data/test/functional/base_controller_test.rb +73 -0
- data/test/functional/page_articles_controller_test.rb +168 -0
- data/test/functional/page_articles_routes_test.rb +73 -0
- data/test/integration/admin/cached_pages_test.rb +43 -0
- data/test/integration/admin/categories_test.rb +66 -0
- data/test/integration/admin/custom_templates_test.rb +42 -0
- data/test/integration/admin/filtering_articles_test.rb +32 -0
- data/test/integration/admin/plugins.rb +32 -0
- data/test/integration/admin/section_article_test.rb +150 -0
- data/test/integration/admin/section_test.rb +88 -0
- data/test/integration/admin/sites_test.rb +48 -0
- data/test/integration/installation_test.rb +109 -0
- data/test/integration/page_article_comment_test.rb +51 -0
- data/test/integration/page_article_test.rb +87 -0
- data/test/integration/section_index_test.rb +37 -0
- data/test/javascript/assets/jquery-lowpro.js +224 -0
- data/test/javascript/assets/jquery-ui.js +298 -0
- data/test/javascript/assets/jquery.js +4376 -0
- data/test/javascript/assets/testrunner.js +815 -0
- data/test/javascript/assets/testsuite.css +120 -0
- data/test/javascript/lib/jstest.rb +588 -0
- data/test/javascript/templates/test_case.erb +33 -0
- data/test/plugins/adva_context_templates/context_templates_test.rb +138 -0
- data/test/plugins/adva_post_ping/controller/integration_test.rb +78 -0
- data/test/plugins/adva_post_ping/post_ping_test.rb +94 -0
- data/test/plugins/adva_url_history/article_test.rb +94 -0
- data/test/plugins/adva_url_history/init_url_history.rb +18 -0
- data/test/plugins/adva_url_history/section_test.rb +49 -0
- data/test/test_helper.rb +75 -0
- data/test/test_helper/clear_directories.rb +16 -0
- data/test/test_helper/ensure_single_site_mode.rb +10 -0
- data/test/test_helper/extensions/cacheable_flash.rb +14 -0
- data/test/test_helper/extensions/cronjob.rb +11 -0
- data/test/test_helper/extensions/even_test_log.rb +21 -0
- data/test/test_helper/extensions/integration_test.rb +78 -0
- data/test/test_helper/extensions/matchy.rb +365 -0
- data/test/test_helper/extensions/matchy_adva_cms.rb +441 -0
- data/test/test_helper/extensions/rails_patch.rb +40 -0
- data/test/test_helper/extensions/rr.rb +7 -0
- data/test/test_helper/extensions/test_unit.rb +35 -0
- data/test/test_helper/extensions/with_sugar.rb +166 -0
- data/test/test_helper/parse_options.rb +18 -0
- data/test/test_helper/setup_db_transaction.rb +15 -0
- data/test/test_helper/setup_webrat.rb +9 -0
- data/test/test_helper/test_server/init.rb +15 -0
- data/test/unit/helpers/admin/base_helper_test.rb +139 -0
- data/test/unit/helpers/base_helper_spec.rb +54 -0
- data/test/unit/helpers/base_helper_test.rb +165 -0
- data/test/unit/helpers/content_helper_test.rb +127 -0
- data/test/unit/helpers/resource_helper_test.rb +180 -0
- data/test/unit/i18n_test.rb +22 -0
- data/test/unit/lib/cells_ext_spec.rb +96 -0
- data/test/unit/lib/extensible_forms_test.rb +362 -0
- data/test/unit/lib/menu_test.rb +119 -0
- data/test/unit/lib/rails_ext/content_for_assignments_test.rb +75 -0
- data/test/unit/lib/rails_ext/plugin_configuration_test.rb +40 -0
- data/test/unit/lib/rails_ext/sticky_changes_test.rb +33 -0
- data/test/unit/lib/registry_test.rb +91 -0
- data/test/unit/lib/routing_filter/routing_filter_categories_spec.rb +63 -0
- data/test/unit/lib/routing_filter/routing_filter_categories_test.rb +159 -0
- data/test/unit/lib/routing_filter/routing_filter_locale_spec.rb +73 -0
- data/test/unit/lib/routing_filter/routing_filter_root_blog_archive_spec.rb +40 -0
- data/test/unit/lib/routing_filter/routing_filter_root_section_articles_spec.rb +48 -0
- data/test/unit/lib/routing_filter/routing_filter_root_wikipages_spec.rb +40 -0
- data/test/unit/lib/routing_filter/routing_filter_sections_spec.rb +143 -0
- data/test/unit/lib/routing_filter/routing_filter_sections_test.rb +32 -0
- data/test/unit/lib/routing_filter/routing_filter_sets_test.rb +86 -0
- data/test/unit/models/article_test.rb +191 -0
- data/test/unit/models/category_test.rb +68 -0
- data/test/unit/models/content_test.rb +409 -0
- data/test/unit/models/counter_test.rb +43 -0
- data/test/unit/models/event_test.rb +41 -0
- data/test/unit/models/nested_categories_test.rb +34 -0
- data/test/unit/models/page_test.rb +63 -0
- data/test/unit/models/section_test.rb +315 -0
- data/test/unit/models/site_test.rb +199 -0
- data/test/unit/observers/activities_article_observer_test.rb +42 -0
- data/vendor/gems/belongs_to_cacheable/.gitignore +17 -0
- data/vendor/gems/belongs_to_cacheable/Gemfile +4 -0
- data/vendor/gems/belongs_to_cacheable/LICENSE +22 -0
- data/vendor/gems/belongs_to_cacheable/README.md +29 -0
- data/vendor/gems/belongs_to_cacheable/Rakefile +2 -0
- data/vendor/gems/belongs_to_cacheable/belongs_to_cacheable.gemspec +22 -0
- data/vendor/gems/belongs_to_cacheable/init.rb +1 -0
- data/vendor/gems/belongs_to_cacheable/lib/active_record/belongs_to_cacheable.rb +77 -0
- data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable.rb +3 -0
- data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable/version.rb +3 -0
- data/vendor/gems/belongs_to_cacheable/spec/belongs_to_cacheable_spec.rb +52 -0
- data/vendor/gems/belongs_to_cacheable/spec/spec_helper.rb +50 -0
- data/vendor/gems/filtered_column/.gitignore +17 -0
- data/vendor/gems/filtered_column/Gemfile +4 -0
- data/vendor/gems/filtered_column/LICENSE +22 -0
- data/vendor/gems/filtered_column/README +4 -0
- data/vendor/gems/filtered_column/README.md +29 -0
- data/vendor/gems/filtered_column/Rakefile +23 -0
- data/vendor/gems/filtered_column/filtered_column.gemspec +17 -0
- data/vendor/gems/filtered_column/lib/filtered_column.rb +17 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/base.rb +28 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/smartypants_filter.rb +14 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/textile_filter.rb +13 -0
- data/vendor/gems/filtered_column/lib/filtered_column/macros/base.rb +25 -0
- data/vendor/gems/filtered_column/lib/filtered_column/mixin.rb +46 -0
- data/vendor/gems/filtered_column/lib/filtered_column/processor.rb +52 -0
- data/vendor/gems/filtered_column/lib/filtered_column/version.rb +3 -0
- data/vendor/gems/filtered_column/tasks/filtered_column_tasks.rake +4 -0
- data/vendor/gems/filtered_column/test/abstract_unit.rb +73 -0
- data/vendor/gems/filtered_column/test/filtered_column_test.rb +53 -0
- data/vendor/gems/filtered_column/test/macro_filter_test.rb +23 -0
- data/vendor/gems/has_counter/.gitignore +17 -0
- data/vendor/gems/has_counter/Gemfile +4 -0
- data/vendor/gems/has_counter/LICENSE +22 -0
- data/vendor/gems/has_counter/MIT-LICENSE +20 -0
- data/vendor/gems/has_counter/README.markdown +64 -0
- data/vendor/gems/has_counter/README.md +29 -0
- data/vendor/gems/has_counter/Rakefile +2 -0
- data/vendor/gems/has_counter/db/migrate/20080601194338_create_counters_table.rb.rb +13 -0
- data/vendor/gems/has_counter/has_counter.gemspec +17 -0
- data/vendor/gems/has_counter/lib/active_record/has_counter.rb +64 -0
- data/vendor/gems/has_counter/lib/counter.rb +23 -0
- data/vendor/gems/has_counter/lib/has_counter.rb +4 -0
- data/vendor/gems/has_counter/lib/has_counter/version.rb +3 -0
- data/vendor/gems/has_counter/spec/has_counter.spec.log +0 -0
- data/vendor/gems/has_counter/spec/has_counter.sqlite3.db +0 -0
- data/vendor/gems/has_counter/spec/has_counter_spec.rb +55 -0
- data/vendor/gems/has_counter/spec/spec_helper.rb +117 -0
- data/vendor/gems/has_filter/.gitignore +17 -0
- data/vendor/gems/has_filter/Gemfile +4 -0
- data/vendor/gems/has_filter/LICENSE +22 -0
- data/vendor/gems/has_filter/README.md +29 -0
- data/vendor/gems/has_filter/Rakefile +2 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_add.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_left.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_right.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_remove.png +0 -0
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/filter.js +35 -0
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/jquery.filter.js +23 -0
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/alternate/filter.css +102 -0
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/filter.css +100 -0
- data/vendor/gems/has_filter/app/helpers/filter_helper.rb +3 -0
- data/vendor/gems/has_filter/has_filter.gemspec +17 -0
- data/vendor/gems/has_filter/init.rb +3 -0
- data/vendor/gems/has_filter/lib/has_filter.rb +22 -0
- data/vendor/gems/has_filter/lib/has_filter/active_record/act_macro.rb +102 -0
- data/vendor/gems/has_filter/lib/has_filter/filter.rb +17 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/base.rb +67 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/categorized.rb +24 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/chain.rb +45 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/set.rb +80 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/state.rb +25 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/tagged.rb +22 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/text.rb +55 -0
- data/vendor/gems/has_filter/lib/has_filter/version.rb +3 -0
- data/vendor/gems/has_filter/test/db/setup.rb +45 -0
- data/vendor/gems/has_filter/test/db/test.sqlite3.db +0 -0
- data/vendor/gems/has_filter/test/fixtures.rb +15 -0
- data/vendor/gems/has_filter/test/has_filter/filter_chain_test.rb +41 -0
- data/vendor/gems/has_filter/test/has_filter/filter_scopes_test.rb +102 -0
- data/vendor/gems/has_filter/test/has_filter/filter_tags_test.rb +113 -0
- data/vendor/gems/has_filter/test/has_filter/integration.rb +15 -0
- data/vendor/gems/has_filter/test/has_filter/scopes_test.rb +48 -0
- data/vendor/gems/has_filter/test/log/test.log +34346 -0
- data/vendor/gems/has_filter/test/models.rb +23 -0
- data/vendor/gems/has_filter/test/templates/has_filter/test/index.html.erb +5 -0
- data/vendor/gems/has_filter/test/test_helper.rb +66 -0
- data/vendor/gems/simple_taggable/.gitignore +17 -0
- data/vendor/gems/simple_taggable/Gemfile +4 -0
- data/vendor/gems/simple_taggable/LICENSE +22 -0
- data/vendor/gems/simple_taggable/README +24 -0
- data/vendor/gems/simple_taggable/README.md +29 -0
- data/vendor/gems/simple_taggable/Rakefile +2 -0
- data/vendor/gems/simple_taggable/lib/simple_taggable.rb +153 -0
- data/vendor/gems/simple_taggable/lib/simple_taggable/version.rb +3 -0
- data/vendor/gems/simple_taggable/lib/tag.rb +31 -0
- data/vendor/gems/simple_taggable/lib/tag_list.rb +90 -0
- data/vendor/gems/simple_taggable/lib/tagging.rb +8 -0
- data/vendor/gems/simple_taggable/simple_taggable.gemspec +17 -0
- data/vendor/gems/simple_taggable/test/db/schema.rb +41 -0
- data/vendor/gems/simple_taggable/test/db/simple_taggable.sqlite3.db +0 -0
- data/vendor/gems/simple_taggable/test/fixtures/magazine.rb +3 -0
- data/vendor/gems/simple_taggable/test/fixtures/magazines.yml +2 -0
- data/vendor/gems/simple_taggable/test/fixtures/photo.rb +8 -0
- data/vendor/gems/simple_taggable/test/fixtures/photos.yml +19 -0
- data/vendor/gems/simple_taggable/test/fixtures/post.rb +5 -0
- data/vendor/gems/simple_taggable/test/fixtures/posts.yml +27 -0
- data/vendor/gems/simple_taggable/test/fixtures/subscription.rb +4 -0
- data/vendor/gems/simple_taggable/test/fixtures/subscriptions.yml +3 -0
- data/vendor/gems/simple_taggable/test/fixtures/taggings.yml +112 -0
- data/vendor/gems/simple_taggable/test/fixtures/tags.yml +14 -0
- data/vendor/gems/simple_taggable/test/fixtures/user.rb +6 -0
- data/vendor/gems/simple_taggable/test/fixtures/users.yml +5 -0
- data/vendor/gems/simple_taggable/test/log/simple_taggable.log +1614 -0
- data/vendor/gems/simple_taggable/test/simple_taggable_test.rb +226 -0
- data/vendor/gems/simple_taggable/test/tag_list_test.rb +105 -0
- data/vendor/gems/simple_taggable/test/test_helper.rb +80 -0
- data/vendor/gems/table_builder/.gitignore +17 -0
- data/vendor/gems/table_builder/Gemfile +4 -0
- data/vendor/gems/table_builder/LICENSE +22 -0
- data/vendor/gems/table_builder/README.md +29 -0
- data/vendor/gems/table_builder/Rakefile +2 -0
- data/vendor/gems/table_builder/lib/table_builder.rb +27 -0
- data/vendor/gems/table_builder/lib/table_builder/body.rb +28 -0
- data/vendor/gems/table_builder/lib/table_builder/cell.rb +21 -0
- data/vendor/gems/table_builder/lib/table_builder/column.rb +26 -0
- data/vendor/gems/table_builder/lib/table_builder/foot.rb +6 -0
- data/vendor/gems/table_builder/lib/table_builder/head.rb +16 -0
- data/vendor/gems/table_builder/lib/table_builder/row.rb +40 -0
- data/vendor/gems/table_builder/lib/table_builder/rows.rb +26 -0
- data/vendor/gems/table_builder/lib/table_builder/table.rb +75 -0
- data/vendor/gems/table_builder/lib/table_builder/tag.rb +58 -0
- data/vendor/gems/table_builder/lib/table_builder/version.rb +3 -0
- data/vendor/gems/table_builder/table_builder.gemspec +17 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_all.html.erb +20 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_auto_body.html.erb +3 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_auto_columns.html.erb +1 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_simple.html.erb +7 -0
- data/vendor/gems/table_builder/test/table_builder/table_test.rb +230 -0
- data/vendor/gems/table_builder/test/test_helper.rb +49 -0
- data/vendor/gems/tags/.gitignore +17 -0
- data/vendor/gems/tags/Gemfile +4 -0
- data/vendor/gems/tags/LICENSE +22 -0
- data/vendor/gems/tags/README.md +29 -0
- data/vendor/gems/tags/Rakefile +2 -0
- data/vendor/gems/tags/lib/breadcrumbs.rb +13 -0
- data/vendor/gems/tags/lib/menu.rb +179 -0
- data/vendor/gems/tags/lib/menu/builder.rb +74 -0
- data/vendor/gems/tags/lib/tags.rb +7 -0
- data/vendor/gems/tags/lib/tags/tag.rb +125 -0
- data/vendor/gems/tags/lib/tags/version.rb +3 -0
- data/vendor/gems/tags/tags.gemspec +17 -0
- data/vendor/gems/tags/test/tags/menu_test.rb +173 -0
- data/vendor/gems/tags/test/tags/tag_test.rb +13 -0
- data/vendor/gems/tags/test/test_helper.rb +18 -0
- data/vendor/gems/xss_terminate/.gitignore +17 -0
- data/vendor/gems/xss_terminate/Gemfile +4 -0
- data/vendor/gems/xss_terminate/LICENSE +22 -0
- data/vendor/gems/xss_terminate/MIT-LICENSE +20 -0
- data/vendor/gems/xss_terminate/README +94 -0
- data/vendor/gems/xss_terminate/README.md +29 -0
- data/vendor/gems/xss_terminate/Rakefile +23 -0
- data/vendor/gems/xss_terminate/lib/html5lib_sanitize.rb +2453 -0
- data/vendor/gems/xss_terminate/lib/rails_sanitize.rb +8 -0
- data/vendor/gems/xss_terminate/lib/xss_terminate.rb +141 -0
- data/vendor/gems/xss_terminate/lib/xss_terminate/version.rb +3 -0
- data/vendor/gems/xss_terminate/tasks/xss_terminate_tasks.rake +7 -0
- data/vendor/gems/xss_terminate/test/models/comment.rb +5 -0
- data/vendor/gems/xss_terminate/test/models/entry.rb +7 -0
- data/vendor/gems/xss_terminate/test/models/message.rb +3 -0
- data/vendor/gems/xss_terminate/test/models/person.rb +5 -0
- data/vendor/gems/xss_terminate/test/models/review.rb +5 -0
- data/vendor/gems/xss_terminate/test/schema.rb +34 -0
- data/vendor/gems/xss_terminate/test/setup_test.rb +16 -0
- data/vendor/gems/xss_terminate/test/xss_terminate_test.rb +50 -0
- data/vendor/gems/xss_terminate/xss_terminate.gemspec +17 -0
- metadata +744 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 }
|
2
|
+
body {font-size: 10pt; }
|
3
|
+
h1 { padding: 15px; font-size: large; background-color: #06b; color: white; }
|
4
|
+
h1 a { color: white; }
|
5
|
+
h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal }
|
6
|
+
|
7
|
+
.pass { color: green; }
|
8
|
+
.fail { color: red; }
|
9
|
+
p.result { margin-left: 1em; }
|
10
|
+
|
11
|
+
#banner { height: 2em; border-bottom: 1px solid white; }
|
12
|
+
h2.pass { background-color: green; }
|
13
|
+
h2.fail { background-color: red; }
|
14
|
+
|
15
|
+
div.testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; }
|
16
|
+
|
17
|
+
ol#tests > li > strong { cursor:pointer; }
|
18
|
+
|
19
|
+
div#fx-tests h4 {
|
20
|
+
background: red;
|
21
|
+
}
|
22
|
+
|
23
|
+
div#fx-tests h4.pass {
|
24
|
+
background: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
div#fx-tests div.box {
|
28
|
+
background: red url(data/cow.jpg) no-repeat;
|
29
|
+
overflow: hidden;
|
30
|
+
border: 2px solid #000;
|
31
|
+
}
|
32
|
+
|
33
|
+
div#fx-tests div.overflow {
|
34
|
+
overflow: visible;
|
35
|
+
}
|
36
|
+
|
37
|
+
div.inline {
|
38
|
+
display: inline;
|
39
|
+
}
|
40
|
+
|
41
|
+
div.autoheight {
|
42
|
+
height: auto;
|
43
|
+
}
|
44
|
+
|
45
|
+
div.autowidth {
|
46
|
+
width: auto;
|
47
|
+
}
|
48
|
+
|
49
|
+
div.autoopacity {
|
50
|
+
opacity: auto;
|
51
|
+
}
|
52
|
+
|
53
|
+
div.largewidth {
|
54
|
+
width: 100px;
|
55
|
+
}
|
56
|
+
|
57
|
+
div.largeheight {
|
58
|
+
height: 100px;
|
59
|
+
}
|
60
|
+
|
61
|
+
div.largeopacity {
|
62
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
|
63
|
+
}
|
64
|
+
|
65
|
+
div.medwidth {
|
66
|
+
width: 50px;
|
67
|
+
}
|
68
|
+
|
69
|
+
div.medheight {
|
70
|
+
height: 50px;
|
71
|
+
}
|
72
|
+
|
73
|
+
div.medopacity {
|
74
|
+
opacity: 0.5;
|
75
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
|
76
|
+
}
|
77
|
+
|
78
|
+
div.nowidth {
|
79
|
+
width: 0px;
|
80
|
+
}
|
81
|
+
|
82
|
+
div.noheight {
|
83
|
+
height: 0px;
|
84
|
+
}
|
85
|
+
|
86
|
+
div.noopacity {
|
87
|
+
opacity: 0;
|
88
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
|
89
|
+
}
|
90
|
+
|
91
|
+
div.hidden {
|
92
|
+
display: none;
|
93
|
+
}
|
94
|
+
|
95
|
+
div#fx-tests div.widewidth {
|
96
|
+
background-repeat: repeat-x;
|
97
|
+
}
|
98
|
+
|
99
|
+
div#fx-tests div.wideheight {
|
100
|
+
background-repeat: repeat-y;
|
101
|
+
}
|
102
|
+
|
103
|
+
div#fx-tests div.widewidth.wideheight {
|
104
|
+
background-repeat: repeat;
|
105
|
+
}
|
106
|
+
|
107
|
+
div#fx-tests div.noback {
|
108
|
+
background-image: none;
|
109
|
+
}
|
110
|
+
|
111
|
+
div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; }
|
112
|
+
div.chain div { position: absolute; top: 0px; left: 0px; }
|
113
|
+
|
114
|
+
div.chain.test { background: red; }
|
115
|
+
div.chain.test div { background: green; }
|
116
|
+
|
117
|
+
div.chain.out { background: green; }
|
118
|
+
div.chain.out div { background: red; display: none; }
|
119
|
+
|
120
|
+
div#show-tests * { display: none; }
|
@@ -0,0 +1,588 @@
|
|
1
|
+
#
|
2
|
+
# (c) 2005-2009 Prototype Team http://prototypejs.org
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'activesupport'
|
7
|
+
require 'rake/tasklib'
|
8
|
+
require 'thread'
|
9
|
+
require 'webrick'
|
10
|
+
require 'fileutils'
|
11
|
+
include FileUtils
|
12
|
+
require 'erb'
|
13
|
+
|
14
|
+
class Browser
|
15
|
+
def supported?; true; end
|
16
|
+
def setup ; end
|
17
|
+
def open(url) ; end
|
18
|
+
def teardown ; end
|
19
|
+
|
20
|
+
def host
|
21
|
+
require 'rbconfig'
|
22
|
+
Config::CONFIG['host']
|
23
|
+
end
|
24
|
+
|
25
|
+
def macos?
|
26
|
+
host.include?('darwin')
|
27
|
+
end
|
28
|
+
|
29
|
+
def windows?
|
30
|
+
host.include?('mswin')
|
31
|
+
end
|
32
|
+
|
33
|
+
def linux?
|
34
|
+
host.include?('linux')
|
35
|
+
end
|
36
|
+
|
37
|
+
def applescript(script)
|
38
|
+
raise "Can't run AppleScript on #{host}" unless macos?
|
39
|
+
system "osascript -e '#{script}' 2>&1 >/dev/null"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class FirefoxBrowser < Browser
|
44
|
+
def initialize(path=File.join(ENV['ProgramFiles'] || 'c:\Program Files', '\Mozilla Firefox\firefox.exe'))
|
45
|
+
@path = path
|
46
|
+
end
|
47
|
+
|
48
|
+
def visit(url)
|
49
|
+
system("open -a Firefox '#{url}'") if macos?
|
50
|
+
system("#{@path} #{url}") if windows?
|
51
|
+
system("firefox #{url}") if linux?
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_s
|
55
|
+
"Firefox"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class SafariBrowser < Browser
|
60
|
+
def supported?
|
61
|
+
macos?
|
62
|
+
end
|
63
|
+
|
64
|
+
def setup
|
65
|
+
applescript('tell application "Safari" to make new document')
|
66
|
+
end
|
67
|
+
|
68
|
+
def visit(url)
|
69
|
+
applescript('tell application "Safari" to set URL of front document to "' + url + '"')
|
70
|
+
end
|
71
|
+
|
72
|
+
def teardown
|
73
|
+
#applescript('tell application "Safari" to close front document')
|
74
|
+
end
|
75
|
+
|
76
|
+
def to_s
|
77
|
+
"Safari"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class IEBrowser < Browser
|
82
|
+
def setup
|
83
|
+
require 'win32ole' if windows?
|
84
|
+
end
|
85
|
+
|
86
|
+
def supported?
|
87
|
+
windows?
|
88
|
+
end
|
89
|
+
|
90
|
+
def visit(url)
|
91
|
+
if windows?
|
92
|
+
ie = WIN32OLE.new('InternetExplorer.Application')
|
93
|
+
ie.visible = true
|
94
|
+
ie.Navigate(url)
|
95
|
+
sleep 0.01 while ie.Busy || ie.ReadyState != 4
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def to_s
|
100
|
+
"Internet Explorer"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
class KonquerorBrowser < Browser
|
105
|
+
@@configDir = File.join((ENV['HOME'] || ''), '.kde', 'share', 'config')
|
106
|
+
@@globalConfig = File.join(@@configDir, 'kdeglobals')
|
107
|
+
@@konquerorConfig = File.join(@@configDir, 'konquerorrc')
|
108
|
+
|
109
|
+
def supported?
|
110
|
+
linux?
|
111
|
+
end
|
112
|
+
|
113
|
+
# Forces KDE's default browser to be Konqueror during the tests, and forces
|
114
|
+
# Konqueror to open external URL requests in new tabs instead of a new
|
115
|
+
# window.
|
116
|
+
def setup
|
117
|
+
cd @@configDir, :verbose => false do
|
118
|
+
copy @@globalConfig, "#{@@globalConfig}.bak", :preserve => true, :verbose => false
|
119
|
+
copy @@konquerorConfig, "#{@@konquerorConfig}.bak", :preserve => true, :verbose => false
|
120
|
+
# Too lazy to write it in Ruby... Is sed dependency so bad?
|
121
|
+
system "sed -ri /^BrowserApplication=/d '#{@@globalConfig}'"
|
122
|
+
system "sed -ri /^KonquerorTabforExternalURL=/s:false:true: '#{@@konquerorConfig}'"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def teardown
|
127
|
+
cd @@configDir, :verbose => false do
|
128
|
+
copy "#{@@globalConfig}.bak", @@globalConfig, :preserve => true, :verbose => false
|
129
|
+
copy "#{@@konquerorConfig}.bak", @@konquerorConfig, :preserve => true, :verbose => false
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def visit(url)
|
134
|
+
system("kfmclient openURL #{url}")
|
135
|
+
end
|
136
|
+
|
137
|
+
def to_s
|
138
|
+
"Konqueror"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class OperaBrowser < Browser
|
143
|
+
def initialize(path='c:\Program Files\Opera\Opera.exe')
|
144
|
+
@path = path
|
145
|
+
end
|
146
|
+
|
147
|
+
def setup
|
148
|
+
if windows?
|
149
|
+
puts %{
|
150
|
+
MAJOR ANNOYANCE on Windows.
|
151
|
+
You have to shut down Opera manually after each test
|
152
|
+
for the script to proceed.
|
153
|
+
Any suggestions on fixing this is GREATLY appreciated!
|
154
|
+
Thank you for your understanding.
|
155
|
+
}
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def visit(url)
|
160
|
+
applescript('tell application "Opera" to GetURL "' + url + '"') if macos?
|
161
|
+
system("#{@path} #{url}") if windows?
|
162
|
+
system("opera #{url}") if linux?
|
163
|
+
end
|
164
|
+
|
165
|
+
def to_s
|
166
|
+
"Opera"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# shut up, webrick :-)
|
171
|
+
class ::WEBrick::HTTPServer
|
172
|
+
def access_log(config, req, res)
|
173
|
+
# nop
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class ::WEBrick::BasicLog
|
178
|
+
def log(level, data)
|
179
|
+
# nop
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
class WEBrick::HTTPResponse
|
184
|
+
alias send send_response
|
185
|
+
def send_response(socket)
|
186
|
+
send(socket) unless fail_silently?
|
187
|
+
end
|
188
|
+
|
189
|
+
def fail_silently?
|
190
|
+
@fail_silently
|
191
|
+
end
|
192
|
+
|
193
|
+
def fail_silently
|
194
|
+
@fail_silently = true
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
class WEBrick::HTTPRequest
|
199
|
+
def to_json
|
200
|
+
headers = []
|
201
|
+
each { |k, v| headers.push "#{k.inspect}: #{v.inspect}" }
|
202
|
+
headers = "{" << headers.join(', ') << "}"
|
203
|
+
%({ "headers": #{headers}, "body": #{body.inspect}, "method": #{request_method.inspect} })
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
class WEBrick::HTTPServlet::AbstractServlet
|
208
|
+
def prevent_caching(res)
|
209
|
+
res['ETag'] = nil
|
210
|
+
res['Last-Modified'] = Time.now + 100**4
|
211
|
+
res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
|
212
|
+
res['Pragma'] = 'no-cache'
|
213
|
+
res['Expires'] = Time.now - 100**4
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
class BasicServlet < WEBrick::HTTPServlet::AbstractServlet
|
218
|
+
def do_GET(req, res)
|
219
|
+
prevent_caching(res)
|
220
|
+
res['Content-Type'] = "text/plain"
|
221
|
+
|
222
|
+
req.query.each do |k, v|
|
223
|
+
res[k] = v unless k == 'responseBody'
|
224
|
+
end
|
225
|
+
res.body = req.query["responseBody"]
|
226
|
+
|
227
|
+
raise WEBrick::HTTPStatus::OK
|
228
|
+
end
|
229
|
+
|
230
|
+
def do_POST(req, res)
|
231
|
+
do_GET(req, res)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class SlowServlet < BasicServlet
|
236
|
+
def do_GET(req, res)
|
237
|
+
sleep(2)
|
238
|
+
super
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
class DownServlet < BasicServlet
|
243
|
+
def do_GET(req, res)
|
244
|
+
res.fail_silently
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
class InspectionServlet < BasicServlet
|
249
|
+
def do_GET(req, res)
|
250
|
+
prevent_caching(res)
|
251
|
+
res['Content-Type'] = "application/json"
|
252
|
+
res.body = req.to_json
|
253
|
+
raise WEBrick::HTTPStatus::OK
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
class NonCachingFileHandler < WEBrick::HTTPServlet::FileHandler
|
258
|
+
def do_GET(req, res)
|
259
|
+
super
|
260
|
+
set_default_content_type(res, req.path)
|
261
|
+
prevent_caching(res)
|
262
|
+
end
|
263
|
+
|
264
|
+
def set_default_content_type(res, path)
|
265
|
+
res['Content-Type'] = case path
|
266
|
+
when /\.js$/ then 'text/javascript'
|
267
|
+
when /\.html$/ then 'text/html'
|
268
|
+
when /\.css$/ then 'text/css'
|
269
|
+
else 'text/plain'
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
class JavaScriptTestTask < ::Rake::TaskLib
|
275
|
+
|
276
|
+
def initialize(name=:test)
|
277
|
+
@name = name
|
278
|
+
@tests = []
|
279
|
+
@browsers = []
|
280
|
+
|
281
|
+
@queue = Queue.new
|
282
|
+
|
283
|
+
@server = WEBrick::HTTPServer.new(:Port => 4711) # TODO: make port configurable
|
284
|
+
@server.mount_proc("/results") do |req, res|
|
285
|
+
@queue.push(req)
|
286
|
+
res.body = "OK"
|
287
|
+
end
|
288
|
+
@server.mount("/response", BasicServlet)
|
289
|
+
@server.mount("/slow", SlowServlet)
|
290
|
+
@server.mount("/down", DownServlet)
|
291
|
+
@server.mount("/inspect", InspectionServlet)
|
292
|
+
yield self if block_given?
|
293
|
+
define
|
294
|
+
end
|
295
|
+
|
296
|
+
def define
|
297
|
+
task @name do
|
298
|
+
trap("INT") { @server.shutdown; exit }
|
299
|
+
t = Thread.new { @server.start }
|
300
|
+
|
301
|
+
# run all combinations of browsers and tests
|
302
|
+
@browsers.each do |browser|
|
303
|
+
if browser.supported?
|
304
|
+
t0 = Time.now
|
305
|
+
test_suite_results = TestSuiteResults.new
|
306
|
+
|
307
|
+
browser.setup
|
308
|
+
puts "\nStarted tests in #{browser}."
|
309
|
+
|
310
|
+
@tests.each do |test|
|
311
|
+
browser.visit(get_url(test))
|
312
|
+
results = TestResults.new(@queue.pop.query, test[:url])
|
313
|
+
print results
|
314
|
+
test_suite_results << results
|
315
|
+
end
|
316
|
+
|
317
|
+
print "\nFinished in #{Time.now - t0} seconds."
|
318
|
+
print test_suite_results
|
319
|
+
browser.teardown
|
320
|
+
else
|
321
|
+
puts "\nSkipping #{browser}, not supported on this OS."
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
@test_builder.teardown
|
326
|
+
@server.shutdown
|
327
|
+
t.join
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
def get_url(test)
|
332
|
+
params = "resultsURL=http://localhost:4711/results&t=" + ("%.6f" % Time.now.to_f)
|
333
|
+
params << "&tests=#{test[:testcases]}" unless test[:testcases] == :all
|
334
|
+
"http://localhost:4711#{test[:url]}?#{params}"
|
335
|
+
end
|
336
|
+
|
337
|
+
def mount(path, dir=nil)
|
338
|
+
dir = Dir.pwd + path unless dir
|
339
|
+
|
340
|
+
# don't cache anything in our tests
|
341
|
+
@server.mount(path, NonCachingFileHandler, dir)
|
342
|
+
end
|
343
|
+
|
344
|
+
# test should be specified as a hash of the form
|
345
|
+
# {:url => "url", :testcases => "testFoo,testBar"}.
|
346
|
+
# specifying :testcases is optional
|
347
|
+
def run(url, testcases = :all)
|
348
|
+
@tests << { :url => url, :testcases => testcases }
|
349
|
+
end
|
350
|
+
|
351
|
+
def browser(browser)
|
352
|
+
browser =
|
353
|
+
case(browser)
|
354
|
+
when :firefox
|
355
|
+
FirefoxBrowser.new
|
356
|
+
when :safari
|
357
|
+
SafariBrowser.new
|
358
|
+
when :ie
|
359
|
+
IEBrowser.new
|
360
|
+
when :konqueror
|
361
|
+
KonquerorBrowser.new
|
362
|
+
when :opera
|
363
|
+
OperaBrowser.new
|
364
|
+
else
|
365
|
+
browser
|
366
|
+
end
|
367
|
+
|
368
|
+
@browsers<<browser
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
class AdvaJavaScriptTestTask < JavaScriptTestTask
|
373
|
+
ASSETS_PATH = File.expand_path(File.dirname(__FILE__) + "/../assets")
|
374
|
+
|
375
|
+
def prepare_plugins(plugins)
|
376
|
+
plugins ||= Dir[File.expand_path(File.dirname(__FILE__) + "/../../../../*")].map{ |dir| File.basename(dir) }
|
377
|
+
@plugins = plugins.map do |name|
|
378
|
+
plugin = Plugin.new(name)
|
379
|
+
raise "Unknown plugin #{plugin}" unless plugin.exist?
|
380
|
+
plugin
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
def mount_root
|
385
|
+
mount "/", ASSETS_PATH
|
386
|
+
end
|
387
|
+
|
388
|
+
def mount_plugins
|
389
|
+
@plugins.each do |plugin|
|
390
|
+
mount "/#{plugin}", "#{plugin.root}/public"
|
391
|
+
mount "/#{plugin}/assets", "#{plugin.root}/test/javascript/assets"
|
392
|
+
mount "/#{plugin}/test", "#{plugin.root}/test/javascript/tmp"
|
393
|
+
mount_controllers plugin
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
def prepare_tests
|
398
|
+
@test_builder = TestBuilder.new(self, @plugins)
|
399
|
+
@test_builder.setup
|
400
|
+
end
|
401
|
+
|
402
|
+
private
|
403
|
+
def mount_controllers(plugin)
|
404
|
+
Dir["#{plugin.root}/test/javascript/assets/**/*_controller.rb"].each do |controller|
|
405
|
+
require controller
|
406
|
+
controller = File.basename(controller, ".rb")
|
407
|
+
@server.mount "/#{plugin}/controllers/#{controller.gsub("_controller", "")}", controller.camelize.constantize
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
class TestResults
|
413
|
+
attr_reader :modules, :tests, :assertions, :failures, :errors, :filename
|
414
|
+
def initialize(query, filename)
|
415
|
+
@modules = query['modules'].to_i
|
416
|
+
@tests = query['tests'].to_i
|
417
|
+
@assertions = query['assertions'].to_i
|
418
|
+
@failures = query['failures'].to_i
|
419
|
+
@errors = query['errors'].to_i
|
420
|
+
@filename = filename
|
421
|
+
end
|
422
|
+
|
423
|
+
def error?
|
424
|
+
@errors > 0
|
425
|
+
end
|
426
|
+
|
427
|
+
def failure?
|
428
|
+
@failures > 0
|
429
|
+
end
|
430
|
+
|
431
|
+
def to_s
|
432
|
+
return "E" if error?
|
433
|
+
return "F" if failure?
|
434
|
+
"."
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
class TestSuiteResults
|
439
|
+
def initialize
|
440
|
+
@modules = 0
|
441
|
+
@tests = 0
|
442
|
+
@assertions = 0
|
443
|
+
@failures = 0
|
444
|
+
@errors = 0
|
445
|
+
@error_files = []
|
446
|
+
@failure_files = []
|
447
|
+
end
|
448
|
+
|
449
|
+
def <<(result)
|
450
|
+
@modules += result.modules
|
451
|
+
@tests += result.tests
|
452
|
+
@assertions += result.assertions
|
453
|
+
@failures += result.failures
|
454
|
+
@errors += result.errors
|
455
|
+
@error_files.push(result.filename) if result.error?
|
456
|
+
@failure_files.push(result.filename) if result.failure?
|
457
|
+
end
|
458
|
+
|
459
|
+
def error?
|
460
|
+
@errors > 0
|
461
|
+
end
|
462
|
+
|
463
|
+
def failure?
|
464
|
+
@failures > 0
|
465
|
+
end
|
466
|
+
|
467
|
+
def to_s
|
468
|
+
str = ""
|
469
|
+
str << "\n Failures: #{@failure_files.join(', ')}" if failure?
|
470
|
+
str << "\n Errors: #{@error_files.join(', ')}" if error?
|
471
|
+
"#{str}\n#{summary}\n\n"
|
472
|
+
end
|
473
|
+
|
474
|
+
def summary
|
475
|
+
"#{@modules} modules, #{@tests} tests, #{@assertions} assertions, #{@failures} failures, #{@errors} errors."
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
class TestBuilder
|
480
|
+
TEMPLATE_PATH = File.expand_path(File.dirname(__FILE__) + "/../templates/test_case.erb")
|
481
|
+
attr_reader :test_task
|
482
|
+
|
483
|
+
def initialize(test_task, plugins)
|
484
|
+
@test_task, @plugins = test_task, plugins
|
485
|
+
@template = ERB.new(File.new(TEMPLATE_PATH).read)
|
486
|
+
end
|
487
|
+
|
488
|
+
def setup
|
489
|
+
@plugins.each do |plugin|
|
490
|
+
plugin.create_temp_test_path
|
491
|
+
plugin.test_cases.each do |test_case|
|
492
|
+
@test_case = test_case
|
493
|
+
self.write_template plugin
|
494
|
+
self.test_task.run test_case.url
|
495
|
+
end
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
def teardown
|
500
|
+
@plugins.each { |plugin| plugin.destroy_temp_test_path }
|
501
|
+
end
|
502
|
+
|
503
|
+
protected
|
504
|
+
def write_template(plugin)
|
505
|
+
template_path = "#{plugin.temp_test_path}/#{@test_case.type}/#{@test_case.title}.html"
|
506
|
+
File.open(template_path, 'w') { |f| f.write(@template.result(binding)) }
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
class Plugin
|
511
|
+
PLUGINS_ROOT = File.expand_path(File.dirname(__FILE__) + "/../../../../")
|
512
|
+
attr_reader :name
|
513
|
+
|
514
|
+
def initialize(name)
|
515
|
+
@name = name
|
516
|
+
end
|
517
|
+
|
518
|
+
def test_cases
|
519
|
+
@test_cases ||= Dir["#{test_path}/**/*_test.js"].map {|file| TestCase.new(self, file)}
|
520
|
+
end
|
521
|
+
|
522
|
+
def root
|
523
|
+
@root ||= File.join(PLUGINS_ROOT, name)
|
524
|
+
end
|
525
|
+
|
526
|
+
def test_path
|
527
|
+
"#{root}/test/javascript"
|
528
|
+
end
|
529
|
+
|
530
|
+
def temp_test_path
|
531
|
+
"#{test_path}/tmp"
|
532
|
+
end
|
533
|
+
|
534
|
+
def create_temp_test_path
|
535
|
+
destroy_temp_test_path
|
536
|
+
FileUtils.mkdir_p "#{temp_test_path}/unit"
|
537
|
+
FileUtils.mkdir_p "#{temp_test_path}/functional"
|
538
|
+
end
|
539
|
+
|
540
|
+
def destroy_temp_test_path
|
541
|
+
FileUtils.rm_rf(temp_test_path) rescue nil
|
542
|
+
end
|
543
|
+
|
544
|
+
def exist?
|
545
|
+
File.directory?(root)
|
546
|
+
end
|
547
|
+
|
548
|
+
def to_s
|
549
|
+
name
|
550
|
+
end
|
551
|
+
end
|
552
|
+
|
553
|
+
class TestCase
|
554
|
+
attr_reader :plugin
|
555
|
+
|
556
|
+
def initialize(plugin, path)
|
557
|
+
@plugin, @path = plugin, path
|
558
|
+
end
|
559
|
+
|
560
|
+
def title
|
561
|
+
File.basename(@path, ".js")
|
562
|
+
end
|
563
|
+
|
564
|
+
def content
|
565
|
+
File.new(@path).read
|
566
|
+
end
|
567
|
+
|
568
|
+
def type
|
569
|
+
@type ||= @path =~ /unit/ ? "unit" : "functional"
|
570
|
+
end
|
571
|
+
|
572
|
+
def relative_path
|
573
|
+
@relative_path ||= @path.gsub("#{@plugin.root}/test/javascript/#{type}/", "")
|
574
|
+
end
|
575
|
+
|
576
|
+
def target
|
577
|
+
"/#{@plugin.name}/assets/#{@plugin.name}/#{relative_path.gsub("_test", "")}"
|
578
|
+
end
|
579
|
+
|
580
|
+
def html_fixtures
|
581
|
+
path = "#{@plugin.root}/test/javascript/fixtures/#{type}/#{relative_path.gsub("_test.js", "_fixtures.html")}"
|
582
|
+
File.new(path).read rescue ""
|
583
|
+
end
|
584
|
+
|
585
|
+
def url
|
586
|
+
"/#{@plugin.name}/test/#{type}/#{title}.html"
|
587
|
+
end
|
588
|
+
end
|