refinerycms 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTORS +8 -0
- data/LICENSE +21 -0
- data/README +40 -0
- data/app/controllers/application.rb +3 -0
- data/app/controllers/application_controller.rb +8 -0
- data/config/amazon_s3.yml +17 -0
- data/config/boot.rb +110 -0
- data/config/database.yml.example +20 -0
- data/config/environment.rb +67 -0
- data/config/environments/development.rb +17 -0
- data/config/environments/production.rb +19 -0
- data/config/environments/test.rb +22 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/rackspace_cloudfiles.yml +14 -0
- data/config/routes.rb +19 -0
- data/db/migrate/20090903030652_remove_title_from_resources.rb +9 -0
- data/db/migrate/20090914025122_change_default_image_thumbnails.rb +9 -0
- data/db/migrate/20090916025552_resave_refinery_settings_through_serializer.rb +13 -0
- data/db/migrate/20090916045536_create_user_plugins.rb +41 -0
- data/db/migrate/20090916055243_add_position_to_user_plugins.rb +9 -0
- data/db/schema.rb +141 -0
- data/db/seeds.rb +109 -0
- data/lib/refinery_initializer.rb +9 -0
- data/public/.htaccess +40 -0
- data/public/404.html +29 -0
- data/public/422.html +30 -0
- data/public/500.html +30 -0
- data/public/favicon.ico +0 -0
- data/public/images/lightbox/bullet.gif +0 -0
- data/public/images/lightbox/close.gif +0 -0
- data/public/images/lightbox/closelabel.gif +0 -0
- data/public/images/lightbox/donate-button.gif +0 -0
- data/public/images/lightbox/download-icon.gif +0 -0
- data/public/images/lightbox/loading.gif +0 -0
- data/public/images/lightbox/nextlabel.gif +0 -0
- data/public/images/lightbox/prevlabel.gif +0 -0
- data/public/images/refinery/add.gif +0 -0
- data/public/images/refinery/add.png +0 -0
- data/public/images/refinery/admin_bg.png +0 -0
- data/public/images/refinery/ajax-loader.gif +0 -0
- data/public/images/refinery/branch-end.gif +0 -0
- data/public/images/refinery/branch-start.gif +0 -0
- data/public/images/refinery/branch.gif +0 -0
- data/public/images/refinery/cross.gif +0 -0
- data/public/images/refinery/deactive-gradient.gif +0 -0
- data/public/images/refinery/delete.gif +0 -0
- data/public/images/refinery/drag.gif +0 -0
- data/public/images/refinery/edit.gif +0 -0
- data/public/images/refinery/header-background.gif +0 -0
- data/public/images/refinery/header_background.png +0 -0
- data/public/images/refinery/hover-gradient.jpg +0 -0
- data/public/images/refinery/icons/accept.png +0 -0
- data/public/images/refinery/icons/add.png +0 -0
- data/public/images/refinery/icons/application_edit.png +0 -0
- data/public/images/refinery/icons/application_go.png +0 -0
- data/public/images/refinery/icons/arrow_left.png +0 -0
- data/public/images/refinery/icons/arrow_switch.png +0 -0
- data/public/images/refinery/icons/arrow_up.png +0 -0
- data/public/images/refinery/icons/bin_closed.png +0 -0
- data/public/images/refinery/icons/cancel.png +0 -0
- data/public/images/refinery/icons/cog_add.png +0 -0
- data/public/images/refinery/icons/cog_edit.png +0 -0
- data/public/images/refinery/icons/cross.png +0 -0
- data/public/images/refinery/icons/delete.png +0 -0
- data/public/images/refinery/icons/edit.png +0 -0
- data/public/images/refinery/icons/email_edit.png +0 -0
- data/public/images/refinery/icons/email_go.png +0 -0
- data/public/images/refinery/icons/email_open.png +0 -0
- data/public/images/refinery/icons/eye.png +0 -0
- data/public/images/refinery/icons/help.png +0 -0
- data/public/images/refinery/icons/image_add.png +0 -0
- data/public/images/refinery/icons/image_edit.png +0 -0
- data/public/images/refinery/icons/layout_add.png +0 -0
- data/public/images/refinery/icons/layout_edit.png +0 -0
- data/public/images/refinery/icons/page_add.png +0 -0
- data/public/images/refinery/icons/page_edit.png +0 -0
- data/public/images/refinery/icons/page_link.png +0 -0
- data/public/images/refinery/icons/page_white_edit.png +0 -0
- data/public/images/refinery/icons/page_white_put.png +0 -0
- data/public/images/refinery/icons/reorder.png +0 -0
- data/public/images/refinery/icons/tick.png +0 -0
- data/public/images/refinery/icons/user.png +0 -0
- data/public/images/refinery/icons/user_add.png +0 -0
- data/public/images/refinery/icons/user_comment.png +0 -0
- data/public/images/refinery/icons/user_edit.png +0 -0
- data/public/images/refinery/info.gif +0 -0
- data/public/images/refinery/logo.png +0 -0
- data/public/images/refinery/m-tools.gif +0 -0
- data/public/images/refinery/magnifier.png +0 -0
- data/public/images/refinery/nav-3-background.gif +0 -0
- data/public/images/refinery/page_bg.png +0 -0
- data/public/images/refinery/resolve-digital.gif +0 -0
- data/public/images/refinery/search.gif +0 -0
- data/public/images/refinery/shad_blcorner.png +0 -0
- data/public/images/refinery/shad_bottom.png +0 -0
- data/public/images/refinery/shad_brcorner.png +0 -0
- data/public/images/refinery/shad_tlcorner.png +0 -0
- data/public/images/refinery/shad_trcorner.png +0 -0
- data/public/images/refinery/tableft.gif +0 -0
- data/public/images/refinery/tabright.gif +0 -0
- data/public/images/refinery/tick.gif +0 -0
- data/public/images/thickbox/cross.png +0 -0
- data/public/images/thickbox/loadingAnimation.gif +0 -0
- data/public/images/thickbox/macFFBgHack.png +0 -0
- data/public/images/wymeditor/skins/refinery/blockquote.png +0 -0
- data/public/images/wymeditor/skins/refinery/center.png +0 -0
- data/public/images/wymeditor/skins/refinery/css.png +0 -0
- data/public/images/wymeditor/skins/refinery/h1.png +0 -0
- data/public/images/wymeditor/skins/refinery/h2.png +0 -0
- data/public/images/wymeditor/skins/refinery/h3.png +0 -0
- data/public/images/wymeditor/skins/refinery/h4.png +0 -0
- data/public/images/wymeditor/skins/refinery/h5.png +0 -0
- data/public/images/wymeditor/skins/refinery/h6.png +0 -0
- data/public/images/wymeditor/skins/refinery/icons.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
- data/public/images/wymeditor/skins/refinery/justify.png +0 -0
- data/public/images/wymeditor/skins/refinery/left.png +0 -0
- data/public/images/wymeditor/skins/refinery/paragraph.png +0 -0
- data/public/images/wymeditor/skins/refinery/right.png +0 -0
- data/public/images/wymeditor/skins/wymeditor_icon.png +0 -0
- data/public/javascripts/admin.js +26 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/builder.js +136 -0
- data/public/javascripts/controls.js +963 -0
- data/public/javascripts/dialog.js +52 -0
- data/public/javascripts/dragdrop.js +973 -0
- data/public/javascripts/effects.js +1128 -0
- data/public/javascripts/fastinit.js +84 -0
- data/public/javascripts/jquery/GPL-LICENSE.txt +278 -0
- data/public/javascripts/jquery/MIT-LICENSE.txt +20 -0
- data/public/javascripts/jquery/README +67 -0
- data/public/javascripts/jquery/jquery.js +11 -0
- data/public/javascripts/jquery/jquery.ui.draggable.js +1 -0
- data/public/javascripts/jquery/jquery.ui.js +1 -0
- data/public/javascripts/jquery/jquery.ui.resizable.js +1 -0
- data/public/javascripts/jquery/jquery.ui.sortable.js +1 -0
- data/public/javascripts/lightbox.js +503 -0
- data/public/javascripts/livepipe.js +356 -0
- data/public/javascripts/overlabel.js +66 -0
- data/public/javascripts/parse_url.js +38 -0
- data/public/javascripts/prototype.enhancements.js +24 -0
- data/public/javascripts/prototype.js +4320 -0
- data/public/javascripts/scriptaculous.js +47 -0
- data/public/javascripts/slider.js +275 -0
- data/public/javascripts/tabs.js +147 -0
- data/public/javascripts/thickbox.js +363 -0
- data/public/javascripts/tooltips.js +173 -0
- data/public/javascripts/wymeditor/boot_wym.js +163 -0
- data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +4986 -0
- data/public/javascripts/wymeditor/lang/ca.js +45 -0
- data/public/javascripts/wymeditor/lang/cs.js +45 -0
- data/public/javascripts/wymeditor/lang/de.js +45 -0
- data/public/javascripts/wymeditor/lang/en.js +48 -0
- data/public/javascripts/wymeditor/lang/es.js +45 -0
- data/public/javascripts/wymeditor/lang/fa.js +46 -0
- data/public/javascripts/wymeditor/lang/fr.js +45 -0
- data/public/javascripts/wymeditor/lang/he.js +45 -0
- data/public/javascripts/wymeditor/lang/hu.js +45 -0
- data/public/javascripts/wymeditor/lang/it.js +45 -0
- data/public/javascripts/wymeditor/lang/nb.js +45 -0
- data/public/javascripts/wymeditor/lang/nl.js +45 -0
- data/public/javascripts/wymeditor/lang/nn.js +45 -0
- data/public/javascripts/wymeditor/lang/pl.js +45 -0
- data/public/javascripts/wymeditor/lang/pt-br.js +45 -0
- data/public/javascripts/wymeditor/lang/pt.js +45 -0
- data/public/javascripts/wymeditor/lang/ru.js +45 -0
- data/public/javascripts/wymeditor/lang/sv.js +45 -0
- data/public/javascripts/wymeditor/lang/tr.js +45 -0
- data/public/javascripts/wymeditor/lang/zh_cn.js +47 -0
- data/public/javascripts/wymeditor/skins/refinery/skin.js +40 -0
- data/public/robots.txt +2 -0
- data/public/stylesheets/application.css +0 -0
- data/public/stylesheets/application.css.example +76 -0
- data/public/stylesheets/formatting.css +0 -0
- data/public/stylesheets/formatting.css.example +86 -0
- data/public/stylesheets/home.css +0 -0
- data/public/stylesheets/home.css.example +27 -0
- data/public/stylesheets/ie6.css +0 -0
- data/public/stylesheets/ie7.css +0 -0
- data/public/stylesheets/lightbox.css +27 -0
- data/public/stylesheets/overlabel.css +21 -0
- data/public/stylesheets/refinery.css +1036 -0
- data/public/stylesheets/theme.css +36 -0
- data/public/stylesheets/thickbox.css +165 -0
- data/public/stylesheets/tooltips.css +38 -0
- data/public/stylesheets/wymeditor/skins/refinery/skin.css +211 -0
- data/public/stylesheets/wymeditor/skins/refinery/wymiframe.css +92 -0
- data/public/wymeditor/GPL-license.txt +278 -0
- data/public/wymeditor/MIT-license.txt +20 -0
- data/public/wymeditor/README +35 -0
- data/vendor/plugins/acts_as_indexed/CHANGELOG +74 -0
- data/vendor/plugins/acts_as_indexed/MIT-LICENSE +20 -0
- data/vendor/plugins/acts_as_indexed/README.rdoc +114 -0
- data/vendor/plugins/acts_as_indexed/Rakefile +35 -0
- data/vendor/plugins/acts_as_indexed/init.rb +2 -0
- data/vendor/plugins/acts_as_indexed/lib/acts_as_indexed.rb +224 -0
- data/vendor/plugins/acts_as_indexed/lib/search_atom.rb +107 -0
- data/vendor/plugins/acts_as_indexed/lib/search_index.rb +329 -0
- data/vendor/plugins/acts_as_indexed/lib/will_paginate_search.rb +29 -0
- data/vendor/plugins/acts_as_indexed/test/abstract_unit.rb +47 -0
- data/vendor/plugins/acts_as_indexed/test/acts_as_indexed_test.rb +102 -0
- data/vendor/plugins/acts_as_indexed/test/database.yml +10 -0
- data/vendor/plugins/acts_as_indexed/test/fixtures/post.rb +5 -0
- data/vendor/plugins/acts_as_indexed/test/fixtures/posts.yml +31 -0
- data/vendor/plugins/acts_as_indexed/test/schema.rb +6 -0
- data/vendor/plugins/acts_as_tree/README +26 -0
- data/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +141 -0
- data/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/vendor/plugins/attachment_fu/CHANGELOG +35 -0
- data/vendor/plugins/attachment_fu/LICENSE +20 -0
- data/vendor/plugins/attachment_fu/README +193 -0
- data/vendor/plugins/attachment_fu/Rakefile +22 -0
- data/vendor/plugins/attachment_fu/amazon_s3.yml.tpl +17 -0
- data/vendor/plugins/attachment_fu/init.rb +16 -0
- data/vendor/plugins/attachment_fu/install.rb +7 -0
- data/vendor/plugins/attachment_fu/lib/geometry.rb +93 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb +514 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/cloud_file_backend.rb +211 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb +39 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb +126 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb +394 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/core_image_processor.rb +59 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/gd2_processor.rb +54 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb +61 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb +132 -0
- data/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb +57 -0
- data/vendor/plugins/attachment_fu/rackspace_cloudfiles.yml.tpl +14 -0
- data/vendor/plugins/attachment_fu/test/backends/db_file_test.rb +16 -0
- data/vendor/plugins/attachment_fu/test/backends/file_system_test.rb +143 -0
- data/vendor/plugins/attachment_fu/test/backends/remote/cloudfiles_test.rb +102 -0
- data/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb +119 -0
- data/vendor/plugins/attachment_fu/test/base_attachment_tests.rb +77 -0
- data/vendor/plugins/attachment_fu/test/basic_test.rb +70 -0
- data/vendor/plugins/attachment_fu/test/database.yml +18 -0
- data/vendor/plugins/attachment_fu/test/extra_attachment_test.rb +67 -0
- data/vendor/plugins/attachment_fu/test/fixtures/attachment.rb +226 -0
- data/vendor/plugins/attachment_fu/test/fixtures/files/fake/rails.png +0 -0
- data/vendor/plugins/attachment_fu/test/fixtures/files/foo.txt +1 -0
- data/vendor/plugins/attachment_fu/test/fixtures/files/rails.png +0 -0
- data/vendor/plugins/attachment_fu/test/geometry_test.rb +108 -0
- data/vendor/plugins/attachment_fu/test/processors/core_image_test.rb +37 -0
- data/vendor/plugins/attachment_fu/test/processors/gd2_test.rb +31 -0
- data/vendor/plugins/attachment_fu/test/processors/image_science_test.rb +31 -0
- data/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb +103 -0
- data/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb +255 -0
- data/vendor/plugins/attachment_fu/test/schema.rb +134 -0
- data/vendor/plugins/attachment_fu/test/test_helper.rb +150 -0
- data/vendor/plugins/attachment_fu/test/validation_test.rb +55 -0
- data/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/color.rb +27 -0
- data/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/effects.rb +31 -0
- data/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/perspective.rb +25 -0
- data/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/quality.rb +25 -0
- data/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/scale.rb +47 -0
- data/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/watermark.rb +32 -0
- data/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/processor.rb +123 -0
- data/vendor/plugins/authentication/README +0 -0
- data/vendor/plugins/authentication/Rakefile +0 -0
- data/vendor/plugins/authentication/app/controllers/admin/users_controller.rb +93 -0
- data/vendor/plugins/authentication/app/controllers/sessions_controller.rb +30 -0
- data/vendor/plugins/authentication/app/controllers/users_controller.rb +86 -0
- data/vendor/plugins/authentication/app/helpers/sessions_helper.rb +2 -0
- data/vendor/plugins/authentication/app/helpers/users_helper.rb +2 -0
- data/vendor/plugins/authentication/app/models/user.rb +146 -0
- data/vendor/plugins/authentication/app/models/user_mailer.rb +25 -0
- data/vendor/plugins/authentication/app/models/user_observer.rb +11 -0
- data/vendor/plugins/authentication/app/models/user_plugin.rb +5 -0
- data/vendor/plugins/authentication/app/views/admin/users/_form.html.erb +42 -0
- data/vendor/plugins/authentication/app/views/admin/users/edit.html.erb +1 -0
- data/vendor/plugins/authentication/app/views/admin/users/index.html.erb +41 -0
- data/vendor/plugins/authentication/app/views/admin/users/new.html.erb +1 -0
- data/vendor/plugins/authentication/app/views/sessions/new.html.erb +21 -0
- data/vendor/plugins/authentication/app/views/user_mailer/activation.html.erb +3 -0
- data/vendor/plugins/authentication/app/views/user_mailer/signup_notification.html.erb +8 -0
- data/vendor/plugins/authentication/app/views/users/new.html.erb +28 -0
- data/vendor/plugins/authentication/config/routes.rb +10 -0
- data/vendor/plugins/authentication/init.rb +13 -0
- data/vendor/plugins/authentication/lib/authenticated_system.rb +115 -0
- data/vendor/plugins/authentication/lib/authenticated_test_helper.rb +10 -0
- data/vendor/plugins/authentication/test/fixtures/users.yml +19 -0
- data/vendor/plugins/authentication/test/functional/admin/base_controller_test.rb +8 -0
- data/vendor/plugins/authentication/test/functional/admin/dashboard_controller_test.rb +8 -0
- data/vendor/plugins/authentication/test/functional/admin/pages_controller_test.rb +8 -0
- data/vendor/plugins/authentication/test/functional/sessions_controller_test.rb +85 -0
- data/vendor/plugins/authentication/test/functional/users_controller_test.rb +99 -0
- data/vendor/plugins/authentication/test/test_helper.rb +38 -0
- data/vendor/plugins/authentication/test/unit/user_mailer_test.rb +31 -0
- data/vendor/plugins/authentication/test/unit/user_test.rb +164 -0
- data/vendor/plugins/dashboard/app/controllers/admin/dashboard_controller.rb +16 -0
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +19 -0
- data/vendor/plugins/dashboard/app/views/admin/dashboard/_recent_activity.html.erb +14 -0
- data/vendor/plugins/dashboard/app/views/admin/dashboard/index.html.erb +31 -0
- data/vendor/plugins/dashboard/config/routes.rb +5 -0
- data/vendor/plugins/dashboard/init.rb +7 -0
- data/vendor/plugins/images/app/controllers/admin/images_controller.rb +72 -0
- data/vendor/plugins/images/app/helpers/admin/images_helper.rb +17 -0
- data/vendor/plugins/images/app/models/image.rb +51 -0
- data/vendor/plugins/images/app/views/admin/images/_form.html.erb +36 -0
- data/vendor/plugins/images/app/views/admin/images/_grid_view.html.erb +17 -0
- data/vendor/plugins/images/app/views/admin/images/_list_view.html.erb +21 -0
- data/vendor/plugins/images/app/views/admin/images/edit.html.erb +1 -0
- data/vendor/plugins/images/app/views/admin/images/index.html.erb +43 -0
- data/vendor/plugins/images/app/views/admin/images/insert.html.erb +115 -0
- data/vendor/plugins/images/app/views/admin/images/new.html.erb +1 -0
- data/vendor/plugins/images/config/routes.rb +5 -0
- data/vendor/plugins/images/init.rb +8 -0
- data/vendor/plugins/images/lib/tasks/images.rake +28 -0
- data/vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb +29 -0
- data/vendor/plugins/inquiries/app/controllers/admin/inquiry_settings_controller.rb +16 -0
- data/vendor/plugins/inquiries/app/controllers/inquiries_controller.rb +41 -0
- data/vendor/plugins/inquiries/app/helpers/inquiries_helper.rb +13 -0
- data/vendor/plugins/inquiries/app/models/inquiry.rb +18 -0
- data/vendor/plugins/inquiries/app/models/inquiry_mailer.rb +19 -0
- data/vendor/plugins/inquiries/app/models/inquiry_setting.rb +11 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +27 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiries/index.html.erb +44 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiries/show.html.erb +62 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/_confirmation_email_form.html.erb +50 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/_notification_recipients_form.html.erb +22 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/edit.html.erb +5 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/index.html.erb +32 -0
- data/vendor/plugins/inquiries/app/views/inquiries/new.html.erb +33 -0
- data/vendor/plugins/inquiries/app/views/inquiries/thank_you.html.erb +9 -0
- data/vendor/plugins/inquiries/app/views/inquiry_mailer/confirmation.html.erb +1 -0
- data/vendor/plugins/inquiries/app/views/inquiry_mailer/notification.html.erb +18 -0
- data/vendor/plugins/inquiries/config/routes.rb +8 -0
- data/vendor/plugins/inquiries/init.rb +11 -0
- data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +5 -0
- data/vendor/plugins/news/app/controllers/news_items_controller.rb +20 -0
- data/vendor/plugins/news/app/models/news_item.rb +26 -0
- data/vendor/plugins/news/app/views/admin/news_items/_form.html.erb +33 -0
- data/vendor/plugins/news/app/views/admin/news_items/_news_item.html.erb +15 -0
- data/vendor/plugins/news/app/views/admin/news_items/edit.html.erb +1 -0
- data/vendor/plugins/news/app/views/admin/news_items/index.html.erb +36 -0
- data/vendor/plugins/news/app/views/admin/news_items/new.html.erb +1 -0
- data/vendor/plugins/news/app/views/news_items/_recent_posts.html.erb +8 -0
- data/vendor/plugins/news/app/views/news_items/index.html.erb +23 -0
- data/vendor/plugins/news/app/views/news_items/show.html.erb +18 -0
- data/vendor/plugins/news/config/routes.rb +7 -0
- data/vendor/plugins/news/init.rb +7 -0
- data/vendor/plugins/pages/app/controllers/admin/page_dialogs_controller.rb +48 -0
- data/vendor/plugins/pages/app/controllers/admin/page_parts_controller.rb +35 -0
- data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +12 -0
- data/vendor/plugins/pages/app/controllers/pages_controller.rb +20 -0
- data/vendor/plugins/pages/app/helpers/pages_helper.rb +2 -0
- data/vendor/plugins/pages/app/models/page.rb +97 -0
- data/vendor/plugins/pages/app/models/page_part.rb +17 -0
- data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +6 -0
- data/vendor/plugins/pages/app/views/admin/page_dialogs/link_to.html.erb +253 -0
- data/vendor/plugins/pages/app/views/admin/page_parts/new.html.erb +11 -0
- data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +179 -0
- data/vendor/plugins/pages/app/views/admin/pages/_list.html.erb +29 -0
- data/vendor/plugins/pages/app/views/admin/pages/_sortable_list.html.erb +4 -0
- data/vendor/plugins/pages/app/views/admin/pages/edit.html.erb +1 -0
- data/vendor/plugins/pages/app/views/admin/pages/index.html.erb +42 -0
- data/vendor/plugins/pages/app/views/admin/pages/new.html.erb +1 -0
- data/vendor/plugins/pages/app/views/pages/home.html.erb +9 -0
- data/vendor/plugins/pages/app/views/pages/show.html.erb +10 -0
- data/vendor/plugins/pages/config/routes.rb +12 -0
- data/vendor/plugins/pages/init.rb +8 -0
- data/vendor/plugins/refinery/app/controllers/admin/base_controller.rb +37 -0
- data/vendor/plugins/refinery/app/controllers/admin/refinery_core_controller.rb +14 -0
- data/vendor/plugins/refinery/app/helpers/application_helper.rb +84 -0
- data/vendor/plugins/refinery/app/views/admin/_head.html.erb +27 -0
- data/vendor/plugins/refinery/app/views/admin/_menu.html.erb +85 -0
- data/vendor/plugins/refinery/app/views/layouts/admin.html.erb +25 -0
- data/vendor/plugins/refinery/app/views/layouts/application.html.erb +32 -0
- data/vendor/plugins/refinery/app/views/shared/_footer.html.erb +3 -0
- data/vendor/plugins/refinery/app/views/shared/_google_analytics.html.erb +12 -0
- data/vendor/plugins/refinery/app/views/shared/_ie6check.html.erb +11 -0
- data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +16 -0
- data/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb +28 -0
- data/vendor/plugins/refinery/app/views/shared/_message.html.erb +10 -0
- data/vendor/plugins/refinery/app/views/shared/_submenu.html.erb +4 -0
- data/vendor/plugins/refinery/app/views/shared/_submenu_branch.html.erb +10 -0
- data/vendor/plugins/refinery/app/views/shared/admin/_make_sortable.html.erb +71 -0
- data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +5 -0
- data/vendor/plugins/refinery/app/views/shared/admin/_sortable_list.html.erb +10 -0
- data/vendor/plugins/refinery/app/views/welcome.html.erb +13 -0
- data/vendor/plugins/refinery/app/views/wymiframe.html.erb +8 -0
- data/vendor/plugins/refinery/config/routes.rb +10 -0
- data/vendor/plugins/refinery/init.rb +9 -0
- data/vendor/plugins/refinery/lib/crud.rb +134 -0
- data/vendor/plugins/refinery/lib/generators/refinery/README +29 -0
- data/vendor/plugins/refinery/lib/generators/refinery/Rakefile +12 -0
- data/vendor/plugins/refinery/lib/generators/refinery/USAGE +2 -0
- data/vendor/plugins/refinery/lib/generators/refinery/install.rb +2 -0
- data/vendor/plugins/refinery/lib/generators/refinery/refinery_generator.rb +65 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/config/routes.rb +7 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/controller.rb +5 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/init.rb +7 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/migration.rb +36 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/model.rb +8 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb +20 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_form.html.erb +18 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_singular_name.html.erb +15 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_sortable_list.html.erb +2 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/edit.html.erb +1 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/index.html.erb +45 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/new.html.erb +1 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/index.html.erb +15 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/show.html.erb +23 -0
- data/vendor/plugins/refinery/lib/refinery.rb +15 -0
- data/vendor/plugins/refinery/lib/refinery/activity.rb +16 -0
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +53 -0
- data/vendor/plugins/refinery/lib/refinery/form_helpers.rb +28 -0
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +28 -0
- data/vendor/plugins/refinery/lib/refinery/link_renderer.rb +45 -0
- data/vendor/plugins/refinery/lib/refinery/plugin.rb +47 -0
- data/vendor/plugins/refinery/lib/refinery/plugins.rb +53 -0
- data/vendor/plugins/refinery/lib/tasks/refinery.rake +28 -0
- data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +24 -0
- data/vendor/plugins/refinery_dialogs/app/views/admin/dialogs/show.html.erb +20 -0
- data/vendor/plugins/refinery_dialogs/app/views/layouts/admin_dialog.html.erb +31 -0
- data/vendor/plugins/refinery_dialogs/config/routes.rb +5 -0
- data/vendor/plugins/refinery_dialogs/init.rb +8 -0
- data/vendor/plugins/refinery_settings/app/controllers/admin/refinery_settings_controller.rb +5 -0
- data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +62 -0
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +21 -0
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_make_sortable.html.erb +7 -0
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_refinery_setting.html.erb +13 -0
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/edit.html.erb +4 -0
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/index.html.erb +33 -0
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/new.html.erb +1 -0
- data/vendor/plugins/refinery_settings/config/routes.rb +5 -0
- data/vendor/plugins/refinery_settings/init.rb +9 -0
- data/vendor/plugins/resources/app/controllers/admin/resources_controller.rb +25 -0
- data/vendor/plugins/resources/app/models/resource.rb +36 -0
- data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +18 -0
- data/vendor/plugins/resources/app/views/admin/resources/_resource.html.erb +16 -0
- data/vendor/plugins/resources/app/views/admin/resources/edit.html.erb +1 -0
- data/vendor/plugins/resources/app/views/admin/resources/index.html.erb +33 -0
- data/vendor/plugins/resources/app/views/admin/resources/new.html.erb +1 -0
- data/vendor/plugins/resources/config/routes.rb +7 -0
- data/vendor/plugins/resources/init.rb +7 -0
- metadata +567 -0
@@ -0,0 +1,255 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
|
2
|
+
|
3
|
+
class RmagickTest < Test::Unit::TestCase
|
4
|
+
attachment_model Attachment
|
5
|
+
|
6
|
+
if Object.const_defined?(:Magick)
|
7
|
+
def test_should_create_image_from_uploaded_file
|
8
|
+
assert_created do
|
9
|
+
attachment = upload_file :filename => '/files/rails.png'
|
10
|
+
assert_valid attachment
|
11
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
12
|
+
assert attachment.image?
|
13
|
+
assert !attachment.size.zero?
|
14
|
+
#assert_equal 1784, attachment.size
|
15
|
+
assert_equal 50, attachment.width
|
16
|
+
assert_equal 64, attachment.height
|
17
|
+
assert_equal '50x64', attachment.image_size
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_create_image_from_uploaded_file_with_custom_content_type
|
22
|
+
assert_created do
|
23
|
+
attachment = upload_file :content_type => 'foo/bar', :filename => '/files/rails.png'
|
24
|
+
assert_valid attachment
|
25
|
+
assert !attachment.image?
|
26
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
27
|
+
assert !attachment.size.zero?
|
28
|
+
#assert_equal 1784, attachment.size
|
29
|
+
assert_nil attachment.width
|
30
|
+
assert_nil attachment.height
|
31
|
+
assert_equal [], attachment.thumbnails
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_should_create_thumbnail
|
36
|
+
attachment = upload_file :filename => '/files/rails.png'
|
37
|
+
|
38
|
+
assert_created do
|
39
|
+
basename, ext = attachment.filename.split '.'
|
40
|
+
thumbnail = attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 50, 50)
|
41
|
+
assert_valid thumbnail
|
42
|
+
assert !thumbnail.size.zero?
|
43
|
+
#assert_in_delta 4673, thumbnail.size, 2
|
44
|
+
assert_equal 50, thumbnail.width
|
45
|
+
assert_equal 50, thumbnail.height
|
46
|
+
assert_equal [thumbnail.id], attachment.thumbnails.collect(&:id)
|
47
|
+
assert_equal attachment.id, thumbnail.parent_id if thumbnail.respond_to?(:parent_id)
|
48
|
+
assert_equal "#{basename}_thumb.#{ext}", thumbnail.filename
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_create_thumbnail_with_geometry_string
|
53
|
+
attachment = upload_file :filename => '/files/rails.png'
|
54
|
+
|
55
|
+
assert_created do
|
56
|
+
basename, ext = attachment.filename.split '.'
|
57
|
+
thumbnail = attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 'x50')
|
58
|
+
assert_valid thumbnail
|
59
|
+
assert !thumbnail.size.zero?
|
60
|
+
#assert_equal 3915, thumbnail.size
|
61
|
+
assert_equal 39, thumbnail.width
|
62
|
+
assert_equal 50, thumbnail.height
|
63
|
+
assert_equal [thumbnail], attachment.thumbnails
|
64
|
+
assert_equal attachment.id, thumbnail.parent_id if thumbnail.respond_to?(:parent_id)
|
65
|
+
assert_equal "#{basename}_thumb.#{ext}", thumbnail.filename
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_should_resize_image(klass = ImageAttachment)
|
70
|
+
attachment_model klass
|
71
|
+
assert_equal [50, 50], attachment_model.attachment_options[:resize_to]
|
72
|
+
attachment = upload_file :filename => '/files/rails.png'
|
73
|
+
assert_valid attachment
|
74
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
75
|
+
assert attachment.image?
|
76
|
+
assert !attachment.size.zero?
|
77
|
+
#assert_in_delta 4673, attachment.size, 2
|
78
|
+
assert_equal 50, attachment.width
|
79
|
+
assert_equal 50, attachment.height
|
80
|
+
end
|
81
|
+
|
82
|
+
test_against_subclass :test_should_resize_image, ImageAttachment
|
83
|
+
|
84
|
+
def test_should_resize_image_with_geometry(klass = ImageOrPdfAttachment)
|
85
|
+
attachment_model klass
|
86
|
+
assert_equal 'x50', attachment_model.attachment_options[:resize_to]
|
87
|
+
attachment = upload_file :filename => '/files/rails.png'
|
88
|
+
assert_valid attachment
|
89
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
90
|
+
assert attachment.image?
|
91
|
+
assert !attachment.size.zero?
|
92
|
+
#assert_equal 3915, attachment.size
|
93
|
+
assert_equal 39, attachment.width
|
94
|
+
assert_equal 50, attachment.height
|
95
|
+
end
|
96
|
+
|
97
|
+
test_against_subclass :test_should_resize_image_with_geometry, ImageOrPdfAttachment
|
98
|
+
|
99
|
+
def test_should_give_correct_thumbnail_filenames(klass = ImageWithThumbsFileAttachment)
|
100
|
+
attachment_model klass
|
101
|
+
assert_created 3 do
|
102
|
+
attachment = upload_file :filename => '/files/rails.png'
|
103
|
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
|
104
|
+
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
|
105
|
+
|
106
|
+
[attachment, thumb, geo].each { |record| assert_valid record }
|
107
|
+
|
108
|
+
assert_match /rails\.png$/, attachment.full_filename
|
109
|
+
assert_match /rails_geometry\.png$/, attachment.full_filename(:geometry)
|
110
|
+
assert_match /rails_thumb\.png$/, attachment.full_filename(:thumb)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
test_against_subclass :test_should_give_correct_thumbnail_filenames, ImageWithThumbsFileAttachment
|
115
|
+
|
116
|
+
def test_should_automatically_create_thumbnails(klass = ImageWithThumbsAttachment)
|
117
|
+
attachment_model klass
|
118
|
+
assert_created 3 do
|
119
|
+
attachment = upload_file :filename => '/files/rails.png'
|
120
|
+
assert_valid attachment
|
121
|
+
assert !attachment.size.zero?
|
122
|
+
#assert_equal 1784, attachment.size
|
123
|
+
assert_equal 55, attachment.width
|
124
|
+
assert_equal 55, attachment.height
|
125
|
+
assert_equal 2, attachment.thumbnails.length
|
126
|
+
assert_equal 1.0, attachment.aspect_ratio
|
127
|
+
|
128
|
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
|
129
|
+
assert !thumb.new_record?, thumb.errors.full_messages.join("\n")
|
130
|
+
assert !thumb.size.zero?
|
131
|
+
#assert_in_delta 4673, thumb.size, 2
|
132
|
+
assert_equal 50, thumb.width
|
133
|
+
assert_equal 50, thumb.height
|
134
|
+
assert_equal 1.0, thumb.aspect_ratio
|
135
|
+
|
136
|
+
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
|
137
|
+
assert !geo.new_record?, geo.errors.full_messages.join("\n")
|
138
|
+
assert !geo.size.zero?
|
139
|
+
#assert_equal 3915, geo.size
|
140
|
+
assert_equal 50, geo.width
|
141
|
+
assert_equal 50, geo.height
|
142
|
+
assert_equal 1.0, geo.aspect_ratio
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
test_against_subclass :test_should_automatically_create_thumbnails, ImageWithThumbsAttachment
|
147
|
+
|
148
|
+
# same as above method, but test it on a file model
|
149
|
+
test_against_class :test_should_automatically_create_thumbnails, ImageWithThumbsFileAttachment
|
150
|
+
test_against_subclass :test_should_automatically_create_thumbnails_on_class, ImageWithThumbsFileAttachment
|
151
|
+
|
152
|
+
def test_should_use_thumbnail_subclass(klass = ImageWithThumbsClassFileAttachment)
|
153
|
+
attachment_model klass
|
154
|
+
attachment = nil
|
155
|
+
assert_difference ImageThumbnail, :count do
|
156
|
+
attachment = upload_file :filename => '/files/rails.png'
|
157
|
+
assert_valid attachment
|
158
|
+
end
|
159
|
+
assert_kind_of ImageThumbnail, attachment.thumbnails.first
|
160
|
+
if attachment.thumbnails.first.respond_to?(:parent)
|
161
|
+
assert_equal attachment.id, attachment.thumbnails.first.parent.id
|
162
|
+
assert_kind_of FileAttachment, attachment.thumbnails.first.parent
|
163
|
+
end
|
164
|
+
assert_equal 'rails_thumb.png', attachment.thumbnails.first.filename
|
165
|
+
assert_equal attachment.thumbnails.first.full_filename, attachment.full_filename(attachment.thumbnails.first.thumbnail),
|
166
|
+
"#full_filename does not use thumbnail class' path."
|
167
|
+
assert_equal attachment.destroy, attachment
|
168
|
+
end
|
169
|
+
|
170
|
+
test_against_subclass :test_should_use_thumbnail_subclass, ImageWithThumbsClassFileAttachment
|
171
|
+
|
172
|
+
def test_should_remove_old_thumbnail_files_when_updating(klass = ImageWithThumbsFileAttachment)
|
173
|
+
attachment_model klass
|
174
|
+
attachment = nil
|
175
|
+
assert_created 3 do
|
176
|
+
attachment = upload_file :filename => '/files/rails.png'
|
177
|
+
end
|
178
|
+
|
179
|
+
old_filenames = [attachment.full_filename] + attachment.thumbnails.collect(&:full_filename)
|
180
|
+
|
181
|
+
assert_not_created do
|
182
|
+
use_temp_file "files/rails.png" do |file|
|
183
|
+
attachment.filename = 'rails2.png'
|
184
|
+
attachment.temp_paths.unshift File.join(fixture_path, file)
|
185
|
+
attachment.save
|
186
|
+
new_filenames = [attachment.reload.full_filename] + attachment.thumbnails.collect { |t| t.reload.full_filename }
|
187
|
+
new_filenames.each { |f| assert File.exists?(f), "#{f} does not exist" }
|
188
|
+
old_filenames.each { |f| assert !File.exists?(f), "#{f} still exists" }
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
test_against_subclass :test_should_remove_old_thumbnail_files_when_updating, ImageWithThumbsFileAttachment
|
194
|
+
|
195
|
+
def test_should_delete_file_when_in_file_system_when_attachment_record_destroyed(klass = ImageWithThumbsFileAttachment)
|
196
|
+
attachment_model klass
|
197
|
+
attachment = upload_file :filename => '/files/rails.png'
|
198
|
+
filenames = [attachment.full_filename] + attachment.thumbnails.collect(&:full_filename)
|
199
|
+
filenames.each { |f| assert File.exists?(f), "#{f} never existed to delete on destroy" }
|
200
|
+
attachment.destroy
|
201
|
+
filenames.each { |f| assert !File.exists?(f), "#{f} still exists" }
|
202
|
+
end
|
203
|
+
|
204
|
+
test_against_subclass :test_should_delete_file_when_in_file_system_when_attachment_record_destroyed, ImageWithThumbsFileAttachment
|
205
|
+
|
206
|
+
def test_should_have_full_filename_method(klass = FileAttachment)
|
207
|
+
attachment_model klass
|
208
|
+
attachment = upload_file :filename => '/files/rails.png'
|
209
|
+
assert_respond_to attachment, :full_filename
|
210
|
+
end
|
211
|
+
|
212
|
+
test_against_subclass :test_should_have_full_filename_method, FileAttachment
|
213
|
+
|
214
|
+
def test_should_overwrite_old_thumbnail_records_when_updating(klass = ImageWithThumbsAttachment)
|
215
|
+
attachment_model klass
|
216
|
+
attachment = nil
|
217
|
+
assert_created 3 do
|
218
|
+
attachment = upload_file :filename => '/files/rails.png'
|
219
|
+
end
|
220
|
+
assert_not_created do # no new db_file records
|
221
|
+
use_temp_file "files/rails.png" do |file|
|
222
|
+
attachment.filename = 'rails2.png'
|
223
|
+
# The above test (#test_should_have_full_filename_method) to pass before be can set the temp_path below --
|
224
|
+
# #temp_path calls #full_filename, which is not getting mixed into the attachment. Maybe we don't need to
|
225
|
+
# set temp_path at all?
|
226
|
+
#
|
227
|
+
# attachment.temp_paths.unshift File.join(fixture_path, file)
|
228
|
+
attachment.save!
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
test_against_subclass :test_should_overwrite_old_thumbnail_records_when_updating, ImageWithThumbsAttachment
|
234
|
+
|
235
|
+
def test_should_overwrite_old_thumbnail_records_when_renaming(klass = ImageWithThumbsAttachment)
|
236
|
+
attachment_model klass
|
237
|
+
attachment = nil
|
238
|
+
assert_created 3 do
|
239
|
+
attachment = upload_file :class => klass, :filename => '/files/rails.png'
|
240
|
+
end
|
241
|
+
assert_not_created do # no new db_file records
|
242
|
+
attachment.filename = 'rails2.png'
|
243
|
+
attachment.save
|
244
|
+
assert !attachment.reload.size.zero?
|
245
|
+
assert_equal 'rails2.png', attachment.filename
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
test_against_subclass :test_should_overwrite_old_thumbnail_records_when_renaming, ImageWithThumbsAttachment
|
250
|
+
else
|
251
|
+
def test_flunk
|
252
|
+
puts "RMagick not installed, no tests running"
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
create_table :attachments, :force => true do |t|
|
3
|
+
t.column :db_file_id, :integer
|
4
|
+
t.column :parent_id, :integer
|
5
|
+
t.column :thumbnail, :string
|
6
|
+
t.column :filename, :string, :limit => 255
|
7
|
+
t.column :content_type, :string, :limit => 255
|
8
|
+
t.column :size, :integer
|
9
|
+
t.column :width, :integer
|
10
|
+
t.column :height, :integer
|
11
|
+
t.column :aspect_ratio, :float
|
12
|
+
end
|
13
|
+
|
14
|
+
create_table :file_attachments, :force => true do |t|
|
15
|
+
t.column :parent_id, :integer
|
16
|
+
t.column :thumbnail, :string
|
17
|
+
t.column :filename, :string, :limit => 255
|
18
|
+
t.column :content_type, :string, :limit => 255
|
19
|
+
t.column :size, :integer
|
20
|
+
t.column :width, :integer
|
21
|
+
t.column :height, :integer
|
22
|
+
t.column :type, :string
|
23
|
+
t.column :aspect_ratio, :float
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table :file_attachments_with_string_id, :id => false, :force => true do |t|
|
27
|
+
t.column :id, :string
|
28
|
+
t.column :parent_id, :string
|
29
|
+
t.column :thumbnail, :string
|
30
|
+
t.column :filename, :string, :limit => 255
|
31
|
+
t.column :content_type, :string, :limit => 255
|
32
|
+
t.column :size, :integer
|
33
|
+
t.column :width, :integer
|
34
|
+
t.column :height, :integer
|
35
|
+
t.column :type, :string
|
36
|
+
t.column :aspect_ratio, :float
|
37
|
+
end
|
38
|
+
|
39
|
+
create_table :gd2_attachments, :force => true do |t|
|
40
|
+
t.column :parent_id, :integer
|
41
|
+
t.column :thumbnail, :string
|
42
|
+
t.column :filename, :string, :limit => 255
|
43
|
+
t.column :content_type, :string, :limit => 255
|
44
|
+
t.column :size, :integer
|
45
|
+
t.column :width, :integer
|
46
|
+
t.column :height, :integer
|
47
|
+
t.column :type, :string
|
48
|
+
end
|
49
|
+
|
50
|
+
create_table :image_science_attachments, :force => true do |t|
|
51
|
+
t.column :parent_id, :integer
|
52
|
+
t.column :thumbnail, :string
|
53
|
+
t.column :filename, :string, :limit => 255
|
54
|
+
t.column :content_type, :string, :limit => 255
|
55
|
+
t.column :size, :integer
|
56
|
+
t.column :width, :integer
|
57
|
+
t.column :height, :integer
|
58
|
+
t.column :type, :string
|
59
|
+
end
|
60
|
+
|
61
|
+
create_table :core_image_attachments, :force => true do |t|
|
62
|
+
t.column :parent_id, :integer
|
63
|
+
t.column :thumbnail, :string
|
64
|
+
t.column :filename, :string, :limit => 255
|
65
|
+
t.column :content_type, :string, :limit => 255
|
66
|
+
t.column :size, :integer
|
67
|
+
t.column :width, :integer
|
68
|
+
t.column :height, :integer
|
69
|
+
t.column :type, :string
|
70
|
+
end
|
71
|
+
|
72
|
+
create_table :mini_magick_attachments, :force => true do |t|
|
73
|
+
t.column :parent_id, :integer
|
74
|
+
t.column :thumbnail, :string
|
75
|
+
t.column :filename, :string, :limit => 255
|
76
|
+
t.column :content_type, :string, :limit => 255
|
77
|
+
t.column :size, :integer
|
78
|
+
t.column :width, :integer
|
79
|
+
t.column :height, :integer
|
80
|
+
t.column :type, :string
|
81
|
+
end
|
82
|
+
|
83
|
+
create_table :mini_magick_attachments, :force => true do |t|
|
84
|
+
t.column :parent_id, :integer
|
85
|
+
t.column :thumbnail, :string
|
86
|
+
t.column :filename, :string, :limit => 255
|
87
|
+
t.column :content_type, :string, :limit => 255
|
88
|
+
t.column :size, :integer
|
89
|
+
t.column :width, :integer
|
90
|
+
t.column :height, :integer
|
91
|
+
t.column :type, :string
|
92
|
+
end
|
93
|
+
|
94
|
+
create_table :orphan_attachments, :force => true do |t|
|
95
|
+
t.column :db_file_id, :integer
|
96
|
+
t.column :filename, :string, :limit => 255
|
97
|
+
t.column :content_type, :string, :limit => 255
|
98
|
+
t.column :size, :integer
|
99
|
+
end
|
100
|
+
|
101
|
+
create_table :minimal_attachments, :force => true do |t|
|
102
|
+
t.column :size, :integer
|
103
|
+
t.column :content_type, :string, :limit => 255
|
104
|
+
end
|
105
|
+
|
106
|
+
create_table :db_files, :force => true do |t|
|
107
|
+
t.column :data, :binary
|
108
|
+
end
|
109
|
+
|
110
|
+
create_table :s3_attachments, :force => true do |t|
|
111
|
+
t.column :parent_id, :integer
|
112
|
+
t.column :thumbnail, :string
|
113
|
+
t.column :filename, :string, :limit => 255
|
114
|
+
t.column :content_type, :string, :limit => 255
|
115
|
+
t.column :size, :integer
|
116
|
+
t.column :width, :integer
|
117
|
+
t.column :height, :integer
|
118
|
+
t.column :type, :string
|
119
|
+
t.column :aspect_ratio, :float
|
120
|
+
end
|
121
|
+
|
122
|
+
create_table :cloud_files_attachments, :force => true do |t|
|
123
|
+
t.column :parent_id, :integer
|
124
|
+
t.column :thumbnail, :string
|
125
|
+
t.column :filename, :string, :limit => 255
|
126
|
+
t.column :content_type, :string, :limit => 255
|
127
|
+
t.column :size, :integer
|
128
|
+
t.column :width, :integer
|
129
|
+
t.column :height, :integer
|
130
|
+
t.column :type, :string
|
131
|
+
t.column :aspect_ratio, :float
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
2
|
+
|
3
|
+
ENV['RAILS_ENV'] = 'test'
|
4
|
+
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
|
8
|
+
require 'active_record/fixtures'
|
9
|
+
require 'action_controller/test_process'
|
10
|
+
|
11
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
12
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
13
|
+
|
14
|
+
db_adapter = ENV['DB']
|
15
|
+
|
16
|
+
# no db passed, try one of these fine config-free DBs before bombing.
|
17
|
+
db_adapter ||=
|
18
|
+
begin
|
19
|
+
require 'rubygems'
|
20
|
+
require 'sqlite'
|
21
|
+
'sqlite'
|
22
|
+
rescue MissingSourceFile
|
23
|
+
begin
|
24
|
+
require 'sqlite3'
|
25
|
+
'sqlite3'
|
26
|
+
rescue MissingSourceFile
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if db_adapter.nil?
|
31
|
+
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
32
|
+
end
|
33
|
+
|
34
|
+
ActiveRecord::Base.establish_connection(config[db_adapter])
|
35
|
+
|
36
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
37
|
+
|
38
|
+
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures"
|
39
|
+
$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
|
40
|
+
|
41
|
+
class Test::Unit::TestCase #:nodoc:
|
42
|
+
include ActionController::TestProcess
|
43
|
+
def create_fixtures(*table_names)
|
44
|
+
if block_given?
|
45
|
+
Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
|
46
|
+
else
|
47
|
+
Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def setup
|
52
|
+
Attachment.saves = 0
|
53
|
+
DbFile.transaction { [Attachment, FileAttachment, OrphanAttachment, MinimalAttachment, DbFile].each { |klass| klass.delete_all } }
|
54
|
+
attachment_model self.class.attachment_model
|
55
|
+
end
|
56
|
+
|
57
|
+
def teardown
|
58
|
+
FileUtils.rm_rf File.join(File.dirname(__FILE__), 'files')
|
59
|
+
end
|
60
|
+
|
61
|
+
self.use_transactional_fixtures = true
|
62
|
+
self.use_instantiated_fixtures = false
|
63
|
+
|
64
|
+
def self.attachment_model(klass = nil)
|
65
|
+
@attachment_model = klass if klass
|
66
|
+
@attachment_model
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.test_against_class(test_method, klass, subclass = false)
|
70
|
+
define_method("#{test_method}_on_#{:sub if subclass}class") do
|
71
|
+
klass = Class.new(klass) if subclass
|
72
|
+
attachment_model klass
|
73
|
+
send test_method, klass
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.test_against_subclass(test_method, klass)
|
78
|
+
test_against_class test_method, klass, true
|
79
|
+
end
|
80
|
+
|
81
|
+
protected
|
82
|
+
def upload_file(options = {})
|
83
|
+
use_temp_file options[:filename] do |file|
|
84
|
+
att = attachment_model.create :uploaded_data => fixture_file_upload(file, options[:content_type] || 'image/png')
|
85
|
+
att.reload unless att.new_record?
|
86
|
+
return att
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def upload_merb_file(options = {})
|
91
|
+
use_temp_file options[:filename] do |file|
|
92
|
+
att = attachment_model.create :uploaded_data => {"size" => file.size, "content_type" => options[:content_type] || 'image/png', "filename" => file, 'tempfile' => fixture_file_upload(file, options[:content_type] || 'image/png')}
|
93
|
+
att.reload unless att.new_record?
|
94
|
+
return att
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def use_temp_file(fixture_filename)
|
99
|
+
temp_path = File.join('/tmp', File.basename(fixture_filename))
|
100
|
+
FileUtils.mkdir_p File.join(fixture_path, 'tmp')
|
101
|
+
FileUtils.cp File.join(fixture_path, fixture_filename), File.join(fixture_path, temp_path)
|
102
|
+
yield temp_path
|
103
|
+
ensure
|
104
|
+
FileUtils.rm_rf File.join(fixture_path, 'tmp')
|
105
|
+
end
|
106
|
+
|
107
|
+
def assert_created(num = 1)
|
108
|
+
assert_difference attachment_model.base_class, :count, num do
|
109
|
+
if attachment_model.included_modules.include? DbFile
|
110
|
+
assert_difference DbFile, :count, num do
|
111
|
+
yield
|
112
|
+
end
|
113
|
+
else
|
114
|
+
yield
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def assert_not_created
|
120
|
+
assert_created(0) { yield }
|
121
|
+
end
|
122
|
+
|
123
|
+
def should_reject_by_size_with(klass)
|
124
|
+
attachment_model klass
|
125
|
+
assert_not_created do
|
126
|
+
attachment = upload_file :filename => '/files/rails.png'
|
127
|
+
assert attachment.new_record?
|
128
|
+
assert attachment.errors.on(:size)
|
129
|
+
assert_nil attachment.db_file if attachment.respond_to?(:db_file)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def assert_difference(object, method = nil, difference = 1)
|
134
|
+
initial_value = object.send(method)
|
135
|
+
yield
|
136
|
+
assert_equal initial_value + difference, object.send(method)
|
137
|
+
end
|
138
|
+
|
139
|
+
def assert_no_difference(object, method, &block)
|
140
|
+
assert_difference object, method, 0, &block
|
141
|
+
end
|
142
|
+
|
143
|
+
def attachment_model(klass = nil)
|
144
|
+
@attachment_model = klass if klass
|
145
|
+
@attachment_model
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
require File.join(File.dirname(__FILE__), 'fixtures/attachment')
|
150
|
+
require File.join(File.dirname(__FILE__), 'base_attachment_tests')
|