muck-comments 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +24 -0
- data/Rakefile +2 -11
- data/VERSION +1 -1
- data/app/controllers/muck/comments_controller.rb +66 -36
- data/app/helpers/muck_comments_helper.rb +23 -5
- data/app/views/activity_templates/_comment.html.erb +3 -9
- data/app/views/comments/_comment.html.erb +6 -25
- data/app/views/comments/_form.html.erb +2 -1
- data/app/views/comments/index.html.erb +3 -0
- data/app/views/comments/new.html.erb +5 -0
- data/db/migrate/20090730154102_allow_null_user.rb +9 -0
- data/lib/active_record/acts/muck_comment.rb +2 -2
- data/lib/acts_as_commentable_with_threading.rb +3 -3
- data/lib/muck_comments.rb +2 -0
- data/locales/en.yml +5 -1
- data/muck-comments.gemspec +307 -15
- data/test/rails_root/.gitignore +8 -0
- data/test/rails_root/.rake_tasks +103 -0
- data/test/rails_root/Capfile +3 -0
- data/test/rails_root/Rakefile +15 -0
- data/test/rails_root/app/controllers/application_controller.rb +21 -0
- data/test/rails_root/app/controllers/default_controller.rb +7 -0
- data/test/rails_root/app/helpers/application_helper.rb +3 -0
- data/test/rails_root/app/models/.keep +0 -0
- data/test/rails_root/app/models/comment.rb +3 -0
- data/test/rails_root/app/models/user.rb +8 -0
- data/test/rails_root/app/models/user_session.rb +2 -0
- data/test/rails_root/app/views/default/index.html.erb +0 -0
- data/test/rails_root/app/views/layouts/default.html.erb +26 -0
- data/test/rails_root/config/amazon_s3.yml +14 -0
- data/test/rails_root/config/boot.rb +109 -0
- data/test/rails_root/config/database.yml +23 -0
- data/test/rails_root/config/environment.rb +30 -0
- data/test/rails_root/config/environments/cucumber.rb +38 -0
- data/test/rails_root/config/environments/development.rb +19 -0
- data/test/rails_root/config/environments/production.rb +1 -0
- data/test/rails_root/config/environments/test.rb +42 -0
- data/test/rails_root/config/global_config.yml +77 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/requires.rb +13 -0
- data/test/rails_root/config/initializers/session_store.rb +8 -0
- data/test/rails_root/config/routes.rb +4 -0
- data/test/rails_root/db/.keep +0 -0
- data/test/rails_root/db/migrate/20090320174818_create_muck_permissions_and_roles.rb +16 -0
- data/test/rails_root/db/migrate/20090402033319_add_muck_activities.rb +36 -0
- data/test/rails_root/db/migrate/20090402234137_create_languages.rb +18 -0
- data/test/rails_root/db/migrate/20090426041056_create_countries.rb +15 -0
- data/test/rails_root/db/migrate/20090426041103_create_states.rb +18 -0
- data/test/rails_root/db/migrate/20090602041838_create_users.rb +39 -0
- data/test/rails_root/db/migrate/20090608073052_create_friends.rb +16 -0
- data/test/rails_root/db/migrate/20090613173314_create_comments.rb +24 -0
- data/test/rails_root/db/migrate/20090703055724_add_contents.rb +49 -0
- data/test/rails_root/db/migrate/20090704220055_create_slugs.rb +18 -0
- data/test/rails_root/db/migrate/20090704220120_acts_as_taggable_on_migration.rb +29 -0
- data/test/rails_root/db/migrate/20090730044139_add_comment_cache.rb +9 -0
- data/test/rails_root/db/migrate/20090730074858_add_comment_count_to_users.rb +9 -0
- data/test/rails_root/db/migrate/20090730154102_allow_null_user.rb +9 -0
- data/test/rails_root/db/schema.rb +215 -0
- data/test/rails_root/features/comments.feature +21 -0
- data/test/rails_root/features/step_definitions/comment_steps.rb +11 -0
- data/test/rails_root/features/step_definitions/common_steps.rb +93 -0
- data/test/rails_root/features/step_definitions/webrat_steps.rb +128 -0
- data/test/rails_root/features/support/env.rb +49 -0
- data/test/rails_root/features/support/paths.rb +33 -0
- data/test/rails_root/lib/tasks/cucumber.rake +20 -0
- data/test/rails_root/public/.htaccess +40 -0
- data/test/rails_root/public/404.html +30 -0
- data/test/rails_root/public/422.html +30 -0
- data/test/rails_root/public/500.html +30 -0
- data/test/rails_root/public/dispatch.rb +10 -0
- data/test/rails_root/public/favicon.ico +0 -0
- data/test/rails_root/public/images/arrow_left.gif +0 -0
- data/test/rails_root/public/images/arrow_right.gif +0 -0
- data/test/rails_root/public/images/fancybox/fancy_closebox.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_progress.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_right.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_e.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_n.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_ne.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_nw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_s.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_se.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_sw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_w.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_main.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_right.png +0 -0
- data/test/rails_root/public/images/icons/accept.png +0 -0
- data/test/rails_root/public/images/icons/add.png +0 -0
- data/test/rails_root/public/images/icons/delete.png +0 -0
- data/test/rails_root/public/images/icons/vote.png +0 -0
- data/test/rails_root/public/images/loading.gif +0 -0
- data/test/rails_root/public/images/nothing.png +0 -0
- data/test/rails_root/public/images/profile_default.jpg +0 -0
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/images/spinner.gif +0 -0
- data/test/rails_root/public/images/sprites.png +0 -0
- data/test/rails_root/public/javascripts/application.js +2 -0
- data/test/rails_root/public/javascripts/builder.js +136 -0
- data/test/rails_root/public/javascripts/controls.js +963 -0
- data/test/rails_root/public/javascripts/dragdrop.js +972 -0
- data/test/rails_root/public/javascripts/effects.js +1120 -0
- data/test/rails_root/public/javascripts/fancyzoom.min.js +1 -0
- data/test/rails_root/public/javascripts/jquery/jquery-ui.js +273 -0
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +1 -0
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +9 -0
- data/test/rails_root/public/javascripts/jquery/jquery.form.js +637 -0
- data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +2 -0
- data/test/rails_root/public/javascripts/jquery/jquery.js +19 -0
- data/test/rails_root/public/javascripts/jquery/jquery.tips.js +69 -0
- data/test/rails_root/public/javascripts/muck.js +80 -0
- data/test/rails_root/public/javascripts/muck_activities.js +108 -0
- data/test/rails_root/public/javascripts/prototype.js +4225 -0
- data/test/rails_root/public/javascripts/scriptaculous.js +58 -0
- data/test/rails_root/public/javascripts/slider.js +277 -0
- data/test/rails_root/public/javascripts/sound.js +60 -0
- data/test/rails_root/public/robots.txt +1 -0
- data/test/rails_root/public/stylesheets/.keep +0 -0
- data/test/rails_root/public/stylesheets/admin.css +12 -0
- data/test/rails_root/public/stylesheets/blueprint/ie.css +26 -0
- data/test/rails_root/public/stylesheets/blueprint/liquid_screen.css +203 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/key.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/readme.txt +32 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/screen.css +97 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/screen.css +71 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/readme.txt +18 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/screen.css +40 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/liquid.css +134 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/src/liquid.css +197 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/readme.txt +10 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/screen.css +109 -0
- data/test/rails_root/public/stylesheets/blueprint/print.css +30 -0
- data/test/rails_root/public/stylesheets/blueprint/screen.css +251 -0
- data/test/rails_root/public/stylesheets/blueprint/sprite.css +1 -0
- data/test/rails_root/public/stylesheets/blueprint/src/forms.css +49 -0
- data/test/rails_root/public/stylesheets/blueprint/src/grid.css +213 -0
- data/test/rails_root/public/stylesheets/blueprint/src/grid.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/src/ie.css +59 -0
- data/test/rails_root/public/stylesheets/blueprint/src/print.css +85 -0
- data/test/rails_root/public/stylesheets/blueprint/src/reset.css +38 -0
- data/test/rails_root/public/stylesheets/blueprint/src/typography.css +105 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_888888_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/jquery.fancybox.css +44 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_217bc0_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_469bdd_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/reset.css +0 -0
- data/test/rails_root/public/stylesheets/styles.css +89 -0
- data/test/rails_root/public/stylesheets/themes/blue/styles.css +1 -0
- data/test/rails_root/public/stylesheets/themes/red/styles.css +1 -0
- data/test/rails_root/script/about +3 -0
- data/test/rails_root/script/breakpointer +3 -0
- data/test/rails_root/script/console +3 -0
- data/test/rails_root/script/create_project.rb +52 -0
- data/test/rails_root/script/cucumber +8 -0
- data/test/rails_root/script/dbconsole +3 -0
- data/test/rails_root/script/destroy +3 -0
- data/test/rails_root/script/generate +3 -0
- data/test/rails_root/script/performance/benchmarker +3 -0
- data/test/rails_root/script/performance/profiler +3 -0
- data/test/rails_root/script/performance/request +3 -0
- data/test/rails_root/script/plugin +3 -0
- data/test/rails_root/script/process/inspector +3 -0
- data/test/rails_root/script/process/reaper +3 -0
- data/test/rails_root/script/process/spawner +3 -0
- data/test/rails_root/script/runner +3 -0
- data/test/rails_root/script/server +3 -0
- data/test/rails_root/test/factories.rb +75 -0
- data/test/rails_root/test/functional/.keep +0 -0
- data/test/rails_root/test/functional/comments_controller_test.rb +72 -0
- data/test/rails_root/test/mocks/development/.keep +0 -0
- data/test/rails_root/test/mocks/test/.keep +0 -0
- data/test/rails_root/test/shoulda_macros/controller.rb +49 -0
- data/test/rails_root/test/shoulda_macros/forms.rb +32 -0
- data/test/rails_root/test/shoulda_macros/models.rb +50 -0
- data/test/rails_root/test/shoulda_macros/pagination.rb +53 -0
- data/test/rails_root/test/shoulda_macros/plugins.rb +34 -0
- data/test/rails_root/test/test_helper.rb +48 -0
- data/test/rails_root/test/unit/.keep +0 -0
- data/test/rails_root/test/unit/comment_test.rb +63 -0
- data/test/rails_root/test/unit/user_test.rb +23 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/README +43 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb +62 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb +132 -0
- data/test/rails_root/vendor/plugins/validation_reflection/CHANGELOG +24 -0
- data/test/rails_root/vendor/plugins/validation_reflection/LICENSE +20 -0
- data/test/rails_root/vendor/plugins/validation_reflection/README +64 -0
- data/test/rails_root/vendor/plugins/validation_reflection/Rakefile +22 -0
- data/test/rails_root/vendor/plugins/validation_reflection/about.yml +7 -0
- data/test/rails_root/vendor/plugins/validation_reflection/init.rb +8 -0
- data/test/rails_root/vendor/plugins/validation_reflection/lib/boiler_plate/validation_reflection.rb +129 -0
- data/test/rails_root/vendor/plugins/validation_reflection/test/test_helper.rb +36 -0
- data/test/rails_root/vendor/plugins/validation_reflection/test/validation_reflection_test.rb +126 -0
- metadata +307 -15
- data/test/db/database.yml +0 -18
- data/test/db/schema.rb +0 -25
- data/test/factories.rb +0 -8
- data/test/functional/comments_controller_test.rb +0 -34
- data/test/test_helper.rb +0 -44
- data/test/unit/comment_test.rb +0 -49
- data/test/unit/commentable_test.rb +0 -7
@@ -0,0 +1,109 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class GemBoot < Boot
|
51
|
+
def load_initializer
|
52
|
+
self.class.load_rubygems
|
53
|
+
load_rails_gem
|
54
|
+
require 'initializer'
|
55
|
+
end
|
56
|
+
|
57
|
+
def load_rails_gem
|
58
|
+
if version = self.class.gem_version
|
59
|
+
gem 'rails', version
|
60
|
+
else
|
61
|
+
gem 'rails'
|
62
|
+
end
|
63
|
+
rescue Gem::LoadError => load_error
|
64
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
65
|
+
exit 1
|
66
|
+
end
|
67
|
+
|
68
|
+
class << self
|
69
|
+
def rubygems_version
|
70
|
+
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
|
71
|
+
end
|
72
|
+
|
73
|
+
def gem_version
|
74
|
+
if defined? RAILS_GEM_VERSION
|
75
|
+
RAILS_GEM_VERSION
|
76
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
77
|
+
ENV['RAILS_GEM_VERSION']
|
78
|
+
else
|
79
|
+
parse_gem_version(read_environment_rb)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_rubygems
|
84
|
+
require 'rubygems'
|
85
|
+
min_version = '1.1.1'
|
86
|
+
unless rubygems_version >= min_version
|
87
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
|
+
exit 1
|
89
|
+
end
|
90
|
+
|
91
|
+
rescue LoadError
|
92
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
93
|
+
exit 1
|
94
|
+
end
|
95
|
+
|
96
|
+
def parse_gem_version(text)
|
97
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
def read_environment_rb
|
102
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# All that for this:
|
109
|
+
Rails.boot!
|
@@ -0,0 +1,23 @@
|
|
1
|
+
development:
|
2
|
+
adapter: sqlite3
|
3
|
+
database: db/development.sqlite3
|
4
|
+
timeout: 5000
|
5
|
+
|
6
|
+
test: &TEST
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/test.sqlite3
|
9
|
+
timeout: 5000
|
10
|
+
|
11
|
+
production:
|
12
|
+
adapter: sqlite3
|
13
|
+
database: db/production.sqlite3
|
14
|
+
timeout: 5000
|
15
|
+
|
16
|
+
cucumber:
|
17
|
+
<<: *TEST
|
18
|
+
cucumber:
|
19
|
+
<<: *TEST
|
20
|
+
cucumber:
|
21
|
+
<<: *TEST
|
22
|
+
cucumber:
|
23
|
+
<<: *TEST
|
@@ -0,0 +1,30 @@
|
|
1
|
+
RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
4
|
+
|
5
|
+
# Load a global constant so the initializers can use them
|
6
|
+
require 'ostruct'
|
7
|
+
require 'yaml'
|
8
|
+
::GlobalConfig = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/global_config.yml")[RAILS_ENV])
|
9
|
+
|
10
|
+
class TestGemLocator < Rails::Plugin::Locator
|
11
|
+
def plugins
|
12
|
+
Rails::Plugin.new(File.join(File.dirname(__FILE__), *%w(.. .. ..)))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Rails::Initializer.run do |config|
|
17
|
+
config.time_zone = 'UTC'
|
18
|
+
config.gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'
|
19
|
+
config.gem "binarylogic-authlogic", :lib => 'authlogic', :source => 'http://gems.github.com', :version => ">=2.1.0"
|
20
|
+
config.gem "binarylogic-searchlogic", :lib => 'searchlogic', :source => 'http://gems.github.com', :version => '~> 2.1.1'
|
21
|
+
config.gem "bcrypt-ruby", :lib => "bcrypt", :version => ">=2.0.5"
|
22
|
+
config.gem 'mbleigh-acts-as-taggable-on', :lib => "acts-as-taggable-on", :source => "http://gems.github.com"
|
23
|
+
config.gem "collectiveidea-awesome_nested_set", :lib => 'awesome_nested_set', :source => "http://gems.github.com"
|
24
|
+
config.gem "friendly_id", :version => '>=2.1.3'
|
25
|
+
config.gem "babelphish"
|
26
|
+
config.gem 'muck-engine', :lib => 'muck_engine'
|
27
|
+
config.gem 'muck-users', :lib => 'muck_users'
|
28
|
+
config.gem 'muck-activities', :lib => 'muck_activities'
|
29
|
+
config.plugin_locators << TestGemLocator
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
config.cache_classes = true # This must be true for Cucumber to operate correctly!
|
2
|
+
|
3
|
+
# Log error messages when you accidentally call methods on nil.
|
4
|
+
config.whiny_nils = true
|
5
|
+
|
6
|
+
# Show full error reports and disable caching
|
7
|
+
config.action_controller.consider_all_requests_local = true
|
8
|
+
config.action_controller.perform_caching = false
|
9
|
+
config.action_view.cache_template_loading = true
|
10
|
+
|
11
|
+
# Disable request forgery protection in test environment
|
12
|
+
config.action_controller.allow_forgery_protection = false
|
13
|
+
|
14
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
15
|
+
# The :test delivery method accumulates sent emails in the
|
16
|
+
# ActionMailer::Base.deliveries array.
|
17
|
+
config.action_mailer.delivery_method = :test
|
18
|
+
|
19
|
+
config.gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => 'http://gems.github.com'
|
20
|
+
config.gem 'thoughtbot-shoulda', :lib => 'shoulda', :source => 'http://gems.github.com'
|
21
|
+
config.gem "cucumber", :lib => false, :version => ">=0.3.92" unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
|
22
|
+
config.gem "webrat", :lib => false, :version => ">=0.4.4" unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
23
|
+
config.gem "rspec", :lib => false, :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
24
|
+
config.gem "rspec-rails", :lib => 'spec/rails', :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
25
|
+
|
26
|
+
# only required if you want to use selenium for testing
|
27
|
+
config.gem 'selenium-client', :lib => 'selenium/client'
|
28
|
+
config.gem 'bmabey-database_cleaner', :lib => 'database_cleaner', :source => 'http://gems.github.com'
|
29
|
+
|
30
|
+
config.gem 'term-ansicolor', :version => '>=1.0.3', :lib => 'term/ansicolor'
|
31
|
+
|
32
|
+
require 'factory_girl'
|
33
|
+
begin require 'redgreen'; rescue LoadError; end
|
34
|
+
|
35
|
+
config.action_controller.session = {
|
36
|
+
:key => GlobalConfig.session_key,
|
37
|
+
:secret => GlobalConfig.session_secret
|
38
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
13
|
+
config.action_controller.perform_caching = false
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
HOST = "localhost"
|
@@ -0,0 +1 @@
|
|
1
|
+
HOST = "http://example.com"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# The test environment is used exclusively to run your application's
|
2
|
+
# test suite. You never need to work with it otherwise. Remember that
|
3
|
+
# your test database is "scratch space" for the test suite and is wiped
|
4
|
+
# and recreated between test runs. Don't rely on the data there!
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Log error messages when you accidentally call methods on nil.
|
8
|
+
config.whiny_nils = true
|
9
|
+
|
10
|
+
# Show full error reports and disable caching
|
11
|
+
config.action_controller.consider_all_requests_local = true
|
12
|
+
config.action_controller.perform_caching = false
|
13
|
+
config.action_view.cache_template_loading = true
|
14
|
+
|
15
|
+
# Disable request forgery protection in test environment
|
16
|
+
config.action_controller.allow_forgery_protection = false
|
17
|
+
|
18
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
19
|
+
# The :test delivery method accumulates sent emails in the
|
20
|
+
# ActionMailer::Base.deliveries array.
|
21
|
+
config.action_mailer.delivery_method = :test
|
22
|
+
|
23
|
+
HOST = "localhost"
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
29
|
+
|
30
|
+
config.gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => 'http://gems.github.com'
|
31
|
+
config.gem 'thoughtbot-shoulda', :lib => 'shoulda', :source => 'http://gems.github.com'
|
32
|
+
config.gem 'treetop', :version => '>=1.2.4'
|
33
|
+
config.gem 'term-ansicolor', :version => '>=1.0.3', :lib => 'term/ansicolor'
|
34
|
+
config.gem 'polyglot', :version => '>=0.2.4'
|
35
|
+
config.gem "rcov", :version => '>=0.8.1.2.0'
|
36
|
+
|
37
|
+
# only required if you want to use selenium for testing
|
38
|
+
config.gem 'selenium-client', :lib => 'selenium/client'
|
39
|
+
config.gem 'bmabey-database_cleaner', :lib => 'database_cleaner', :source => 'http://gems.github.com'
|
40
|
+
|
41
|
+
require 'factory_girl'
|
42
|
+
begin require 'redgreen'; rescue LoadError; end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
default: &DEFAULT
|
2
|
+
|
3
|
+
application_url: localhost:3000
|
4
|
+
|
5
|
+
# Sent in emails to users
|
6
|
+
application_name: 'example'
|
7
|
+
from_email: 'support@example.com' # Emails will come from this address
|
8
|
+
from_email_name: 'example' # This will show up as the name on emails. i.e. support@example.com <Example>
|
9
|
+
support_email: 'support@example.com'
|
10
|
+
admin_email: 'admin@example.com'
|
11
|
+
customer_service_number: '1-800-'
|
12
|
+
|
13
|
+
# Email charset
|
14
|
+
mail_charset: 'utf-8'
|
15
|
+
|
16
|
+
# Email server configuration
|
17
|
+
email_user_name: 'system@example.com'
|
18
|
+
email_password: 'test'
|
19
|
+
base_domain: 'example.com'
|
20
|
+
|
21
|
+
# sign up options
|
22
|
+
automatically_activate: true
|
23
|
+
automatically_login_after_account_create: true
|
24
|
+
send_welcome: true
|
25
|
+
|
26
|
+
application_url: localhost:3000
|
27
|
+
|
28
|
+
# if you use recaptcha you will need to also provide a public and private
|
29
|
+
# key available from http://recaptcha.net.
|
30
|
+
use_recaptcha: false
|
31
|
+
recaptcha_pub_key: GET_A_RECAPTCHA_KEY(TODO)
|
32
|
+
recaptcha_priv_key: GET_A_RECAPTCHA_KEY(TODO)
|
33
|
+
|
34
|
+
# jgrowl related settings
|
35
|
+
growl_enabled: false
|
36
|
+
|
37
|
+
# application configuration
|
38
|
+
let_users_delete_their_account: false # turn on/off ability for users to delete their own account
|
39
|
+
|
40
|
+
# activity configuration
|
41
|
+
enable_live_activity_updates: true # Turns on polling inside the user's activity feed so they constantly get updates from the site
|
42
|
+
live_activity_update_interval: 60 # time between updates to live activity feed in seconds
|
43
|
+
enable_activity_comments: true # Turn on comments in the activity feed
|
44
|
+
|
45
|
+
# Friend configuration
|
46
|
+
allow_following: true
|
47
|
+
enable_friend_activity: true
|
48
|
+
|
49
|
+
# ssl
|
50
|
+
enable_ssl: false
|
51
|
+
|
52
|
+
# session key information
|
53
|
+
session_key: _test_session
|
54
|
+
session_secret: 882585c5d472d21e832965410ab233be541ea626e50ed0eb68a00a2f49b59073480e58599404e3dc62105a803ee42d67872e3f95eb48e2d6508b42038436abd6
|
55
|
+
|
56
|
+
# Content options
|
57
|
+
content_git_repository: "#{File.join(RAILS_ROOT, 'repo', RAILS_ENV)}"
|
58
|
+
enable_auto_translations: true
|
59
|
+
content_enable_solr: true
|
60
|
+
|
61
|
+
production:
|
62
|
+
<<: *DEFAULT
|
63
|
+
|
64
|
+
development:
|
65
|
+
<<: *DEFAULT
|
66
|
+
|
67
|
+
test:
|
68
|
+
<<: *DEFAULT
|
69
|
+
|
70
|
+
# controls account activation and automatic login
|
71
|
+
automatically_activate: false
|
72
|
+
automatically_login_after_account_create: false
|
73
|
+
|
74
|
+
# turn off for testing
|
75
|
+
use_recaptcha: false
|
76
|
+
|
77
|
+
application_url: 'localhost:3000'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Dir[File.join(RAILS_ROOT, 'lib', 'extensions', '*.rb')].each do |f|
|
2
|
+
require f
|
3
|
+
end
|
4
|
+
|
5
|
+
Dir[File.join(RAILS_ROOT, 'lib', '*.rb')].each do |f|
|
6
|
+
require f
|
7
|
+
end
|
8
|
+
|
9
|
+
# Rails 2 doesn't like mocks
|
10
|
+
|
11
|
+
Dir[File.join(RAILS_ROOT, 'test', 'mocks', RAILS_ENV, '*.rb')].each do |f|
|
12
|
+
require f
|
13
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Your secret key for verifying cookie session data integrity.
|
2
|
+
# If you change this key, all old sessions will become invalid!
|
3
|
+
# Make sure the secret is at least 30 characters and all random,
|
4
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
5
|
+
ActionController::Base.session = {
|
6
|
+
:key => GlobalConfig.session_key,
|
7
|
+
:secret => GlobalConfig.session_secret
|
8
|
+
}
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateMuckPermissionsAndRoles < ActiveRecord::Migration
|
2
|
+
|
3
|
+
create_table "permissions", :force => true do |t|
|
4
|
+
t.integer "role_id", :null => false
|
5
|
+
t.integer "user_id", :null => false
|
6
|
+
t.datetime "created_at"
|
7
|
+
t.datetime "updated_at"
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table "roles", :force => true do |t|
|
11
|
+
t.string "rolename"
|
12
|
+
t.datetime "created_at"
|
13
|
+
t.datetime "updated_at"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class AddMuckActivities < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
|
5
|
+
create_table :activities, :force => true do |t|
|
6
|
+
t.integer :item_id
|
7
|
+
t.string :item_type
|
8
|
+
t.string :template
|
9
|
+
t.integer :source_id
|
10
|
+
t.string :source_type
|
11
|
+
t.text :content
|
12
|
+
t.string :title
|
13
|
+
t.boolean :is_status_update, :default => false
|
14
|
+
t.boolean :is_public, :default => true
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :activities, ["item_id", "item_type"]
|
19
|
+
|
20
|
+
create_table :activity_feeds, :force => true do |t|
|
21
|
+
t.integer :activity_id
|
22
|
+
t.integer :ownable_id
|
23
|
+
t.string :ownable_type
|
24
|
+
end
|
25
|
+
|
26
|
+
add_index :activity_feeds, ["activity_id"]
|
27
|
+
add_index :activity_feeds, ["ownable_id", "ownable_type"]
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.down
|
32
|
+
drop_table :activities
|
33
|
+
drop_table :activity_feeds
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateLanguages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :languages, :force => true do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :english_name
|
6
|
+
t.string :locale
|
7
|
+
t.boolean :supported, :default => true
|
8
|
+
t.integer :is_default, :default => false
|
9
|
+
end
|
10
|
+
add_index :languages, :name
|
11
|
+
add_index :languages, :locale
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :languages
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateCountries < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :countries, :force => true do |t|
|
4
|
+
t.string "name", :limit => 128, :default => "", :null => false
|
5
|
+
t.string "abbreviation", :limit => 3, :default => "", :null => false
|
6
|
+
t.integer "sort", :default => 1000, :null => false
|
7
|
+
end
|
8
|
+
add_index :countries, :name
|
9
|
+
add_index :countries, :abbreviation
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :countries
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateStates < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :states, :force => true do |t|
|
4
|
+
t.string "name", :limit => 128, :default => "", :null => false
|
5
|
+
t.string "abbreviation", :limit => 3, :default => "", :null => false
|
6
|
+
t.integer "country_id", :limit => 8, :null => false
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :states, :country_id
|
10
|
+
add_index :states, :name
|
11
|
+
add_index :states, :abbreviation
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :states
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :users, :force => true do |t|
|
5
|
+
t.string :login
|
6
|
+
t.string :email
|
7
|
+
t.string :first_name
|
8
|
+
t.string :last_name
|
9
|
+
t.string :crypted_password
|
10
|
+
t.string :password_salt
|
11
|
+
t.string :persistence_token
|
12
|
+
t.string :single_access_token
|
13
|
+
t.string :perishable_token
|
14
|
+
t.integer :login_count, :null => false, :default => 0
|
15
|
+
t.integer :failed_login_count, :null => false, :default => 0
|
16
|
+
t.datetime :last_request_at
|
17
|
+
t.datetime :last_login_at
|
18
|
+
t.datetime :current_login_at
|
19
|
+
t.string :current_login_ip
|
20
|
+
t.string :last_login_ip
|
21
|
+
t.boolean :terms_of_service, :default => false, :null => false
|
22
|
+
t.string :time_zone, :default => "UTC"
|
23
|
+
t.datetime :disabled_at
|
24
|
+
t.datetime :activated_at
|
25
|
+
t.timestamps
|
26
|
+
end
|
27
|
+
|
28
|
+
add_index :users, :login
|
29
|
+
add_index :users, :email
|
30
|
+
add_index :users, :persistence_token
|
31
|
+
add_index :users, :perishable_token
|
32
|
+
add_index :users, :single_access_token
|
33
|
+
add_index :users, :last_request_at
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.down
|
37
|
+
drop_table :users
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateFriends < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :friends, :force => true do |t|
|
4
|
+
t.integer "inviter_id"
|
5
|
+
t.integer "invited_id"
|
6
|
+
t.integer "status", :default => 0
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :friends, ["inviter_id", "invited_id"]
|
10
|
+
add_index :friends, ["invited_id", "inviter_id"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :friends
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateComments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :comments, :force => true do |t|
|
4
|
+
t.integer :commentable_id, :default => 0
|
5
|
+
t.string :commentable_type, :limit => 15, :default => ""
|
6
|
+
t.text :body
|
7
|
+
t.integer :user_id, :default => 0, :null => false
|
8
|
+
t.integer :parent_id
|
9
|
+
t.integer :lft
|
10
|
+
t.integer :rgt
|
11
|
+
t.integer :is_denied, :default => 0, :null => false
|
12
|
+
t.boolean :is_reviewed, :default => false
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index :comments, ["user_id"]
|
17
|
+
add_index :comments, ["commentable_id", "commentable_type"]
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
drop_table :comments
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class AddContents < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :contents, :force => true do |t|
|
4
|
+
t.integer :creator_id
|
5
|
+
t.string :title
|
6
|
+
t.text :body
|
7
|
+
t.string :locale
|
8
|
+
t.text :body_raw
|
9
|
+
t.integer :contentable_id
|
10
|
+
t.string :contentable_type
|
11
|
+
t.integer :parent_id
|
12
|
+
t.integer :lft
|
13
|
+
t.integer :rgt
|
14
|
+
t.boolean :is_public
|
15
|
+
t.string :state
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
create_table :content_translations, :force => true do |t|
|
20
|
+
t.integer :content_id
|
21
|
+
t.string :title
|
22
|
+
t.text :body
|
23
|
+
t.string :locale
|
24
|
+
t.boolean :user_edited, :default => false
|
25
|
+
t.timestamps
|
26
|
+
end
|
27
|
+
|
28
|
+
create_table :content_permissions, :force => true do |t|
|
29
|
+
t.integer :content_id
|
30
|
+
t.integer :user_id
|
31
|
+
t.timestamps
|
32
|
+
end
|
33
|
+
|
34
|
+
add_index :contents, :parent_id
|
35
|
+
add_index :contents, :creator_id
|
36
|
+
|
37
|
+
add_index :content_translations, :content_id
|
38
|
+
add_index :content_translations, :locale
|
39
|
+
|
40
|
+
add_index :content_permissions, [:content_id, :user_id]
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.down
|
44
|
+
drop_table :content_versions
|
45
|
+
drop_table :contents
|
46
|
+
drop_table :content_translations
|
47
|
+
drop_table :content_permissions
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateSlugs < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :slugs do |t|
|
4
|
+
t.string :name
|
5
|
+
t.integer :sluggable_id
|
6
|
+
t.integer :sequence, :null => false, :default => 1
|
7
|
+
t.string :sluggable_type, :limit => 40
|
8
|
+
t.string :scope, :limit => 40
|
9
|
+
t.datetime :created_at
|
10
|
+
end
|
11
|
+
add_index :slugs, [:name, :sluggable_type, :scope, :sequence], :unique => true
|
12
|
+
add_index :slugs, :sluggable_id
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :slugs
|
17
|
+
end
|
18
|
+
end
|