From 3fa8937b95a4d90000ad1be9c588424052136455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Wed, 27 Jul 2011 13:46:24 +0300 Subject: [PATCH 001/248] Rails 3.1 - wip. --- .../admin/blog/categories_controller.rb | 11 - .../admin/blog/comments_controller.rb | 40 ---- .../admin/blog/posts_controller.rb | 97 -------- .../admin/blog/settings_controller.rb | 53 ----- app/controllers/blog/categories_controller.rb | 13 -- app/controllers/blog/posts_controller.rb | 105 --------- app/controllers/blog_controller.rb | 16 -- .../admin/blog/categories_controller.rb | 13 ++ .../admin/blog/comments_controller.rb | 42 ++++ .../refinery/admin/blog/posts_controller.rb | 99 ++++++++ .../admin/blog/settings_controller.rb | 55 +++++ .../refinery/blog/categories_controller.rb | 15 ++ .../refinery/blog/posts_controller.rb | 107 +++++++++ app/controllers/refinery/blog_controller.rb | 18 ++ app/mailers/blog/comment_mailer.rb | 13 -- app/mailers/refinery/blog/comment_mailer.rb | 15 ++ app/models/blog/comment_mailer.rb | 1 - app/models/blog_category.rb | 19 -- app/models/blog_comment.rb | 131 ----------- app/models/blog_post.rb | 114 --------- app/models/categorization.rb | 7 - app/models/refinery/blog/comment_mailer.rb | 1 + app/models/refinery/blog_category.rb | 21 ++ app/models/refinery/blog_comment.rb | 133 +++++++++++ app/models/refinery/blog_post.rb | 116 ++++++++++ app/models/refinery/categorization.rb | 9 + config/routes.rb | 70 +++--- db/migrate/1_create_blog_structure.rb | 32 +-- db/migrate/2_add_user_id_to_blog_posts.rb | 12 +- db/migrate/3_acts_as_taggable_on_migration.rb | 4 +- db/migrate/4_create_seo_meta_for_blog.rb | 4 +- db/migrate/5_add_cached_slugs.rb | 11 +- .../6_add_custom_url_field_to_blog_posts.rb | 8 +- ...7_add_custom_teaser_field_to_blog_posts.rb | 8 +- .../8_add_primary_key_to_categorizations.rb | 12 +- db/seeds/refinerycms_blog.rb | 12 +- features/support/factories/blog_categories.rb | 2 +- features/support/factories/blog_comments.rb | 2 +- features/support/factories/blog_posts.rb | 2 +- lib/gemspec.rb | 2 +- lib/generators/blog_generator.rb | 10 + lib/generators/refinerycms_blog_generator.rb | 8 - lib/refinery/blog/version.rb | 6 +- lib/refinerycms-blog.rb | 9 +- refinerycms-blog.gemspec | 58 +++-- spec/models/blog_category_spec.rb | 41 ---- spec/models/blog_comment_spec.rb | 21 -- spec/models/blog_post_spec.rb | 217 ----------------- spec/models/refinery/blog_category_spec.rb | 43 ++++ spec/models/refinery/blog_comment_spec.rb | 23 ++ spec/models/refinery/blog_post_spec.rb | 219 ++++++++++++++++++ 51 files changed, 1064 insertions(+), 1036 deletions(-) delete mode 100644 app/controllers/admin/blog/categories_controller.rb delete mode 100644 app/controllers/admin/blog/comments_controller.rb delete mode 100644 app/controllers/admin/blog/posts_controller.rb delete mode 100644 app/controllers/admin/blog/settings_controller.rb delete mode 100644 app/controllers/blog/categories_controller.rb delete mode 100644 app/controllers/blog/posts_controller.rb delete mode 100644 app/controllers/blog_controller.rb create mode 100644 app/controllers/refinery/admin/blog/categories_controller.rb create mode 100644 app/controllers/refinery/admin/blog/comments_controller.rb create mode 100644 app/controllers/refinery/admin/blog/posts_controller.rb create mode 100644 app/controllers/refinery/admin/blog/settings_controller.rb create mode 100644 app/controllers/refinery/blog/categories_controller.rb create mode 100644 app/controllers/refinery/blog/posts_controller.rb create mode 100644 app/controllers/refinery/blog_controller.rb delete mode 100644 app/mailers/blog/comment_mailer.rb create mode 100644 app/mailers/refinery/blog/comment_mailer.rb delete mode 100644 app/models/blog/comment_mailer.rb delete mode 100644 app/models/blog_category.rb delete mode 100644 app/models/blog_comment.rb delete mode 100644 app/models/blog_post.rb delete mode 100644 app/models/categorization.rb create mode 100644 app/models/refinery/blog/comment_mailer.rb create mode 100644 app/models/refinery/blog_category.rb create mode 100644 app/models/refinery/blog_comment.rb create mode 100644 app/models/refinery/blog_post.rb create mode 100644 app/models/refinery/categorization.rb create mode 100644 lib/generators/blog_generator.rb delete mode 100644 lib/generators/refinerycms_blog_generator.rb delete mode 100644 spec/models/blog_category_spec.rb delete mode 100644 spec/models/blog_comment_spec.rb delete mode 100644 spec/models/blog_post_spec.rb create mode 100644 spec/models/refinery/blog_category_spec.rb create mode 100644 spec/models/refinery/blog_comment_spec.rb create mode 100644 spec/models/refinery/blog_post_spec.rb diff --git a/app/controllers/admin/blog/categories_controller.rb b/app/controllers/admin/blog/categories_controller.rb deleted file mode 100644 index 6933c44..0000000 --- a/app/controllers/admin/blog/categories_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Admin - module Blog - class CategoriesController < Admin::BaseController - - crudify :blog_category, - :title_attribute => :title, - :order => 'title ASC' - - end - end -end diff --git a/app/controllers/admin/blog/comments_controller.rb b/app/controllers/admin/blog/comments_controller.rb deleted file mode 100644 index 1868206..0000000 --- a/app/controllers/admin/blog/comments_controller.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Admin - module Blog - class CommentsController < Admin::BaseController - - crudify :blog_comment, - :title_attribute => :name, - :order => 'published_at DESC' - - def index - @blog_comments = BlogComment.unmoderated - render :action => 'index' - end - - def approved - unless params[:id].present? - @blog_comments = BlogComment.approved - render :action => 'index' - else - @blog_comment = BlogComment.find(params[:id]) - @blog_comment.approve! - flash[:notice] = t('approved', :scope => 'admin.blog.comments', :author => @blog_comment.name) - redirect_to :action => params[:return_to] || 'index' - end - end - - def rejected - unless params[:id].present? - @blog_comments = BlogComment.rejected - render :action => 'index' - else - @blog_comment = BlogComment.find(params[:id]) - @blog_comment.reject! - flash[:notice] = t('rejected', :scope => 'admin.blog.comments', :author => @blog_comment.name) - redirect_to :action => params[:return_to] || 'index' - end - end - - end - end -end \ No newline at end of file diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb deleted file mode 100644 index c8dfc13..0000000 --- a/app/controllers/admin/blog/posts_controller.rb +++ /dev/null @@ -1,97 +0,0 @@ -module Admin - module Blog - class PostsController < Admin::BaseController - - - crudify :blog_post, - :title_attribute => :title, - :order => 'published_at DESC' - - def uncategorized - @blog_posts = BlogPost.uncategorized.paginate({ - :page => params[:page], - :per_page => BlogPost.per_page - }) - end - - def tags - op = case ActiveRecord::Base.connection.adapter_name.downcase - when 'postgresql' - '~*' - else - 'LIKE' - end - wildcard = case ActiveRecord::Base.connection.adapter_name.downcase - when 'postgresql' - '.*' - else - '%' - end - @tags = BlogPost.tag_counts_on(:tags).where( - ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"] - ).map { |tag| {:id => tag.id, :value => tag.name}} - render :json => @tags.flatten - end - - def create - # if the position field exists, set this object as last object, given the conditions of this class. - if BlogPost.column_names.include?("position") - params[:blog_post].merge!({ - :position => ((BlogPost.maximum(:position, :conditions => "")||-1) + 1) - }) - end - - if BlogPost.column_names.include?("user_id") - params[:blog_post].merge!({ - :user_id => current_user.id - }) - end - - if (@blog_post = BlogPost.create(params[:blog_post])).valid? - (request.xhr? ? flash.now : flash).notice = t( - 'refinery.crudify.created', - :what => "'#{@blog_post.title}'" - ) - - unless from_dialog? - unless params[:continue_editing] =~ /true|on|1/ - redirect_back_or_default(admin_blog_posts_url) - else - unless request.xhr? - redirect_to :back - else - render :partial => "/shared/message" - end - end - else - render :text => "" - end - else - unless request.xhr? - render :action => 'new' - else - render :partial => "/shared/admin/error_messages", - :locals => { - :object => @blog_post, - :include_object_name => true - } - end - end - end - - before_filter :find_all_categories, - :only => [:new, :edit, :create, :update] - - before_filter :check_category_ids, :only => :update - - protected - def find_all_categories - @blog_categories = BlogCategory.find(:all) - end - - def check_category_ids - params[:blog_post][:category_ids] ||= [] - end - end - end -end \ No newline at end of file diff --git a/app/controllers/admin/blog/settings_controller.rb b/app/controllers/admin/blog/settings_controller.rb deleted file mode 100644 index 5f2b3be..0000000 --- a/app/controllers/admin/blog/settings_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -module Admin - module Blog - class SettingsController < Admin::BaseController - - def notification_recipients - @recipients = BlogComment::Notification.recipients - - if request.post? - BlogComment::Notification.recipients = params[:recipients] - flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients', - :recipients => BlogComment::Notification.recipients) - unless request.xhr? or from_dialog? - redirect_back_or_default(admin_blog_posts_path) - else - render :text => "", - :layout => false - end - end - end - - def moderation - enabled = BlogComment::Moderation.toggle! - unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) - else - render :json => {:enabled => enabled}, - :layout => false - end - end - - def comments - enabled = BlogComment.toggle! - unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) - else - render :json => {:enabled => enabled}, - :layout => false - end - end - - def teasers - enabled = BlogPost.teaser_enabled_toggle! - unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) - else - render :json => {:enabled => enabled}, - :layout => false - end - end - - end - end -end \ No newline at end of file diff --git a/app/controllers/blog/categories_controller.rb b/app/controllers/blog/categories_controller.rb deleted file mode 100644 index efda778..0000000 --- a/app/controllers/blog/categories_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Blog - class CategoriesController < BlogController - - def show - @category = BlogCategory.find(params[:id]) - @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) - end - - end -end \ No newline at end of file diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb deleted file mode 100644 index edac5ab..0000000 --- a/app/controllers/blog/posts_controller.rb +++ /dev/null @@ -1,105 +0,0 @@ -module Blog - class PostsController < BlogController - - before_filter :find_all_blog_posts, :except => [:archive] - before_filter :find_blog_post, :only => [:show, :comment, :update_nav] - before_filter :find_tags - - respond_to :html, :js, :rss - - def index - # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@blog_posts = BlogPost.live.includes(:comments, :categories).all) if request.format.rss? - respond_with (@blog_posts) do |format| - format.html - format.rss - end - end - - def show - @blog_comment = BlogComment.new - - respond_with (@blog_post) do |format| - format.html { present(@blog_post) } - format.js { render :partial => 'post', :layout => false } - end - end - - def comment - if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? - if BlogComment::Moderation.enabled? or @blog_comment.ham? - begin - Blog::CommentMailer.notification(@blog_comment, request).deliver - rescue - logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" - end - end - - if BlogComment::Moderation.enabled? - flash[:notice] = t('thank_you_moderated', :scope => 'blog.posts.comments') - redirect_to blog_post_url(params[:id]) - else - flash[:notice] = t('thank_you', :scope => 'blog.posts.comments') - redirect_to blog_post_url(params[:id], - :anchor => "comment-#{@blog_comment.to_param}") - end - else - render :action => 'show' - end - end - - def archive - if params[:month].present? - date = "#{params[:month]}/#{params[:year]}" - @archive_date = Time.parse(date) - @date_title = @archive_date.strftime('%B %Y') - @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) - else - date = "01/#{params[:year]}" - @archive_date = Time.parse(date) - @date_title = @archive_date.strftime('%Y') - @blog_posts = BlogPost.live.by_year(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) - end - respond_with (@blog_posts) - end - - def tagged - @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) - @tag_name = @tag.name - @blog_posts = BlogPost.tagged_with(@tag_name).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) - end - - protected - - def find_blog_post - unless (@blog_post = BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = BlogPost.find(params[:id]) - else - error_404 - end - end - end - - def find_all_blog_posts - @blog_posts = BlogPost.live.includes(:comments, :categories).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) - end - - def find_tags - @tags = BlogPost.tag_counts_on(:tags) - end - - end -end \ No newline at end of file diff --git a/app/controllers/blog_controller.rb b/app/controllers/blog_controller.rb deleted file mode 100644 index f51d5bb..0000000 --- a/app/controllers/blog_controller.rb +++ /dev/null @@ -1,16 +0,0 @@ -class BlogController < ApplicationController - - helper :blog_posts - before_filter :find_page, :find_all_blog_categories - -protected - - def find_page - @page = Page.find_by_link_url("/blog") - end - - def find_all_blog_categories - @blog_categories = BlogCategory.all - end - -end diff --git a/app/controllers/refinery/admin/blog/categories_controller.rb b/app/controllers/refinery/admin/blog/categories_controller.rb new file mode 100644 index 0000000..7196e8f --- /dev/null +++ b/app/controllers/refinery/admin/blog/categories_controller.rb @@ -0,0 +1,13 @@ +module Refinery + module Admin + module Blog + class CategoriesController < ::Admin::BaseController + + crudify :'refinery/blog_category', + :title_attribute => :title, + :order => 'title ASC' + + end + end + end +end diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb new file mode 100644 index 0000000..9f78caa --- /dev/null +++ b/app/controllers/refinery/admin/blog/comments_controller.rb @@ -0,0 +1,42 @@ +module Refinery + module Admin + module Blog + class CommentsController < ::Admin::BaseController + + crudify :'refinery/blog_comment', + :title_attribute => :name, + :order => 'published_at DESC' + + def index + @blog_comments = Refinery::BlogComment.unmoderated + render :action => 'index' + end + + def approved + unless params[:id].present? + @blog_comments = Refinery::BlogComment.approved + render :action => 'index' + else + @blog_comment = Refinery::BlogComment.find(params[:id]) + @blog_comment.approve! + flash[:notice] = t('approved', :scope => 'admin.blog.comments', :author => @blog_comment.name) + redirect_to :action => params[:return_to] || 'index' + end + end + + def rejected + unless params[:id].present? + @blog_comments = Refinery::BlogComment.rejected + render :action => 'index' + else + @blog_comment = Refinery::BlogComment.find(params[:id]) + @blog_comment.reject! + flash[:notice] = t('rejected', :scope => 'admin.blog.comments', :author => @blog_comment.name) + redirect_to :action => params[:return_to] || 'index' + end + end + + end + end + end +end diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb new file mode 100644 index 0000000..a934a15 --- /dev/null +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -0,0 +1,99 @@ +module Refinery + module Admin + module Blog + class PostsController < ::Admin::BaseController + + + crudify :'refinery/blog_post', + :title_attribute => :title, + :order => 'published_at DESC' + + def uncategorized + @blog_posts = Refinery::BlogPost.uncategorized.paginate({ + :page => params[:page], + :per_page => Refinery::BlogPost.per_page + }) + end + + def tags + op = case ActiveRecord::Base.connection.adapter_name.downcase + when 'postgresql' + '~*' + else + 'LIKE' + end + wildcard = case ActiveRecord::Base.connection.adapter_name.downcase + when 'postgresql' + '.*' + else + '%' + end + @tags = Refinery::BlogPost.tag_counts_on(:tags).where( + ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"] + ).map { |tag| {:id => tag.id, :value => tag.name}} + render :json => @tags.flatten + end + + def create + # if the position field exists, set this object as last object, given the conditions of this class. + if Refinery::BlogPost.column_names.include?("position") + params[:blog_post].merge!({ + :position => ((Refinery::BlogPost.maximum(:position, :conditions => "")||-1) + 1) + }) + end + + if Refinery::BlogPost.column_names.include?("user_id") + params[:blog_post].merge!({ + :user_id => current_user.id + }) + end + + if (@blog_post = Refinery::BlogPost.create(params[:blog_post])).valid? + (request.xhr? ? flash.now : flash).notice = t( + 'refinery.crudify.created', + :what => "'#{@blog_post.title}'" + ) + + unless from_dialog? + unless params[:continue_editing] =~ /true|on|1/ + redirect_back_or_default(admin_blog_posts_url) + else + unless request.xhr? + redirect_to :back + else + render :partial => "/shared/message" + end + end + else + render :text => "" + end + else + unless request.xhr? + render :action => 'new' + else + render :partial => "/shared/admin/error_messages", + :locals => { + :object => @blog_post, + :include_object_name => true + } + end + end + end + + before_filter :find_all_categories, + :only => [:new, :edit, :create, :update] + + before_filter :check_category_ids, :only => :update + + protected + def find_all_categories + @blog_categories = Refinery::BlogCategory.find(:all) + end + + def check_category_ids + params[:blog_post][:category_ids] ||= [] + end + end + end + end +end diff --git a/app/controllers/refinery/admin/blog/settings_controller.rb b/app/controllers/refinery/admin/blog/settings_controller.rb new file mode 100644 index 0000000..469a1dc --- /dev/null +++ b/app/controllers/refinery/admin/blog/settings_controller.rb @@ -0,0 +1,55 @@ +module Refinery + module Admin + module Blog + class SettingsController < ::Admin::BaseController + + def notification_recipients + @recipients = Refinery::BlogComment::Notification.recipients + + if request.post? + Refinery::BlogComment::Notification.recipients = params[:recipients] + flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients', + :recipients => Refinery::BlogComment::Notification.recipients) + unless request.xhr? or from_dialog? + redirect_back_or_default(admin_blog_posts_path) + else + render :text => "", + :layout => false + end + end + end + + def moderation + enabled = Refinery::BlogComment::Moderation.toggle! + unless request.xhr? + redirect_back_or_default(admin_blog_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + def comments + enabled = Refinery::BlogComment.toggle! + unless request.xhr? + redirect_back_or_default(admin_blog_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + def teasers + enabled = Refinery::BlogPost.teaser_enabled_toggle! + unless request.xhr? + redirect_back_or_default(admin_blog_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + end + end + end +end diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb new file mode 100644 index 0000000..2c8c4c5 --- /dev/null +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -0,0 +1,15 @@ +module Refinery + module Blog + class CategoriesController < BlogController + + def show + @category = Refinery::BlogCategory.find(params[:id]) + @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({ + :page => params[:page], + :per_page => Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + }) + end + + end + end +end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb new file mode 100644 index 0000000..bdf53f0 --- /dev/null +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -0,0 +1,107 @@ +module Refinery + module Blog + class PostsController < BlogController + + before_filter :find_all_blog_posts, :except => [:archive] + before_filter :find_blog_post, :only => [:show, :comment, :update_nav] + before_filter :find_tags + + respond_to :html, :js, :rss + + def index + # Rss feeders are greedy. Let's give them every blog post instead of paginating. + (@blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).all) if request.format.rss? + respond_with (@blog_posts) do |format| + format.html + format.rss + end + end + + def show + @blog_comment = Refinery::BlogComment.new + + respond_with (@blog_post) do |format| + format.html { present(@blog_post) } + format.js { render :partial => 'post', :layout => false } + end + end + + def comment + if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? + if Refinery::BlogComment::Moderation.enabled? or @blog_comment.ham? + begin + Refinery::Blog::CommentMailer.notification(@blog_comment, request).deliver + rescue + logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" + end + end + + if Refinery::BlogComment::Moderation.enabled? + flash[:notice] = t('thank_you_moderated', :scope => 'blog.posts.comments') + redirect_to blog_post_url(params[:id]) + else + flash[:notice] = t('thank_you', :scope => 'blog.posts.comments') + redirect_to blog_post_url(params[:id], + :anchor => "comment-#{@blog_comment.to_param}") + end + else + render :action => 'show' + end + end + + def archive + if params[:month].present? + date = "#{params[:month]}/#{params[:year]}" + @archive_date = Time.parse(date) + @date_title = @archive_date.strftime('%B %Y') + @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({ + :page => params[:page], + :per_page => Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + }) + else + date = "01/#{params[:year]}" + @archive_date = Time.parse(date) + @date_title = @archive_date.strftime('%Y') + @blog_posts = Refinery::live.by_year(@archive_date).paginate({ + :page => params[:page], + :per_page => Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + }) + end + respond_with (@blog_posts) + end + + def tagged + @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) + @tag_name = @tag.name + @blog_posts = Refinery::BlogPost.tagged_with(@tag_name).paginate({ + :page => params[:page], + :per_page => Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + }) + end + + protected + + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 + end + end + end + + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).paginate({ + :page => params[:page], + :per_page => Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + }) + end + + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + end + end +end diff --git a/app/controllers/refinery/blog_controller.rb b/app/controllers/refinery/blog_controller.rb new file mode 100644 index 0000000..6bec0a5 --- /dev/null +++ b/app/controllers/refinery/blog_controller.rb @@ -0,0 +1,18 @@ +module Refinery + class BlogController < ::ApplicationController + + helper :blog_posts + before_filter :find_page, :find_all_blog_categories + + protected + + def find_page + @page = Refinery::Page.find_by_link_url("/blog") + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end + + end +end diff --git a/app/mailers/blog/comment_mailer.rb b/app/mailers/blog/comment_mailer.rb deleted file mode 100644 index 3710ea1..0000000 --- a/app/mailers/blog/comment_mailer.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Blog - class CommentMailer < ActionMailer::Base - - def notification(comment, request) - subject BlogComment::Notification.subject - recipients BlogComment::Notification.recipients - from "\"#{RefinerySetting[:site_name]}\" " - sent_on Time.now - @comment = comment - end - - end -end \ No newline at end of file diff --git a/app/mailers/refinery/blog/comment_mailer.rb b/app/mailers/refinery/blog/comment_mailer.rb new file mode 100644 index 0000000..f36ea29 --- /dev/null +++ b/app/mailers/refinery/blog/comment_mailer.rb @@ -0,0 +1,15 @@ +module Refinery + module Blog + class CommentMailer < ActionMailer::Base + + def notification(comment, request) + subject BlogComment::Notification.subject + recipients BlogComment::Notification.recipients + from "\"#{RefinerySetting[:site_name]}\" " + sent_on Time.now + @comment = comment + end + + end + end +end diff --git a/app/models/blog/comment_mailer.rb b/app/models/blog/comment_mailer.rb deleted file mode 100644 index acef313..0000000 --- a/app/models/blog/comment_mailer.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../mailers/blog/comment_mailer', __FILE__) diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb deleted file mode 100644 index b66a94d..0000000 --- a/app/models/blog_category.rb +++ /dev/null @@ -1,19 +0,0 @@ -class BlogCategory < ActiveRecord::Base - - has_many :categorizations, :dependent => :destroy - has_many :posts, :through => :categorizations, :source => :blog_post - - acts_as_indexed :fields => [:title] - - validates :title, :presence => true, :uniqueness => true - - has_friendly_id :title, :use_slug => true, - :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), - :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - - def post_count - posts.select(&:live?).count - end - -end diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb deleted file mode 100644 index 6216cc2..0000000 --- a/app/models/blog_comment.rb +++ /dev/null @@ -1,131 +0,0 @@ -class BlogComment < ActiveRecord::Base - - attr_accessible :name, :email, :message - - filters_spam :author_field => :name, - :email_field => :email, - :message_field => :body - - belongs_to :post, :class_name => 'BlogPost', :foreign_key => 'blog_post_id' - - acts_as_indexed :fields => [:name, :email, :message] - - alias_attribute :message, :body - - validates :name, :message, :presence => true - validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } - - scope :unmoderated, :conditions => {:state => nil} - scope :approved, :conditions => {:state => 'approved'} - scope :rejected, :conditions => {:state => 'rejected'} - - def avatar_url(options = {}) - options = {:size => 60} - require 'digest/md5' - size = ("?s=#{options[:size]}" if options[:size]) - "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" - end - - def approve! - self.update_attribute(:state, 'approved') - end - - def reject! - self.update_attribute(:state, 'rejected') - end - - def rejected? - self.state == 'rejected' - end - - def approved? - self.state == 'approved' - end - - def unmoderated? - self.state.nil? - end - - def self.toggle! - currently = RefinerySetting.find_or_set(:comments_allowed, true, { - :scoping => 'blog' - }) - RefinerySetting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'}) - end - - before_create do |comment| - unless BlogComment::Moderation.enabled? - comment.state = comment.ham? ? 'approved' : 'rejected' - end - end - - module Moderation - class << self - def enabled? - RefinerySetting.find_or_set(:comment_moderation, true, { - :scoping => 'blog', - :restricted => false - }) - end - - def toggle! - new_value = { - :value => !BlogComment::Moderation.enabled?, - :scoping => 'blog', - :restricted => false - } - if RefinerySetting.respond_to?(:set) - RefinerySetting.set(:comment_moderation, new_value) - else - RefinerySetting[:comment_moderation] = new_value - end - end - end - end - - module Notification - class << self - def recipients - RefinerySetting.find_or_set(:comment_notification_recipients, (Role[:refinery].users.first.email rescue ''), - { - :scoping => 'blog', - :restricted => false - }) - end - - def recipients=(emails) - new_value = { - :value => emails, - :scoping => 'blog', - :restricted => false - } - if RefinerySetting.respond_to?(:set) - RefinerySetting.set(:comment_notification_recipients, new_value) - else - RefinerySetting[:comment_notification_recipients] = new_value - end - end - - def subject - RefinerySetting.find_or_set(:comment_notification_subject, "New inquiry from your website", { - :scoping => 'blog', - :restricted => false - }) - end - - def subject=(subject_line) - new_value = { - :value => subject_line, - :scoping => 'blog', - :restricted => false - } - if RefinerySetting.respond_to?(:set) - RefinerySetting.set(:comment_notification_subject, new_value) - else - RefinerySetting[:comment_notification_subject] = new_value - end - end - end - end - -end diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb deleted file mode 100644 index e03be99..0000000 --- a/app/models/blog_post.rb +++ /dev/null @@ -1,114 +0,0 @@ -require 'acts-as-taggable-on' -require 'seo_meta' - -class BlogPost < ActiveRecord::Base - - is_seo_meta if self.table_exists? - - default_scope :order => 'published_at DESC' - #.first & .last will be reversed -- consider a with_exclusive_scope on these? - - belongs_to :author, :class_name => 'User', :foreign_key => :user_id, :readonly => true - - has_many :comments, :class_name => 'BlogComment', :dependent => :destroy - acts_as_taggable - - has_many :categorizations, :dependent => :destroy - has_many :categories, :through => :categorizations, :source => :blog_category - - acts_as_indexed :fields => [:title, :body] - - validates :title, :presence => true, :uniqueness => true - validates :body, :presence => true - - has_friendly_id :friendly_id_source, :use_slug => true, - :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), - :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - - scope :by_archive, lambda { |archive_date| - where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) - } - - scope :by_year, lambda { |archive_year| - where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) - } - - scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } - - scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } - - scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } - # next is now in << self - - def next - BlogPost.next(self).first - end - - def prev - BlogPost.previous(self).first - end - - def live? - !draft and published_at <= Time.now - end - - def category_ids=(ids) - self.categories = ids.reject{|id| id.blank?}.collect {|c_id| - BlogCategory.find(c_id.to_i) rescue nil - }.compact - end - - def friendly_id_source - custom_url.present? ? custom_url : title - end - - class << self - def next current_record - self.send(:with_exclusive_scope) do - where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") - end - end - - def comments_allowed? - RefinerySetting.find_or_set(:comments_allowed, true, { - :scoping => 'blog' - }) - end - - def teasers_enabled? - RefinerySetting.find_or_set(:teasers_enabled, true, { - :scoping => 'blog' - }) - end - - def teaser_enabled_toggle! - currently = RefinerySetting.find_or_set(:teasers_enabled, true, { - :scoping => 'blog' - }) - RefinerySetting.set(:teasers_enabled, {:value => !currently, :scoping => 'blog'}) - end - - def uncategorized - BlogPost.live.reject { |p| p.categories.any? } - end - end - - module ShareThis - DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - - class << self - def key - RefinerySetting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, { - :scoping => 'blog' - }) - end - - def enabled? - key = BlogPost::ShareThis.key - key.present? and key != BlogPost::ShareThis::DEFAULT_KEY - end - end - end - -end diff --git a/app/models/categorization.rb b/app/models/categorization.rb deleted file mode 100644 index 1735ea9..0000000 --- a/app/models/categorization.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Categorization < ActiveRecord::Base - - set_table_name 'blog_categories_blog_posts' - belongs_to :blog_post - belongs_to :blog_category - -end \ No newline at end of file diff --git a/app/models/refinery/blog/comment_mailer.rb b/app/models/refinery/blog/comment_mailer.rb new file mode 100644 index 0000000..7013355 --- /dev/null +++ b/app/models/refinery/blog/comment_mailer.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../mailers/refinery/blog/comment_mailer', __FILE__) diff --git a/app/models/refinery/blog_category.rb b/app/models/refinery/blog_category.rb new file mode 100644 index 0000000..7a35e67 --- /dev/null +++ b/app/models/refinery/blog_category.rb @@ -0,0 +1,21 @@ +module Refinery + class BlogCategory < ActiveRecord::Base + + has_many :categorizations, :dependent => :destroy + has_many :posts, :through => :categorizations, :source => :blog_post + + acts_as_indexed :fields => [:title] + + validates :title, :presence => true, :uniqueness => true + + has_friendly_id :title, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') + + def post_count + posts.select(&:live?).count + end + + end +end diff --git a/app/models/refinery/blog_comment.rb b/app/models/refinery/blog_comment.rb new file mode 100644 index 0000000..e5869a8 --- /dev/null +++ b/app/models/refinery/blog_comment.rb @@ -0,0 +1,133 @@ +module Refinery + class BlogComment < ActiveRecord::Base + + attr_accessible :name, :email, :message + + filters_spam :author_field => :name, + :email_field => :email, + :message_field => :body + + belongs_to :post, :class_name => 'Refinery::BlogPost', :foreign_key => 'blog_post_id' + + acts_as_indexed :fields => [:name, :email, :message] + + alias_attribute :message, :body + + validates :name, :message, :presence => true + validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } + + scope :unmoderated, :conditions => {:state => nil} + scope :approved, :conditions => {:state => 'approved'} + scope :rejected, :conditions => {:state => 'rejected'} + + def avatar_url(options = {}) + options = {:size => 60} + require 'digest/md5' + size = ("?s=#{options[:size]}" if options[:size]) + "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" + end + + def approve! + self.update_attribute(:state, 'approved') + end + + def reject! + self.update_attribute(:state, 'rejected') + end + + def rejected? + self.state == 'rejected' + end + + def approved? + self.state == 'approved' + end + + def unmoderated? + self.state.nil? + end + + def self.toggle! + currently = Refinery::Setting.find_or_set(:comments_allowed, true, { + :scoping => 'blog' + }) + Refinery::Setting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'}) + end + + before_create do |comment| + unless BlogComment::Moderation.enabled? + comment.state = comment.ham? ? 'approved' : 'rejected' + end + end + + module Moderation + class << self + def enabled? + Refinery::Setting.find_or_set(:comment_moderation, true, { + :scoping => 'blog', + :restricted => false + }) + end + + def toggle! + new_value = { + :value => !BlogComment::Moderation.enabled?, + :scoping => 'blog', + :restricted => false + } + if Refinery::Setting.respond_to?(:set) + Refinery::Setting.set(:comment_moderation, new_value) + else + Refinery::Setting[:comment_moderation] = new_value + end + end + end + end + + module Notification + class << self + def recipients + Refinery::Setting.find_or_set(:comment_notification_recipients, (Refinery::Role[:refinery].users.first.email rescue ''), + { + :scoping => 'blog', + :restricted => false + }) + end + + def recipients=(emails) + new_value = { + :value => emails, + :scoping => 'blog', + :restricted => false + } + if Refinery::Setting.respond_to?(:set) + Refinery::Setting.set(:comment_notification_recipients, new_value) + else + Refinery::Setting[:comment_notification_recipients] = new_value + end + end + + def subject + Refinery::Setting.find_or_set(:comment_notification_subject, "New inquiry from your website", { + :scoping => 'blog', + :restricted => false + }) + end + + def subject=(subject_line) + new_value = { + :value => subject_line, + :scoping => 'blog', + :restricted => false + } + if Refinery::Setting.respond_to?(:set) + Refinery::Setting.set(:comment_notification_subject, new_value) + else + Refinery::Setting[:comment_notification_subject] = new_value + end + end + end + end + + end +end \ No newline at end of file diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb new file mode 100644 index 0000000..12ce6f2 --- /dev/null +++ b/app/models/refinery/blog_post.rb @@ -0,0 +1,116 @@ +require 'acts-as-taggable-on' +require 'seo_meta' + +module Refinery + class BlogPost < ActiveRecord::Base + + is_seo_meta if self.table_exists? + + default_scope :order => 'published_at DESC' + #.first & .last will be reversed -- consider a with_exclusive_scope on these? + + belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true + + has_many :comments, :class_name => 'Refinery::BlogComment', :dependent => :destroy + acts_as_taggable + + has_many :categorizations, :dependent => :destroy + has_many :categories, :through => :categorizations, :source => :blog_category + + acts_as_indexed :fields => [:title, :body] + + validates :title, :presence => true, :uniqueness => true + validates :body, :presence => true + + has_friendly_id :friendly_id_source, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') + + scope :by_archive, lambda { |archive_date| + where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) + } + + scope :by_year, lambda { |archive_year| + where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) + } + + scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } + + scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } + + scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } + # next is now in << self + + def next + BlogPost.next(self).first + end + + def prev + BlogPost.previous(self).first + end + + def live? + !draft and published_at <= Time.now + end + + def category_ids=(ids) + self.categories = ids.reject{|id| id.blank?}.collect {|c_id| + Refinery::BlogCategory.find(c_id.to_i) rescue nil + }.compact + end + + def friendly_id_source + custom_url.present? ? custom_url : title + end + + class << self + def next current_record + self.send(:with_exclusive_scope) do + where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") + end + end + + def comments_allowed? + Refinery::Setting.find_or_set(:comments_allowed, true, { + :scoping => 'blog' + }) + end + + def teasers_enabled? + Refinery::Setting.find_or_set(:teasers_enabled, true, { + :scoping => 'blog' + }) + end + + def teaser_enabled_toggle! + currently = Refinery::Setting.find_or_set(:teasers_enabled, true, { + :scoping => 'blog' + }) + Refinery::Setting.set(:teasers_enabled, {:value => !currently, :scoping => 'blog'}) + end + + def uncategorized + BlogPost.live.reject { |p| p.categories.any? } + end + end + + module ShareThis + DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + + class << self + def key + Refinery::Setting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, { + :scoping => 'blog' + }) + end + + def enabled? + key = BlogPost::ShareThis.key + key.present? and key != BlogPost::ShareThis::DEFAULT_KEY + end + end + end + + end +end diff --git a/app/models/refinery/categorization.rb b/app/models/refinery/categorization.rb new file mode 100644 index 0000000..c4feaec --- /dev/null +++ b/app/models/refinery/categorization.rb @@ -0,0 +1,9 @@ +module Refinery + class Categorization < ActiveRecord::Base + + set_table_name 'refinery_blog_categories_blog_posts' + belongs_to :blog_post + belongs_to :blog_category + + end +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e26fe64..6ba5186 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,45 +1,47 @@ ::Refinery::Application.routes.draw do - scope(:path => 'blog', :module => 'blog') do - root :to => 'posts#index', :as => 'blog_root' - match 'feed.rss', :to => 'posts#index', :as => 'blog_rss_feed', :defaults => {:format => "rss"} - match ':id', :to => 'posts#show', :as => 'blog_post' - match 'categories/:id', :to => 'categories#show', :as => 'blog_category' - match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' - get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts' - get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts' - end + scope(:module => 'refinery') do + scope(:path => 'blog', :module => 'blog') do + root :to => 'posts#index', :as => 'blog_root' + match 'feed.rss', :to => 'posts#index', :as => 'blog_rss_feed', :defaults => {:format => "rss"} + match ':id', :to => 'posts#show', :as => 'blog_post' + match 'categories/:id', :to => 'categories#show', :as => 'blog_category' + match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' + get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts' + get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts' + end - scope(:path => 'refinery', :as => 'admin', :module => 'admin') do - scope(:path => 'blog', :as => 'blog', :module => 'blog') do - root :to => 'posts#index' - resources :posts do - collection do - get :uncategorized - get :tags + scope(:path => 'refinery', :as => 'refinery_admin', :module => 'admin') do + scope(:path => 'blog', :as => 'blog', :module => 'blog') do + root :to => 'posts#index' + resources :posts do + collection do + get :uncategorized + get :tags + end end - end - resources :categories + resources :categories - resources :comments do - collection do - get :approved - get :rejected + resources :comments do + collection do + get :approved + get :rejected + end + member do + get :approved + get :rejected + end end - member do - get :approved - get :rejected - end - end - resources :settings do - collection do - get :notification_recipients - post :notification_recipients + resources :settings do + collection do + get :notification_recipients + post :notification_recipients - get :moderation - get :comments - get :teasers + get :moderation + get :comments + get :teasers + end end end end diff --git a/db/migrate/1_create_blog_structure.rb b/db/migrate/1_create_blog_structure.rb index a93d2d4..612584e 100644 --- a/db/migrate/1_create_blog_structure.rb +++ b/db/migrate/1_create_blog_structure.rb @@ -1,7 +1,7 @@ class CreateBlogStructure < ActiveRecord::Migration - def self.up - create_table :blog_posts, :id => true do |t| + def up + create_table Refinery::BlogPost.table_name, :id => true do |t| t.string :title t.text :body t.boolean :draft @@ -9,9 +9,9 @@ class CreateBlogStructure < ActiveRecord::Migration t.timestamps end - add_index :blog_posts, :id + add_index Refinery::BlogPost.table_name, :id - create_table :blog_comments, :id => true do |t| + create_table Refinery::BlogComment.table_name, :id => true do |t| t.integer :blog_post_id t.boolean :spam t.string :name @@ -21,34 +21,34 @@ class CreateBlogStructure < ActiveRecord::Migration t.timestamps end - add_index :blog_comments, :id + add_index Refinery::BlogComment.table_name, :id - create_table :blog_categories, :id => true do |t| + create_table Refinery::BlogCategory.table_name, :id => true do |t| t.string :title t.timestamps end - add_index :blog_categories, :id + add_index Refinery::BlogCategory.table_name, :id - create_table :blog_categories_blog_posts, :id => true do |t| + create_table Refinery::Categorization.table_name, :id => true do |t| t.integer :blog_category_id t.integer :blog_post_id end - add_index :blog_categories_blog_posts, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' + add_index Refinery::Categorization.table_name, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s) end - def self.down - UserPlugin.destroy_all({:name => "refinerycms_blog"}) + def down + Refinery::UserPlugin.destroy_all({:name => "refinerycms_blog"}) - Page.delete_all({:link_url => "/blog"}) + Refinery::Page.delete_all({:link_url => "/blog"}) - drop_table :blog_posts - drop_table :blog_comments - drop_table :blog_categories - drop_table :blog_categories_blog_posts + drop_table Refinery::BlogPost.table_name + drop_table Refinery::BlogComment.table_name + drop_table Refinery::Category.table_name + drop_table Refinery::Categorization.table_name end end diff --git a/db/migrate/2_add_user_id_to_blog_posts.rb b/db/migrate/2_add_user_id_to_blog_posts.rb index cd62524..5be3224 100644 --- a/db/migrate/2_add_user_id_to_blog_posts.rb +++ b/db/migrate/2_add_user_id_to_blog_posts.rb @@ -1,11 +1,7 @@ class AddUserIdToBlogPosts < ActiveRecord::Migration - - def self.up - add_column :blog_posts, :user_id, :integer + + def change + add_column Refinery::BlogPost.table_name, :user_id, :integer end - - def self.down - remove_column :blog_posts, :user_id - end - + end \ No newline at end of file diff --git a/db/migrate/3_acts_as_taggable_on_migration.rb b/db/migrate/3_acts_as_taggable_on_migration.rb index 1661061..812daf4 100644 --- a/db/migrate/3_acts_as_taggable_on_migration.rb +++ b/db/migrate/3_acts_as_taggable_on_migration.rb @@ -1,5 +1,5 @@ class ActsAsTaggableOnMigration < ActiveRecord::Migration - def self.up + def up create_table :tags do |t| t.string :name end @@ -21,7 +21,7 @@ class ActsAsTaggableOnMigration < ActiveRecord::Migration add_index :taggings, [:taggable_id, :taggable_type, :context] end - def self.down + def down drop_table :taggings drop_table :tags end diff --git a/db/migrate/4_create_seo_meta_for_blog.rb b/db/migrate/4_create_seo_meta_for_blog.rb index baf81a4..b1c3c31 100644 --- a/db/migrate/4_create_seo_meta_for_blog.rb +++ b/db/migrate/4_create_seo_meta_for_blog.rb @@ -1,6 +1,6 @@ class CreateSeoMetaForBlog < ActiveRecord::Migration - def self.up + def up unless ::SeoMetum.table_exists? create_table ::SeoMetum.table_name do |t| t.integer :seo_meta_id @@ -18,7 +18,7 @@ class CreateSeoMetaForBlog < ActiveRecord::Migration end end - def self.down + def down # can't drop the table because someone else might be using it. end diff --git a/db/migrate/5_add_cached_slugs.rb b/db/migrate/5_add_cached_slugs.rb index c189302..9e39586 100644 --- a/db/migrate/5_add_cached_slugs.rb +++ b/db/migrate/5_add_cached_slugs.rb @@ -1,11 +1,6 @@ class AddCachedSlugs < ActiveRecord::Migration - def self.up - add_column :blog_categories, :cached_slug, :string - add_column :blog_posts, :cached_slug, :string - end - - def self.down - remove_column :blog_categories, :cached_slug - remove_column :blog_posts, :cached_slug + def change + add_column Refinery::BlogCategory.table_name, :cached_slug, :string + add_column Refinery::BlogPost.table_name, :cached_slug, :string end end diff --git a/db/migrate/6_add_custom_url_field_to_blog_posts.rb b/db/migrate/6_add_custom_url_field_to_blog_posts.rb index 5a8901e..22b49a4 100644 --- a/db/migrate/6_add_custom_url_field_to_blog_posts.rb +++ b/db/migrate/6_add_custom_url_field_to_blog_posts.rb @@ -1,9 +1,5 @@ class AddCustomUrlFieldToBlogPosts < ActiveRecord::Migration - def self.up - add_column :blog_posts, :custom_url, :string - end - - def self.down - remove_column :blog_posts, :custom_url + def change + add_column Refinery::BlogPost.table_name, :custom_url, :string end end diff --git a/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb b/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb index daa4d04..9c50b97 100644 --- a/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb +++ b/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb @@ -1,10 +1,6 @@ class AddCustomTeaserFieldToBlogPosts < ActiveRecord::Migration - def self.up - add_column :blog_posts, :custom_teaser, :text - end - - def self.down - remove_column :blog_posts, :custom_teaser + def change + add_column Refinery::BlogPost.table_name, :custom_teaser, :text end end diff --git a/db/migrate/8_add_primary_key_to_categorizations.rb b/db/migrate/8_add_primary_key_to_categorizations.rb index efee289..5bbfcf3 100644 --- a/db/migrate/8_add_primary_key_to_categorizations.rb +++ b/db/migrate/8_add_primary_key_to_categorizations.rb @@ -1,12 +1,14 @@ class AddPrimaryKeyToCategorizations < ActiveRecord::Migration - def self.up - unless ::Categorization.column_names.include?("id") - add_column :blog_categories_blog_posts, :id, :primary_key + def up + unless Refinery::Categorization.column_names.include?("id") + add_column Refinery::Categorization.table_name, :id, :primary_key end end - def self.down - remove_column :blog_categories_blog_posts, :id + def down + if Refinery::Categorization.column_names.include?("id") + remove_column Refinery::Categorization.table_name, :id + end end end diff --git a/db/seeds/refinerycms_blog.rb b/db/seeds/refinerycms_blog.rb index 0be2a06..19c4370 100644 --- a/db/seeds/refinerycms_blog.rb +++ b/db/seeds/refinerycms_blog.rb @@ -1,20 +1,20 @@ -::User.find(:all).each do |user| +Refinery::User.find(:all).each do |user| if user.plugins.where(:name => 'refinerycms_blog').blank? user.plugins.create(:name => "refinerycms_blog", :position => (user.plugins.maximum(:position) || -1) +1) end -end if defined?(::User) +end if defined?(Refinery::User) -if defined?(::Page) - page = ::Page.create( +if defined?(Refinery::Page) + page = Refinery::Page.create( :title => "Blog", :link_url => "/blog", :deletable => false, - :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), + :position => ((Refinery::Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), :menu_match => "^/blogs?(\/|\/.+?|)$" ) - ::Page.default_parts.each do |default_page_part| + Refinery::Page.default_parts.each do |default_page_part| page.parts.create(:title => default_page_part, :body => nil) end end \ No newline at end of file diff --git a/features/support/factories/blog_categories.rb b/features/support/factories/blog_categories.rb index 2b47a87..9b98d91 100644 --- a/features/support/factories/blog_categories.rb +++ b/features/support/factories/blog_categories.rb @@ -1,5 +1,5 @@ require 'factory_girl' -Factory.define(:blog_category) do |f| +Factory.define :blog_category, :class => 'refinery/blog_category' do |f| f.sequence(:title) { |n| "Shopping #{n}" } end diff --git a/features/support/factories/blog_comments.rb b/features/support/factories/blog_comments.rb index 9405c42..1c05190 100644 --- a/features/support/factories/blog_comments.rb +++ b/features/support/factories/blog_comments.rb @@ -1,6 +1,6 @@ require 'factory_girl' -Factory.define(:blog_comment) do |f| +Factory.define :blog_comment, :class => 'refinery/blog_comment' do |f| f.name "Joe Commenter" f.sequence(:email) { |n| "person#{n}@example.com" } f.body "Which one is the best for picking up new shoes?" diff --git a/features/support/factories/blog_posts.rb b/features/support/factories/blog_posts.rb index 4584fec..b5996a5 100644 --- a/features/support/factories/blog_posts.rb +++ b/features/support/factories/blog_posts.rb @@ -1,6 +1,6 @@ require 'factory_girl' -Factory.define(:blog_post, :class => BlogPost) do |f| +Factory.define :blog_post, :class => 'refinery/blog_post' do |f| f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." f.draft false diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 3562315..60c9671 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 1.0.3' + s.add_dependency 'refinerycms-core', '~> 1.1.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.1.0' diff --git a/lib/generators/blog_generator.rb b/lib/generators/blog_generator.rb new file mode 100644 index 0000000..8b09bb7 --- /dev/null +++ b/lib/generators/blog_generator.rb @@ -0,0 +1,10 @@ +require 'refinery/generators' + +module ::Refinery + class BlogGenerator < ::Refinery::Generators::EngineInstaller + + source_root File.expand_path('../../../', __FILE__) + engine_name "refinerycms-blog" + + end +end diff --git a/lib/generators/refinerycms_blog_generator.rb b/lib/generators/refinerycms_blog_generator.rb deleted file mode 100644 index 6fca607..0000000 --- a/lib/generators/refinerycms_blog_generator.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'refinery/generators' - -class RefinerycmsBlogGenerator < ::Refinery::Generators::EngineInstaller - - source_root File.expand_path('../../../', __FILE__) - engine_name "refinerycms-blog" - -end \ No newline at end of file diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb index 0390414..4023000 100644 --- a/lib/refinery/blog/version.rb +++ b/lib/refinery/blog/version.rb @@ -1,9 +1,9 @@ module Refinery module Blog class Version - @major = 1 - @minor = 6 - @tiny = 2 + @major = 2 + @minor = 0 + @tiny = 0 class << self attr_reader :major, :minor, :tiny diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 452863b..10be99d 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -1,4 +1,5 @@ require 'filters_spam' +require File.expand_path('../generators/blog_generator', __FILE__) module Refinery module Blog @@ -25,14 +26,14 @@ module Refinery require File.expand_path('../refinery/blog/tabs', __FILE__) end - config.after_initialize do + initializer "init plugin", :after => :set_routes_reloader do |app| Refinery::Plugin.register do |plugin| plugin.pathname = root plugin.name = "refinerycms_blog" - plugin.url = {:controller => '/admin/blog/posts', :action => 'index'} - plugin.menu_match = /^\/?(admin|refinery)\/blog\/?(posts|comments|categories)?/ + plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path + plugin.menu_match = /^\/refinery\/blog\/?(posts|comments|categories)?/ plugin.activity = { - :class => BlogPost + :class => Refinery::BlogPost } end end diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 51682fb..14c2480 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,8 +1,8 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.6.2} + s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-06-29} + s.date = %q{2011-07-27} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 1.0.3' + s.add_dependency 'refinerycms-core', '~> 1.1.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.1.0' @@ -21,28 +21,31 @@ Gem::Specification.new do |s| s.files = %w( app app/controllers - app/controllers/admin - app/controllers/admin/blog - app/controllers/admin/blog/categories_controller.rb - app/controllers/admin/blog/comments_controller.rb - app/controllers/admin/blog/posts_controller.rb - app/controllers/admin/blog/settings_controller.rb - app/controllers/blog - app/controllers/blog/categories_controller.rb - app/controllers/blog/posts_controller.rb - app/controllers/blog_controller.rb + app/controllers/refinery + app/controllers/refinery/admin + app/controllers/refinery/admin/blog + app/controllers/refinery/admin/blog/categories_controller.rb + app/controllers/refinery/admin/blog/comments_controller.rb + app/controllers/refinery/admin/blog/posts_controller.rb + app/controllers/refinery/admin/blog/settings_controller.rb + app/controllers/refinery/blog + app/controllers/refinery/blog/categories_controller.rb + app/controllers/refinery/blog/posts_controller.rb + app/controllers/refinery/blog_controller.rb app/helpers app/helpers/blog_posts_helper.rb app/mailers - app/mailers/blog - app/mailers/blog/comment_mailer.rb + app/mailers/refinery + app/mailers/refinery/blog + app/mailers/refinery/blog/comment_mailer.rb app/models - app/models/blog - app/models/blog/comment_mailer.rb - app/models/blog_category.rb - app/models/blog_comment.rb - app/models/blog_post.rb - app/models/categorization.rb + app/models/refinery + app/models/refinery/blog + app/models/refinery/blog/comment_mailer.rb + app/models/refinery/blog_category.rb + app/models/refinery/blog_comment.rb + app/models/refinery/blog_post.rb + app/models/refinery/categorization.rb app/views app/views/admin app/views/admin/blog @@ -99,12 +102,14 @@ Gem::Specification.new do |s| changelog.md config config/locales + config/locales/bg.yml config/locales/cs.yml config/locales/de.yml config/locales/en.yml config/locales/es.yml config/locales/fr.yml config/locales/it.yml + config/locales/jp.yml config/locales/nb.yml config/locales/nl.yml config/locales/pl.yml @@ -122,6 +127,7 @@ Gem::Specification.new do |s| db/migrate/5_add_cached_slugs.rb db/migrate/6_add_custom_url_field_to_blog_posts.rb db/migrate/7_add_custom_teaser_field_to_blog_posts.rb + db/migrate/8_add_primary_key_to_categorizations.rb db/seeds db/seeds/refinerycms_blog.rb features @@ -141,7 +147,7 @@ Gem::Specification.new do |s| lib lib/gemspec.rb lib/generators - lib/generators/refinerycms_blog_generator.rb + lib/generators/blog_generator.rb lib/refinery lib/refinery/blog lib/refinery/blog/tabs.rb @@ -194,9 +200,11 @@ Gem::Specification.new do |s| refinerycms-blog.gemspec spec spec/models - spec/models/blog_category_spec.rb - spec/models/blog_comment_spec.rb - spec/models/blog_post_spec.rb + spec/models/refinery + spec/models/refinery/blog_category_spec.rb + spec/models/refinery/blog_comment_spec.rb + spec/models/refinery/blog_post_spec.rb + todo.md ) end diff --git a/spec/models/blog_category_spec.rb b/spec/models/blog_category_spec.rb deleted file mode 100644 index 7792744..0000000 --- a/spec/models/blog_category_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} - -describe BlogCategory do - before(:each) do - @blog_category = Factory.create(:blog_category) - end - - describe "validations" do - it "requires title" do - Factory.build(:blog_category, :title => "").should_not be_valid - end - - it "won't allow duplicate titles" do - Factory.build(:blog_category, :title => @blog_category.title).should_not be_valid - end - end - - describe "blog posts association" do - it "has a posts attribute" do - @blog_category.should respond_to(:posts) - end - - it "returns posts by published_at date in descending order" do - first_post = @blog_category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday }) - latest_post = @blog_category.posts.create!({ :title => "parndt is p. okay", :body => "For a Kiwi.", :published_at => Time.now }) - - @blog_category.posts.first.should == latest_post - end - - end - - describe "#post_count" do - it "returns post count in category" do - 2.times do - @blog_category.posts << Factory.create(:blog_post) - end - @blog_category.post_count.should == 2 - end - end -end diff --git a/spec/models/blog_comment_spec.rb b/spec/models/blog_comment_spec.rb deleted file mode 100644 index feb2860..0000000 --- a/spec/models/blog_comment_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} - -describe BlogComment do - - context "wiring up" do - - before(:each) do - @comment = Factory.create(:blog_comment) - end - - it "saves" do - @comment.should_not be_nil - end - - it "has a blog post" do - @comment.post.should_not be_nil - end - - end -end diff --git a/spec/models/blog_post_spec.rb b/spec/models/blog_post_spec.rb deleted file mode 100644 index afe82cc..0000000 --- a/spec/models/blog_post_spec.rb +++ /dev/null @@ -1,217 +0,0 @@ -require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} - -describe BlogPost do - let(:blog_post ) { Factory.create(:blog_post) } - - describe "validations" do - it "requires title" do - Factory.build(:blog_post, :title => "").should_not be_valid - end - - it "won't allow duplicate titles" do - Factory.build(:blog_post, :title => blog_post.title).should_not be_valid - end - - it "requires body" do - Factory.build(:blog_post, :body => nil).should_not be_valid - end - end - - describe "comments association" do - - it "have a comments attribute" do - blog_post.should respond_to(:comments) - end - - it "destroys associated comments" do - Factory.create(:blog_comment, :blog_post_id => blog_post.id) - blog_post.destroy - BlogComment.find_by_blog_post_id(blog_post.id).should == nil - end - end - - describe "categories association" do - it "have categories attribute" do - blog_post.should respond_to(:categories) - end - end - - describe "tags" do - it "acts as taggable" do - blog_post.should respond_to(:tag_list) - - #the factory has default tags, including 'chicago' - blog_post.tag_list.should include("chicago") - end - end - - describe "authors" do - it "are authored" do - BlogPost.instance_methods.map(&:to_sym).should include(:author) - end - end - - describe "by_archive scope" do - before do - @blog_post1 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 11)) - @blog_post2 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 12)) - - #2 months before - Factory.create(:blog_post, :published_at => Date.new(2011, 1, 10)) - end - - it "returns all posts from specified month" do - #check for this month - date = "03/2011" - BlogPost.by_archive(Time.parse(date)).count.should be == 2 - BlogPost.by_archive(Time.parse(date)).should == [@blog_post2, @blog_post1] - end - end - - describe "all_previous scope" do - before do - @blog_post1 = Factory.create(:blog_post, :published_at => Time.now - 2.months) - @blog_post2 = Factory.create(:blog_post, :published_at => Time.now - 1.month) - Factory.create(:blog_post, :published_at => Time.now) - end - - it "returns all posts from previous months" do - BlogPost.all_previous.count.should be == 2 - BlogPost.all_previous.should == [@blog_post2, @blog_post1] - end - end - - describe "live scope" do - before do - @blog_post1 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -2)) - @blog_post2 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) - Factory.create(:blog_post, :draft => true) - Factory.create(:blog_post, :published_at => Time.now + 1.minute) - end - - it "returns all posts which aren't in draft and pub date isn't in future" do - BlogPost.live.count.should be == 2 - BlogPost.live.should == [@blog_post2, @blog_post1] - end - end - - describe "uncategorized scope" do - before do - @uncategorized_blog_post = Factory.create(:blog_post) - @categorized_blog_post = Factory.create(:blog_post) - - @categorized_blog_post.categories << Factory.create(:blog_category) - end - - it "returns uncategorized posts if they exist" do - BlogPost.uncategorized.should include @uncategorized_blog_post - BlogPost.uncategorized.should_not include @categorized_blog_post - end - end - - describe "#live?" do - it "returns true if post is not in draft and it's published" do - Factory.create(:blog_post).live?.should be_true - end - - it "returns false if post is in draft" do - Factory.create(:blog_post, :draft => true).live?.should be_false - end - - it "returns false if post pub date is in future" do - Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => 1)).live?.should be_false - end - end - - describe "#next" do - before do - Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) - @blog_post = Factory.create(:blog_post) - end - - it "returns next article when called on current article" do - BlogPost.last.next.should == @blog_post - end - end - - describe "#prev" do - before do - Factory.create(:blog_post) - @blog_post = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) - end - - it "returns previous article when called on current article" do - BlogPost.first.prev.should == @blog_post - end - end - - describe "#category_ids=" do - before do - @cat1 = Factory.create(:blog_category, :id => 1) - @cat2 = Factory.create(:blog_category, :id => 2) - @cat3 = Factory.create(:blog_category, :id => 3) - blog_post.category_ids = [1,2,"","",3] - end - - it "rejects blank category ids" do - blog_post.categories.count.should == 3 - end - - it "returns array of categories based on given ids" do - blog_post.categories.should == [@cat1, @cat2, @cat3] - end - end - - describe ".comments_allowed?" do - context "with RefinerySetting comments_allowed set to true" do - before do - RefinerySetting.set(:comments_allowed, { :scoping => 'blog', :value => true }) - end - - it "should be true" do - BlogPost.comments_allowed?.should be_true - end - end - - context "with RefinerySetting comments_allowed set to false" do - before do - RefinerySetting.set(:comments_allowed, { :scoping => 'blog', :value => false }) - end - - it "should be false" do - BlogPost.comments_allowed?.should be_false - end - end - end - - describe "custom teasers" do - it "should allow a custom teaser" do - Factory.create(:blog_post, :custom_teaser => 'This is some custom content').should be_valid - end - end - - describe ".teasers_enabled?" do - context "with RefinerySetting teasers_enabled set to true" do - before do - RefinerySetting.set(:teasers_enabled, { :scoping => 'blog', :value => true }) - end - - it "should be true" do - BlogPost.teasers_enabled?.should be_true - end - end - - context "with RefinerySetting teasers_enabled set to false" do - before do - RefinerySetting.set(:teasers_enabled, { :scoping => 'blog', :value => false }) - end - - it "should be false" do - BlogPost.teasers_enabled?.should be_false - end - end - - end - -end diff --git a/spec/models/refinery/blog_category_spec.rb b/spec/models/refinery/blog_category_spec.rb new file mode 100644 index 0000000..9a6e2e4 --- /dev/null +++ b/spec/models/refinery/blog_category_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' +Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} + +module Refinery + describe BlogCategory do + before(:each) do + @blog_category = Factory.create(:blog_category) + end + + describe "validations" do + it "requires title" do + Factory.build(:blog_category, :title => "").should_not be_valid + end + + it "won't allow duplicate titles" do + Factory.build(:blog_category, :title => @blog_category.title).should_not be_valid + end + end + + describe "blog posts association" do + it "has a posts attribute" do + @blog_category.should respond_to(:posts) + end + + it "returns posts by published_at date in descending order" do + first_post = @blog_category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday }) + latest_post = @blog_category.posts.create!({ :title => "parndt is p. okay", :body => "For a Kiwi.", :published_at => Time.now }) + + @blog_category.posts.first.should == latest_post + end + + end + + describe "#post_count" do + it "returns post count in category" do + 2.times do + @blog_category.posts << Factory.create(:blog_post) + end + @blog_category.post_count.should == 2 + end + end + end +end diff --git a/spec/models/refinery/blog_comment_spec.rb b/spec/models/refinery/blog_comment_spec.rb new file mode 100644 index 0000000..455ea4a --- /dev/null +++ b/spec/models/refinery/blog_comment_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' +Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} + +module Refinery + describe BlogComment do + + context "wiring up" do + + before(:each) do + @comment = Factory.create(:blog_comment) + end + + it "saves" do + @comment.should_not be_nil + end + + it "has a blog post" do + @comment.post.should_not be_nil + end + + end + end +end diff --git a/spec/models/refinery/blog_post_spec.rb b/spec/models/refinery/blog_post_spec.rb new file mode 100644 index 0000000..deb1409 --- /dev/null +++ b/spec/models/refinery/blog_post_spec.rb @@ -0,0 +1,219 @@ +require 'spec_helper' +Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} + +module Refinery + describe BlogPost do + let(:blog_post ) { Factory.create(:blog_post) } + + describe "validations" do + it "requires title" do + Factory.build(:blog_post, :title => "").should_not be_valid + end + + it "won't allow duplicate titles" do + Factory.build(:blog_post, :title => blog_post.title).should_not be_valid + end + + it "requires body" do + Factory.build(:blog_post, :body => nil).should_not be_valid + end + end + + describe "comments association" do + + it "have a comments attribute" do + blog_post.should respond_to(:comments) + end + + it "destroys associated comments" do + Factory.create(:blog_comment, :blog_post_id => blog_post.id) + blog_post.destroy + BlogComment.find_by_blog_post_id(blog_post.id).should == nil + end + end + + describe "categories association" do + it "have categories attribute" do + blog_post.should respond_to(:categories) + end + end + + describe "tags" do + it "acts as taggable" do + blog_post.should respond_to(:tag_list) + + #the factory has default tags, including 'chicago' + blog_post.tag_list.should include("chicago") + end + end + + describe "authors" do + it "are authored" do + BlogPost.instance_methods.map(&:to_sym).should include(:author) + end + end + + describe "by_archive scope" do + before do + @blog_post1 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 11)) + @blog_post2 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 12)) + + #2 months before + Factory.create(:blog_post, :published_at => Date.new(2011, 1, 10)) + end + + it "returns all posts from specified month" do + #check for this month + date = "03/2011" + BlogPost.by_archive(Time.parse(date)).count.should be == 2 + BlogPost.by_archive(Time.parse(date)).should == [@blog_post2, @blog_post1] + end + end + + describe "all_previous scope" do + before do + @blog_post1 = Factory.create(:blog_post, :published_at => Time.now - 2.months) + @blog_post2 = Factory.create(:blog_post, :published_at => Time.now - 1.month) + Factory.create(:blog_post, :published_at => Time.now) + end + + it "returns all posts from previous months" do + BlogPost.all_previous.count.should be == 2 + BlogPost.all_previous.should == [@blog_post2, @blog_post1] + end + end + + describe "live scope" do + before do + @blog_post1 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -2)) + @blog_post2 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) + Factory.create(:blog_post, :draft => true) + Factory.create(:blog_post, :published_at => Time.now + 1.minute) + end + + it "returns all posts which aren't in draft and pub date isn't in future" do + BlogPost.live.count.should be == 2 + BlogPost.live.should == [@blog_post2, @blog_post1] + end + end + + describe "uncategorized scope" do + before do + @uncategorized_blog_post = Factory.create(:blog_post) + @categorized_blog_post = Factory.create(:blog_post) + + @categorized_blog_post.categories << Factory.create(:blog_category) + end + + it "returns uncategorized posts if they exist" do + BlogPost.uncategorized.should include @uncategorized_blog_post + BlogPost.uncategorized.should_not include @categorized_blog_post + end + end + + describe "#live?" do + it "returns true if post is not in draft and it's published" do + Factory.create(:blog_post).live?.should be_true + end + + it "returns false if post is in draft" do + Factory.create(:blog_post, :draft => true).live?.should be_false + end + + it "returns false if post pub date is in future" do + Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => 1)).live?.should be_false + end + end + + describe "#next" do + before do + Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) + @blog_post = Factory.create(:blog_post) + end + + it "returns next article when called on current article" do + BlogPost.last.next.should == @blog_post + end + end + + describe "#prev" do + before do + Factory.create(:blog_post) + @blog_post = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) + end + + it "returns previous article when called on current article" do + BlogPost.first.prev.should == @blog_post + end + end + + describe "#category_ids=" do + before do + @cat1 = Factory.create(:blog_category, :id => 1) + @cat2 = Factory.create(:blog_category, :id => 2) + @cat3 = Factory.create(:blog_category, :id => 3) + blog_post.category_ids = [1,2,"","",3] + end + + it "rejects blank category ids" do + blog_post.categories.count.should == 3 + end + + it "returns array of categories based on given ids" do + blog_post.categories.should == [@cat1, @cat2, @cat3] + end + end + + describe ".comments_allowed?" do + context "with Refinery::Setting comments_allowed set to true" do + before do + Refinery::Setting.set(:comments_allowed, { :scoping => 'blog', :value => true }) + end + + it "should be true" do + BlogPost.comments_allowed?.should be_true + end + end + + context "with Refinery::Setting comments_allowed set to false" do + before do + Refinery::Setting.set(:comments_allowed, { :scoping => 'blog', :value => false }) + end + + it "should be false" do + BlogPost.comments_allowed?.should be_false + end + end + end + + describe "custom teasers" do + it "should allow a custom teaser" do + Factory.create(:blog_post, :custom_teaser => 'This is some custom content').should be_valid + end + end + + describe ".teasers_enabled?" do + context "with Refinery::Setting teasers_enabled set to true" do + before do + Refinery::Setting.set(:teasers_enabled, { :scoping => 'blog', :value => true }) + end + + it "should be true" do + BlogPost.teasers_enabled?.should be_true + end + end + + context "with Refinery::Setting teasers_enabled set to false" do + before do + Refinery::Setting.set(:teasers_enabled, { :scoping => 'blog', :value => false }) + end + + it "should be false" do + BlogPost.teasers_enabled?.should be_false + end + end + + end + + end +end From 06071e558008477e1b8dbb376d6693af97eeff32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Wed, 27 Jul 2011 17:28:09 +0300 Subject: [PATCH 002/248] Wip. --- .../refinery/admin/blog/posts_controller.rb | 2 +- .../admin/blog/_submenu.html.erb | 40 +++---- .../admin/blog/categories/_category.html.erb | 0 .../admin/blog/categories/_form.html.erb | 0 .../blog/categories/_sortable_list.html.erb | 0 .../admin/blog/categories/edit.html.erb | 0 .../admin/blog/categories/index.html.erb | 0 .../admin/blog/categories/new.html.erb | 0 .../admin/blog/comments/_comment.html.erb | 0 .../blog/comments/_sortable_list.html.erb | 0 .../admin/blog/comments/index.html.erb | 0 .../admin/blog/comments/show.html.erb | 0 .../admin/blog/posts/_form.css.erb | 0 .../admin/blog/posts/_form.html.erb | 8 +- .../admin/blog/posts/_form.js.erb | 0 .../admin/blog/posts/_form_part.html.erb | 0 .../admin/blog/posts/_post.html.erb | 0 .../admin/blog/posts/_sortable_list.html.erb | 0 .../admin/blog/posts/_teaser_part.html.erb | 0 .../admin/blog/posts/edit.html.erb | 0 .../admin/blog/posts/index.html.erb | 2 +- .../admin/blog/posts/new.html.erb | 0 .../admin/blog/posts/uncategorized.html.erb | 0 .../settings/notification_recipients.html.erb | 0 .../blog/categories/show.html.erb | 0 .../blog/comment_mailer/notification.html.erb | 0 .../blog/posts/_comment.html.erb | 0 .../{ => refinery}/blog/posts/_nav.html.erb | 0 .../{ => refinery}/blog/posts/_post.html.erb | 0 .../blog/posts/archive.html.erb | 0 .../{ => refinery}/blog/posts/index.html.erb | 0 .../blog/posts/index.rss.builder | 0 .../{ => refinery}/blog/posts/show.html.erb | 0 .../{ => refinery}/blog/posts/tagged.html.erb | 0 .../blog/shared/_categories.html.erb | 0 .../{ => refinery}/blog/shared/_post.html.erb | 0 .../blog/shared/_posts.html.erb | 0 .../blog/shared/_rss_feed.html.erb | 0 .../{ => refinery}/blog/shared/_tags.html.erb | 0 .../shared/admin/_autocomplete.html.erb | 0 features/support/paths.rb | 4 +- refinerycms-blog.gemspec | 105 +++++++++--------- 42 files changed, 81 insertions(+), 80 deletions(-) rename app/views/{ => refinery}/admin/blog/_submenu.html.erb (50%) rename app/views/{ => refinery}/admin/blog/categories/_category.html.erb (100%) rename app/views/{ => refinery}/admin/blog/categories/_form.html.erb (100%) rename app/views/{ => refinery}/admin/blog/categories/_sortable_list.html.erb (100%) rename app/views/{ => refinery}/admin/blog/categories/edit.html.erb (100%) rename app/views/{ => refinery}/admin/blog/categories/index.html.erb (100%) rename app/views/{ => refinery}/admin/blog/categories/new.html.erb (100%) rename app/views/{ => refinery}/admin/blog/comments/_comment.html.erb (100%) rename app/views/{ => refinery}/admin/blog/comments/_sortable_list.html.erb (100%) rename app/views/{ => refinery}/admin/blog/comments/index.html.erb (100%) rename app/views/{ => refinery}/admin/blog/comments/show.html.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/_form.css.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/_form.html.erb (92%) rename app/views/{ => refinery}/admin/blog/posts/_form.js.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/_form_part.html.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/_post.html.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/_sortable_list.html.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/_teaser_part.html.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/edit.html.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/index.html.erb (92%) rename app/views/{ => refinery}/admin/blog/posts/new.html.erb (100%) rename app/views/{ => refinery}/admin/blog/posts/uncategorized.html.erb (100%) rename app/views/{ => refinery}/admin/blog/settings/notification_recipients.html.erb (100%) rename app/views/{ => refinery}/blog/categories/show.html.erb (100%) rename app/views/{ => refinery}/blog/comment_mailer/notification.html.erb (100%) rename app/views/{ => refinery}/blog/posts/_comment.html.erb (100%) rename app/views/{ => refinery}/blog/posts/_nav.html.erb (100%) rename app/views/{ => refinery}/blog/posts/_post.html.erb (100%) rename app/views/{ => refinery}/blog/posts/archive.html.erb (100%) rename app/views/{ => refinery}/blog/posts/index.html.erb (100%) rename app/views/{ => refinery}/blog/posts/index.rss.builder (100%) rename app/views/{ => refinery}/blog/posts/show.html.erb (100%) rename app/views/{ => refinery}/blog/posts/tagged.html.erb (100%) rename app/views/{ => refinery}/blog/shared/_categories.html.erb (100%) rename app/views/{ => refinery}/blog/shared/_post.html.erb (100%) rename app/views/{ => refinery}/blog/shared/_posts.html.erb (100%) rename app/views/{ => refinery}/blog/shared/_rss_feed.html.erb (100%) rename app/views/{ => refinery}/blog/shared/_tags.html.erb (100%) rename app/views/{ => refinery}/shared/admin/_autocomplete.html.erb (100%) diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index a934a15..ac30342 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -56,7 +56,7 @@ module Refinery unless from_dialog? unless params[:continue_editing] =~ /true|on|1/ - redirect_back_or_default(admin_blog_posts_url) + redirect_back_or_default(main_app.refinery_admin_blog_posts_path) else unless request.xhr? redirect_to :back diff --git a/app/views/admin/blog/_submenu.html.erb b/app/views/refinery/admin/blog/_submenu.html.erb similarity index 50% rename from app/views/admin/blog/_submenu.html.erb rename to app/views/refinery/admin/blog/_submenu.html.erb index 25f437b..442ab47 100644 --- a/app/views/admin/blog/_submenu.html.erb +++ b/app/views/refinery/admin/blog/_submenu.html.erb @@ -1,9 +1,9 @@ -<% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog')%> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/refinery/admin/blog/comments/show.html.erb b/app/views/refinery/admin/blog/comments/show.html.erb index d4c2186..2e72eb0 100644 --- a/app/views/refinery/admin/blog/comments/show.html.erb +++ b/app/views/refinery/admin/blog/comments/show.html.erb @@ -60,4 +60,4 @@ -<% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog') %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/refinery/admin/blog/posts/_form.css.erb b/app/views/refinery/admin/blog/posts/_form.css.erb deleted file mode 100644 index 869ab9b..0000000 --- a/app/views/refinery/admin/blog/posts/_form.css.erb +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/admin/blog/posts/_form.html.erb index f8c6ba3..8a3b091 100644 --- a/app/views/refinery/admin/blog/posts/_form.html.erb +++ b/app/views/refinery/admin/blog/posts/_form.html.erb @@ -103,6 +103,6 @@ } %> <% end -%> -<% content_for :stylesheets, render(:partial => 'form.css') -%> -<% content_for :javascripts, render(:partial => 'form.js') -%> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> +<% content_for :javascripts, javascript_include_tag('refinery/blog/backend') %> <%= render 'refinery/shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => main_app.tags_refinery_admin_blog_posts_url %> diff --git a/app/views/refinery/admin/blog/posts/_form.js.erb b/app/views/refinery/admin/blog/posts/_form.js.erb deleted file mode 100644 index 87ad23f..0000000 --- a/app/views/refinery/admin/blog/posts/_form.js.erb +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/app/views/refinery/blog/categories/show.html.erb b/app/views/refinery/blog/categories/show.html.erb index a31c85b..1ae938f 100644 --- a/app/views/refinery/blog/categories/show.html.erb +++ b/app/views/refinery/blog/categories/show.html.erb @@ -18,4 +18,4 @@ <% end %> <%= render :partial => "/refinery/content_page" %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/posts/archive.html.erb b/app/views/refinery/blog/posts/archive.html.erb index ca12383..c7a2c92 100644 --- a/app/views/refinery/blog/posts/archive.html.erb +++ b/app/views/refinery/blog/posts/archive.html.erb @@ -12,4 +12,4 @@ <%= render :partial => '/refinery/blog/shared/body_content_right' %> <%= render :partial => "/refinery/content_page" %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/posts/index.html.erb b/app/views/refinery/blog/posts/index.html.erb index c6ca75a..f347af1 100644 --- a/app/views/refinery/blog/posts/index.html.erb +++ b/app/views/refinery/blog/posts/index.html.erb @@ -17,4 +17,4 @@ <%= render :partial => '/refinery/blog/shared/body_content_right' %> <%= render :partial => "/refinery/content_page" %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb index 3670bf1..3f5cf07 100644 --- a/app/views/refinery/blog/posts/show.html.erb +++ b/app/views/refinery/blog/posts/show.html.erb @@ -12,11 +12,11 @@ <%= render :partial => "/refinery/content_page", :locals => { :remove_automatic_sections => true } %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> <% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> <% content_for :javascripts do %> <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> - <%#= javascript_include_tag('refinerycms-blog') %> + <%#= javascript_include_tag('refinery/blog/frontend') %> <% end if Refinery::BlogPost::ShareThis.enabled? %> diff --git a/app/views/refinery/blog/posts/tagged.html.erb b/app/views/refinery/blog/posts/tagged.html.erb index f116732..860bd72 100644 --- a/app/views/refinery/blog/posts/tagged.html.erb +++ b/app/views/refinery/blog/posts/tagged.html.erb @@ -14,4 +14,4 @@ <%= render :partial => '/refinery/blog/shared/body_content_right' %> <%= render :partial => "/refinery/content_page" %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/shared/admin/_autocomplete.html.erb b/app/views/refinery/shared/admin/_autocomplete.html.erb index b4898cc..bf495e0 100644 --- a/app/views/refinery/shared/admin/_autocomplete.html.erb +++ b/app/views/refinery/shared/admin/_autocomplete.html.erb @@ -1,55 +1,5 @@ -<% content_for :stylesheets, stylesheet_link_tag("ui-lightness/jquery-ui-1.8.13.custom.css") -%> +<% content_for :stylesheets, stylesheet_link_tag("refinery/blog/ui-lightness/jquery-ui-1.8.13.custom") %> <% content_for :javascripts do %> <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js" %> - <% end %> \ No newline at end of file diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 10be99d..334380e 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -18,10 +18,6 @@ module Refinery end class Engine < Rails::Engine - initializer 'blog serves assets' do |app| - app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public" - end - config.to_prepare do require File.expand_path('../refinery/blog/tabs', __FILE__) end diff --git a/public/stylesheets/refinery/refinerycms-blog.css b/public/stylesheets/refinery/refinerycms-blog.css deleted file mode 100644 index 3df86f0..0000000 --- a/public/stylesheets/refinery/refinerycms-blog.css +++ /dev/null @@ -1,55 +0,0 @@ -.comments_icon { - background-image: url('/images/refinerycms-blog/icons/comments.png'); -} -.comment_icon { - background-image: url('/images/refinerycms-blog/icons/comment.png'); -} -.comment_cross_icon { - background-image: url('/images/refinerycms-blog/icons/comment_cross.png'); -} -.comment_tick_icon { - background-image: url('/images/refinerycms-blog/icons/comment_tick.png'); -} -.folder_icon { - background-image: url('/images/refinerycms-blog/icons/folder.png'); -} -.folder_add_icon { - background-image: url('/images/refinerycms-blog/icons/folder_add.png'); -} -.folder_edit_icon { - background-image: url('/images/refinerycms-blog/icons/folder_edit.png'); -} -.settings_icon { - background-image: url('/images/refinerycms-blog/icons/cog.png'); -} -.page_icon { - background-image: url('/images/refinerycms-blog/icons/page.png'); -} -.page_copy_icon { - background-image: url('/images/refinerycms-blog/icons/page_copy.png'); -} -.page_add_icon { - background-image: url('/images/refinerycms-blog/icons/page_add.png'); -} -ul.collapsible_menu li { - position: relative; -} -ul.collapsible_menu li span.arrow { - background-repeat: no-repeat; - position: absolute; - right: 10px; - top: 13px; - width: 11px; - height: 7px; - cursor: pointer; -} -ul.collapsible_menu li span.arrow { - background-image: url('/images/refinerycms-blog/icons/up.gif'); -} -ul.collapsible_menu li.closed span.arrow { - background-image: url('/images/refinerycms-blog/icons/down.gif'); -} -ul.collapsible_menu > div { - width: 93%; - margin: 0px auto; -} diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 9a55c33..dca15fb 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-07-27} + s.date = %q{2011-08-03} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -20,6 +20,52 @@ Gem::Specification.new do |s| s.files = %w( app + app/assets + app/assets/images + app/assets/images/refinery + app/assets/images/refinery/blog + app/assets/images/refinery/blog/icons + app/assets/images/refinery/blog/icons/cog.png + app/assets/images/refinery/blog/icons/comment.png + app/assets/images/refinery/blog/icons/comment_cross.png + app/assets/images/refinery/blog/icons/comment_tick.png + app/assets/images/refinery/blog/icons/comments.png + app/assets/images/refinery/blog/icons/down.gif + app/assets/images/refinery/blog/icons/folder.png + app/assets/images/refinery/blog/icons/folder_add.png + app/assets/images/refinery/blog/icons/folder_edit.png + app/assets/images/refinery/blog/icons/page.png + app/assets/images/refinery/blog/icons/page_add.png + app/assets/images/refinery/blog/icons/page_copy.png + app/assets/images/refinery/blog/icons/up.gif + app/assets/images/refinery/blog/rss-feed.png + app/assets/javascripts + app/assets/javascripts/refinery + app/assets/javascripts/refinery/blog + app/assets/javascripts/refinery/blog/backend.js + app/assets/javascripts/refinery/blog/frontend.js + app/assets/stylesheets + app/assets/stylesheets/refinery + app/assets/stylesheets/refinery/blog + app/assets/stylesheets/refinery/blog/backend.css.scss + app/assets/stylesheets/refinery/blog/frontend.css.scss + app/assets/stylesheets/refinery/blog/ui-lightness + app/assets/stylesheets/refinery/blog/ui-lightness/images + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_flat_10_000000_40x100.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_222222_256x240.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_228ef1_256x240.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ef8c08_256x240.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffd27a_256x240.png + app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffffff_256x240.png + app/assets/stylesheets/refinery/blog/ui-lightness/jquery-ui-1.8.13.custom.css.scss app/controllers app/controllers/refinery app/controllers/refinery/admin @@ -65,9 +111,7 @@ Gem::Specification.new do |s| app/views/refinery/admin/blog/comments/index.html.erb app/views/refinery/admin/blog/comments/show.html.erb app/views/refinery/admin/blog/posts - app/views/refinery/admin/blog/posts/_form.css.erb app/views/refinery/admin/blog/posts/_form.html.erb - app/views/refinery/admin/blog/posts/_form.js.erb app/views/refinery/admin/blog/posts/_form_part.html.erb app/views/refinery/admin/blog/posts/_post.html.erb app/views/refinery/admin/blog/posts/_sortable_list.html.erb @@ -100,6 +144,8 @@ Gem::Specification.new do |s| app/views/refinery/blog/shared/_posts.html.erb app/views/refinery/blog/shared/_rss_feed.html.erb app/views/refinery/blog/shared/_tags.html.erb + app/views/refinery/blog/widgets + app/views/refinery/blog/widgets/_blog_archive.html.erb app/views/refinery/shared app/views/refinery/shared/admin app/views/refinery/shared/admin/_autocomplete.html.erb @@ -158,48 +204,6 @@ Gem::Specification.new do |s| lib/refinery/blog/version.rb lib/refinerycms-blog.rb public - public/images - public/images/refinerycms-blog - public/images/refinerycms-blog/icons - public/images/refinerycms-blog/icons/cog.png - public/images/refinerycms-blog/icons/comment.png - public/images/refinerycms-blog/icons/comment_cross.png - public/images/refinerycms-blog/icons/comment_tick.png - public/images/refinerycms-blog/icons/comments.png - public/images/refinerycms-blog/icons/down.gif - public/images/refinerycms-blog/icons/folder.png - public/images/refinerycms-blog/icons/folder_add.png - public/images/refinerycms-blog/icons/folder_edit.png - public/images/refinerycms-blog/icons/page.png - public/images/refinerycms-blog/icons/page_add.png - public/images/refinerycms-blog/icons/page_copy.png - public/images/refinerycms-blog/icons/up.gif - public/images/refinerycms-blog/rss-feed.png - public/javascripts - public/javascripts/refinery - public/javascripts/refinery/refinerycms-blog.js - public/javascripts/refinerycms-blog.js - public/stylesheets - public/stylesheets/refinery - public/stylesheets/refinery/refinerycms-blog.css - public/stylesheets/refinerycms-blog.css - public/stylesheets/ui-lightness - public/stylesheets/ui-lightness/images - public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png - public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png - public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png - public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png - public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png - public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png - public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png - public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png - public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png - public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png - public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png - public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png - public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png - public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png - public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css readme.md refinerycms-blog.gemspec spec @@ -208,6 +212,10 @@ Gem::Specification.new do |s| spec/models/refinery/blog_category_spec.rb spec/models/refinery/blog_comment_spec.rb spec/models/refinery/blog_post_spec.rb + spec/requests + spec/requests/blog_categories_spec.rb + spec/requests/blog_posts_spec.rb + spec/requests/manage_blog_posts_spec.rb todo.md ) From fddcebd878a03f579bb3c1a3265fa9cc9ef427c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Wed, 3 Aug 2011 13:54:07 +0300 Subject: [PATCH 025/248] Make those specs green again. --- spec/models/refinery/blog_category_spec.rb | 1 - spec/models/refinery/blog_comment_spec.rb | 1 - spec/models/refinery/blog_post_spec.rb | 1 - spec/requests/blog_categories_spec.rb | 6 +----- spec/requests/blog_posts_spec.rb | 6 +----- spec/requests/manage_blog_posts_spec.rb | 11 +---------- .../support/refinery}/factories/blog_categories.rb | 2 -- .../support/refinery}/factories/blog_comments.rb | 2 -- .../support/refinery}/factories/blog_posts.rb | 2 -- 9 files changed, 3 insertions(+), 29 deletions(-) rename {features/support => spec/support/refinery}/factories/blog_categories.rb (83%) rename {features/support => spec/support/refinery}/factories/blog_comments.rb (91%) rename {features/support => spec/support/refinery}/factories/blog_posts.rb (93%) diff --git a/spec/models/refinery/blog_category_spec.rb b/spec/models/refinery/blog_category_spec.rb index 9a6e2e4..9c92d14 100644 --- a/spec/models/refinery/blog_category_spec.rb +++ b/spec/models/refinery/blog_category_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} module Refinery describe BlogCategory do diff --git a/spec/models/refinery/blog_comment_spec.rb b/spec/models/refinery/blog_comment_spec.rb index 455ea4a..5337958 100644 --- a/spec/models/refinery/blog_comment_spec.rb +++ b/spec/models/refinery/blog_comment_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} module Refinery describe BlogComment do diff --git a/spec/models/refinery/blog_post_spec.rb b/spec/models/refinery/blog_post_spec.rb index deb1409..d5000f1 100644 --- a/spec/models/refinery/blog_post_spec.rb +++ b/spec/models/refinery/blog_post_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} module Refinery describe BlogPost do diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb index d0682b6..2ba5f82 100644 --- a/spec/requests/blog_categories_spec.rb +++ b/spec/requests/blog_categories_spec.rb @@ -1,11 +1,7 @@ require "spec_helper" describe "blog categories" do - before(:all) do - # destroy all existing (if any) users before creating new one - Refinery::User.destroy_all - Factory(:refinery_user) - end + login_refinery_user before(:each) do @blog_post = Factory(:blog_post, :title => "Refinery CMS blog post") diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb index 284bd07..e7ab573 100644 --- a/spec/requests/blog_posts_spec.rb +++ b/spec/requests/blog_posts_spec.rb @@ -1,11 +1,7 @@ require "spec_helper" describe "blog" do - before(:all) do - # destroy all existing (if any) users before creating new one - Refinery::User.destroy_all - Factory(:refinery_user) - end + login_refinery_user it "displays the blog rss feed" do get blog_rss_feed_path diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 2e44c53..724cc59 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -1,16 +1,7 @@ require "spec_helper" describe "manage blog posts" do - # TODO: share this with other request specs - before(:each) do - Factory(:refinery_user, :username => "refinerycms", - :password => "123456", - :password_confirmation => "123456") - visit new_refinery_user_session_url - fill_in "Login", :with => "refinerycms" - fill_in "Password", :with => "123456" - click_button "Sign in" - end + login_refinery_user let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } diff --git a/features/support/factories/blog_categories.rb b/spec/support/refinery/factories/blog_categories.rb similarity index 83% rename from features/support/factories/blog_categories.rb rename to spec/support/refinery/factories/blog_categories.rb index 9b98d91..c3701dd 100644 --- a/features/support/factories/blog_categories.rb +++ b/spec/support/refinery/factories/blog_categories.rb @@ -1,5 +1,3 @@ -require 'factory_girl' - Factory.define :blog_category, :class => 'refinery/blog_category' do |f| f.sequence(:title) { |n| "Shopping #{n}" } end diff --git a/features/support/factories/blog_comments.rb b/spec/support/refinery/factories/blog_comments.rb similarity index 91% rename from features/support/factories/blog_comments.rb rename to spec/support/refinery/factories/blog_comments.rb index 1c05190..d738cac 100644 --- a/features/support/factories/blog_comments.rb +++ b/spec/support/refinery/factories/blog_comments.rb @@ -1,5 +1,3 @@ -require 'factory_girl' - Factory.define :blog_comment, :class => 'refinery/blog_comment' do |f| f.name "Joe Commenter" f.sequence(:email) { |n| "person#{n}@example.com" } diff --git a/features/support/factories/blog_posts.rb b/spec/support/refinery/factories/blog_posts.rb similarity index 93% rename from features/support/factories/blog_posts.rb rename to spec/support/refinery/factories/blog_posts.rb index b5996a5..548636d 100644 --- a/features/support/factories/blog_posts.rb +++ b/spec/support/refinery/factories/blog_posts.rb @@ -1,5 +1,3 @@ -require 'factory_girl' - Factory.define :blog_post, :class => 'refinery/blog_post' do |f| f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." From 3454a9c3007a4bfd10ccd0ff39dc594ebb2a0184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Wed, 3 Aug 2011 16:59:31 +0300 Subject: [PATCH 026/248] I18n scope fix. --- app/views/refinery/admin/blog/posts/_teaser_part.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/refinery/admin/blog/posts/_teaser_part.html.erb b/app/views/refinery/admin/blog/posts/_teaser_part.html.erb index 71d7d01..dc9186a 100644 --- a/app/views/refinery/admin/blog/posts/_teaser_part.html.erb +++ b/app/views/refinery/admin/blog/posts/_teaser_part.html.erb @@ -2,9 +2,9 @@ <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%>

- <%= link_to t('copy_body', :scope => 'admin.blog.posts.form'), "#", + <%= link_to t('copy_body', :scope => 'refinery.admin.blog.posts.form'), "#", :id => 'copy_body_link', - :title => t('copy_body_help', :scope => 'admin.blog.posts.form') %> + :title => t('copy_body_help', :scope => 'refinery.admin.blog.posts.form') %>

From 21b19db5a30fcb6db83f4ac9302cc94c6320a0db Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 1 Aug 2011 11:27:28 -0700 Subject: [PATCH 027/248] refactor engine testing scenario Engine is now tested standalone by leveraging a dummy rails app Enable Guard for speedy testing Move factories to the more standard location `spec/factories/*` Update README with a Testing section Rename migrations to contain datetimestamps for their version to fix migration order issues when migrating the dummy application --- .gitignore | 3 + .rspec | 2 + Gemfile | 8 + Guardfile | 34 +++ Rakefile | 26 ++ app/assets/images/refinerycms-blog/.gitkeep | 0 .../javascripts/refinerycms-blog/.gitkeep | 0 .../stylesheets/refinerycms-blog/.gitkeep | 0 app/controllers/.gitkeep | 0 app/helpers/.gitkeep | 0 app/models/.gitkeep | 0 app/views/.gitkeep | 0 config/cucumber.yml | 10 + config/environment.rb | 3 + ...> 20110803223522_create_blog_structure.rb} | 2 +- ...110803223523_add_user_id_to_blog_posts.rb} | 0 ...03223524_acts_as_taggable_on_migration.rb} | 0 ...0110803223525_create_seo_meta_for_blog.rb} | 0 ....rb => 20110803223526_add_cached_slugs.rb} | 0 ...527_add_custom_url_field_to_blog_posts.rb} | 0 ..._add_custom_teaser_field_to_blog_posts.rb} | 0 ...529_add_primary_key_to_categorizations.rb} | 0 .../step_definitions/authors_steps.rb | 0 .../step_definitions/category_steps.rb | 0 .../step_definitions/tags_steps.rb | 0 features/step_definitions/user_steps.rb | 42 +++ features/step_definitions/web_steps.rb | 196 ++++++++++++++ features/support/env.rb | 50 ++++ features/support/paths.rb | 34 +-- features/support/selectors.rb | 39 +++ lib/refinery/blog/engine.rb | 21 ++ lib/refinerycms-blog.rb | 28 +- readme.md | 17 +- refinerycms-blog.gemspec | 13 + script/cucumber | 10 + script/rails | 6 + spec/dummy/.gitignore | 77 ++++++ spec/dummy/Rakefile | 7 + spec/dummy/app/assets/javascripts/admin.js | 7 + .../app/assets/javascripts/application.js | 9 + .../app/assets/stylesheets/application.css | 1 + .../assets/stylesheets/application.css.backup | 1 + .../app/assets/stylesheets/formatting.css | 4 + spec/dummy/app/assets/stylesheets/home.css | 4 + spec/dummy/app/assets/stylesheets/theme.css | 4 + .../app/controllers/application_controller.rb | 3 + spec/dummy/app/helpers/application_helper.rb | 2 + spec/dummy/app/mailers/.gitkeep | 0 spec/dummy/app/models/.gitkeep | 0 .../views/layouts/application.html.erb.backup | 14 + .../dummy/app/views/sitemap/index.xml.builder | 25 ++ spec/dummy/autotest/autotest.rb | 17 ++ spec/dummy/autotest/discover.rb | 2 + spec/dummy/config.ru | 4 + spec/dummy/config/application.rb | 42 +++ spec/dummy/config/boot.rb | 10 + spec/dummy/config/database.yml | 25 ++ spec/dummy/config/database.yml.mysql | 20 ++ spec/dummy/config/database.yml.postgresql | 55 ++++ spec/dummy/config/database.yml.sqlite3 | 26 ++ spec/dummy/config/environment.rb | 5 + spec/dummy/config/environments/development.rb | 31 +++ spec/dummy/config/environments/production.rb | 55 ++++ spec/dummy/config/environments/test.rb | 43 ++++ .../initializers/backtrace_silencers.rb | 7 + spec/dummy/config/initializers/devise.rb | 144 +++++++++++ spec/dummy/config/initializers/inflections.rb | 10 + spec/dummy/config/initializers/mime_types.rb | 5 + .../dummy/config/initializers/secret_token.rb | 7 + .../config/initializers/session_store.rb | 8 + .../config/initializers/wrap_parameters.rb | 12 + spec/dummy/config/locales/en.yml | 5 + spec/dummy/config/routes.rb | 58 +++++ ...02081556_create_refinerycms_core_schema.rb | 23 ++ .../20110802081557_add_locale_to_slugs.rb | 13 + ...1558_create_refinerycms_settings_schema.rb | 24 ++ ...559_add_value_type_to_refinery_settings.rb | 9 + ...reate_refinerycms_authentication_schema.rb | 48 ++++ ...1561_add_missing_indexes_to_roles_users.rb | 11 + ...0802081562_change_to_devise_users_table.rb | 31 +++ ...081563_add_remember_created_at_to_users.rb | 5 + ...2081564_remove_password_salt_from_users.rb | 13 + ...081565_create_refinerycms_images_schema.rb | 23 ++ ...2081566_create_refinerycms_pages_schema.rb | 56 ++++ .../20110802081567_translate_page_plugin.rb | 38 +++ ...802081568_remove_cached_slug_from_pages.rb | 11 + ...2081569_translate_custom_title_on_pages.rb | 26 ++ ...570_remove_translated_fields_from_pages.rb | 13 + .../migrate/20110802081571_create_seo_meta.rb | 86 +++++++ ...10802081572_create_add_template_columns.rb | 11 + ...573_create_refinerycms_resources_schema.rb | 21 ++ spec/dummy/db/schema.rb | 239 ++++++++++++++++++ spec/dummy/db/seeds.rb | 5 + spec/dummy/db/seeds/pages.rb | 63 +++++ spec/dummy/lib/assets/.gitkeep | 0 spec/dummy/log/.gitkeep | 0 spec/dummy/public/404.html | 26 ++ spec/dummy/public/422.html | 26 ++ spec/dummy/public/500.html | 26 ++ spec/dummy/public/favicon.ico | 0 spec/dummy/script/rails | 6 + .../factories/blog_categories.rb | 0 .../refinery => }/factories/blog_comments.rb | 0 .../refinery => }/factories/blog_posts.rb | 0 spec/factories/user.rb | 27 ++ spec/models/refinery/blog_post_spec.rb | 4 +- spec/rcov.opts | 2 + spec/requests/blog_categories_spec.rb | 4 +- spec/requests/blog_posts_spec.rb | 32 +-- spec/requests/manage_blog_posts_spec.rb | 9 +- spec/spec_helper.rb | 48 ++++ 111 files changed, 2208 insertions(+), 64 deletions(-) create mode 100644 .rspec create mode 100644 Gemfile create mode 100644 Guardfile create mode 100644 Rakefile create mode 100644 app/assets/images/refinerycms-blog/.gitkeep create mode 100644 app/assets/javascripts/refinerycms-blog/.gitkeep create mode 100644 app/assets/stylesheets/refinerycms-blog/.gitkeep create mode 100644 app/controllers/.gitkeep create mode 100644 app/helpers/.gitkeep create mode 100644 app/models/.gitkeep create mode 100644 app/views/.gitkeep create mode 100644 config/cucumber.yml create mode 100644 config/environment.rb rename db/migrate/{1_create_blog_structure.rb => 20110803223522_create_blog_structure.rb} (95%) rename db/migrate/{2_add_user_id_to_blog_posts.rb => 20110803223523_add_user_id_to_blog_posts.rb} (100%) rename db/migrate/{3_acts_as_taggable_on_migration.rb => 20110803223524_acts_as_taggable_on_migration.rb} (100%) rename db/migrate/{4_create_seo_meta_for_blog.rb => 20110803223525_create_seo_meta_for_blog.rb} (100%) rename db/migrate/{5_add_cached_slugs.rb => 20110803223526_add_cached_slugs.rb} (100%) rename db/migrate/{6_add_custom_url_field_to_blog_posts.rb => 20110803223527_add_custom_url_field_to_blog_posts.rb} (100%) rename db/migrate/{7_add_custom_teaser_field_to_blog_posts.rb => 20110803223528_add_custom_teaser_field_to_blog_posts.rb} (100%) rename db/migrate/{8_add_primary_key_to_categorizations.rb => 20110803223529_add_primary_key_to_categorizations.rb} (100%) rename features/{support => }/step_definitions/authors_steps.rb (100%) rename features/{support => }/step_definitions/category_steps.rb (100%) rename features/{support => }/step_definitions/tags_steps.rb (100%) create mode 100644 features/step_definitions/user_steps.rb create mode 100644 features/step_definitions/web_steps.rb create mode 100644 features/support/env.rb create mode 100644 features/support/selectors.rb create mode 100644 lib/refinery/blog/engine.rb create mode 100755 script/cucumber create mode 100755 script/rails create mode 100644 spec/dummy/.gitignore create mode 100644 spec/dummy/Rakefile create mode 100644 spec/dummy/app/assets/javascripts/admin.js create mode 100644 spec/dummy/app/assets/javascripts/application.js create mode 100644 spec/dummy/app/assets/stylesheets/application.css create mode 100644 spec/dummy/app/assets/stylesheets/application.css.backup create mode 100644 spec/dummy/app/assets/stylesheets/formatting.css create mode 100644 spec/dummy/app/assets/stylesheets/home.css create mode 100644 spec/dummy/app/assets/stylesheets/theme.css create mode 100644 spec/dummy/app/controllers/application_controller.rb create mode 100644 spec/dummy/app/helpers/application_helper.rb create mode 100644 spec/dummy/app/mailers/.gitkeep create mode 100644 spec/dummy/app/models/.gitkeep create mode 100644 spec/dummy/app/views/layouts/application.html.erb.backup create mode 100644 spec/dummy/app/views/sitemap/index.xml.builder create mode 100644 spec/dummy/autotest/autotest.rb create mode 100644 spec/dummy/autotest/discover.rb create mode 100644 spec/dummy/config.ru create mode 100644 spec/dummy/config/application.rb create mode 100644 spec/dummy/config/boot.rb create mode 100644 spec/dummy/config/database.yml create mode 100644 spec/dummy/config/database.yml.mysql create mode 100644 spec/dummy/config/database.yml.postgresql create mode 100644 spec/dummy/config/database.yml.sqlite3 create mode 100644 spec/dummy/config/environment.rb create mode 100644 spec/dummy/config/environments/development.rb create mode 100644 spec/dummy/config/environments/production.rb create mode 100644 spec/dummy/config/environments/test.rb create mode 100644 spec/dummy/config/initializers/backtrace_silencers.rb create mode 100644 spec/dummy/config/initializers/devise.rb create mode 100644 spec/dummy/config/initializers/inflections.rb create mode 100644 spec/dummy/config/initializers/mime_types.rb create mode 100644 spec/dummy/config/initializers/secret_token.rb create mode 100644 spec/dummy/config/initializers/session_store.rb create mode 100644 spec/dummy/config/initializers/wrap_parameters.rb create mode 100644 spec/dummy/config/locales/en.yml create mode 100644 spec/dummy/config/routes.rb create mode 100644 spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb create mode 100644 spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb create mode 100644 spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb create mode 100644 spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb create mode 100644 spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb create mode 100644 spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb create mode 100644 spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb create mode 100644 spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb create mode 100644 spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb create mode 100644 spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb create mode 100644 spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb create mode 100644 spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb create mode 100644 spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb create mode 100644 spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb create mode 100644 spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb create mode 100644 spec/dummy/db/migrate/20110802081571_create_seo_meta.rb create mode 100644 spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb create mode 100644 spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb create mode 100644 spec/dummy/db/schema.rb create mode 100644 spec/dummy/db/seeds.rb create mode 100644 spec/dummy/db/seeds/pages.rb create mode 100644 spec/dummy/lib/assets/.gitkeep create mode 100644 spec/dummy/log/.gitkeep create mode 100644 spec/dummy/public/404.html create mode 100644 spec/dummy/public/422.html create mode 100644 spec/dummy/public/500.html create mode 100644 spec/dummy/public/favicon.ico create mode 100755 spec/dummy/script/rails rename spec/{support/refinery => }/factories/blog_categories.rb (100%) rename spec/{support/refinery => }/factories/blog_comments.rb (100%) rename spec/{support/refinery => }/factories/blog_posts.rb (100%) create mode 100644 spec/factories/user.rb create mode 100644 spec/rcov.opts create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore index 9c1a2c5..2c06a4c 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,6 @@ nbproject # Capybara Bug capybara-*html + +.rvmrc +Gemfile.lock diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..4d52986 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color spec +--drb diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..dab5e38 --- /dev/null +++ b/Gemfile @@ -0,0 +1,8 @@ +source "http://rubygems.org" + +## Uncomment the following lines to develop against a local clone of refinery +# gem 'refinerycms', :path => '~/Code/refinerycms' +# gem 'refinerycms-generators', :path => '~/Code/refinerycms-generators' +# gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' + +gemspec diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..91d89e0 --- /dev/null +++ b/Guardfile @@ -0,0 +1,34 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +guard 'rspec', :version => 2 do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } + + # Rails example + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch('spec/spec_helper.rb') { "spec" } + watch('config/routes.rb') { "spec/routing" } + watch('app/controllers/application_controller.rb') { "spec/controllers" } + # Capybara request specs + watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } +end + +guard 'cucumber' do + watch(%r{^features/.+\.feature$}) + watch(%r{^features/support/.+$}) { 'features' } + watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } +end + +guard 'spork', :wait => 60, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do + watch('config/application.rb') + watch('config/environment.rb') + watch(%r{^config/environments/.+\.rb$}) + watch(%r{^config/initializers/.+\.rb$}) + watch('spec/spec_helper.rb') +end diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..699f74d --- /dev/null +++ b/Rakefile @@ -0,0 +1,26 @@ +#!/usr/bin/env rake +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end +begin + require 'rdoc/task' +rescue LoadError + require 'rdoc/rdoc' + require 'rake/rdoctask' + RDoc::Task = Rake::RDocTask +end + +RDoc::Task.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'RefinerycmsBlog' + rdoc.options << '--line-numbers' + rdoc.rdoc_files.include('README.rdoc') + rdoc.rdoc_files.include('lib/**/*.rb') +end + +APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) +load 'rails/tasks/engine.rake' + +Bundler::GemHelper.install_tasks diff --git a/app/assets/images/refinerycms-blog/.gitkeep b/app/assets/images/refinerycms-blog/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/refinerycms-blog/.gitkeep b/app/assets/javascripts/refinerycms-blog/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/refinerycms-blog/.gitkeep b/app/assets/stylesheets/refinerycms-blog/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/.gitkeep b/app/controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/helpers/.gitkeep b/app/helpers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/views/.gitkeep b/app/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/config/cucumber.yml b/config/cucumber.yml new file mode 100644 index 0000000..368422a --- /dev/null +++ b/config/cucumber.yml @@ -0,0 +1,10 @@ +<% +ENV["RAILS_ENV"] ||= "test" +require ::File.expand_path('../spec/dummy/config/environment', __FILE__) +rerun = IO.read('rerun.txt') if File.file?('rerun.txt') +rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" +std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip -r features" +%> +default: <%= std_opts %> +wip: --tags @wip:3 --wip features +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip \ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..5cdbfa5 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,3 @@ +# TODO: Remove this when you figure out how to get Cucumber to look for the +# environment file in the dummy app instead of within the project root +require File.expand_path('../../spec/dummy/config/environment', __FILE__) diff --git a/db/migrate/1_create_blog_structure.rb b/db/migrate/20110803223522_create_blog_structure.rb similarity index 95% rename from db/migrate/1_create_blog_structure.rb rename to db/migrate/20110803223522_create_blog_structure.rb index 612584e..f6f5b2d 100644 --- a/db/migrate/1_create_blog_structure.rb +++ b/db/migrate/20110803223522_create_blog_structure.rb @@ -37,7 +37,7 @@ class CreateBlogStructure < ActiveRecord::Migration add_index Refinery::Categorization.table_name, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' - load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s) + load(File.expand_path('../../seeds/refinerycms_blog.rb', __FILE__)) end def down diff --git a/db/migrate/2_add_user_id_to_blog_posts.rb b/db/migrate/20110803223523_add_user_id_to_blog_posts.rb similarity index 100% rename from db/migrate/2_add_user_id_to_blog_posts.rb rename to db/migrate/20110803223523_add_user_id_to_blog_posts.rb diff --git a/db/migrate/3_acts_as_taggable_on_migration.rb b/db/migrate/20110803223524_acts_as_taggable_on_migration.rb similarity index 100% rename from db/migrate/3_acts_as_taggable_on_migration.rb rename to db/migrate/20110803223524_acts_as_taggable_on_migration.rb diff --git a/db/migrate/4_create_seo_meta_for_blog.rb b/db/migrate/20110803223525_create_seo_meta_for_blog.rb similarity index 100% rename from db/migrate/4_create_seo_meta_for_blog.rb rename to db/migrate/20110803223525_create_seo_meta_for_blog.rb diff --git a/db/migrate/5_add_cached_slugs.rb b/db/migrate/20110803223526_add_cached_slugs.rb similarity index 100% rename from db/migrate/5_add_cached_slugs.rb rename to db/migrate/20110803223526_add_cached_slugs.rb diff --git a/db/migrate/6_add_custom_url_field_to_blog_posts.rb b/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb similarity index 100% rename from db/migrate/6_add_custom_url_field_to_blog_posts.rb rename to db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb diff --git a/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb b/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb similarity index 100% rename from db/migrate/7_add_custom_teaser_field_to_blog_posts.rb rename to db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb diff --git a/db/migrate/8_add_primary_key_to_categorizations.rb b/db/migrate/20110803223529_add_primary_key_to_categorizations.rb similarity index 100% rename from db/migrate/8_add_primary_key_to_categorizations.rb rename to db/migrate/20110803223529_add_primary_key_to_categorizations.rb diff --git a/features/support/step_definitions/authors_steps.rb b/features/step_definitions/authors_steps.rb similarity index 100% rename from features/support/step_definitions/authors_steps.rb rename to features/step_definitions/authors_steps.rb diff --git a/features/support/step_definitions/category_steps.rb b/features/step_definitions/category_steps.rb similarity index 100% rename from features/support/step_definitions/category_steps.rb rename to features/step_definitions/category_steps.rb diff --git a/features/support/step_definitions/tags_steps.rb b/features/step_definitions/tags_steps.rb similarity index 100% rename from features/support/step_definitions/tags_steps.rb rename to features/step_definitions/tags_steps.rb diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb new file mode 100644 index 0000000..002fa7d --- /dev/null +++ b/features/step_definitions/user_steps.rb @@ -0,0 +1,42 @@ +def login(options = {}) + options = {:user => @refinery_user}.merge(options) + visit new_refinery_user_session_path + fill_in("refinery_user_login", :with => options[:user].email) + fill_in("refinery_user_password", :with => 'greenandjuicy') + click_button("submit_button") +end + +Given /^I am a logged in refinery user$/i do + @refinery_user ||= Factory(:refinery_user) + login(:user => @refinery_user) +end + +Given /^I am a logged in refinery translator$/i do + @refinery_translator ||= Factory(:refinery_translator) + login(:user => @refinery_translator) +end + +Given /^I am a logged in customer$/i do + @user ||= Factory(:user) + login(:user => @user) +end + +Given /^A Refinery user exists$/i do + @refinery_user ||= Factory(:refinery_user) +end + +Given /^I have a user named "(.*)"$/ do |name| + @user = Factory(:user, :username => name) +end + +Given /^I have a refinery user named "(.*)"$/i do |name| + @refinery_user = Factory(:refinery_user, :username => name) +end + +Given /^I have no users$/ do + ::Refinery::User.delete_all +end + +Then /^I should have ([0-9]+) users?$/ do |count| + ::Refinery::User.count.should == count.to_i +end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb new file mode 100644 index 0000000..22abbf6 --- /dev/null +++ b/features/step_definitions/web_steps.rb @@ -0,0 +1,196 @@ +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. +# It is recommended to regenerate this file in the future when you upgrade to a +# newer version of cucumber-rails. Consider adding your own code to a new file +# instead of editing this one. Cucumber will automatically load all features/**/*.rb +# files. + +require 'uri' +require 'cgi' +require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) +require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors")) + +module WithinHelpers + def with_scope(locator) + locator ? within(*selector_for(locator)) { yield } : yield + end +end +World(WithinHelpers) + +# Single-line step scoper +When /^(.*) within (.*[^:])$/ do |step, parent| + with_scope(parent) { When step } +end + +# Multi-line step scoper +When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string| + with_scope(parent) { When "#{step}:", table_or_string } +end + +Given /^(?:|I )am on (.+)$/ do |page_name| + visit path_to(page_name) +end + +When /^(?:|I )go to (.+)$/ do |page_name| + visit path_to(page_name) +end + +When /^(?:|I )press "([^"]*)"$/ do |button| + click_button(button) +end + +When /^(?:|I )follow "([^"]*)"$/ do |link| + click_link(link) +end + +When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value| + fill_in(field, :with => value) +end + +When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field| + fill_in(field, :with => value) +end + +# Use this to fill in an entire form with data from a table. Example: +# +# When I fill in the following: +# | Account Number | 5002 | +# | Expiry date | 2009-11-01 | +# | Note | Nice guy | +# | Wants Email? | | +# +# TODO: Add support for checkbox, select og option +# based on naming conventions. +# +When /^(?:|I )fill in the following:$/ do |fields| + fields.rows_hash.each do |name, value| + When %{I fill in "#{name}" with "#{value}"} + end +end + +When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field| + select(value, :from => field) +end + +When /^(?:|I )check "([^"]*)"$/ do |field| + check(field) +end + +When /^(?:|I )uncheck "([^"]*)"$/ do |field| + uncheck(field) +end + +When /^(?:|I )choose "([^"]*)"$/ do |field| + choose(field) +end + +When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field| + attach_file(field, File.expand_path(path)) +end + +Then /^(?:|I )should see "([^"]*)"$/ do |text| + if page.respond_to? :should + page.should have_content(text) + else + assert page.has_content?(text) + end +end + +Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp| + regexp = Regexp.new(regexp) + + if page.respond_to? :should + page.should have_xpath('//*', :text => regexp) + else + assert page.has_xpath?('//*', :text => regexp) + end +end + +Then /^(?:|I )should not see "([^"]*)"$/ do |text| + if page.respond_to? :should + page.should have_no_content(text) + else + assert page.has_no_content?(text) + end +end + +Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp| + regexp = Regexp.new(regexp) + + if page.respond_to? :should + page.should have_no_xpath('//*', :text => regexp) + else + assert page.has_no_xpath?('//*', :text => regexp) + end +end + +Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value| + with_scope(parent) do + field = find_field(field) + field_value = (field.tag_name == 'textarea') ? field.text : field.value + if field_value.respond_to? :should + field_value.should =~ /#{value}/ + else + assert_match(/#{value}/, field_value) + end + end +end + +Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value| + with_scope(parent) do + field = find_field(field) + field_value = (field.tag_name == 'textarea') ? field.text : field.value + if field_value.respond_to? :should_not + field_value.should_not =~ /#{value}/ + else + assert_no_match(/#{value}/, field_value) + end + end +end + +Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent| + with_scope(parent) do + field_checked = find_field(label)['checked'] + if field_checked.respond_to? :should + field_checked.should be_true + else + assert field_checked + end + end +end + +Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent| + with_scope(parent) do + field_checked = find_field(label)['checked'] + if field_checked.respond_to? :should + field_checked.should be_false + else + assert !field_checked + end + end +end + +Then /^(?:|I )should be on (.+)$/ do |page_name| + current_path = URI.parse(current_url).path + if current_path.respond_to? :should + current_path.should == path_to(page_name) + else + assert_equal path_to(page_name), current_path + end +end + +Then /^(?:|I )should have the following query string:$/ do |expected_pairs| + query = URI.parse(current_url).query + actual_params = query ? CGI.parse(query) : {} + expected_params = {} + expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} + + if actual_params.respond_to? :should + actual_params.should == expected_params + else + assert_equal expected_params, actual_params + end +end + +Then /^show me the page$/ do + save_and_open_page +end diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 0000000..a84d601 --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,50 @@ +require 'rubygems' +require 'bundler/setup' +require 'spork' + +Spork.prefork do + require 'cucumber/rails' + require 'capybara/rails' + require 'capybara/cucumber' + require 'capybara/session' + + require 'factory_girl' + require 'database_cleaner' + require 'database_cleaner/cucumber' + + Dir[File.expand_path("../../../spec/factories/*.rb", __FILE__)].each {|f| require f} + + include ::Devise::Controllers::UrlHelpers + + # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In + # order to ease the transition to Capybara we set the default here. If you'd + # prefer to use XPath just remove this line and adjust any selectors in your + # steps to use the XPath syntax. + Capybara.default_selector = :css + + # By default, any exception happening in your Rails application will bubble up + # to Cucumber so that your scenario will fail. This is a different from how + # your application behaves in the production environment, where an error page will + # be rendered instead. + # + # Sometimes we want to override this default behaviour and allow Rails to rescue + # exceptions and display an error page (just like when the app is running in production). + # Typical scenarios where you want to do this is when you test your error pages. + # There are two ways to allow Rails to rescue exceptions: + # + # 1) Tag your scenario (or feature) with @allow-rescue + # + # 2) Set the value below to true. Beware that doing this globally is not + # recommended as it will mask a lot of errors for you! + # + ActionController::Base.allow_rescue = false + + DatabaseCleaner.strategy = :truncation + + Before { DatabaseCleaner.start } + After { DatabaseCleaner.clean } +end + +Spork.each_run do + # This code will be run each time you run your specs. +end diff --git a/features/support/paths.rb b/features/support/paths.rb index 1fdf9f8..f69b8fe 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -1,24 +1,18 @@ -module NavigationHelpers - module Refinery - module Blog - def path_to(page_name) - case page_name - when /the list of blog posts/ - refinery_admin_blog_posts_path - when /the new blog posts? form/ - new_refinery_admin_blog_post_path - else - begin - if page_name =~ /the blog post titled "?([^\"]*)"?/ and (page = BlogPost.find_by_title($1)).present? - self.url_for(page.url) - else - nil - end - rescue - nil - end - end +def path_to(page_name) + case page_name + when /the list of blog posts/ + refinery_admin_blog_posts_path + when /the new blog posts? form/ + new_refinery_admin_blog_post_path + else + begin + if page_name =~ /the blog post titled "?([^\"]*)"?/ and (page = BlogPost.find_by_title($1)).present? + self.url_for(page.url) + else + nil end + rescue + nil end end end diff --git a/features/support/selectors.rb b/features/support/selectors.rb new file mode 100644 index 0000000..44e34a4 --- /dev/null +++ b/features/support/selectors.rb @@ -0,0 +1,39 @@ +module HtmlSelectorsHelpers + # Maps a name to a selector. Used primarily by the + # + # When /^(.+) within (.+)$/ do |step, scope| + # + # step definitions in web_steps.rb + # + def selector_for(locator) + case locator + + when "the page" + "html > body" + + # Add more mappings here. + # Here is an example that pulls values out of the Regexp: + # + # when /^the (notice|error|info) flash$/ + # ".flash.#{$1}" + + # You can also return an array to use a different selector + # type, like: + # + # when /the header/ + # [:xpath, "//header"] + + # This allows you to provide a quoted selector as the scope + # for "within" steps as was previously the default for the + # web steps: + when /^"(.+)"$/ + $1 + + else + raise "Can't find mapping from \"#{locator}\" to a selector.\n" + + "Now, go and add a mapping in #{__FILE__}" + end + end +end + +World(HtmlSelectorsHelpers) diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb new file mode 100644 index 0000000..ef21472 --- /dev/null +++ b/lib/refinery/blog/engine.rb @@ -0,0 +1,21 @@ +module Refinery + module Blog + class Engine < Rails::Engine + config.to_prepare do + require 'refinery/blog/tabs' + end + + initializer "init plugin", :after => :set_routes_reloader do |app| + Refinery::Plugin.register do |plugin| + plugin.pathname = root + plugin.name = "refinerycms_blog" + plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path + plugin.menu_match = /^\/refinery\/blog\/?(posts|comments|categories)?/ + plugin.activity = { + :class => Refinery::BlogPost + } + end + end + end + end +end diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 334380e..fafedf5 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -1,10 +1,14 @@ +require 'rubygems' +require 'bundler' +Bundler.require + require 'filters_spam' require File.expand_path('../generators/blog_generator', __FILE__) module Refinery module Blog - autoload :Version, File.expand_path('../refinery/blog/version', __FILE__) - autoload :Tab, File.expand_path("../refinery/blog/tabs", __FILE__) + autoload :Version, 'refinery/blog/version' + autoload :Tab, 'refinery/blog/tabs' class << self attr_accessor :root @@ -16,23 +20,7 @@ module Refinery ::Refinery::Blog::Version.to_s end end - - class Engine < Rails::Engine - config.to_prepare do - require File.expand_path('../refinery/blog/tabs', __FILE__) - end - - initializer "init plugin", :after => :set_routes_reloader do |app| - Refinery::Plugin.register do |plugin| - plugin.pathname = root - plugin.name = "refinerycms_blog" - plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path - plugin.menu_match = /^\/refinery\/blog\/?(posts|comments|categories)?/ - plugin.activity = { - :class => Refinery::BlogPost - } - end - end - end if defined?(Rails::Engine) end end + +require 'refinery/blog/engine' if defined?(Rails) diff --git a/readme.md b/readme.md index 32bf487..f5f0e53 100644 --- a/readme.md +++ b/readme.md @@ -27,4 +27,19 @@ Next, to install the blog plugin run: Finally migrate your database and you're done. - rake db:migrate \ No newline at end of file + rake db:migrate + +## Developing & Contributing + +### Testing + +Setup the test environment + + $ bundle install + $ bundle exec rake app:db:migrate + $ bundle exec rake app:db:test:prepare + +Run the test suite with [Guard](https://github.com/guard/guard) + + $ bundle exec guard start + \ No newline at end of file diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index dca15fb..91f2b07 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -16,7 +16,20 @@ Gem::Specification.new do |s| s.add_dependency 'seo_meta', '~> 1.1.0' # Development dependencies + s.add_development_dependency 'rake', '~> 0.9.2' + s.add_development_dependency 'rails', '3.1.0.rc5' s.add_development_dependency 'factory_girl' + s.add_development_dependency 'sqlite3' + s.add_development_dependency 'rspec' + s.add_development_dependency 'rspec-rails', '2.6.1.beta1' + s.add_development_dependency 'capybara' + s.add_development_dependency 'cucumber-rails' + s.add_development_dependency 'spork', '0.9.0.rc9' + s.add_development_dependency 'guard-spork' + s.add_development_dependency 'guard-rspec' + s.add_development_dependency 'guard-cucumber' + s.add_development_dependency 'rb-fsevent' + s.add_development_dependency 'database_cleaner' s.files = %w( app diff --git a/script/cucumber b/script/cucumber new file mode 100755 index 0000000..7fa5c92 --- /dev/null +++ b/script/cucumber @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby + +vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first +if vendored_cucumber_bin + load File.expand_path(vendored_cucumber_bin) +else + require 'rubygems' unless ENV['NO_RUBYGEMS'] + require 'cucumber' + load Cucumber::BINARY +end diff --git a/script/rails b/script/rails new file mode 100755 index 0000000..4309856 --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +ENGINE_PATH = File.expand_path('../..', __FILE__) +load File.expand_path('../../spec/dummy/script/rails', __FILE__) diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore new file mode 100644 index 0000000..55ff259 --- /dev/null +++ b/spec/dummy/.gitignore @@ -0,0 +1,77 @@ +# Rails +.bundle +db/*.sqlite3 +db/*.sqlite3-journal +*.log +tmp +tmp/**/* + +# Documentation +doc/api +doc/app +.yardoc +.yardopts +coverage + +# Public Uploads +public/system/* +public/themes/* + +# Public Cache +public/javascripts/cache +public/stylesheets/cache + +# Vendor Cache +vendor/cache + +# Acts as Indexed +index/**/* + +# Refinery Specific +*.tmproj +*.autobackupbyrefinery.* +refinerycms-*.gem +.autotest + +# Mac +.DS_Store + +# Windows +Thumbs.db + +# NetBeans +nbproject + +# Eclipse +.project + +# Redcar +.redcar + +# Rubinius +*.rbc + +# Vim +*.swp +*.swo + +# RubyMine +.idea + +# E-texteditor +.eprj + +# Backup +*~ + +# Capybara Bug +capybara-*html + +# sass +.sass-cache +.sass-cache/* + +#rvm +.rvmrc +.rvmrc.* + diff --git a/spec/dummy/Rakefile b/spec/dummy/Rakefile new file mode 100644 index 0000000..3645852 --- /dev/null +++ b/spec/dummy/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Dummy::Application.load_tasks diff --git a/spec/dummy/app/assets/javascripts/admin.js b/spec/dummy/app/assets/javascripts/admin.js new file mode 100644 index 0000000..23c4fb9 --- /dev/null +++ b/spec/dummy/app/assets/javascripts/admin.js @@ -0,0 +1,7 @@ +// Use this to customize the wymeditor boot process +// Just mirror the options specified in boot_wym.js with the new options here. +// This will completely override anything specified in boot_wym.js for that key. +// e.g. skin: 'something_else' +var custom_wymeditor_boot_options = { + +}; \ No newline at end of file diff --git a/spec/dummy/app/assets/javascripts/application.js b/spec/dummy/app/assets/javascripts/application.js new file mode 100644 index 0000000..37c7bfc --- /dev/null +++ b/spec/dummy/app/assets/javascripts/application.js @@ -0,0 +1,9 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/spec/dummy/app/assets/stylesheets/application.css b/spec/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/application.css @@ -0,0 +1 @@ + diff --git a/spec/dummy/app/assets/stylesheets/application.css.backup b/spec/dummy/app/assets/stylesheets/application.css.backup new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/application.css.backup @@ -0,0 +1 @@ + diff --git a/spec/dummy/app/assets/stylesheets/formatting.css b/spec/dummy/app/assets/stylesheets/formatting.css new file mode 100644 index 0000000..1132188 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/formatting.css @@ -0,0 +1,4 @@ +/* + Override default refinery formatting below. + Formatting applies to backend WYSIWYG editors and all frontend. +*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/home.css b/spec/dummy/app/assets/stylesheets/home.css new file mode 100644 index 0000000..824db99 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/home.css @@ -0,0 +1,4 @@ +/* + Override default refinery homepage styles here. + These only apply to the homepage of your site. +*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/theme.css b/spec/dummy/app/assets/stylesheets/theme.css new file mode 100644 index 0000000..8205050 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/theme.css @@ -0,0 +1,4 @@ +/* + Override default refinery 'theme' styles here. + These only apply when using custom WYMeditor CSS. +*/ \ No newline at end of file diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..e8065d9 --- /dev/null +++ b/spec/dummy/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery +end diff --git a/spec/dummy/app/helpers/application_helper.rb b/spec/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/spec/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/spec/dummy/app/mailers/.gitkeep b/spec/dummy/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/models/.gitkeep b/spec/dummy/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/views/layouts/application.html.erb.backup b/spec/dummy/app/views/layouts/application.html.erb.backup new file mode 100644 index 0000000..9a8a761 --- /dev/null +++ b/spec/dummy/app/views/layouts/application.html.erb.backup @@ -0,0 +1,14 @@ + + + + Dummy + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/spec/dummy/app/views/sitemap/index.xml.builder b/spec/dummy/app/views/sitemap/index.xml.builder new file mode 100644 index 0000000..8e89852 --- /dev/null +++ b/spec/dummy/app/views/sitemap/index.xml.builder @@ -0,0 +1,25 @@ +xml.instruct! + +xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do + + @locales.each do |locale| + ::I18n.locale = locale + ::Refinery::Page.live.in_menu.includes(:parts).each do |page| + # exclude sites that are external to our own domain. + page_url = if page.url.is_a?(Hash) + # This is how most pages work without being overriden by link_url + page.url.merge({:only_path => false}) + elsif page.url.to_s !~ /^http/ + # handle relative link_url addresses. + [request.protocol, request.host_with_port, page.url].join + end + + # Add XML entry only if there is a valid page_url found above. + xml.url do + xml.loc url_for(page_url) + xml.lastmod page.updated_at.to_date + end if page_url.present? and page.show_in_menu? + end + end + +end diff --git a/spec/dummy/autotest/autotest.rb b/spec/dummy/autotest/autotest.rb new file mode 100644 index 0000000..09f5b8a --- /dev/null +++ b/spec/dummy/autotest/autotest.rb @@ -0,0 +1,17 @@ +### uncomment any of the following requires applicable for your system +### and then copy this to .autotest if you are using the ZenTest autotest. +# require "autotest/restart" +# require "test_notifier/runner/autotest" +# require "redgreen/autotest" +# require "autotest/timestamp" + +# adds exceptions from .gitignore file, please modify exceptions there! +imported_exceptions = IO.readlines('.gitignore').inject([]) do |acc, line| + acc << line.strip if line.to_s[0] != '#' && line.strip != ''; acc +end + +Autotest.add_hook :initialize do |autotest| + imported_exceptions.each do |exception| + autotest.add_exception(exception) + end +end diff --git a/spec/dummy/autotest/discover.rb b/spec/dummy/autotest/discover.rb new file mode 100644 index 0000000..f421dc5 --- /dev/null +++ b/spec/dummy/autotest/discover.rb @@ -0,0 +1,2 @@ +Autotest.add_discovery { "rails" } +Autotest.add_discovery { "rspec2" } diff --git a/spec/dummy/config.ru b/spec/dummy/config.ru new file mode 100644 index 0000000..1989ed8 --- /dev/null +++ b/spec/dummy/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Dummy::Application diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb new file mode 100644 index 0000000..f83ab50 --- /dev/null +++ b/spec/dummy/config/application.rb @@ -0,0 +1,42 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +Bundler.require +require "refinerycms-blog" + +module Dummy + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable the asset pipeline + config.assets.enabled = true + end +end + diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb new file mode 100644 index 0000000..eba0681 --- /dev/null +++ b/spec/dummy/config/boot.rb @@ -0,0 +1,10 @@ +require 'rubygems' +gemfile = File.expand_path('../../../../Gemfile', __FILE__) + +if File.exist?(gemfile) + ENV['BUNDLE_GEMFILE'] = gemfile + require 'bundler' + Bundler.setup +end + +$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml new file mode 100644 index 0000000..51a4dd4 --- /dev/null +++ b/spec/dummy/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 diff --git a/spec/dummy/config/database.yml.mysql b/spec/dummy/config/database.yml.mysql new file mode 100644 index 0000000..75cca95 --- /dev/null +++ b/spec/dummy/config/database.yml.mysql @@ -0,0 +1,20 @@ +development: &development + adapter: mysql2 + host: localhost + username: root + password: + database: your_local_database + +test: &test + adapter: mysql2 + host: localhost + username: root + password: + database: your_test_database + +production: &production + adapter: mysql2 + host: localhost + database: your_production_database + username: your_production_database_login + password: your_production_database_password diff --git a/spec/dummy/config/database.yml.postgresql b/spec/dummy/config/database.yml.postgresql new file mode 100644 index 0000000..2146d1f --- /dev/null +++ b/spec/dummy/config/database.yml.postgresql @@ -0,0 +1,55 @@ +# PostgreSQL. Versions 7.4 and 8.x are supported. +# +# Install the pg driver: +# gem install pg +# On Mac OS X with macports: +# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config +# On Windows: +# gem install pg +# Choose the win32 build. +# Install PostgreSQL and put its /bin directory on your path. +# +# Configure Using Gemfile +# gem 'pg' +# +development: + adapter: postgresql + encoding: unicode + database: refinery_database_development + pool: 5 + username: postgres + password: postgres + + # Connect on a TCP socket. Omitted by default since the client uses a + # domain socket that doesn't need configuration. Windows does not have + # domain sockets, so uncomment these lines. + #host: localhost + #port: 5432 + + # Schema search path. The server defaults to $user,public + #schema_search_path: myapp,sharedapp,public + + # Minimum log levels, in increasing order: + # debug5, debug4, debug3, debug2, debug1, + # log, notice, warning, error, fatal, and panic + # The server defaults to notice. + #min_messages: warning + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: postgresql + encoding: unicode + database: refinery_database_test + pool: 5 + username: postgres + password: postgres + +production: + adapter: postgresql + encoding: unicode + database: refinery_database_production + pool: 5 + username: postgres + password: postgres diff --git a/spec/dummy/config/database.yml.sqlite3 b/spec/dummy/config/database.yml.sqlite3 new file mode 100644 index 0000000..c2da158 --- /dev/null +++ b/spec/dummy/config/database.yml.sqlite3 @@ -0,0 +1,26 @@ +# SQLite version 3.x +development: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/development.sqlite3 + timeout: 5000 + +# Warning: The database defined as 'test' will be erased and +# re-generated from your development database when you run 'rake'. +# Do not set this db to the same as development or production. +test: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/test.sqlite3 + timeout: 5000 + +# Warning: The database defined as 'cucumber' will be erased and +# re-generated from your development database when you run 'rake'. +# Do not set this db to the same as development or production. +cucumber: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/cucumber.sqlite3 + timeout: 5000 + +production: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/production.sqlite3 + timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb new file mode 100644 index 0000000..3da5eb9 --- /dev/null +++ b/spec/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Dummy::Application.initialize! diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb new file mode 100644 index 0000000..8604338 --- /dev/null +++ b/spec/dummy/config/environments/development.rb @@ -0,0 +1,31 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Do not compress assets + config.assets.compress = false +end +Refinery.rescue_not_found = false +# When true will use Amazon's Simple Storage Service on your production machine +# instead of the default file system for resources and images +Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb new file mode 100644 index 0000000..17a630b --- /dev/null +++ b/spec/dummy/config/environments/production.rb @@ -0,0 +1,55 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = true # Refinery CMS requires this to be true + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Specifies the header that your server uses for sending files + # (comment out if your front-end server doesn't support this) + config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify +end +Refinery.rescue_not_found = true +# When true will use Amazon's Simple Storage Service on your production machine +# instead of the default file system for resources and images +Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb new file mode 100644 index 0000000..9e84bae --- /dev/null +++ b/spec/dummy/config/environments/test.rb @@ -0,0 +1,43 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = false + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end +Refinery.rescue_not_found = false +# When true will use Amazon's Simple Storage Service on your production machine +# instead of the default file system for resources and images +Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/initializers/backtrace_silencers.rb b/spec/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/spec/dummy/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/dummy/config/initializers/devise.rb b/spec/dummy/config/initializers/devise.rb new file mode 100644 index 0000000..0d00106 --- /dev/null +++ b/spec/dummy/config/initializers/devise.rb @@ -0,0 +1,144 @@ +require 'devise' + +# Use this hook to configure devise mailer, warden hooks and so forth. The first +# four configuration values can also be set straight in your models. +::Devise.setup do |config| + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in DeviseMailer. + # config.mailer_sender = "please-change-me@config-initializers-devise.com" + + # Configure the class responsible to send e-mails. + # config.mailer = "::Devise::Mailer" + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating an user. By default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating an user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + config.authentication_keys = [ :login ] + + # Tell if authentication through request.params is enabled. True by default. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. False by default. + # config.http_authenticatable = false + + # Set this to true to use Basic Auth for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication + # config.http_authentication_realm = "Application" + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # config.stretches = 20 + + # Define which will be the encryption algorithm. Devise also supports encryptors + # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then + # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1 + # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :bcrypt + + # Setup a pepper to generate the encrypted password. + # config.pepper = "2e20a8abdd34d729ba6d05f679e513cfea9fbb1e83c81f84b29e9e4fdbd4ee59b56a32200064082a15a72b05a4d4a6a2c3784a09c0554b3a47a67cc8333ccbc7" + + # ==> Configuration for :confirmable + # The time you want to give your user to confirm his account. During this time + # he will be able to access your application without confirming. Default is nil. + # When confirm_within is zero, the user won't be able to sign in without confirming. + # You can use this to let your user access some features of your application + # without confirming the account, but blocking it after a certain period + # (ie 2 days). + # config.confirm_within = 2.days + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # If true, a valid remember token can be re-used between multiple browsers. + # config.remember_across_browsers = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # ==> Configuration for :validatable + # Range for password length + config.password_length = 4..20 + + # Regex to use to validate the email address + # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. + # config.timeout_in = 10.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = true + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes. + # config.default_scope = :user + + # Configure sign_out behavior. + # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope). + # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes. + # config.sign_out_all_scopes = false + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. Default is [:html] + # config.navigational_formats = [:html, :iphone] + + # ==> Warden configuration + # If you want to use other strategies, that are not (yet) supported by Devise, + # you can configure them inside the config.warden block. The example below + # allows you to setup OAuth, using http://github.com/roman/warden_oauth + # + # config.warden do |manager| + # manager.oauth(:twitter) do |twitter| + # twitter.consumer_secret = + # twitter.consumer_key = + # twitter.options :site => 'http://twitter.com' + # end + # manager.default_strategies(:scope => :user).unshift :twitter_oauth + # end +end diff --git a/spec/dummy/config/initializers/inflections.rb b/spec/dummy/config/initializers/inflections.rb new file mode 100644 index 0000000..9e8b013 --- /dev/null +++ b/spec/dummy/config/initializers/inflections.rb @@ -0,0 +1,10 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end diff --git a/spec/dummy/config/initializers/mime_types.rb b/spec/dummy/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/spec/dummy/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/spec/dummy/config/initializers/secret_token.rb b/spec/dummy/config/initializers/secret_token.rb new file mode 100644 index 0000000..7a99397 --- /dev/null +++ b/spec/dummy/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Dummy::Application.config.secret_token = '75470fb2f9c361e0509af41d5835fdb3fee2e588a44c68596c6201976f994e0689c434b6e8360dbc45c0d424c1811a5cf1e3f4f0550be9b784fed60fb4e5d29d' diff --git a/spec/dummy/config/initializers/session_store.rb b/spec/dummy/config/initializers/session_store.rb new file mode 100644 index 0000000..952473f --- /dev/null +++ b/spec/dummy/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# Dummy::Application.config.session_store :active_record_store diff --git a/spec/dummy/config/initializers/wrap_parameters.rb b/spec/dummy/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..16c3243 --- /dev/null +++ b/spec/dummy/config/initializers/wrap_parameters.rb @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActionController::Base.wrap_parameters format: [:json] + +# Disable root element in JSON by default. +if defined?(ActiveRecord) + ActiveRecord::Base.include_root_in_json = false +end diff --git a/spec/dummy/config/locales/en.yml b/spec/dummy/config/locales/en.yml new file mode 100644 index 0000000..179c14c --- /dev/null +++ b/spec/dummy/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb new file mode 100644 index 0000000..bb509f2 --- /dev/null +++ b/spec/dummy/config/routes.rb @@ -0,0 +1,58 @@ +Dummy::Application.routes.draw do + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb new file mode 100644 index 0000000..3199a9c --- /dev/null +++ b/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb @@ -0,0 +1,23 @@ +class CreateRefinerycmsCoreSchema < ActiveRecord::Migration + def self.up + create_table ::Slug.table_name, :force => true do |t| + t.string "name" + t.integer "sluggable_id" + t.integer "sequence", :default => 1, :null => false + t.string "sluggable_type", :limit => 40 + t.string "scope", :limit => 40 + t.datetime "created_at" + end + + add_index ::Slug.table_name, ["name", "sluggable_type", "scope", "sequence"], :name => "index_#{::Slug.table_name}_on_n_s_s_and_s", :unique => true + add_index ::Slug.table_name, ["sluggable_id"], :name => "index_#{::Slug.table_name}_on_sluggable_id" + end + + def self.down + [::Slug].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name + end + end +end diff --git a/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb b/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb new file mode 100644 index 0000000..0795cad --- /dev/null +++ b/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb @@ -0,0 +1,13 @@ +class AddLocaleToSlugs < ActiveRecord::Migration + def self.up + add_column ::Slug.table_name, :locale, :string + + add_index ::Slug.table_name, :locale + end + + def self.down + remove_column ::Slug.table_name, :locale + + remove_index ::Slug.table_name, :locale + end +end diff --git a/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb b/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb new file mode 100644 index 0000000..b60cf82 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb @@ -0,0 +1,24 @@ +class CreateRefinerycmsSettingsSchema < ActiveRecord::Migration + def self.up + create_table ::Refinery::Setting.table_name, :force => true do |t| + t.string "name" + t.text "value" + t.boolean "destroyable", :default => true + t.datetime "created_at" + t.datetime "updated_at" + t.string "scoping" + t.boolean "restricted", :default => false + t.string "callback_proc_as_string" + end + + add_index ::Refinery::Setting.table_name, ["name"], :name => "index_#{::Refinery::Setting.table_name}_on_name" + end + + def self.down + [::Refinery::Setting].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name + end + end +end diff --git a/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb b/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb new file mode 100644 index 0000000..2fdf6d8 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb @@ -0,0 +1,9 @@ +class AddValueTypeToRefinerySettings < ActiveRecord::Migration + def self.up + add_column ::Refinery::Setting.table_name, :form_value_type, :string + end + + def self.down + remove_column ::Refinery::Setting.table_name, :form_value_type + end +end diff --git a/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb b/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb new file mode 100644 index 0000000..f9b6c2e --- /dev/null +++ b/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb @@ -0,0 +1,48 @@ +class CreateRefinerycmsAuthenticationSchema < ActiveRecord::Migration + def self.up + # Postgres apparently requires the roles_users table to exist before creating the roles table. + create_table ::Refinery::RolesUsers.table_name, :id => false, :force => true do |t| + t.integer "user_id" + t.integer "role_id" + end unless ::Refinery::RolesUsers.table_exists? + + create_table ::Refinery::Role.table_name, :force => true do |t| + t.string "title" + end unless ::Refinery::Role.table_exists? + + unless ::Refinery::UserPlugin.table_exists? + create_table ::Refinery::UserPlugin.table_name, :force => true do |t| + t.integer "user_id" + t.string "name" + t.integer "position" + end + + add_index ::Refinery::UserPlugin.table_name, ["name"], :name => "index_#{::Refinery::UserPlugin.table_name}_on_title" + add_index ::Refinery::UserPlugin.table_name, ["user_id", "name"], :name => "index_unique_#{::Refinery::UserPlugin.table_name}", :unique => true + + end + + unless ::Refinery::User.table_exists? + create_table ::Refinery::User.table_name, :force => true do |t| + t.string "login", :null => false + t.string "email", :null => false + t.string "crypted_password", :null => false + t.string "password_salt", :null => false + t.string "persistence_token" + t.datetime "created_at" + t.datetime "updated_at" + t.string "perishable_token" + end + + add_index ::Refinery::User.table_name, ["id"], :name => "index_#{::Refinery::User.table_name}_on_id" + end + end + + def self.down + [::User].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb b/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb new file mode 100644 index 0000000..e72d81f --- /dev/null +++ b/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb @@ -0,0 +1,11 @@ +class AddMissingIndexesToRolesUsers < ActiveRecord::Migration + def self.up + add_index ::Refinery::RolesUsers.table_name, [:role_id, :user_id] + add_index ::Refinery::RolesUsers.table_name, [:user_id, :role_id] + end + + def self.down + remove_index ::Refinery::RolesUsers.table_name, :column => [:role_id, :user_id] + remove_index ::Refinery::RolesUsers.table_name, :column => [:user_id, :role_id] + end +end diff --git a/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb b/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb new file mode 100644 index 0000000..8beef83 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb @@ -0,0 +1,31 @@ +class ChangeToDeviseUsersTable < ActiveRecord::Migration + def self.up + add_column ::Refinery::User.table_name, :current_sign_in_at, :datetime + add_column ::Refinery::User.table_name, :last_sign_in_at, :datetime + add_column ::Refinery::User.table_name, :current_sign_in_ip, :string + add_column ::Refinery::User.table_name, :last_sign_in_ip, :string + add_column ::Refinery::User.table_name, :sign_in_count, :integer + add_column ::Refinery::User.table_name, :remember_token, :string + add_column ::Refinery::User.table_name, :reset_password_token, :string + + rename_column ::Refinery::User.table_name, :crypted_password, :encrypted_password + rename_column ::Refinery::User.table_name, :login, :username + + ::Refinery::User.reset_column_information + end + + def self.down + remove_column ::Refinery::User.table_name, :current_sign_in_at + remove_column ::Refinery::User.table_name, :last_sign_in_at + remove_column ::Refinery::User.table_name, :current_sign_in_ip + remove_column ::Refinery::User.table_name, :last_sign_in_ip + remove_column ::Refinery::User.table_name, :sign_in_count + remove_column ::Refinery::User.table_name, :remember_token + remove_column ::Refinery::User.table_name, :reset_password_token + + rename_column ::Refinery::User.table_name, :encrypted_password, :crypted_password + rename_column ::Refinery::User.table_name, :username, :login + + ::Refinery::User.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb b/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb new file mode 100644 index 0000000..524b36f --- /dev/null +++ b/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb @@ -0,0 +1,5 @@ +class AddRememberCreatedAtToUsers < ActiveRecord::Migration + def change + add_column ::Refinery::User.table_name, :remember_created_at, :datetime + end +end diff --git a/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb b/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb new file mode 100644 index 0000000..afcbfd7 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb @@ -0,0 +1,13 @@ +class RemovePasswordSaltFromUsers < ActiveRecord::Migration + def self.up + remove_column ::Refinery::User.table_name, :password_salt + # Make the current password invalid :( + ::Refinery::User.all.each do |u| + u.update_attribute(:encrypted_password, u.encrypted_password[29..-1]) + end + end + + def self.down + add_column ::Refinery::User.table_name, :password_salt, :string + end +end diff --git a/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb b/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb new file mode 100644 index 0000000..6c4e079 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb @@ -0,0 +1,23 @@ +class CreateRefinerycmsImagesSchema < ActiveRecord::Migration + def self.up + create_table ::Refinery::Image.table_name, :force => true do |t| + t.string "image_mime_type" + t.string "image_name" + t.integer "image_size" + t.integer "image_width" + t.integer "image_height" + t.datetime "created_at" + t.datetime "updated_at" + t.string "image_uid" + t.string "image_ext" + end unless ::Refinery::Image.table_exists? + end + + def self.down + [::Image].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb b/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb new file mode 100644 index 0000000..4458726 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb @@ -0,0 +1,56 @@ +class CreateRefinerycmsPagesSchema < ActiveRecord::Migration + def self.up + unless ::Refinery::PagePart.table_exists? + create_table ::Refinery::PagePart.table_name, :force => true do |t| + t.integer "refinery_page_id" + t.string "title" + t.text "body" + t.integer "position" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index ::Refinery::PagePart.table_name, ["id"], :name => "index_#{::Refinery::PagePart.table_name}_on_id" + add_index ::Refinery::PagePart.table_name, ["refinery_page_id"], :name => "index_#{::Refinery::PagePart.table_name}_on_page_id" + end + + unless ::Refinery::Page.table_exists? + create_table ::Refinery::Page.table_name, :force => true do |t| + t.string "title" + t.integer "parent_id" + t.integer "position" + t.string "path" + t.datetime "created_at" + t.datetime "updated_at" + t.string "meta_keywords" + t.text "meta_description" + t.boolean "show_in_menu", :default => true + t.string "link_url" + t.string "menu_match" + t.boolean "deletable", :default => true + t.string "custom_title" + t.string "custom_title_type", :default => "none" + t.boolean "draft", :default => false + t.string "browser_title" + t.boolean "skip_to_first_child", :default => false + t.integer "lft" + t.integer "rgt" + t.integer "depth" + end + + add_index ::Refinery::Page.table_name, ["depth"], :name => "index_#{::Refinery::Page.table_name}_on_depth" + add_index ::Refinery::Page.table_name, ["id"], :name => "index_#{::Refinery::Page.table_name}_on_id" + add_index ::Refinery::Page.table_name, ["lft"], :name => "index_#{::Refinery::Page.table_name}_on_lft" + add_index ::Refinery::Page.table_name, ["parent_id"], :name => "index_#{::Refinery::Page.table_name}_on_parent_id" + add_index ::Refinery::Page.table_name, ["rgt"], :name => "index_#{::Refinery::Page.table_name}_on_rgt" + end + end + + def self.down + [::Page, ::Refinery::PagePart].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb b/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb new file mode 100644 index 0000000..bdb0a43 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb @@ -0,0 +1,38 @@ +class TranslatePagePlugin < ActiveRecord::Migration + def self.up + say_with_time("Creating ::Refinery::PagePart translation table") do + ::Refinery::PagePart.create_translation_table!({ + :body => :text + }, { + :migrate_data => true + }) + end + + say_with_time("Creating ::Refinery::Page translation table") do + ::Refinery::Page.create_translation_table!({ + :title => :string, + :meta_keywords => :string, + :meta_description => :text, + :browser_title => :string + }, { + :migrate_data => true + }) + end + + puts "seeds pages" + if (seed_file = Rails.root.join('db', 'seeds', 'pages.rb')).file? + load seed_file.to_s unless ::Refinery::Page.where(:link_url => '/').any? + end + + say_with_time("Updating slugs") do + ::Slug.update_all(:locale => I18n.locale) + end + end + + def self.down + say_with_time("Dropping ::Refinery::Page and ::Refinery::PagePart translation tables") do + ::Refinery::Page.drop_translation_table! :migrate_data => true + ::Refinery::PagePart.drop_translation_table! :migrate_data => true + end + end +end diff --git a/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb b/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb new file mode 100644 index 0000000..d265838 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb @@ -0,0 +1,11 @@ +class RemoveCachedSlugFromPages < ActiveRecord::Migration + def self.up + if ::Refinery::Page.column_names.map(&:to_s).include?('cached_slug') + remove_column ::Refinery::Page.table_name, :cached_slug + end + end + + def self.down + # Don't add this column back, it breaks stuff. + end +end diff --git a/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb new file mode 100644 index 0000000..ab21e11 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb @@ -0,0 +1,26 @@ +class TranslateCustomTitleOnPages < ActiveRecord::Migration + def self.up + unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title) + add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string + + # Re-save custom_title + ::Refinery::Page.all.each do |page| + page.update_attribute(:custom_title, page.untranslated_attributes['custom_title']) + end + + end + end + + def self.down + # Re-save custom_title + ::Refinery::Page.all.each do |page| + ::Refinery::Page.update_all({ + :custom_title => page.attributes['custom_title'] + }, { + :id => page.id.to_s + }) unless page.attributes['custom_title'].nil? + end + + remove_column ::Refinery::Page.translation_class.table_name, :custom_title + end +end diff --git a/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb b/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb new file mode 100644 index 0000000..9dc30b2 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb @@ -0,0 +1,13 @@ +class RemoveTranslatedFieldsFromPages < ActiveRecord::Migration + def self.up + ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| + remove_column ::Refinery::Page.table_name, column_name if ::Refinery::Page.column_names.map(&:to_sym).include?(column_name) + end + end + + def self.down + ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| + add_column ::Refinery::Page.table_name, column_name, Page::Translation.columns.detect{|c| c.name.to_sym == column_name}.type + end + end +end diff --git a/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb b/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb new file mode 100644 index 0000000..abc2178 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb @@ -0,0 +1,86 @@ +class CreateSeoMeta < ActiveRecord::Migration + + def self.up + create_table :seo_meta do |t| + t.integer :seo_meta_id + t.string :seo_meta_type + + t.string :browser_title + t.string :meta_keywords + t.text :meta_description + + t.timestamps + end + + add_index :seo_meta, :id + add_index :seo_meta, [:seo_meta_id, :seo_meta_type] + + # Grab the attributes of the records that currently exist + existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) + + # Remove columns + ::SeoMeta.attributes.keys.each do |field| + if ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) + remove_column ::Refinery::Page.translation_class.table_name, field + end + end + + # Reset column information because otherwise the old columns will still exist. + ::Refinery::Page.translation_class.reset_column_information + + # Re-attach seo_meta + ::Refinery::Page.translation_class.send :is_seo_meta + + # Migrate data + existing_translations.each do |translation| + ::Refinery::Page.translation_class.find(translation['id']).update_attributes( + ::SeoMeta.attributes.keys.inject({}) {|attributes, name| + attributes.merge(name => translation[name.to_s]) + } + ) + end + + # Reset column information again because otherwise the old columns will still exist. + ::Refinery::Page.reset_column_information + end + + def self.down + # Grab the attributes of the records that currently exist + existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) + + # Add columns back to your model + ::SeoMeta.attributes.each do |field, field_type| + unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) + add_column ::Refinery::Page.translation_class.table_name, field, field_type + end + end + + # Reset column information because otherwise the new columns won't exist yet. + ::Refinery::Page.translation_class.reset_column_information + + # Migrate data + existing_translations.each do |translation| + ::Refinery::Page.translation_class.update_all( + ::SeoMeta.attributes.keys.inject({}) {|attributes, name| + attributes.merge(name => translation[name.to_s]) + }, :id => translation['id'] + ) + end + + ::SeoMeta.attributes.keys.each do |k| + ::Refinery::Page.translation_class.module_eval %{ + def #{k} + end + + def #{k}=(*args) + end + } + end + + # Reset column information again because otherwise the old columns will still exist. + ::Refinery::Page.reset_column_information + + drop_table :seo_meta + end + +end diff --git a/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb b/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb new file mode 100644 index 0000000..eb98ed1 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb @@ -0,0 +1,11 @@ +class CreateAddTemplateColumns < ActiveRecord::Migration + def self.up + add_column ::Refinery::Page.table_name, :view_template, :string + add_column ::Refinery::Page.table_name, :layout_template, :string + end + + def self.down + remove_column ::Refinery::Page.table_name, :layout_template + remove_column ::Refinery::Page.table_name, :view_template + end +end diff --git a/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb b/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb new file mode 100644 index 0000000..360f469 --- /dev/null +++ b/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb @@ -0,0 +1,21 @@ +class CreateRefinerycmsResourcesSchema < ActiveRecord::Migration + def self.up + create_table ::Refinery::Resource.table_name, :force => true do |t| + t.string "file_mime_type" + t.string "file_name" + t.integer "file_size" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_uid" + t.string "file_ext" + end unless ::Refinery::Resource.table_exists? + end + + def self.down + [::Resource].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb new file mode 100644 index 0000000..3068a6b --- /dev/null +++ b/spec/dummy/db/schema.rb @@ -0,0 +1,239 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20110803223529) do + + create_table "refinery_blog_categories", :force => true do |t| + t.string "title" + t.datetime "created_at" + t.datetime "updated_at" + t.string "cached_slug" + end + + add_index "refinery_blog_categories", ["id"], :name => "index_refinery_blog_categories_on_id" + + create_table "refinery_blog_categories_blog_posts", :force => true do |t| + t.integer "blog_category_id" + t.integer "blog_post_id" + end + + add_index "refinery_blog_categories_blog_posts", ["blog_category_id", "blog_post_id"], :name => "index_blog_categories_blog_posts_on_bc_and_bp" + + create_table "refinery_blog_comments", :force => true do |t| + t.integer "blog_post_id" + t.boolean "spam" + t.string "name" + t.string "email" + t.text "body" + t.string "state" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_blog_comments", ["id"], :name => "index_refinery_blog_comments_on_id" + + create_table "refinery_blog_posts", :force => true do |t| + t.string "title" + t.text "body" + t.boolean "draft" + t.datetime "published_at" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "user_id" + t.string "cached_slug" + t.string "custom_url" + t.text "custom_teaser" + end + + add_index "refinery_blog_posts", ["id"], :name => "index_refinery_blog_posts_on_id" + + create_table "refinery_images", :force => true do |t| + t.string "image_mime_type" + t.string "image_name" + t.integer "image_size" + t.integer "image_width" + t.integer "image_height" + t.datetime "created_at" + t.datetime "updated_at" + t.string "image_uid" + t.string "image_ext" + end + + create_table "refinery_page_part_translations", :force => true do |t| + t.integer "refinery_page_part_id" + t.string "locale" + t.text "body" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_page_part_translations", ["refinery_page_part_id"], :name => "index_f9716c4215584edbca2557e32706a5ae084a15ef" + + create_table "refinery_page_parts", :force => true do |t| + t.integer "refinery_page_id" + t.string "title" + t.text "body" + t.integer "position" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_page_parts", ["id"], :name => "index_refinery_page_parts_on_id" + add_index "refinery_page_parts", ["refinery_page_id"], :name => "index_refinery_page_parts_on_page_id" + + create_table "refinery_page_translations", :force => true do |t| + t.integer "refinery_page_id" + t.string "locale" + t.string "title" + t.string "custom_title" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_page_translations", ["refinery_page_id"], :name => "index_d079468f88bff1c6ea81573a0d019ba8bf5c2902" + + create_table "refinery_pages", :force => true do |t| + t.integer "parent_id" + t.integer "position" + t.string "path" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "show_in_menu", :default => true + t.string "link_url" + t.string "menu_match" + t.boolean "deletable", :default => true + t.string "custom_title_type", :default => "none" + t.boolean "draft", :default => false + t.boolean "skip_to_first_child", :default => false + t.integer "lft" + t.integer "rgt" + t.integer "depth" + t.string "view_template" + t.string "layout_template" + end + + add_index "refinery_pages", ["depth"], :name => "index_refinery_pages_on_depth" + add_index "refinery_pages", ["id"], :name => "index_refinery_pages_on_id" + add_index "refinery_pages", ["lft"], :name => "index_refinery_pages_on_lft" + add_index "refinery_pages", ["parent_id"], :name => "index_refinery_pages_on_parent_id" + add_index "refinery_pages", ["rgt"], :name => "index_refinery_pages_on_rgt" + + create_table "refinery_resources", :force => true do |t| + t.string "file_mime_type" + t.string "file_name" + t.integer "file_size" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_uid" + t.string "file_ext" + end + + create_table "refinery_roles", :force => true do |t| + t.string "title" + end + + create_table "refinery_roles_users", :id => false, :force => true do |t| + t.integer "user_id" + t.integer "role_id" + end + + add_index "refinery_roles_users", ["role_id", "user_id"], :name => "index_refinery_roles_users_on_role_id_and_user_id" + add_index "refinery_roles_users", ["user_id", "role_id"], :name => "index_refinery_roles_users_on_user_id_and_role_id" + + create_table "refinery_settings", :force => true do |t| + t.string "name" + t.text "value" + t.boolean "destroyable", :default => true + t.datetime "created_at" + t.datetime "updated_at" + t.string "scoping" + t.boolean "restricted", :default => false + t.string "callback_proc_as_string" + t.string "form_value_type" + end + + add_index "refinery_settings", ["name"], :name => "index_refinery_settings_on_name" + + create_table "refinery_user_plugins", :force => true do |t| + t.integer "user_id" + t.string "name" + t.integer "position" + end + + add_index "refinery_user_plugins", ["name"], :name => "index_refinery_user_plugins_on_title" + add_index "refinery_user_plugins", ["user_id", "name"], :name => "index_unique_refinery_user_plugins", :unique => true + + create_table "refinery_users", :force => true do |t| + t.string "username", :null => false + t.string "email", :null => false + t.string "encrypted_password", :null => false + t.string "persistence_token" + t.datetime "created_at" + t.datetime "updated_at" + t.string "perishable_token" + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.integer "sign_in_count" + t.string "remember_token" + t.string "reset_password_token" + t.datetime "remember_created_at" + end + + add_index "refinery_users", ["id"], :name => "index_refinery_users_on_id" + + create_table "seo_meta", :force => true do |t| + t.integer "seo_meta_id" + t.string "seo_meta_type" + t.string "browser_title" + t.string "meta_keywords" + t.text "meta_description" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "seo_meta", ["id"], :name => "index_seo_meta_on_id" + add_index "seo_meta", ["seo_meta_id", "seo_meta_type"], :name => "index_seo_meta_on_seo_meta_id_and_seo_meta_type" + + create_table "slugs", :force => true do |t| + t.string "name" + t.integer "sluggable_id" + t.integer "sequence", :default => 1, :null => false + t.string "sluggable_type", :limit => 40 + t.string "scope", :limit => 40 + t.datetime "created_at" + t.string "locale" + end + + add_index "slugs", ["locale"], :name => "index_slugs_on_locale" + add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_n_s_s_and_s", :unique => true + add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id" + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context" + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + + create_table "tags", :force => true do |t| + t.string "name" + end + +end diff --git a/spec/dummy/db/seeds.rb b/spec/dummy/db/seeds.rb new file mode 100644 index 0000000..a158e52 --- /dev/null +++ b/spec/dummy/db/seeds.rb @@ -0,0 +1,5 @@ +# Refinery seeds +Dir[Rails.root.join('db', 'seeds', '*.rb').to_s].each do |file| + puts "Loading db/seeds/#{file.split(File::SEPARATOR).last}" + load(file) +end diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb new file mode 100644 index 0000000..668687f --- /dev/null +++ b/spec/dummy/db/seeds/pages.rb @@ -0,0 +1,63 @@ +module Refinery + ::Refinery::Page.reset_column_information + + # Check whether all columns are applied yet by seo_meta. + unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k| + ::Refinery::Page.translation_class.instance_methods.include?(k) + } + # Make pages model seo_meta because not all columns are accessible. + ::Refinery::Page.translation_class.send :is_seo_meta + end + + page_position = -1 + + unless ::Refinery::Page.where(:menu_match => "^/$").any? + home_page = ::Refinery::Page.create!({:title => "Home", + :deletable => false, + :link_url => "/", + :menu_match => "^/$", + :position => (page_position += 1)}) + home_page.parts.create({ + :title => "Body", + :body => "

Welcome to our site. This is just a place holder page while we gather our content.

", + :position => 0 + }) + home_page.parts.create({ + :title => "Side Body", + :body => "

This is another block of content over here.

", + :position => 1 + }) + + home_page_position = -1 + page_not_found_page = home_page.children.create(:title => "Page not found", + :menu_match => "^/404$", + :show_in_menu => false, + :deletable => false, + :position => (home_page_position += 1)) + page_not_found_page.parts.create({ + :title => "Body", + :body => "

Sorry, there was a problem...

The page you requested was not found.

Return to the home page

", + :position => 0 + }) + else + page_position += 1 + end + + unless ::Refinery::Page.by_title("About").any? + about_us_page = ::Refinery::Page.create(:title => "About", + :deletable => true, + :position => (page_position += 1)) + about_us_page.parts.create({ + :title => "Body", + :body => "

This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.

", + :position => 0 + }) + about_us_page.parts.create({ + :title => "Side Body", + :body => "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.

", + :position => 1 + }) + else + page_position += 1 + end +end diff --git a/spec/dummy/lib/assets/.gitkeep b/spec/dummy/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/log/.gitkeep b/spec/dummy/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/public/404.html b/spec/dummy/public/404.html new file mode 100644 index 0000000..9a48320 --- /dev/null +++ b/spec/dummy/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/spec/dummy/public/422.html b/spec/dummy/public/422.html new file mode 100644 index 0000000..83660ab --- /dev/null +++ b/spec/dummy/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/spec/dummy/public/500.html b/spec/dummy/public/500.html new file mode 100644 index 0000000..b80307f --- /dev/null +++ b/spec/dummy/public/500.html @@ -0,0 +1,26 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+

We've been notified about this issue and we'll take a look at it shortly.

+
+ + diff --git a/spec/dummy/public/favicon.ico b/spec/dummy/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/script/rails b/spec/dummy/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/spec/dummy/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/spec/support/refinery/factories/blog_categories.rb b/spec/factories/blog_categories.rb similarity index 100% rename from spec/support/refinery/factories/blog_categories.rb rename to spec/factories/blog_categories.rb diff --git a/spec/support/refinery/factories/blog_comments.rb b/spec/factories/blog_comments.rb similarity index 100% rename from spec/support/refinery/factories/blog_comments.rb rename to spec/factories/blog_comments.rb diff --git a/spec/support/refinery/factories/blog_posts.rb b/spec/factories/blog_posts.rb similarity index 100% rename from spec/support/refinery/factories/blog_posts.rb rename to spec/factories/blog_posts.rb diff --git a/spec/factories/user.rb b/spec/factories/user.rb new file mode 100644 index 0000000..94fe1d0 --- /dev/null +++ b/spec/factories/user.rb @@ -0,0 +1,27 @@ +require 'refinerycms/all' +require 'refinery/role' + +Factory.define :user, :class => ::Refinery::User do |u| + u.sequence(:username) { |n| "person#{n}" } + u.sequence(:email) { |n| "person#{n}@cucumber.com" } + u.password "greenandjuicy" + u.password_confirmation "greenandjuicy" +end + +Factory.define :refinery_user, :parent => :user do |u| + u.roles { [ ::Refinery::Role[:refinery] ] } + + u.after_create do |user| + ::Refinery::Plugins.registered.each_with_index do |plugin, index| + user.plugins.create(:name => plugin.name, :position => index) + end + end +end + +Factory.define :refinery_translator, :parent => :user do |u| + u.roles { [ ::Refinery::Role[:refinery], ::Refinery::Role[:translator] ] } + + u.after_create do |user| + user.plugins.create(:name => 'refinery_pages', :position => 0) + end +end diff --git a/spec/models/refinery/blog_post_spec.rb b/spec/models/refinery/blog_post_spec.rb index d5000f1..2501a24 100644 --- a/spec/models/refinery/blog_post_spec.rb +++ b/spec/models/refinery/blog_post_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' module Refinery - describe BlogPost do - let(:blog_post ) { Factory.create(:blog_post) } + describe BlogPost do + let(:blog_post) { Factory.create(:blog_post) } describe "validations" do it "requires title" do diff --git a/spec/rcov.opts b/spec/rcov.opts new file mode 100644 index 0000000..274ed51 --- /dev/null +++ b/spec/rcov.opts @@ -0,0 +1,2 @@ +--exclude "spec/*,gems/*" +--rails \ No newline at end of file diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb index 2ba5f82..33d330b 100644 --- a/spec/requests/blog_categories_spec.rb +++ b/spec/requests/blog_categories_spec.rb @@ -1,9 +1,8 @@ require "spec_helper" describe "blog categories" do - login_refinery_user - before(:each) do + Factory.create(:refinery_user) @blog_post = Factory(:blog_post, :title => "Refinery CMS blog post") @blog_category = Factory(:blog_category, :title => "Video Games") @blog_post.categories << @blog_category @@ -17,5 +16,4 @@ describe "blog categories" do page.should have_content("Video Games") end end - end diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb index e7ab573..8695d9a 100644 --- a/spec/requests/blog_posts_spec.rb +++ b/spec/requests/blog_posts_spec.rb @@ -1,22 +1,22 @@ require "spec_helper" -describe "blog" do - login_refinery_user - - it "displays the blog rss feed" do - get blog_rss_feed_path - response.should be_success - response.content_type.should eq("application/rss+xml") +describe "blog posts" do + before(:each) do + Factory.create(:refinery_user) end - - describe "posts" do - let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } - - context "has blog posts" do - it "Displays blog post" do - visit blog_post_path(blog_post) - page.should have_content("Refinery CMS blog post") - end + + context "when has blog posts" do + let(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } + + it "should display blog post" do + visit blog_post_path(blog_post) + page.should have_content("Refinery CMS blog post") + end + + it "should display the blog rss feed" do + get blog_rss_feed_path + response.should be_success + response.content_type.should eq("application/rss+xml") end end end diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 724cc59..8b1097d 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -1,7 +1,14 @@ require "spec_helper" describe "manage blog posts" do - login_refinery_user + # TODO: share this with other request specs + before(:each) do + user = Factory.create(:refinery_user) + visit new_refinery_user_session_url + fill_in "Login", :with => user.username + fill_in "Password", :with => user.password + click_button "Sign in" + end let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..441da1d --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,48 @@ +require 'rubygems' +require 'spork' + +Spork.prefork do + # Loading more in this block will cause your tests to run faster. However, + # if you change any configuration or code from libraries loaded here, you'll + # need to restart spork for it take effect. + + # Configure Rails Environment + ENV["RAILS_ENV"] ||= 'test' + require File.expand_path("../dummy/config/environment.rb", __FILE__) + + require 'rspec/rails' + require 'capybara/rspec' + require 'factory_girl' + require 'devise' + require 'database_cleaner' + + Rails.backtrace_cleaner.remove_silencers! + + Dir[ + File.expand_path("../support/*.rb", __FILE__), + File.expand_path("../factories/*.rb", __FILE__) + ].each {|f| require f} + + RSpec.configure do |config| + config.mock_with :rspec + config.use_transactional_fixtures = false + + config.before(:suite) do + DatabaseCleaner.strategy = :truncation + end + + config.before(:each) do + DatabaseCleaner.start + end + + config.after(:each) do + DatabaseCleaner.clean + end + + config.include Devise::TestHelpers, :type => :controller + end +end + +Spork.each_run do + # This code will be run each time you run your specs. +end From 5e24eeb3d24a2722673fe1acba08257fbf0f71a2 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 18:27:20 -0700 Subject: [PATCH 028/248] Update README with additional development instructions --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index f5f0e53..11e9c53 100644 --- a/readme.md +++ b/readme.md @@ -31,6 +31,8 @@ Finally migrate your database and you're done. ## Developing & Contributing +The version of Refinery to develop this engine against is defined in the gemspec. To override the version of refinery to develop against, edit the project Gemfile to point to a local path containing a clone of refinerycms. + ### Testing Setup the test environment From 00d71519a953a8f20bb15b84c133e01772690c2a Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 19:02:16 -0700 Subject: [PATCH 029/248] Rid this project of autotest --- spec/dummy/autotest/autotest.rb | 17 ----------------- spec/dummy/autotest/discover.rb | 2 -- 2 files changed, 19 deletions(-) delete mode 100644 spec/dummy/autotest/autotest.rb delete mode 100644 spec/dummy/autotest/discover.rb diff --git a/spec/dummy/autotest/autotest.rb b/spec/dummy/autotest/autotest.rb deleted file mode 100644 index 09f5b8a..0000000 --- a/spec/dummy/autotest/autotest.rb +++ /dev/null @@ -1,17 +0,0 @@ -### uncomment any of the following requires applicable for your system -### and then copy this to .autotest if you are using the ZenTest autotest. -# require "autotest/restart" -# require "test_notifier/runner/autotest" -# require "redgreen/autotest" -# require "autotest/timestamp" - -# adds exceptions from .gitignore file, please modify exceptions there! -imported_exceptions = IO.readlines('.gitignore').inject([]) do |acc, line| - acc << line.strip if line.to_s[0] != '#' && line.strip != ''; acc -end - -Autotest.add_hook :initialize do |autotest| - imported_exceptions.each do |exception| - autotest.add_exception(exception) - end -end diff --git a/spec/dummy/autotest/discover.rb b/spec/dummy/autotest/discover.rb deleted file mode 100644 index f421dc5..0000000 --- a/spec/dummy/autotest/discover.rb +++ /dev/null @@ -1,2 +0,0 @@ -Autotest.add_discovery { "rails" } -Autotest.add_discovery { "rspec2" } From 13c35c262072c06a97b178c9c9cabbe2482ac649 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 19:02:27 -0700 Subject: [PATCH 030/248] rename default database for mysql and postgres example databases --- spec/dummy/config/database.yml.mysql | 6 +++--- spec/dummy/config/database.yml.postgresql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/dummy/config/database.yml.mysql b/spec/dummy/config/database.yml.mysql index 75cca95..4a15c05 100644 --- a/spec/dummy/config/database.yml.mysql +++ b/spec/dummy/config/database.yml.mysql @@ -3,18 +3,18 @@ development: &development host: localhost username: root password: - database: your_local_database + database: refinerycms_blog_development test: &test adapter: mysql2 host: localhost username: root password: - database: your_test_database + database: refinerycms_blog_test production: &production adapter: mysql2 host: localhost - database: your_production_database + database: refinerycms_blog_production username: your_production_database_login password: your_production_database_password diff --git a/spec/dummy/config/database.yml.postgresql b/spec/dummy/config/database.yml.postgresql index 2146d1f..0556b23 100644 --- a/spec/dummy/config/database.yml.postgresql +++ b/spec/dummy/config/database.yml.postgresql @@ -15,7 +15,7 @@ development: adapter: postgresql encoding: unicode - database: refinery_database_development + database: refinerycms_blog_development pool: 5 username: postgres password: postgres @@ -41,7 +41,7 @@ development: test: adapter: postgresql encoding: unicode - database: refinery_database_test + database: refinerycms_blog_test pool: 5 username: postgres password: postgres @@ -49,7 +49,7 @@ test: production: adapter: postgresql encoding: unicode - database: refinery_database_production + database: refinerycms_blog_production pool: 5 username: postgres password: postgres From 274ba14ea24d2e59a4ddf2e09fd94fa9246f1c55 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 19:18:19 -0700 Subject: [PATCH 031/248] refactor dummy application into git submodule --- .gitmodules | 3 + spec/dummy | 1 + spec/dummy/.gitignore | 77 ------ spec/dummy/Rakefile | 7 - spec/dummy/app/assets/javascripts/admin.js | 7 - .../app/assets/javascripts/application.js | 9 - .../app/assets/stylesheets/application.css | 1 - .../assets/stylesheets/application.css.backup | 1 - .../app/assets/stylesheets/formatting.css | 4 - spec/dummy/app/assets/stylesheets/home.css | 4 - spec/dummy/app/assets/stylesheets/theme.css | 4 - .../app/controllers/application_controller.rb | 3 - spec/dummy/app/helpers/application_helper.rb | 2 - spec/dummy/app/mailers/.gitkeep | 0 spec/dummy/app/models/.gitkeep | 0 .../views/layouts/application.html.erb.backup | 14 - .../dummy/app/views/sitemap/index.xml.builder | 25 -- spec/dummy/config.ru | 4 - spec/dummy/config/application.rb | 42 --- spec/dummy/config/boot.rb | 10 - spec/dummy/config/database.yml | 25 -- spec/dummy/config/database.yml.mysql | 20 -- spec/dummy/config/database.yml.postgresql | 55 ---- spec/dummy/config/database.yml.sqlite3 | 26 -- spec/dummy/config/environment.rb | 5 - spec/dummy/config/environments/development.rb | 31 --- spec/dummy/config/environments/production.rb | 55 ---- spec/dummy/config/environments/test.rb | 43 ---- .../initializers/backtrace_silencers.rb | 7 - spec/dummy/config/initializers/devise.rb | 144 ----------- spec/dummy/config/initializers/inflections.rb | 10 - spec/dummy/config/initializers/mime_types.rb | 5 - .../dummy/config/initializers/secret_token.rb | 7 - .../config/initializers/session_store.rb | 8 - .../config/initializers/wrap_parameters.rb | 12 - spec/dummy/config/locales/en.yml | 5 - spec/dummy/config/routes.rb | 58 ----- ...02081556_create_refinerycms_core_schema.rb | 23 -- .../20110802081557_add_locale_to_slugs.rb | 13 - ...1558_create_refinerycms_settings_schema.rb | 24 -- ...559_add_value_type_to_refinery_settings.rb | 9 - ...reate_refinerycms_authentication_schema.rb | 48 ---- ...1561_add_missing_indexes_to_roles_users.rb | 11 - ...0802081562_change_to_devise_users_table.rb | 31 --- ...081563_add_remember_created_at_to_users.rb | 5 - ...2081564_remove_password_salt_from_users.rb | 13 - ...081565_create_refinerycms_images_schema.rb | 23 -- ...2081566_create_refinerycms_pages_schema.rb | 56 ---- .../20110802081567_translate_page_plugin.rb | 38 --- ...802081568_remove_cached_slug_from_pages.rb | 11 - ...2081569_translate_custom_title_on_pages.rb | 26 -- ...570_remove_translated_fields_from_pages.rb | 13 - .../migrate/20110802081571_create_seo_meta.rb | 86 ------- ...10802081572_create_add_template_columns.rb | 11 - ...573_create_refinerycms_resources_schema.rb | 21 -- spec/dummy/db/schema.rb | 239 ------------------ spec/dummy/db/seeds.rb | 5 - spec/dummy/db/seeds/pages.rb | 63 ----- spec/dummy/lib/assets/.gitkeep | 0 spec/dummy/log/.gitkeep | 0 spec/dummy/public/404.html | 26 -- spec/dummy/public/422.html | 26 -- spec/dummy/public/500.html | 26 -- spec/dummy/public/favicon.ico | 0 spec/dummy/script/rails | 6 - 65 files changed, 4 insertions(+), 1583 deletions(-) create mode 100644 .gitmodules create mode 160000 spec/dummy delete mode 100644 spec/dummy/.gitignore delete mode 100644 spec/dummy/Rakefile delete mode 100644 spec/dummy/app/assets/javascripts/admin.js delete mode 100644 spec/dummy/app/assets/javascripts/application.js delete mode 100644 spec/dummy/app/assets/stylesheets/application.css delete mode 100644 spec/dummy/app/assets/stylesheets/application.css.backup delete mode 100644 spec/dummy/app/assets/stylesheets/formatting.css delete mode 100644 spec/dummy/app/assets/stylesheets/home.css delete mode 100644 spec/dummy/app/assets/stylesheets/theme.css delete mode 100644 spec/dummy/app/controllers/application_controller.rb delete mode 100644 spec/dummy/app/helpers/application_helper.rb delete mode 100644 spec/dummy/app/mailers/.gitkeep delete mode 100644 spec/dummy/app/models/.gitkeep delete mode 100644 spec/dummy/app/views/layouts/application.html.erb.backup delete mode 100644 spec/dummy/app/views/sitemap/index.xml.builder delete mode 100644 spec/dummy/config.ru delete mode 100644 spec/dummy/config/application.rb delete mode 100644 spec/dummy/config/boot.rb delete mode 100644 spec/dummy/config/database.yml delete mode 100644 spec/dummy/config/database.yml.mysql delete mode 100644 spec/dummy/config/database.yml.postgresql delete mode 100644 spec/dummy/config/database.yml.sqlite3 delete mode 100644 spec/dummy/config/environment.rb delete mode 100644 spec/dummy/config/environments/development.rb delete mode 100644 spec/dummy/config/environments/production.rb delete mode 100644 spec/dummy/config/environments/test.rb delete mode 100644 spec/dummy/config/initializers/backtrace_silencers.rb delete mode 100644 spec/dummy/config/initializers/devise.rb delete mode 100644 spec/dummy/config/initializers/inflections.rb delete mode 100644 spec/dummy/config/initializers/mime_types.rb delete mode 100644 spec/dummy/config/initializers/secret_token.rb delete mode 100644 spec/dummy/config/initializers/session_store.rb delete mode 100644 spec/dummy/config/initializers/wrap_parameters.rb delete mode 100644 spec/dummy/config/locales/en.yml delete mode 100644 spec/dummy/config/routes.rb delete mode 100644 spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb delete mode 100644 spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb delete mode 100644 spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb delete mode 100644 spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb delete mode 100644 spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb delete mode 100644 spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb delete mode 100644 spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb delete mode 100644 spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb delete mode 100644 spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb delete mode 100644 spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb delete mode 100644 spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb delete mode 100644 spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb delete mode 100644 spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb delete mode 100644 spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb delete mode 100644 spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb delete mode 100644 spec/dummy/db/migrate/20110802081571_create_seo_meta.rb delete mode 100644 spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb delete mode 100644 spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb delete mode 100644 spec/dummy/db/schema.rb delete mode 100644 spec/dummy/db/seeds.rb delete mode 100644 spec/dummy/db/seeds/pages.rb delete mode 100644 spec/dummy/lib/assets/.gitkeep delete mode 100644 spec/dummy/log/.gitkeep delete mode 100644 spec/dummy/public/404.html delete mode 100644 spec/dummy/public/422.html delete mode 100644 spec/dummy/public/500.html delete mode 100644 spec/dummy/public/favicon.ico delete mode 100755 spec/dummy/script/rails diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4d704f3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "spec/dummy"] + path = spec/dummy + url = git://github.com/enmasse-entertainment/refinerycms-engine-dummy.git diff --git a/spec/dummy b/spec/dummy new file mode 160000 index 0000000..84d6635 --- /dev/null +++ b/spec/dummy @@ -0,0 +1 @@ +Subproject commit 84d66350ec474665e7d436dca479a142b091f874 diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore deleted file mode 100644 index 55ff259..0000000 --- a/spec/dummy/.gitignore +++ /dev/null @@ -1,77 +0,0 @@ -# Rails -.bundle -db/*.sqlite3 -db/*.sqlite3-journal -*.log -tmp -tmp/**/* - -# Documentation -doc/api -doc/app -.yardoc -.yardopts -coverage - -# Public Uploads -public/system/* -public/themes/* - -# Public Cache -public/javascripts/cache -public/stylesheets/cache - -# Vendor Cache -vendor/cache - -# Acts as Indexed -index/**/* - -# Refinery Specific -*.tmproj -*.autobackupbyrefinery.* -refinerycms-*.gem -.autotest - -# Mac -.DS_Store - -# Windows -Thumbs.db - -# NetBeans -nbproject - -# Eclipse -.project - -# Redcar -.redcar - -# Rubinius -*.rbc - -# Vim -*.swp -*.swo - -# RubyMine -.idea - -# E-texteditor -.eprj - -# Backup -*~ - -# Capybara Bug -capybara-*html - -# sass -.sass-cache -.sass-cache/* - -#rvm -.rvmrc -.rvmrc.* - diff --git a/spec/dummy/Rakefile b/spec/dummy/Rakefile deleted file mode 100644 index 3645852..0000000 --- a/spec/dummy/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -Dummy::Application.load_tasks diff --git a/spec/dummy/app/assets/javascripts/admin.js b/spec/dummy/app/assets/javascripts/admin.js deleted file mode 100644 index 23c4fb9..0000000 --- a/spec/dummy/app/assets/javascripts/admin.js +++ /dev/null @@ -1,7 +0,0 @@ -// Use this to customize the wymeditor boot process -// Just mirror the options specified in boot_wym.js with the new options here. -// This will completely override anything specified in boot_wym.js for that key. -// e.g. skin: 'something_else' -var custom_wymeditor_boot_options = { - -}; \ No newline at end of file diff --git a/spec/dummy/app/assets/javascripts/application.js b/spec/dummy/app/assets/javascripts/application.js deleted file mode 100644 index 37c7bfc..0000000 --- a/spec/dummy/app/assets/javascripts/application.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require_tree . diff --git a/spec/dummy/app/assets/stylesheets/application.css b/spec/dummy/app/assets/stylesheets/application.css deleted file mode 100644 index 8b13789..0000000 --- a/spec/dummy/app/assets/stylesheets/application.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spec/dummy/app/assets/stylesheets/application.css.backup b/spec/dummy/app/assets/stylesheets/application.css.backup deleted file mode 100644 index 8b13789..0000000 --- a/spec/dummy/app/assets/stylesheets/application.css.backup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spec/dummy/app/assets/stylesheets/formatting.css b/spec/dummy/app/assets/stylesheets/formatting.css deleted file mode 100644 index 1132188..0000000 --- a/spec/dummy/app/assets/stylesheets/formatting.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery formatting below. - Formatting applies to backend WYSIWYG editors and all frontend. -*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/home.css b/spec/dummy/app/assets/stylesheets/home.css deleted file mode 100644 index 824db99..0000000 --- a/spec/dummy/app/assets/stylesheets/home.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery homepage styles here. - These only apply to the homepage of your site. -*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/theme.css b/spec/dummy/app/assets/stylesheets/theme.css deleted file mode 100644 index 8205050..0000000 --- a/spec/dummy/app/assets/stylesheets/theme.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery 'theme' styles here. - These only apply when using custom WYMeditor CSS. -*/ \ No newline at end of file diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb deleted file mode 100644 index e8065d9..0000000 --- a/spec/dummy/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/spec/dummy/app/helpers/application_helper.rb b/spec/dummy/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/spec/dummy/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/spec/dummy/app/mailers/.gitkeep b/spec/dummy/app/mailers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/models/.gitkeep b/spec/dummy/app/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/views/layouts/application.html.erb.backup b/spec/dummy/app/views/layouts/application.html.erb.backup deleted file mode 100644 index 9a8a761..0000000 --- a/spec/dummy/app/views/layouts/application.html.erb.backup +++ /dev/null @@ -1,14 +0,0 @@ - - - - Dummy - <%= stylesheet_link_tag "application" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/spec/dummy/app/views/sitemap/index.xml.builder b/spec/dummy/app/views/sitemap/index.xml.builder deleted file mode 100644 index 8e89852..0000000 --- a/spec/dummy/app/views/sitemap/index.xml.builder +++ /dev/null @@ -1,25 +0,0 @@ -xml.instruct! - -xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do - - @locales.each do |locale| - ::I18n.locale = locale - ::Refinery::Page.live.in_menu.includes(:parts).each do |page| - # exclude sites that are external to our own domain. - page_url = if page.url.is_a?(Hash) - # This is how most pages work without being overriden by link_url - page.url.merge({:only_path => false}) - elsif page.url.to_s !~ /^http/ - # handle relative link_url addresses. - [request.protocol, request.host_with_port, page.url].join - end - - # Add XML entry only if there is a valid page_url found above. - xml.url do - xml.loc url_for(page_url) - xml.lastmod page.updated_at.to_date - end if page_url.present? and page.show_in_menu? - end - end - -end diff --git a/spec/dummy/config.ru b/spec/dummy/config.ru deleted file mode 100644 index 1989ed8..0000000 --- a/spec/dummy/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Dummy::Application diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb deleted file mode 100644 index f83ab50..0000000 --- a/spec/dummy/config/application.rb +++ /dev/null @@ -1,42 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -Bundler.require -require "refinerycms-blog" - -module Dummy - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable the asset pipeline - config.assets.enabled = true - end -end - diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb deleted file mode 100644 index eba0681..0000000 --- a/spec/dummy/config/boot.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'rubygems' -gemfile = File.expand_path('../../../../Gemfile', __FILE__) - -if File.exist?(gemfile) - ENV['BUNDLE_GEMFILE'] = gemfile - require 'bundler' - Bundler.setup -end - -$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml deleted file mode 100644 index 51a4dd4..0000000 --- a/spec/dummy/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 diff --git a/spec/dummy/config/database.yml.mysql b/spec/dummy/config/database.yml.mysql deleted file mode 100644 index 4a15c05..0000000 --- a/spec/dummy/config/database.yml.mysql +++ /dev/null @@ -1,20 +0,0 @@ -development: &development - adapter: mysql2 - host: localhost - username: root - password: - database: refinerycms_blog_development - -test: &test - adapter: mysql2 - host: localhost - username: root - password: - database: refinerycms_blog_test - -production: &production - adapter: mysql2 - host: localhost - database: refinerycms_blog_production - username: your_production_database_login - password: your_production_database_password diff --git a/spec/dummy/config/database.yml.postgresql b/spec/dummy/config/database.yml.postgresql deleted file mode 100644 index 0556b23..0000000 --- a/spec/dummy/config/database.yml.postgresql +++ /dev/null @@ -1,55 +0,0 @@ -# PostgreSQL. Versions 7.4 and 8.x are supported. -# -# Install the pg driver: -# gem install pg -# On Mac OS X with macports: -# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config -# On Windows: -# gem install pg -# Choose the win32 build. -# Install PostgreSQL and put its /bin directory on your path. -# -# Configure Using Gemfile -# gem 'pg' -# -development: - adapter: postgresql - encoding: unicode - database: refinerycms_blog_development - pool: 5 - username: postgres - password: postgres - - # Connect on a TCP socket. Omitted by default since the client uses a - # domain socket that doesn't need configuration. Windows does not have - # domain sockets, so uncomment these lines. - #host: localhost - #port: 5432 - - # Schema search path. The server defaults to $user,public - #schema_search_path: myapp,sharedapp,public - - # Minimum log levels, in increasing order: - # debug5, debug4, debug3, debug2, debug1, - # log, notice, warning, error, fatal, and panic - # The server defaults to notice. - #min_messages: warning - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: postgresql - encoding: unicode - database: refinerycms_blog_test - pool: 5 - username: postgres - password: postgres - -production: - adapter: postgresql - encoding: unicode - database: refinerycms_blog_production - pool: 5 - username: postgres - password: postgres diff --git a/spec/dummy/config/database.yml.sqlite3 b/spec/dummy/config/database.yml.sqlite3 deleted file mode 100644 index c2da158..0000000 --- a/spec/dummy/config/database.yml.sqlite3 +++ /dev/null @@ -1,26 +0,0 @@ -# SQLite version 3.x -development: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/development.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'test' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -test: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/test.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'cucumber' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -cucumber: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/cucumber.sqlite3 - timeout: 5000 - -production: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/production.sqlite3 - timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb deleted file mode 100644 index 3da5eb9..0000000 --- a/spec/dummy/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -Dummy::Application.initialize! diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb deleted file mode 100644 index 8604338..0000000 --- a/spec/dummy/config/environments/development.rb +++ /dev/null @@ -1,31 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Do not compress assets - config.assets.compress = false -end -Refinery.rescue_not_found = false -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb deleted file mode 100644 index 17a630b..0000000 --- a/spec/dummy/config/environments/production.rb +++ /dev/null @@ -1,55 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = true # Refinery CMS requires this to be true - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Specifies the header that your server uses for sending files - # (comment out if your front-end server doesn't support this) - config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify -end -Refinery.rescue_not_found = true -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb deleted file mode 100644 index 9e84bae..0000000 --- a/spec/dummy/config/environments/test.rb +++ /dev/null @@ -1,43 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = false - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end -Refinery.rescue_not_found = false -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/initializers/backtrace_silencers.rb b/spec/dummy/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cd..0000000 --- a/spec/dummy/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/dummy/config/initializers/devise.rb b/spec/dummy/config/initializers/devise.rb deleted file mode 100644 index 0d00106..0000000 --- a/spec/dummy/config/initializers/devise.rb +++ /dev/null @@ -1,144 +0,0 @@ -require 'devise' - -# Use this hook to configure devise mailer, warden hooks and so forth. The first -# four configuration values can also be set straight in your models. -::Devise.setup do |config| - # ==> Mailer Configuration - # Configure the e-mail address which will be shown in DeviseMailer. - # config.mailer_sender = "please-change-me@config-initializers-devise.com" - - # Configure the class responsible to send e-mails. - # config.mailer = "::Devise::Mailer" - - # ==> ORM configuration - # Load and configure the ORM. Supports :active_record (default) and - # :mongoid (bson_ext recommended) by default. Other ORMs may be - # available as additional gems. - require 'devise/orm/active_record' - - # ==> Configuration for any authentication mechanism - # Configure which keys are used when authenticating an user. By default is - # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating an user, both parameters are required. Remember that those - # parameters are used only when authenticating and not when retrieving from - # session. If you need permissions, you should implement that in a before filter. - config.authentication_keys = [ :login ] - - # Tell if authentication through request.params is enabled. True by default. - # config.params_authenticatable = true - - # Tell if authentication through HTTP Basic Auth is enabled. False by default. - # config.http_authenticatable = false - - # Set this to true to use Basic Auth for AJAX requests. True by default. - # config.http_authenticatable_on_xhr = true - - # The realm used in Http Basic Authentication - # config.http_authentication_realm = "Application" - - # ==> Configuration for :database_authenticatable - # For bcrypt, this is the cost for hashing the password and defaults to 10. If - # using other encryptors, it sets how many times you want the password re-encrypted. - # config.stretches = 20 - - # Define which will be the encryption algorithm. Devise also supports encryptors - # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then - # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1 - # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) - # config.encryptor = :bcrypt - - # Setup a pepper to generate the encrypted password. - # config.pepper = "2e20a8abdd34d729ba6d05f679e513cfea9fbb1e83c81f84b29e9e4fdbd4ee59b56a32200064082a15a72b05a4d4a6a2c3784a09c0554b3a47a67cc8333ccbc7" - - # ==> Configuration for :confirmable - # The time you want to give your user to confirm his account. During this time - # he will be able to access your application without confirming. Default is nil. - # When confirm_within is zero, the user won't be able to sign in without confirming. - # You can use this to let your user access some features of your application - # without confirming the account, but blocking it after a certain period - # (ie 2 days). - # config.confirm_within = 2.days - - # ==> Configuration for :rememberable - # The time the user will be remembered without asking for credentials again. - # config.remember_for = 2.weeks - - # If true, a valid remember token can be re-used between multiple browsers. - # config.remember_across_browsers = true - - # If true, extends the user's remember period when remembered via cookie. - # config.extend_remember_period = false - - # ==> Configuration for :validatable - # Range for password length - config.password_length = 4..20 - - # Regex to use to validate the email address - # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i - - # ==> Configuration for :timeoutable - # The time you want to timeout the user session without activity. After this - # time the user will be asked for credentials again. - # config.timeout_in = 10.minutes - - # ==> Configuration for :lockable - # Defines which strategy will be used to lock an account. - # :failed_attempts = Locks an account after a number of failed attempts to sign in. - # :none = No lock strategy. You should handle locking by yourself. - # config.lock_strategy = :failed_attempts - - # Defines which strategy will be used to unlock an account. - # :email = Sends an unlock link to the user email - # :time = Re-enables login after a certain amount of time (see :unlock_in below) - # :both = Enables both strategies - # :none = No unlock strategy. You should handle unlocking by yourself. - # config.unlock_strategy = :both - - # Number of authentication tries before locking an account if lock_strategy - # is failed attempts. - # config.maximum_attempts = 20 - - # Time interval to unlock the account if :time is enabled as unlock_strategy. - # config.unlock_in = 1.hour - - # ==> Configuration for :token_authenticatable - # Defines name of the authentication token params key - # config.token_authentication_key = :auth_token - - # ==> Scopes configuration - # Turn scoped views on. Before rendering "sessions/new", it will first check for - # "users/sessions/new". It's turned off by default because it's slower if you - # are using only default views. - # config.scoped_views = true - - # Configure the default scope given to Warden. By default it's the first - # devise role declared in your routes. - # config.default_scope = :user - - # Configure sign_out behavior. - # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope). - # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes. - # config.sign_out_all_scopes = false - - # ==> Navigation configuration - # Lists the formats that should be treated as navigational. Formats like - # :html, should redirect to the sign in page when the user does not have - # access, but formats like :xml or :json, should return 401. - # If you have any extra navigational formats, like :iphone or :mobile, you - # should add them to the navigational formats lists. Default is [:html] - # config.navigational_formats = [:html, :iphone] - - # ==> Warden configuration - # If you want to use other strategies, that are not (yet) supported by Devise, - # you can configure them inside the config.warden block. The example below - # allows you to setup OAuth, using http://github.com/roman/warden_oauth - # - # config.warden do |manager| - # manager.oauth(:twitter) do |twitter| - # twitter.consumer_secret = - # twitter.consumer_key = - # twitter.options :site => 'http://twitter.com' - # end - # manager.default_strategies(:scope => :user).unshift :twitter_oauth - # end -end diff --git a/spec/dummy/config/initializers/inflections.rb b/spec/dummy/config/initializers/inflections.rb deleted file mode 100644 index 9e8b013..0000000 --- a/spec/dummy/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/spec/dummy/config/initializers/mime_types.rb b/spec/dummy/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/spec/dummy/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/spec/dummy/config/initializers/secret_token.rb b/spec/dummy/config/initializers/secret_token.rb deleted file mode 100644 index 7a99397..0000000 --- a/spec/dummy/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -Dummy::Application.config.secret_token = '75470fb2f9c361e0509af41d5835fdb3fee2e588a44c68596c6201976f994e0689c434b6e8360dbc45c0d424c1811a5cf1e3f4f0550be9b784fed60fb4e5d29d' diff --git a/spec/dummy/config/initializers/session_store.rb b/spec/dummy/config/initializers/session_store.rb deleted file mode 100644 index 952473f..0000000 --- a/spec/dummy/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# Dummy::Application.config.session_store :active_record_store diff --git a/spec/dummy/config/initializers/wrap_parameters.rb b/spec/dummy/config/initializers/wrap_parameters.rb deleted file mode 100644 index 16c3243..0000000 --- a/spec/dummy/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActionController::Base.wrap_parameters format: [:json] - -# Disable root element in JSON by default. -if defined?(ActiveRecord) - ActiveRecord::Base.include_root_in_json = false -end diff --git a/spec/dummy/config/locales/en.yml b/spec/dummy/config/locales/en.yml deleted file mode 100644 index 179c14c..0000000 --- a/spec/dummy/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb deleted file mode 100644 index bb509f2..0000000 --- a/spec/dummy/config/routes.rb +++ /dev/null @@ -1,58 +0,0 @@ -Dummy::Application.routes.draw do - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => 'welcome#index' - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id(.:format)))' -end diff --git a/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb deleted file mode 100644 index 3199a9c..0000000 --- a/spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CreateRefinerycmsCoreSchema < ActiveRecord::Migration - def self.up - create_table ::Slug.table_name, :force => true do |t| - t.string "name" - t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false - t.string "sluggable_type", :limit => 40 - t.string "scope", :limit => 40 - t.datetime "created_at" - end - - add_index ::Slug.table_name, ["name", "sluggable_type", "scope", "sequence"], :name => "index_#{::Slug.table_name}_on_n_s_s_and_s", :unique => true - add_index ::Slug.table_name, ["sluggable_id"], :name => "index_#{::Slug.table_name}_on_sluggable_id" - end - - def self.down - [::Slug].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name - end - end -end diff --git a/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb b/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb deleted file mode 100644 index 0795cad..0000000 --- a/spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AddLocaleToSlugs < ActiveRecord::Migration - def self.up - add_column ::Slug.table_name, :locale, :string - - add_index ::Slug.table_name, :locale - end - - def self.down - remove_column ::Slug.table_name, :locale - - remove_index ::Slug.table_name, :locale - end -end diff --git a/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb b/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb deleted file mode 100644 index b60cf82..0000000 --- a/spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb +++ /dev/null @@ -1,24 +0,0 @@ -class CreateRefinerycmsSettingsSchema < ActiveRecord::Migration - def self.up - create_table ::Refinery::Setting.table_name, :force => true do |t| - t.string "name" - t.text "value" - t.boolean "destroyable", :default => true - t.datetime "created_at" - t.datetime "updated_at" - t.string "scoping" - t.boolean "restricted", :default => false - t.string "callback_proc_as_string" - end - - add_index ::Refinery::Setting.table_name, ["name"], :name => "index_#{::Refinery::Setting.table_name}_on_name" - end - - def self.down - [::Refinery::Setting].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name - end - end -end diff --git a/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb b/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb deleted file mode 100644 index 2fdf6d8..0000000 --- a/spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddValueTypeToRefinerySettings < ActiveRecord::Migration - def self.up - add_column ::Refinery::Setting.table_name, :form_value_type, :string - end - - def self.down - remove_column ::Refinery::Setting.table_name, :form_value_type - end -end diff --git a/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb b/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb deleted file mode 100644 index f9b6c2e..0000000 --- a/spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb +++ /dev/null @@ -1,48 +0,0 @@ -class CreateRefinerycmsAuthenticationSchema < ActiveRecord::Migration - def self.up - # Postgres apparently requires the roles_users table to exist before creating the roles table. - create_table ::Refinery::RolesUsers.table_name, :id => false, :force => true do |t| - t.integer "user_id" - t.integer "role_id" - end unless ::Refinery::RolesUsers.table_exists? - - create_table ::Refinery::Role.table_name, :force => true do |t| - t.string "title" - end unless ::Refinery::Role.table_exists? - - unless ::Refinery::UserPlugin.table_exists? - create_table ::Refinery::UserPlugin.table_name, :force => true do |t| - t.integer "user_id" - t.string "name" - t.integer "position" - end - - add_index ::Refinery::UserPlugin.table_name, ["name"], :name => "index_#{::Refinery::UserPlugin.table_name}_on_title" - add_index ::Refinery::UserPlugin.table_name, ["user_id", "name"], :name => "index_unique_#{::Refinery::UserPlugin.table_name}", :unique => true - - end - - unless ::Refinery::User.table_exists? - create_table ::Refinery::User.table_name, :force => true do |t| - t.string "login", :null => false - t.string "email", :null => false - t.string "crypted_password", :null => false - t.string "password_salt", :null => false - t.string "persistence_token" - t.datetime "created_at" - t.datetime "updated_at" - t.string "perishable_token" - end - - add_index ::Refinery::User.table_name, ["id"], :name => "index_#{::Refinery::User.table_name}_on_id" - end - end - - def self.down - [::User].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb b/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb deleted file mode 100644 index e72d81f..0000000 --- a/spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddMissingIndexesToRolesUsers < ActiveRecord::Migration - def self.up - add_index ::Refinery::RolesUsers.table_name, [:role_id, :user_id] - add_index ::Refinery::RolesUsers.table_name, [:user_id, :role_id] - end - - def self.down - remove_index ::Refinery::RolesUsers.table_name, :column => [:role_id, :user_id] - remove_index ::Refinery::RolesUsers.table_name, :column => [:user_id, :role_id] - end -end diff --git a/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb b/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb deleted file mode 100644 index 8beef83..0000000 --- a/spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb +++ /dev/null @@ -1,31 +0,0 @@ -class ChangeToDeviseUsersTable < ActiveRecord::Migration - def self.up - add_column ::Refinery::User.table_name, :current_sign_in_at, :datetime - add_column ::Refinery::User.table_name, :last_sign_in_at, :datetime - add_column ::Refinery::User.table_name, :current_sign_in_ip, :string - add_column ::Refinery::User.table_name, :last_sign_in_ip, :string - add_column ::Refinery::User.table_name, :sign_in_count, :integer - add_column ::Refinery::User.table_name, :remember_token, :string - add_column ::Refinery::User.table_name, :reset_password_token, :string - - rename_column ::Refinery::User.table_name, :crypted_password, :encrypted_password - rename_column ::Refinery::User.table_name, :login, :username - - ::Refinery::User.reset_column_information - end - - def self.down - remove_column ::Refinery::User.table_name, :current_sign_in_at - remove_column ::Refinery::User.table_name, :last_sign_in_at - remove_column ::Refinery::User.table_name, :current_sign_in_ip - remove_column ::Refinery::User.table_name, :last_sign_in_ip - remove_column ::Refinery::User.table_name, :sign_in_count - remove_column ::Refinery::User.table_name, :remember_token - remove_column ::Refinery::User.table_name, :reset_password_token - - rename_column ::Refinery::User.table_name, :encrypted_password, :crypted_password - rename_column ::Refinery::User.table_name, :username, :login - - ::Refinery::User.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb b/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb deleted file mode 100644 index 524b36f..0000000 --- a/spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddRememberCreatedAtToUsers < ActiveRecord::Migration - def change - add_column ::Refinery::User.table_name, :remember_created_at, :datetime - end -end diff --git a/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb b/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb deleted file mode 100644 index afcbfd7..0000000 --- a/spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb +++ /dev/null @@ -1,13 +0,0 @@ -class RemovePasswordSaltFromUsers < ActiveRecord::Migration - def self.up - remove_column ::Refinery::User.table_name, :password_salt - # Make the current password invalid :( - ::Refinery::User.all.each do |u| - u.update_attribute(:encrypted_password, u.encrypted_password[29..-1]) - end - end - - def self.down - add_column ::Refinery::User.table_name, :password_salt, :string - end -end diff --git a/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb b/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb deleted file mode 100644 index 6c4e079..0000000 --- a/spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CreateRefinerycmsImagesSchema < ActiveRecord::Migration - def self.up - create_table ::Refinery::Image.table_name, :force => true do |t| - t.string "image_mime_type" - t.string "image_name" - t.integer "image_size" - t.integer "image_width" - t.integer "image_height" - t.datetime "created_at" - t.datetime "updated_at" - t.string "image_uid" - t.string "image_ext" - end unless ::Refinery::Image.table_exists? - end - - def self.down - [::Image].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb b/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb deleted file mode 100644 index 4458726..0000000 --- a/spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb +++ /dev/null @@ -1,56 +0,0 @@ -class CreateRefinerycmsPagesSchema < ActiveRecord::Migration - def self.up - unless ::Refinery::PagePart.table_exists? - create_table ::Refinery::PagePart.table_name, :force => true do |t| - t.integer "refinery_page_id" - t.string "title" - t.text "body" - t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index ::Refinery::PagePart.table_name, ["id"], :name => "index_#{::Refinery::PagePart.table_name}_on_id" - add_index ::Refinery::PagePart.table_name, ["refinery_page_id"], :name => "index_#{::Refinery::PagePart.table_name}_on_page_id" - end - - unless ::Refinery::Page.table_exists? - create_table ::Refinery::Page.table_name, :force => true do |t| - t.string "title" - t.integer "parent_id" - t.integer "position" - t.string "path" - t.datetime "created_at" - t.datetime "updated_at" - t.string "meta_keywords" - t.text "meta_description" - t.boolean "show_in_menu", :default => true - t.string "link_url" - t.string "menu_match" - t.boolean "deletable", :default => true - t.string "custom_title" - t.string "custom_title_type", :default => "none" - t.boolean "draft", :default => false - t.string "browser_title" - t.boolean "skip_to_first_child", :default => false - t.integer "lft" - t.integer "rgt" - t.integer "depth" - end - - add_index ::Refinery::Page.table_name, ["depth"], :name => "index_#{::Refinery::Page.table_name}_on_depth" - add_index ::Refinery::Page.table_name, ["id"], :name => "index_#{::Refinery::Page.table_name}_on_id" - add_index ::Refinery::Page.table_name, ["lft"], :name => "index_#{::Refinery::Page.table_name}_on_lft" - add_index ::Refinery::Page.table_name, ["parent_id"], :name => "index_#{::Refinery::Page.table_name}_on_parent_id" - add_index ::Refinery::Page.table_name, ["rgt"], :name => "index_#{::Refinery::Page.table_name}_on_rgt" - end - end - - def self.down - [::Page, ::Refinery::PagePart].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb b/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb deleted file mode 100644 index bdb0a43..0000000 --- a/spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb +++ /dev/null @@ -1,38 +0,0 @@ -class TranslatePagePlugin < ActiveRecord::Migration - def self.up - say_with_time("Creating ::Refinery::PagePart translation table") do - ::Refinery::PagePart.create_translation_table!({ - :body => :text - }, { - :migrate_data => true - }) - end - - say_with_time("Creating ::Refinery::Page translation table") do - ::Refinery::Page.create_translation_table!({ - :title => :string, - :meta_keywords => :string, - :meta_description => :text, - :browser_title => :string - }, { - :migrate_data => true - }) - end - - puts "seeds pages" - if (seed_file = Rails.root.join('db', 'seeds', 'pages.rb')).file? - load seed_file.to_s unless ::Refinery::Page.where(:link_url => '/').any? - end - - say_with_time("Updating slugs") do - ::Slug.update_all(:locale => I18n.locale) - end - end - - def self.down - say_with_time("Dropping ::Refinery::Page and ::Refinery::PagePart translation tables") do - ::Refinery::Page.drop_translation_table! :migrate_data => true - ::Refinery::PagePart.drop_translation_table! :migrate_data => true - end - end -end diff --git a/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb b/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb deleted file mode 100644 index d265838..0000000 --- a/spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb +++ /dev/null @@ -1,11 +0,0 @@ -class RemoveCachedSlugFromPages < ActiveRecord::Migration - def self.up - if ::Refinery::Page.column_names.map(&:to_s).include?('cached_slug') - remove_column ::Refinery::Page.table_name, :cached_slug - end - end - - def self.down - # Don't add this column back, it breaks stuff. - end -end diff --git a/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb deleted file mode 100644 index ab21e11..0000000 --- a/spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb +++ /dev/null @@ -1,26 +0,0 @@ -class TranslateCustomTitleOnPages < ActiveRecord::Migration - def self.up - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title) - add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string - - # Re-save custom_title - ::Refinery::Page.all.each do |page| - page.update_attribute(:custom_title, page.untranslated_attributes['custom_title']) - end - - end - end - - def self.down - # Re-save custom_title - ::Refinery::Page.all.each do |page| - ::Refinery::Page.update_all({ - :custom_title => page.attributes['custom_title'] - }, { - :id => page.id.to_s - }) unless page.attributes['custom_title'].nil? - end - - remove_column ::Refinery::Page.translation_class.table_name, :custom_title - end -end diff --git a/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb b/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb deleted file mode 100644 index 9dc30b2..0000000 --- a/spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb +++ /dev/null @@ -1,13 +0,0 @@ -class RemoveTranslatedFieldsFromPages < ActiveRecord::Migration - def self.up - ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| - remove_column ::Refinery::Page.table_name, column_name if ::Refinery::Page.column_names.map(&:to_sym).include?(column_name) - end - end - - def self.down - ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| - add_column ::Refinery::Page.table_name, column_name, Page::Translation.columns.detect{|c| c.name.to_sym == column_name}.type - end - end -end diff --git a/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb b/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb deleted file mode 100644 index abc2178..0000000 --- a/spec/dummy/db/migrate/20110802081571_create_seo_meta.rb +++ /dev/null @@ -1,86 +0,0 @@ -class CreateSeoMeta < ActiveRecord::Migration - - def self.up - create_table :seo_meta do |t| - t.integer :seo_meta_id - t.string :seo_meta_type - - t.string :browser_title - t.string :meta_keywords - t.text :meta_description - - t.timestamps - end - - add_index :seo_meta, :id - add_index :seo_meta, [:seo_meta_id, :seo_meta_type] - - # Grab the attributes of the records that currently exist - existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) - - # Remove columns - ::SeoMeta.attributes.keys.each do |field| - if ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) - remove_column ::Refinery::Page.translation_class.table_name, field - end - end - - # Reset column information because otherwise the old columns will still exist. - ::Refinery::Page.translation_class.reset_column_information - - # Re-attach seo_meta - ::Refinery::Page.translation_class.send :is_seo_meta - - # Migrate data - existing_translations.each do |translation| - ::Refinery::Page.translation_class.find(translation['id']).update_attributes( - ::SeoMeta.attributes.keys.inject({}) {|attributes, name| - attributes.merge(name => translation[name.to_s]) - } - ) - end - - # Reset column information again because otherwise the old columns will still exist. - ::Refinery::Page.reset_column_information - end - - def self.down - # Grab the attributes of the records that currently exist - existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) - - # Add columns back to your model - ::SeoMeta.attributes.each do |field, field_type| - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) - add_column ::Refinery::Page.translation_class.table_name, field, field_type - end - end - - # Reset column information because otherwise the new columns won't exist yet. - ::Refinery::Page.translation_class.reset_column_information - - # Migrate data - existing_translations.each do |translation| - ::Refinery::Page.translation_class.update_all( - ::SeoMeta.attributes.keys.inject({}) {|attributes, name| - attributes.merge(name => translation[name.to_s]) - }, :id => translation['id'] - ) - end - - ::SeoMeta.attributes.keys.each do |k| - ::Refinery::Page.translation_class.module_eval %{ - def #{k} - end - - def #{k}=(*args) - end - } - end - - # Reset column information again because otherwise the old columns will still exist. - ::Refinery::Page.reset_column_information - - drop_table :seo_meta - end - -end diff --git a/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb b/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb deleted file mode 100644 index eb98ed1..0000000 --- a/spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateAddTemplateColumns < ActiveRecord::Migration - def self.up - add_column ::Refinery::Page.table_name, :view_template, :string - add_column ::Refinery::Page.table_name, :layout_template, :string - end - - def self.down - remove_column ::Refinery::Page.table_name, :layout_template - remove_column ::Refinery::Page.table_name, :view_template - end -end diff --git a/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb b/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb deleted file mode 100644 index 360f469..0000000 --- a/spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb +++ /dev/null @@ -1,21 +0,0 @@ -class CreateRefinerycmsResourcesSchema < ActiveRecord::Migration - def self.up - create_table ::Refinery::Resource.table_name, :force => true do |t| - t.string "file_mime_type" - t.string "file_name" - t.integer "file_size" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_uid" - t.string "file_ext" - end unless ::Refinery::Resource.table_exists? - end - - def self.down - [::Resource].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb deleted file mode 100644 index 3068a6b..0000000 --- a/spec/dummy/db/schema.rb +++ /dev/null @@ -1,239 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20110803223529) do - - create_table "refinery_blog_categories", :force => true do |t| - t.string "title" - t.datetime "created_at" - t.datetime "updated_at" - t.string "cached_slug" - end - - add_index "refinery_blog_categories", ["id"], :name => "index_refinery_blog_categories_on_id" - - create_table "refinery_blog_categories_blog_posts", :force => true do |t| - t.integer "blog_category_id" - t.integer "blog_post_id" - end - - add_index "refinery_blog_categories_blog_posts", ["blog_category_id", "blog_post_id"], :name => "index_blog_categories_blog_posts_on_bc_and_bp" - - create_table "refinery_blog_comments", :force => true do |t| - t.integer "blog_post_id" - t.boolean "spam" - t.string "name" - t.string "email" - t.text "body" - t.string "state" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_blog_comments", ["id"], :name => "index_refinery_blog_comments_on_id" - - create_table "refinery_blog_posts", :force => true do |t| - t.string "title" - t.text "body" - t.boolean "draft" - t.datetime "published_at" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "user_id" - t.string "cached_slug" - t.string "custom_url" - t.text "custom_teaser" - end - - add_index "refinery_blog_posts", ["id"], :name => "index_refinery_blog_posts_on_id" - - create_table "refinery_images", :force => true do |t| - t.string "image_mime_type" - t.string "image_name" - t.integer "image_size" - t.integer "image_width" - t.integer "image_height" - t.datetime "created_at" - t.datetime "updated_at" - t.string "image_uid" - t.string "image_ext" - end - - create_table "refinery_page_part_translations", :force => true do |t| - t.integer "refinery_page_part_id" - t.string "locale" - t.text "body" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_page_part_translations", ["refinery_page_part_id"], :name => "index_f9716c4215584edbca2557e32706a5ae084a15ef" - - create_table "refinery_page_parts", :force => true do |t| - t.integer "refinery_page_id" - t.string "title" - t.text "body" - t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_page_parts", ["id"], :name => "index_refinery_page_parts_on_id" - add_index "refinery_page_parts", ["refinery_page_id"], :name => "index_refinery_page_parts_on_page_id" - - create_table "refinery_page_translations", :force => true do |t| - t.integer "refinery_page_id" - t.string "locale" - t.string "title" - t.string "custom_title" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_page_translations", ["refinery_page_id"], :name => "index_d079468f88bff1c6ea81573a0d019ba8bf5c2902" - - create_table "refinery_pages", :force => true do |t| - t.integer "parent_id" - t.integer "position" - t.string "path" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "show_in_menu", :default => true - t.string "link_url" - t.string "menu_match" - t.boolean "deletable", :default => true - t.string "custom_title_type", :default => "none" - t.boolean "draft", :default => false - t.boolean "skip_to_first_child", :default => false - t.integer "lft" - t.integer "rgt" - t.integer "depth" - t.string "view_template" - t.string "layout_template" - end - - add_index "refinery_pages", ["depth"], :name => "index_refinery_pages_on_depth" - add_index "refinery_pages", ["id"], :name => "index_refinery_pages_on_id" - add_index "refinery_pages", ["lft"], :name => "index_refinery_pages_on_lft" - add_index "refinery_pages", ["parent_id"], :name => "index_refinery_pages_on_parent_id" - add_index "refinery_pages", ["rgt"], :name => "index_refinery_pages_on_rgt" - - create_table "refinery_resources", :force => true do |t| - t.string "file_mime_type" - t.string "file_name" - t.integer "file_size" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_uid" - t.string "file_ext" - end - - create_table "refinery_roles", :force => true do |t| - t.string "title" - end - - create_table "refinery_roles_users", :id => false, :force => true do |t| - t.integer "user_id" - t.integer "role_id" - end - - add_index "refinery_roles_users", ["role_id", "user_id"], :name => "index_refinery_roles_users_on_role_id_and_user_id" - add_index "refinery_roles_users", ["user_id", "role_id"], :name => "index_refinery_roles_users_on_user_id_and_role_id" - - create_table "refinery_settings", :force => true do |t| - t.string "name" - t.text "value" - t.boolean "destroyable", :default => true - t.datetime "created_at" - t.datetime "updated_at" - t.string "scoping" - t.boolean "restricted", :default => false - t.string "callback_proc_as_string" - t.string "form_value_type" - end - - add_index "refinery_settings", ["name"], :name => "index_refinery_settings_on_name" - - create_table "refinery_user_plugins", :force => true do |t| - t.integer "user_id" - t.string "name" - t.integer "position" - end - - add_index "refinery_user_plugins", ["name"], :name => "index_refinery_user_plugins_on_title" - add_index "refinery_user_plugins", ["user_id", "name"], :name => "index_unique_refinery_user_plugins", :unique => true - - create_table "refinery_users", :force => true do |t| - t.string "username", :null => false - t.string "email", :null => false - t.string "encrypted_password", :null => false - t.string "persistence_token" - t.datetime "created_at" - t.datetime "updated_at" - t.string "perishable_token" - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.integer "sign_in_count" - t.string "remember_token" - t.string "reset_password_token" - t.datetime "remember_created_at" - end - - add_index "refinery_users", ["id"], :name => "index_refinery_users_on_id" - - create_table "seo_meta", :force => true do |t| - t.integer "seo_meta_id" - t.string "seo_meta_type" - t.string "browser_title" - t.string "meta_keywords" - t.text "meta_description" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "seo_meta", ["id"], :name => "index_seo_meta_on_id" - add_index "seo_meta", ["seo_meta_id", "seo_meta_type"], :name => "index_seo_meta_on_seo_meta_id_and_seo_meta_type" - - create_table "slugs", :force => true do |t| - t.string "name" - t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false - t.string "sluggable_type", :limit => 40 - t.string "scope", :limit => 40 - t.datetime "created_at" - t.string "locale" - end - - add_index "slugs", ["locale"], :name => "index_slugs_on_locale" - add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_n_s_s_and_s", :unique => true - add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id" - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context" - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - - create_table "tags", :force => true do |t| - t.string "name" - end - -end diff --git a/spec/dummy/db/seeds.rb b/spec/dummy/db/seeds.rb deleted file mode 100644 index a158e52..0000000 --- a/spec/dummy/db/seeds.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Refinery seeds -Dir[Rails.root.join('db', 'seeds', '*.rb').to_s].each do |file| - puts "Loading db/seeds/#{file.split(File::SEPARATOR).last}" - load(file) -end diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb deleted file mode 100644 index 668687f..0000000 --- a/spec/dummy/db/seeds/pages.rb +++ /dev/null @@ -1,63 +0,0 @@ -module Refinery - ::Refinery::Page.reset_column_information - - # Check whether all columns are applied yet by seo_meta. - unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k| - ::Refinery::Page.translation_class.instance_methods.include?(k) - } - # Make pages model seo_meta because not all columns are accessible. - ::Refinery::Page.translation_class.send :is_seo_meta - end - - page_position = -1 - - unless ::Refinery::Page.where(:menu_match => "^/$").any? - home_page = ::Refinery::Page.create!({:title => "Home", - :deletable => false, - :link_url => "/", - :menu_match => "^/$", - :position => (page_position += 1)}) - home_page.parts.create({ - :title => "Body", - :body => "

Welcome to our site. This is just a place holder page while we gather our content.

", - :position => 0 - }) - home_page.parts.create({ - :title => "Side Body", - :body => "

This is another block of content over here.

", - :position => 1 - }) - - home_page_position = -1 - page_not_found_page = home_page.children.create(:title => "Page not found", - :menu_match => "^/404$", - :show_in_menu => false, - :deletable => false, - :position => (home_page_position += 1)) - page_not_found_page.parts.create({ - :title => "Body", - :body => "

Sorry, there was a problem...

The page you requested was not found.

Return to the home page

", - :position => 0 - }) - else - page_position += 1 - end - - unless ::Refinery::Page.by_title("About").any? - about_us_page = ::Refinery::Page.create(:title => "About", - :deletable => true, - :position => (page_position += 1)) - about_us_page.parts.create({ - :title => "Body", - :body => "

This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.

", - :position => 0 - }) - about_us_page.parts.create({ - :title => "Side Body", - :body => "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.

", - :position => 1 - }) - else - page_position += 1 - end -end diff --git a/spec/dummy/lib/assets/.gitkeep b/spec/dummy/lib/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/log/.gitkeep b/spec/dummy/log/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/public/404.html b/spec/dummy/public/404.html deleted file mode 100644 index 9a48320..0000000 --- a/spec/dummy/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
- - diff --git a/spec/dummy/public/422.html b/spec/dummy/public/422.html deleted file mode 100644 index 83660ab..0000000 --- a/spec/dummy/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
- - diff --git a/spec/dummy/public/500.html b/spec/dummy/public/500.html deleted file mode 100644 index b80307f..0000000 --- a/spec/dummy/public/500.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
-

We're sorry, but something went wrong.

-

We've been notified about this issue and we'll take a look at it shortly.

-
- - diff --git a/spec/dummy/public/favicon.ico b/spec/dummy/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/script/rails b/spec/dummy/script/rails deleted file mode 100755 index f8da2cf..0000000 --- a/spec/dummy/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' From d3eff64d19c845dc947a2872644eb514058db762 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 20:33:13 -0700 Subject: [PATCH 032/248] Add rake tasks to initialize the testing environment Update README to reflect new functionality --- Rakefile | 3 +++ lib/refinery/tasks/testing.rake | 21 +++++++++++++++++++++ readme.md | 4 +--- spec/dummy | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 lib/refinery/tasks/testing.rake diff --git a/Rakefile b/Rakefile index 699f74d..0c5b448 100644 --- a/Rakefile +++ b/Rakefile @@ -22,5 +22,8 @@ end APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) load 'rails/tasks/engine.rake' +load 'refinery/tasks/testing.rake' Bundler::GemHelper.install_tasks + +task :default => 'refinery:testing:setup' diff --git a/lib/refinery/tasks/testing.rake b/lib/refinery/tasks/testing.rake new file mode 100644 index 0000000..7b71639 --- /dev/null +++ b/lib/refinery/tasks/testing.rake @@ -0,0 +1,21 @@ +namespace :refinery do + namespace :testing do + + desc "Initialize the testing environment" + task :setup => [ + :init_dummy_app, + :init_test_database + ] + + task :init_dummy_app do + system "git submodule init" + system "git submodule update" + end + + task :init_test_database => [ + 'app:db:migrate', + 'app:db:test:prepare' + ] + + end +end diff --git a/readme.md b/readme.md index 11e9c53..ca11075 100644 --- a/readme.md +++ b/readme.md @@ -37,9 +37,7 @@ The version of Refinery to develop this engine against is defined in the gemspec Setup the test environment - $ bundle install - $ bundle exec rake app:db:migrate - $ bundle exec rake app:db:test:prepare + $ bundle exec rake refinery:testing:setup Run the test suite with [Guard](https://github.com/guard/guard) diff --git a/spec/dummy b/spec/dummy index 84d6635..f672041 160000 --- a/spec/dummy +++ b/spec/dummy @@ -1 +1 @@ -Subproject commit 84d66350ec474665e7d436dca479a142b091f874 +Subproject commit f6720415b9f53b2a3a3b2c9b9d597e3188e2c615 From e85535da5f01d3a5ddcf972efd73c422d26a8887 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 20:56:12 -0700 Subject: [PATCH 033/248] Refactor testing tasks out of this project and into refinerycms project --- Rakefile | 2 +- lib/refinery/tasks/testing.rake | 21 --------------------- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 lib/refinery/tasks/testing.rake diff --git a/Rakefile b/Rakefile index 0c5b448..b8c5ffe 100644 --- a/Rakefile +++ b/Rakefile @@ -22,7 +22,7 @@ end APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) load 'rails/tasks/engine.rake' -load 'refinery/tasks/testing.rake' +load 'refinerycms/tasks/testing.rake' Bundler::GemHelper.install_tasks diff --git a/lib/refinery/tasks/testing.rake b/lib/refinery/tasks/testing.rake deleted file mode 100644 index 7b71639..0000000 --- a/lib/refinery/tasks/testing.rake +++ /dev/null @@ -1,21 +0,0 @@ -namespace :refinery do - namespace :testing do - - desc "Initialize the testing environment" - task :setup => [ - :init_dummy_app, - :init_test_database - ] - - task :init_dummy_app do - system "git submodule init" - system "git submodule update" - end - - task :init_test_database => [ - 'app:db:migrate', - 'app:db:test:prepare' - ] - - end -end From c481c78afa3bfb82de679b46540152fb457f6ce3 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 22:25:41 -0700 Subject: [PATCH 034/248] Require refinerycms-testing framework Location of testing tasks changed --- Gemfile | 1 + Rakefile | 2 +- refinerycms-blog.gemspec | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index dab5e38..6968fa2 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,7 @@ source "http://rubygems.org" ## Uncomment the following lines to develop against a local clone of refinery # gem 'refinerycms', :path => '~/Code/refinerycms' +# gem 'refinerycms-testing', :path => '~/Code/refinerycms/testing' # gem 'refinerycms-generators', :path => '~/Code/refinerycms-generators' # gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' diff --git a/Rakefile b/Rakefile index b8c5ffe..0c5b448 100644 --- a/Rakefile +++ b/Rakefile @@ -22,7 +22,7 @@ end APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) load 'rails/tasks/engine.rake' -load 'refinerycms/tasks/testing.rake' +load 'refinery/tasks/testing.rake' Bundler::GemHelper.install_tasks diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 91f2b07..9857e66 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -16,6 +16,7 @@ Gem::Specification.new do |s| s.add_dependency 'seo_meta', '~> 1.1.0' # Development dependencies + s.add_development_dependency 'refinerycms-testing', '~> 1.1.0' s.add_development_dependency 'rake', '~> 0.9.2' s.add_development_dependency 'rails', '3.1.0.rc5' s.add_development_dependency 'factory_girl' From 1c186d26d0b1a3dfa9784908c5a8bd5d1fc1e415 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 3 Aug 2011 22:33:04 -0700 Subject: [PATCH 035/248] Remove (commented out) duplicate refinerycms-testing gem requirement --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6968fa2..dab5e38 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,6 @@ source "http://rubygems.org" ## Uncomment the following lines to develop against a local clone of refinery # gem 'refinerycms', :path => '~/Code/refinerycms' -# gem 'refinerycms-testing', :path => '~/Code/refinerycms/testing' # gem 'refinerycms-generators', :path => '~/Code/refinerycms-generators' # gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' From a23689a6aa738f5dd051d65b9e26e5d6bb7fa332 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 03:11:56 -0700 Subject: [PATCH 036/248] Remove shared functionality that now exists in refinerycms-testing engine --- features/support/env.rb | 5 +- lib/gemspec.rb | 5 +- refinerycms-blog.gemspec | 472 ++++++++++++++++++++++++++++++++++++--- spec/factories/user.rb | 27 --- spec/spec_helper.rb | 6 +- 5 files changed, 451 insertions(+), 64 deletions(-) delete mode 100644 spec/factories/user.rb diff --git a/features/support/env.rb b/features/support/env.rb index a84d601..4bc2cc2 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -8,10 +8,11 @@ Spork.prefork do require 'capybara/cucumber' require 'capybara/session' - require 'factory_girl' + require 'refinery/testing/factories' + require 'database_cleaner' require 'database_cleaner/cucumber' - + Dir[File.expand_path("../../../spec/factories/*.rb", __FILE__)].each {|f| require f} include ::Devise::Controllers::UrlHelpers diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 60c9671..5627a98 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -5,6 +5,9 @@ raise "Could not get version so gemspec can not be built" if version.nil? files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.gem$}} gemspec = < 1.1.0' # Development dependencies - s.add_development_dependency 'factory_girl' + s.add_development_dependency 'refinerycms-testing', '~> 1.1.0' s.files = %w( #{files.join("\n ")} diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 9857e66..2c65de2 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,8 +1,11 @@ +# Encoding: UTF-8 +# DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it. + Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-08-03} + s.date = %q{2011-08-04} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -17,20 +20,6 @@ Gem::Specification.new do |s| # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 1.1.0' - s.add_development_dependency 'rake', '~> 0.9.2' - s.add_development_dependency 'rails', '3.1.0.rc5' - s.add_development_dependency 'factory_girl' - s.add_development_dependency 'sqlite3' - s.add_development_dependency 'rspec' - s.add_development_dependency 'rspec-rails', '2.6.1.beta1' - s.add_development_dependency 'capybara' - s.add_development_dependency 'cucumber-rails' - s.add_development_dependency 'spork', '0.9.0.rc9' - s.add_development_dependency 'guard-spork' - s.add_development_dependency 'guard-rspec' - s.add_development_dependency 'guard-cucumber' - s.add_development_dependency 'rb-fsevent' - s.add_development_dependency 'database_cleaner' s.files = %w( app @@ -53,11 +42,13 @@ Gem::Specification.new do |s| app/assets/images/refinery/blog/icons/page_copy.png app/assets/images/refinery/blog/icons/up.gif app/assets/images/refinery/blog/rss-feed.png + app/assets/images/refinerycms-blog app/assets/javascripts app/assets/javascripts/refinery app/assets/javascripts/refinery/blog app/assets/javascripts/refinery/blog/backend.js app/assets/javascripts/refinery/blog/frontend.js + app/assets/javascripts/refinerycms-blog app/assets/stylesheets app/assets/stylesheets/refinery app/assets/stylesheets/refinery/blog @@ -80,6 +71,7 @@ Gem::Specification.new do |s| app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffd27a_256x240.png app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffffff_256x240.png app/assets/stylesheets/refinery/blog/ui-lightness/jquery-ui-1.8.13.custom.css.scss + app/assets/stylesheets/refinerycms-blog app/controllers app/controllers/refinery app/controllers/refinery/admin @@ -165,6 +157,8 @@ Gem::Specification.new do |s| app/views/refinery/shared/admin/_autocomplete.html.erb changelog.md config + config/cucumber.yml + config/environment.rb config/locales config/locales/bg.yml config/locales/cs.yml @@ -184,52 +178,466 @@ Gem::Specification.new do |s| config/routes.rb db db/migrate - db/migrate/1_create_blog_structure.rb - db/migrate/2_add_user_id_to_blog_posts.rb - db/migrate/3_acts_as_taggable_on_migration.rb - db/migrate/4_create_seo_meta_for_blog.rb - db/migrate/5_add_cached_slugs.rb - db/migrate/6_add_custom_url_field_to_blog_posts.rb - db/migrate/7_add_custom_teaser_field_to_blog_posts.rb - db/migrate/8_add_primary_key_to_categorizations.rb + db/migrate/20110803223522_create_blog_structure.rb + db/migrate/20110803223523_add_user_id_to_blog_posts.rb + db/migrate/20110803223524_acts_as_taggable_on_migration.rb + db/migrate/20110803223525_create_seo_meta_for_blog.rb + db/migrate/20110803223526_add_cached_slugs.rb + db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb + db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb + db/migrate/20110803223529_add_primary_key_to_categorizations.rb db/seeds db/seeds/refinerycms_blog.rb features features/authors.feature features/category.feature + features/step_definitions + features/step_definitions/authors_steps.rb + features/step_definitions/category_steps.rb + features/step_definitions/tags_steps.rb + features/step_definitions/user_steps.rb + features/step_definitions/web_steps.rb features/support - features/support/factories - features/support/factories/blog_categories.rb - features/support/factories/blog_comments.rb - features/support/factories/blog_posts.rb + features/support/env.rb features/support/paths.rb - features/support/step_definitions - features/support/step_definitions/authors_steps.rb - features/support/step_definitions/category_steps.rb - features/support/step_definitions/tags_steps.rb + features/support/selectors.rb features/tags.feature + Gemfile + Gemfile.lock + Guardfile lib lib/gemspec.rb lib/generators lib/generators/blog_generator.rb lib/refinery lib/refinery/blog + lib/refinery/blog/engine.rb lib/refinery/blog/tabs.rb lib/refinery/blog/version.rb lib/refinerycms-blog.rb - public + Rakefile readme.md refinerycms-blog.gemspec + script + script/cucumber + script/rails spec + spec/dummy + spec/dummy/app + spec/dummy/app/assets + spec/dummy/app/assets/javascripts + spec/dummy/app/assets/javascripts/admin.js + spec/dummy/app/assets/javascripts/application.js + spec/dummy/app/assets/stylesheets + spec/dummy/app/assets/stylesheets/application.css + spec/dummy/app/assets/stylesheets/application.css.backup + spec/dummy/app/assets/stylesheets/formatting.css + spec/dummy/app/assets/stylesheets/home.css + spec/dummy/app/assets/stylesheets/theme.css + spec/dummy/app/controllers + spec/dummy/app/controllers/application_controller.rb + spec/dummy/app/helpers + spec/dummy/app/helpers/application_helper.rb + spec/dummy/app/mailers + spec/dummy/app/models + spec/dummy/app/views + spec/dummy/app/views/layouts + spec/dummy/app/views/layouts/application.html.erb.backup + spec/dummy/app/views/sitemap + spec/dummy/app/views/sitemap/index.xml.builder + spec/dummy/config + spec/dummy/config/application.rb + spec/dummy/config/boot.rb + spec/dummy/config/database.yml + spec/dummy/config/database.yml.mysql + spec/dummy/config/database.yml.postgresql + spec/dummy/config/database.yml.sqlite3 + spec/dummy/config/environment.rb + spec/dummy/config/environments + spec/dummy/config/environments/development.rb + spec/dummy/config/environments/production.rb + spec/dummy/config/environments/test.rb + spec/dummy/config/initializers + spec/dummy/config/initializers/backtrace_silencers.rb + spec/dummy/config/initializers/devise.rb + spec/dummy/config/initializers/inflections.rb + spec/dummy/config/initializers/mime_types.rb + spec/dummy/config/initializers/secret_token.rb + spec/dummy/config/initializers/session_store.rb + spec/dummy/config/initializers/wrap_parameters.rb + spec/dummy/config/locales + spec/dummy/config/locales/en.yml + spec/dummy/config/routes.rb + spec/dummy/config.ru + spec/dummy/db + spec/dummy/db/development.sqlite3 + spec/dummy/db/migrate + spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb + spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb + spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb + spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb + spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb + spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb + spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb + spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb + spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb + spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb + spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb + spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb + spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb + spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb + spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb + spec/dummy/db/migrate/20110802081571_create_seo_meta.rb + spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb + spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb + spec/dummy/db/schema.rb + spec/dummy/db/seeds + spec/dummy/db/seeds/pages.rb + spec/dummy/db/seeds.rb + spec/dummy/db/test.sqlite3 + spec/dummy/index + spec/dummy/index/development + spec/dummy/index/development/Refinery::Page + spec/dummy/index/development/Refinery::Page/102_111_117.ind + spec/dummy/index/development/Refinery::Page/104_111_109.ind + spec/dummy/index/development/Refinery::Page/110_111_116.ind + spec/dummy/index/development/Refinery::Page/112_97_103.ind + spec/dummy/index/development/Refinery::Page/97_98_111.ind + spec/dummy/index/development/Refinery::Page/98_108_111.ind + spec/dummy/index/development/Refinery::Page/size + spec/dummy/index/development/Refinery::Page/version + spec/dummy/index/development/Refinery::Setting + spec/dummy/index/development/Refinery::Setting/100_101_102.ind + spec/dummy/index/development/Refinery::Setting/100_114_97.ind + spec/dummy/index/development/Refinery::Setting/102_114_111.ind + spec/dummy/index/development/Refinery::Setting/112_97_103.ind + spec/dummy/index/development/Refinery::Setting/115_105_116.ind + spec/dummy/index/development/Refinery::Setting/115_116_114.ind + spec/dummy/index/development/Refinery::Setting/116_101_97.ind + spec/dummy/index/development/Refinery::Setting/117_115_101.ind + spec/dummy/index/development/Refinery::Setting/97_110_97.ind + spec/dummy/index/development/Refinery::Setting/97_112_112.ind + spec/dummy/index/development/Refinery::Setting/97_117_116.ind + spec/dummy/index/development/Refinery::Setting/98_108_111.ind + spec/dummy/index/development/Refinery::Setting/99_111_109.ind + spec/dummy/index/development/Refinery::Setting/size + spec/dummy/index/development/Refinery::Setting/version + spec/dummy/index/test + spec/dummy/index/test/Refinery::Setting + spec/dummy/index/test/Refinery::Setting/100_114_97.ind + spec/dummy/index/test/Refinery::Setting/102_114_111.ind + spec/dummy/index/test/Refinery::Setting/112_97_103.ind + spec/dummy/index/test/Refinery::Setting/115_105_116.ind + spec/dummy/index/test/Refinery::Setting/115_116_114.ind + spec/dummy/index/test/Refinery::Setting/116_101_97.ind + spec/dummy/index/test/Refinery::Setting/117_115_101.ind + spec/dummy/index/test/Refinery::Setting/97_110_97.ind + spec/dummy/index/test/Refinery::Setting/97_112_112.ind + spec/dummy/index/test/Refinery::Setting/97_117_116.ind + spec/dummy/index/test/Refinery::Setting/98_108_111.ind + spec/dummy/index/test/Refinery::Setting/99_111_109.ind + spec/dummy/index/test/Refinery::Setting/size + spec/dummy/index/test/Refinery::Setting/version + spec/dummy/lib + spec/dummy/lib/assets + spec/dummy/log + spec/dummy/log/development.log + spec/dummy/log/test.log + spec/dummy/public + spec/dummy/public/404.html + spec/dummy/public/422.html + spec/dummy/public/500.html + spec/dummy/public/favicon.ico + spec/dummy/Rakefile + spec/dummy/README.md + spec/dummy/script + spec/dummy/script/rails + spec/dummy/tmp + spec/dummy/tmp/dragonfly + spec/dummy/tmp/dragonfly/cache + spec/dummy/tmp/dragonfly/cache/body + spec/dummy/tmp/dragonfly/cache/meta + spec/dummy/tmp/index + spec/dummy/tmp/index/development + spec/dummy/tmp/index/development/Refinery::BlogCategory + spec/dummy/tmp/index/development/Refinery::BlogCategory/103_97_109.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/115_104_111.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/118_105_100.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/49.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/49_48.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/49_49.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/49_50.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/50.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/51.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/52.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/53.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/54.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/55.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/56.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/57.ind + spec/dummy/tmp/index/development/Refinery::BlogCategory/size + spec/dummy/tmp/index/development/Refinery::BlogCategory/version + spec/dummy/tmp/index/development/Refinery::BlogComment + spec/dummy/tmp/index/development/Refinery::BlogComment/101_120_97.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/102_111_114.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/105_115.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/106_111_101.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/110_101_119.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/111_110_101.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/112_101_114.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/112_105_99.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/115_104_111.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/116_104_101.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/117_112.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/119_104_105.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/98_101_115.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/99_111_109.ind + spec/dummy/tmp/index/development/Refinery::BlogComment/size + spec/dummy/tmp/index/development/Refinery::BlogComment/version + spec/dummy/tmp/index/development/Refinery::BlogPost + spec/dummy/tmp/index/development/Refinery::BlogPost/102_111_114.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/103_111_105.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/103_117_121.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/104_111_116.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/104_97_120.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/105_110.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/105_115.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/105_116.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/106_111_101.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/107_105_119.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/108_111_110.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/110_101_119.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/111_107_97.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/112.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/112_101_97.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/112_111_115.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/112_97_114.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/114_101.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/114_101_102.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/114_101_97.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/115_104_111.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/115_116_111.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/115_116_117.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/115_97_107.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/116_101_110.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/116_104_101.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/116_111.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/116_111_112.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/116_114_117.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/119_105_116.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/121_111_117.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_48.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_49.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_50.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_51.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_52.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_53.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_54.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_55.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_56.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/49_57.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_48.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_49.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_50.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_51.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_52.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_53.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_54.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_55.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_56.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/50_57.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/51.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/51_48.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/51_49.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/51_50.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/51_51.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/52.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/53.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/55.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/56.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/57.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/97.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/97_110_111.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/97_114_101.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/97_98_111.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/98_108_111.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/98_108_97.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/98_114_101.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/99_101_110.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/99_104_105.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/99_109_115.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/99_111_109.ind + spec/dummy/tmp/index/development/Refinery::BlogPost/size + spec/dummy/tmp/index/development/Refinery::BlogPost/version + spec/dummy/tmp/index/development/Refinery::Setting + spec/dummy/tmp/index/development/Refinery::Setting/102_114_111.ind + spec/dummy/tmp/index/development/Refinery::Setting/112_97_103.ind + spec/dummy/tmp/index/development/Refinery::Setting/115_104_97.ind + spec/dummy/tmp/index/development/Refinery::Setting/115_105_116.ind + spec/dummy/tmp/index/development/Refinery::Setting/115_116_114.ind + spec/dummy/tmp/index/development/Refinery::Setting/116_101_97.ind + spec/dummy/tmp/index/development/Refinery::Setting/117_115_101.ind + spec/dummy/tmp/index/development/Refinery::Setting/97_110_97.ind + spec/dummy/tmp/index/development/Refinery::Setting/97_112_112.ind + spec/dummy/tmp/index/development/Refinery::Setting/97_117_116.ind + spec/dummy/tmp/index/development/Refinery::Setting/98_108_111.ind + spec/dummy/tmp/index/development/Refinery::Setting/99_111_109.ind + spec/dummy/tmp/index/development/Refinery::Setting/99_97_99.ind + spec/dummy/tmp/index/development/Refinery::Setting/size + spec/dummy/tmp/index/development/Refinery::Setting/version + spec/dummy/tmp/index/test + spec/dummy/tmp/index/test/Refinery::BlogCategory + spec/dummy/tmp/index/test/Refinery::BlogCategory/103_97_109.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/115_104_111.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/118_105_100.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_48.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_49.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_50.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_51.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/52.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/53.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/54.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/55.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/56.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/57.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/size + spec/dummy/tmp/index/test/Refinery::BlogCategory/version + spec/dummy/tmp/index/test/Refinery::BlogComment + spec/dummy/tmp/index/test/Refinery::BlogComment/101_120_97.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/102_111_114.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/105_115.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/106_111_101.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/110_101_119.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/111_110_101.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/112_101_114.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/112_105_99.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/115_104_111.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/116_104_101.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/117_112.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/119_104_105.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/98_101_115.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/99_111_109.ind + spec/dummy/tmp/index/test/Refinery::BlogComment/size + spec/dummy/tmp/index/test/Refinery::BlogComment/version + spec/dummy/tmp/index/test/Refinery::BlogPost + spec/dummy/tmp/index/test/Refinery::BlogPost/102_111_114.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/103_111_105.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/103_117_121.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/104_111_116.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/104_97_120.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/105.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/105_110.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/105_115.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/105_116.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/106_111_101.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/107_105_119.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/108_111_110.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/108_111_118.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/109_121.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/110_101_119.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/111_107_97.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/112.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/112_101_97.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/112_111_115.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/112_97_114.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/114_101.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/114_101_102.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/114_101_97.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/115_104_111.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/115_116_111.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/115_116_117.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/115_97_107.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/116_101_110.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/116_104_101.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/116_104_105.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/116_111.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/116_111_112.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/116_114_117.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/119_105_116.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/121_111_117.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_48.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_49.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_50.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_51.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_52.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_53.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_54.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_55.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_56.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/49_57.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_48.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_49.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_50.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_51.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_52.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_53.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_54.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_55.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_56.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/50_57.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_48.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_49.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_50.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_51.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/52.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/53.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/55.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/56.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/57.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/97.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/97_110_100.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/97_110_111.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/97_114_101.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/97_98_111.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/98_108_111.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/98_108_97.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/98_114_101.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/99_101_110.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/99_104_105.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/99_105_116.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/99_109_115.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/99_111_109.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/size + spec/dummy/tmp/index/test/Refinery::BlogPost/version + spec/dummy/tmp/index/test/Refinery::Setting + spec/dummy/tmp/index/test/Refinery::Setting/102_114_111.ind + spec/dummy/tmp/index/test/Refinery::Setting/112_97_103.ind + spec/dummy/tmp/index/test/Refinery::Setting/115_104_97.ind + spec/dummy/tmp/index/test/Refinery::Setting/115_105_116.ind + spec/dummy/tmp/index/test/Refinery::Setting/115_116_114.ind + spec/dummy/tmp/index/test/Refinery::Setting/116_101_97.ind + spec/dummy/tmp/index/test/Refinery::Setting/117_115_101.ind + spec/dummy/tmp/index/test/Refinery::Setting/97_110_97.ind + spec/dummy/tmp/index/test/Refinery::Setting/97_112_112.ind + spec/dummy/tmp/index/test/Refinery::Setting/97_117_116.ind + spec/dummy/tmp/index/test/Refinery::Setting/97_99_116.ind + spec/dummy/tmp/index/test/Refinery::Setting/98_108_111.ind + spec/dummy/tmp/index/test/Refinery::Setting/99_111_109.ind + spec/dummy/tmp/index/test/Refinery::Setting/size + spec/dummy/tmp/index/test/Refinery::Setting/version + spec/factories + spec/factories/blog_categories.rb + spec/factories/blog_comments.rb + spec/factories/blog_posts.rb spec/models spec/models/refinery spec/models/refinery/blog_category_spec.rb spec/models/refinery/blog_comment_spec.rb spec/models/refinery/blog_post_spec.rb + spec/rcov.opts spec/requests spec/requests/blog_categories_spec.rb spec/requests/blog_posts_spec.rb spec/requests/manage_blog_posts_spec.rb + spec/spec_helper.rb todo.md ) diff --git a/spec/factories/user.rb b/spec/factories/user.rb deleted file mode 100644 index 94fe1d0..0000000 --- a/spec/factories/user.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'refinerycms/all' -require 'refinery/role' - -Factory.define :user, :class => ::Refinery::User do |u| - u.sequence(:username) { |n| "person#{n}" } - u.sequence(:email) { |n| "person#{n}@cucumber.com" } - u.password "greenandjuicy" - u.password_confirmation "greenandjuicy" -end - -Factory.define :refinery_user, :parent => :user do |u| - u.roles { [ ::Refinery::Role[:refinery] ] } - - u.after_create do |user| - ::Refinery::Plugins.registered.each_with_index do |plugin, index| - user.plugins.create(:name => plugin.name, :position => index) - end - end -end - -Factory.define :refinery_translator, :parent => :user do |u| - u.roles { [ ::Refinery::Role[:refinery], ::Refinery::Role[:translator] ] } - - u.after_create do |user| - user.plugins.create(:name => 'refinery_pages', :position => 0) - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 441da1d..44506ce 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,9 +12,11 @@ Spork.prefork do require 'rspec/rails' require 'capybara/rspec' - require 'factory_girl' - require 'devise' require 'database_cleaner' + + require 'refinery/testing/factories' + require 'refinery/testing/controller_macros' + require 'refinery/testing/request_macros' Rails.backtrace_cleaner.remove_silencers! From c3b7d0b1d2d23f87536078dc8cc2aa367d7730e4 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 03:21:21 -0700 Subject: [PATCH 037/248] Add request and controller authentication macros to rspec config refactor request specs to take advantage of authentication macros --- spec/requests/blog_categories_spec.rb | 3 ++- spec/requests/blog_posts_spec.rb | 4 +--- spec/requests/manage_blog_posts_spec.rb | 9 +-------- spec/spec_helper.rb | 2 ++ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb index 33d330b..8ac6eff 100644 --- a/spec/requests/blog_categories_spec.rb +++ b/spec/requests/blog_categories_spec.rb @@ -1,8 +1,9 @@ require "spec_helper" describe "blog categories" do + login_refinery_user + before(:each) do - Factory.create(:refinery_user) @blog_post = Factory(:blog_post, :title => "Refinery CMS blog post") @blog_category = Factory(:blog_category, :title => "Video Games") @blog_post.categories << @blog_category diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb index 8695d9a..1eaf27a 100644 --- a/spec/requests/blog_posts_spec.rb +++ b/spec/requests/blog_posts_spec.rb @@ -1,9 +1,7 @@ require "spec_helper" describe "blog posts" do - before(:each) do - Factory.create(:refinery_user) - end + login_refinery_user context "when has blog posts" do let(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 8b1097d..724cc59 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -1,14 +1,7 @@ require "spec_helper" describe "manage blog posts" do - # TODO: share this with other request specs - before(:each) do - user = Factory.create(:refinery_user) - visit new_refinery_user_session_url - fill_in "Login", :with => user.username - fill_in "Password", :with => user.password - click_button "Sign in" - end + login_refinery_user let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 44506ce..5a8d67c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -42,6 +42,8 @@ Spork.prefork do end config.include Devise::TestHelpers, :type => :controller + config.extend Refinery::ControllerMacros::Authentication, :type => :controller + config.extend Refinery::RequestMacros::Authentication, :type => :request end end From 84a2fcdf08430c70cb4da8c678c2d72e8ca54628 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 11:47:33 -0700 Subject: [PATCH 038/248] Replace authors.feature with capybara rspec tests --- features/authors.feature | 15 --------------- features/step_definitions/authors_steps.rb | 7 ------- spec/requests/manage_blog_posts_spec.rb | 20 ++++++++++++++++---- 3 files changed, 16 insertions(+), 26 deletions(-) delete mode 100644 features/authors.feature delete mode 100644 features/step_definitions/authors_steps.rb diff --git a/features/authors.feature b/features/authors.feature deleted file mode 100644 index f3fd3ec..0000000 --- a/features/authors.feature +++ /dev/null @@ -1,15 +0,0 @@ -@blog @blog_authors -Feature: Blog Post Authors - Blog posts can be assigned authors through the given user model - current_user is assumed through admin screens - - Scenario: Saving a blog post in blog_posts#new associates the current_user as the author - Given I am a logged in refinery user - - When I am on the new blog post form - And I fill in "Title" with "This is my blog post" - And I fill in "blog_post_body" with "And I love it" - And I press "Save" - - Then there should be 1 blog post - And the blog post should belong to me \ No newline at end of file diff --git a/features/step_definitions/authors_steps.rb b/features/step_definitions/authors_steps.rb deleted file mode 100644 index eaa5f32..0000000 --- a/features/step_definitions/authors_steps.rb +++ /dev/null @@ -1,7 +0,0 @@ -Then /^there should be (\d+) blog posts?$/ do |num| - ::Refinery::BlogPost.all.size == num -end - -Then /^the blog post should belong to me$/ do - ::Refinery::BlogPost.first.author.login == ::Refinery::User.last.login -end \ No newline at end of file diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 724cc59..585bcd4 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -14,20 +14,32 @@ describe "manage blog posts" do end end - context "when creating blog post" do - it "should succeed" do + describe "when creating first blog post" do + before(:each) do + Refinery::BlogPost.destroy_all + visit refinery_admin_blog_posts_path click_link "Create new post" fill_in "Title", :with => "Another Refinery CMS blog post" fill_in "blog_post_body", :with => "Bla bla" click_button "Save" - + end + + it "should succeed" do page.should have_content("'Another Refinery CMS blog post' was successfully added.") end + + it "should be the only blog post" do + ::Refinery::BlogPost.all.size.should eq(1) + end + + it "should belong to me" do + ::Refinery::BlogPost.first.author.login.should eq(::Refinery::User.last.login) + end end - context "when editing blog post" do + context "when editing blog post" do it "should succeed" do visit refinery_admin_blog_posts_path page.should have_content(blog_post.title) From 8bd056e3e8baa108b2e10e460ceeeed3ec7c4c86 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 13:59:51 -0700 Subject: [PATCH 039/248] Replace category.features with capybara rspec requests Update FactoryGirl factory definition syntax --- features/category.feature | 23 --- features/step_definitions/category_steps.rb | 11 -- spec/factories/blog_categories.rb | 6 +- spec/factories/blog_comments.rb | 12 +- spec/factories/blog_posts.rb | 14 +- spec/requests/blog_categories_spec.rb | 29 ++-- spec/requests/manage_blog_posts_spec.rb | 169 +++++++++++--------- 7 files changed, 131 insertions(+), 133 deletions(-) delete mode 100644 features/category.feature delete mode 100644 features/step_definitions/category_steps.rb diff --git a/features/category.feature b/features/category.feature deleted file mode 100644 index 6af1075..0000000 --- a/features/category.feature +++ /dev/null @@ -1,23 +0,0 @@ -@blog @blog_categories -Feature: Blog Post Categories - Blog posts can be assigned categories - - Background: - Given I am a logged in refinery user - Given there is a category titled "Videos" - - Scenario: The blog post new/edit form has category_list - When I am on the new blog post form - Then I should see "Tags" - Then I should see "Videos" - - Scenario: The blog post new/edit form saves categories - When I am on the new blog post form - And I fill in "Title" with "This is my blog post" - And I fill in "blog_post_body" with "And I love it" - And I check "Videos" - And I press "Save" - - Then there should be 1 blog post - And the blog post should have 1 category - And the blog post should have the category "Videos" \ No newline at end of file diff --git a/features/step_definitions/category_steps.rb b/features/step_definitions/category_steps.rb deleted file mode 100644 index 3c197e2..0000000 --- a/features/step_definitions/category_steps.rb +++ /dev/null @@ -1,11 +0,0 @@ -Given /^there is a category titled "([^"]*)"$/ do |title| - @category = Factory.create(:blog_category, :title => title) -end - -Then /^the blog post should have ([\d]*) categor[yies]{1,3}$/ do |num_category| - ::Refinery::BlogPost.last.categories.count.should == num_category.to_i -end - -Then /^the blog post should have the category "([^"]*)"$/ do |category| - ::Refinery::BlogPost.last.categories.first.title.should == category -end diff --git a/spec/factories/blog_categories.rb b/spec/factories/blog_categories.rb index c3701dd..31ec28b 100644 --- a/spec/factories/blog_categories.rb +++ b/spec/factories/blog_categories.rb @@ -1,3 +1,5 @@ -Factory.define :blog_category, :class => 'refinery/blog_category' do |f| - f.sequence(:title) { |n| "Shopping #{n}" } +FactoryGirl.define do + factory :blog_category, :class => 'refinery/blog_category' do + sequence(:title) { |n| "Shopping #{n}" } + end end diff --git a/spec/factories/blog_comments.rb b/spec/factories/blog_comments.rb index d738cac..0bb5206 100644 --- a/spec/factories/blog_comments.rb +++ b/spec/factories/blog_comments.rb @@ -1,6 +1,8 @@ -Factory.define :blog_comment, :class => 'refinery/blog_comment' do |f| - f.name "Joe Commenter" - f.sequence(:email) { |n| "person#{n}@example.com" } - f.body "Which one is the best for picking up new shoes?" - f.association :post, :factory => :blog_post +FactoryGirl.define do + factory :blog_comment, :class => 'refinery/blog_comment' do + name "Joe Commenter" + sequence(:email) { |n| "person#{n}@example.com" } + body "Which one is the best for picking up new shoes?" + association :post, :factory => :blog_post + end end diff --git a/spec/factories/blog_posts.rb b/spec/factories/blog_posts.rb index 548636d..4586b36 100644 --- a/spec/factories/blog_posts.rb +++ b/spec/factories/blog_posts.rb @@ -1,7 +1,9 @@ -Factory.define :blog_post, :class => 'refinery/blog_post' do |f| - f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } - f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." - f.draft false - f.tag_list "chicago, shopping, fun times" - f.published_at Time.now +FactoryGirl.define do + factory :blog_post, :class => 'refinery/blog_post' do + sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } + body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." + draft false + tag_list "chicago, shopping, fun times" + published_at Time.now + end end diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb index 8ac6eff..d18a552 100644 --- a/spec/requests/blog_categories_spec.rb +++ b/spec/requests/blog_categories_spec.rb @@ -2,19 +2,22 @@ require "spec_helper" describe "blog categories" do login_refinery_user - - before(:each) do - @blog_post = Factory(:blog_post, :title => "Refinery CMS blog post") - @blog_category = Factory(:blog_category, :title => "Video Games") - @blog_post.categories << @blog_category - @blog_post.save! - end - - context "has posts" do - it "displays category's blog posts" do - visit blog_category_path(@blog_category) - page.should have_content("Refinery CMS blog post") - page.should have_content("Video Games") + + context "has one category and post" do + before(:each) do + @blog_post = Factory.create(:blog_post, :title => "Refinery CMS blog post") + @blog_category = Factory.create(:blog_category, :title => "Video Games") + @blog_post.categories << @blog_category + @blog_post.save! + end + + describe "show categories blog posts" do + before(:each) { visit blog_category_path(@blog_category) } + + it "should displays categories blog posts" do + page.should have_content("Refinery CMS blog post") + page.should have_content("Video Games") + end end end end diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 585bcd4..12b7b8f 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -2,95 +2,118 @@ require "spec_helper" describe "manage blog posts" do login_refinery_user - - let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } + + let!(:blog_category) { Factory.create(:blog_category, :title => "Video Games") } context "when no blog posts" do before(:each) { Refinery::BlogPost.destroy_all } - - it "invites to create new post" do - visit refinery_admin_blog_posts_path - page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.") - end - end - - describe "when creating first blog post" do - before(:each) do - Refinery::BlogPost.destroy_all + + describe "blog post listing" do + before(:each) { visit refinery_admin_blog_posts_path } - visit refinery_admin_blog_posts_path - click_link "Create new post" + it "invites to create new post" do + page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.") + end + end + + describe "new blog post form" do + before(:each) do + visit refinery_admin_blog_posts_path + click_link "Create new post" + end - fill_in "Title", :with => "Another Refinery CMS blog post" - fill_in "blog_post_body", :with => "Bla bla" - click_button "Save" - end - - it "should succeed" do - page.should have_content("'Another Refinery CMS blog post' was successfully added.") - end - - it "should be the only blog post" do - ::Refinery::BlogPost.all.size.should eq(1) - end - - it "should belong to me" do - ::Refinery::BlogPost.first.author.login.should eq(::Refinery::User.last.login) + it "should have Tags" do + page.should have_content("Tags") + end + + it "should have Video Games" do + page.should have_content(blog_category.title) + end + + describe "create blog post" do + before(:each) do + fill_in "Title", :with => "This is my blog post" + fill_in "blog_post_body", :with => "And I love it" + check blog_category.title + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + ::Refinery::BlogPost.all.size.should eq(1) + end + + it "should belong to me" do + ::Refinery::BlogPost.first.author.login.should eq(::Refinery::User.last.login) + end + + it "should save categories" do + ::Refinery::BlogPost.last.categories.count.should eq(1) + ::Refinery::BlogPost.last.categories.first.title.should eq(blog_category.title) + end + end end end - context "when editing blog post" do - it "should succeed" do - visit refinery_admin_blog_posts_path - page.should have_content(blog_post.title) + context "when has blog posts" do + let!(:blog_post) { Factory(:blog_post) } + + describe "blog post listing" do + before(:each) { visit refinery_admin_blog_posts_path } + + describe "edit blog post" do + it "should succeed" do + page.should have_content(blog_post.title) - click_link("Edit this blog post") - current_path.should == edit_refinery_admin_blog_post_path(blog_post) + click_link("Edit this blog post") + current_path.should == edit_refinery_admin_blog_post_path(blog_post) - fill_in "Title", :with => "hax0r" - click_button "Save" + fill_in "Title", :with => "hax0r" + click_button "Save" - page.should_not have_content(blog_post.title) - page.should have_content("'hax0r' was successfully updated.") + page.should_not have_content(blog_post.title) + page.should have_content("'hax0r' was successfully updated.") + end + end + + describe "deleting blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link "Remove this blog post forever" + + page.should have_content("'#{blog_post.title}' was successfully removed.") + end + end + + describe "view live" do + it "redirects to blog post in the frontend" do + click_link "View this blog post live" + + current_path.should == blog_post_path(blog_post) + page.should have_content(blog_post.title) + end + end end - end - context "when deleting blog post" do - it "should succeed" do - - visit refinery_admin_blog_posts_path - page.should have_content(blog_post.title) - - click_link "Remove this blog post forever" - - page.should have_content("'#{blog_post.title}' was successfully removed.") + context "when uncategorized post" do + it "shows up in the list" do + visit uncategorized_refinery_admin_blog_posts_path + page.should have_content(blog_post.title) + end end - end - context "uncategorized post" do - it "shows up in the list" do - visit uncategorized_refinery_admin_blog_posts_path - page.should have_content(blog_post.title) - end - end + context "when categorized post" do + it "won't show up in the list" do + blog_post.categories << blog_category + blog_post.save! - context "categorized post" do - it "won't show up in the list" do - blog_post.categories << Factory(:blog_category) - blog_post.save! - - visit uncategorized_refinery_admin_blog_posts_path - page.should_not have_content(blog_post.title) - end - end - - describe "view live" do - it "redirects to blog post in the frontend" do - visit refinery_admin_blog_posts_path - click_link "View this blog post live" - - current_path.should == blog_post_path(blog_post) - page.should have_content(blog_post.title) + visit uncategorized_refinery_admin_blog_posts_path + page.should_not have_content(blog_post.title) + end end end end From ee215655cba5820c3ffe0c665ea71c11f15f3bf9 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 15:39:04 -0700 Subject: [PATCH 040/248] Replace cucumber tag features with rspec request tests Remove cucumber support from project --- Guardfile | 8 +- config/cucumber.yml | 10 -- config/environment.rb | 3 - features/step_definitions/tags_steps.rb | 13 -- features/step_definitions/user_steps.rb | 42 ----- features/step_definitions/web_steps.rb | 196 ------------------------ features/support/env.rb | 51 ------ features/support/paths.rb | 18 --- features/support/selectors.rb | 39 ----- features/tags.feature | 26 ---- spec/requests/blog_posts_spec.rb | 18 +++ spec/requests/manage_blog_posts_spec.rb | 22 +++ 12 files changed, 41 insertions(+), 405 deletions(-) delete mode 100644 config/cucumber.yml delete mode 100644 config/environment.rb delete mode 100644 features/step_definitions/tags_steps.rb delete mode 100644 features/step_definitions/user_steps.rb delete mode 100644 features/step_definitions/web_steps.rb delete mode 100644 features/support/env.rb delete mode 100644 features/support/paths.rb delete mode 100644 features/support/selectors.rb delete mode 100644 features/tags.feature diff --git a/Guardfile b/Guardfile index 91d89e0..4de3a30 100644 --- a/Guardfile +++ b/Guardfile @@ -19,13 +19,7 @@ guard 'rspec', :version => 2 do watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } end -guard 'cucumber' do - watch(%r{^features/.+\.feature$}) - watch(%r{^features/support/.+$}) { 'features' } - watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } -end - -guard 'spork', :wait => 60, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do +guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do watch('config/application.rb') watch('config/environment.rb') watch(%r{^config/environments/.+\.rb$}) diff --git a/config/cucumber.yml b/config/cucumber.yml deleted file mode 100644 index 368422a..0000000 --- a/config/cucumber.yml +++ /dev/null @@ -1,10 +0,0 @@ -<% -ENV["RAILS_ENV"] ||= "test" -require ::File.expand_path('../spec/dummy/config/environment', __FILE__) -rerun = IO.read('rerun.txt') if File.file?('rerun.txt') -rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" -std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip -r features" -%> -default: <%= std_opts %> -wip: --tags @wip:3 --wip features -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip \ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb deleted file mode 100644 index 5cdbfa5..0000000 --- a/config/environment.rb +++ /dev/null @@ -1,3 +0,0 @@ -# TODO: Remove this when you figure out how to get Cucumber to look for the -# environment file in the dummy app instead of within the project root -require File.expand_path('../../spec/dummy/config/environment', __FILE__) diff --git a/features/step_definitions/tags_steps.rb b/features/step_definitions/tags_steps.rb deleted file mode 100644 index d16f758..0000000 --- a/features/step_definitions/tags_steps.rb +++ /dev/null @@ -1,13 +0,0 @@ -Given /^there is a blog post titled "([^"]*)" and tagged "([^"]*)"$/ do |title, tag_name| - @blog_post = Factory.create(:blog_post, :title => title, :tag_list => tag_name) -end - -When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name| - @blog_post ||= Factory.create(:blog_post, :tag_list => tag_name) - tag = ::Refinery::BlogPost.tag_counts_on(:tags).first - visit tagged_posts_path(tag.id, tag_name.parameterize) -end - -Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list| - ::Refinery::BlogPost.last.tag_list == tag_list.split(', ') -end diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb deleted file mode 100644 index 002fa7d..0000000 --- a/features/step_definitions/user_steps.rb +++ /dev/null @@ -1,42 +0,0 @@ -def login(options = {}) - options = {:user => @refinery_user}.merge(options) - visit new_refinery_user_session_path - fill_in("refinery_user_login", :with => options[:user].email) - fill_in("refinery_user_password", :with => 'greenandjuicy') - click_button("submit_button") -end - -Given /^I am a logged in refinery user$/i do - @refinery_user ||= Factory(:refinery_user) - login(:user => @refinery_user) -end - -Given /^I am a logged in refinery translator$/i do - @refinery_translator ||= Factory(:refinery_translator) - login(:user => @refinery_translator) -end - -Given /^I am a logged in customer$/i do - @user ||= Factory(:user) - login(:user => @user) -end - -Given /^A Refinery user exists$/i do - @refinery_user ||= Factory(:refinery_user) -end - -Given /^I have a user named "(.*)"$/ do |name| - @user = Factory(:user, :username => name) -end - -Given /^I have a refinery user named "(.*)"$/i do |name| - @refinery_user = Factory(:refinery_user, :username => name) -end - -Given /^I have no users$/ do - ::Refinery::User.delete_all -end - -Then /^I should have ([0-9]+) users?$/ do |count| - ::Refinery::User.count.should == count.to_i -end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb deleted file mode 100644 index 22abbf6..0000000 --- a/features/step_definitions/web_steps.rb +++ /dev/null @@ -1,196 +0,0 @@ -# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. -# It is recommended to regenerate this file in the future when you upgrade to a -# newer version of cucumber-rails. Consider adding your own code to a new file -# instead of editing this one. Cucumber will automatically load all features/**/*.rb -# files. - -require 'uri' -require 'cgi' -require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) -require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors")) - -module WithinHelpers - def with_scope(locator) - locator ? within(*selector_for(locator)) { yield } : yield - end -end -World(WithinHelpers) - -# Single-line step scoper -When /^(.*) within (.*[^:])$/ do |step, parent| - with_scope(parent) { When step } -end - -# Multi-line step scoper -When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string| - with_scope(parent) { When "#{step}:", table_or_string } -end - -Given /^(?:|I )am on (.+)$/ do |page_name| - visit path_to(page_name) -end - -When /^(?:|I )go to (.+)$/ do |page_name| - visit path_to(page_name) -end - -When /^(?:|I )press "([^"]*)"$/ do |button| - click_button(button) -end - -When /^(?:|I )follow "([^"]*)"$/ do |link| - click_link(link) -end - -When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value| - fill_in(field, :with => value) -end - -When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field| - fill_in(field, :with => value) -end - -# Use this to fill in an entire form with data from a table. Example: -# -# When I fill in the following: -# | Account Number | 5002 | -# | Expiry date | 2009-11-01 | -# | Note | Nice guy | -# | Wants Email? | | -# -# TODO: Add support for checkbox, select og option -# based on naming conventions. -# -When /^(?:|I )fill in the following:$/ do |fields| - fields.rows_hash.each do |name, value| - When %{I fill in "#{name}" with "#{value}"} - end -end - -When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field| - select(value, :from => field) -end - -When /^(?:|I )check "([^"]*)"$/ do |field| - check(field) -end - -When /^(?:|I )uncheck "([^"]*)"$/ do |field| - uncheck(field) -end - -When /^(?:|I )choose "([^"]*)"$/ do |field| - choose(field) -end - -When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field| - attach_file(field, File.expand_path(path)) -end - -Then /^(?:|I )should see "([^"]*)"$/ do |text| - if page.respond_to? :should - page.should have_content(text) - else - assert page.has_content?(text) - end -end - -Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp| - regexp = Regexp.new(regexp) - - if page.respond_to? :should - page.should have_xpath('//*', :text => regexp) - else - assert page.has_xpath?('//*', :text => regexp) - end -end - -Then /^(?:|I )should not see "([^"]*)"$/ do |text| - if page.respond_to? :should - page.should have_no_content(text) - else - assert page.has_no_content?(text) - end -end - -Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp| - regexp = Regexp.new(regexp) - - if page.respond_to? :should - page.should have_no_xpath('//*', :text => regexp) - else - assert page.has_no_xpath?('//*', :text => regexp) - end -end - -Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value| - with_scope(parent) do - field = find_field(field) - field_value = (field.tag_name == 'textarea') ? field.text : field.value - if field_value.respond_to? :should - field_value.should =~ /#{value}/ - else - assert_match(/#{value}/, field_value) - end - end -end - -Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value| - with_scope(parent) do - field = find_field(field) - field_value = (field.tag_name == 'textarea') ? field.text : field.value - if field_value.respond_to? :should_not - field_value.should_not =~ /#{value}/ - else - assert_no_match(/#{value}/, field_value) - end - end -end - -Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent| - with_scope(parent) do - field_checked = find_field(label)['checked'] - if field_checked.respond_to? :should - field_checked.should be_true - else - assert field_checked - end - end -end - -Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent| - with_scope(parent) do - field_checked = find_field(label)['checked'] - if field_checked.respond_to? :should - field_checked.should be_false - else - assert !field_checked - end - end -end - -Then /^(?:|I )should be on (.+)$/ do |page_name| - current_path = URI.parse(current_url).path - if current_path.respond_to? :should - current_path.should == path_to(page_name) - else - assert_equal path_to(page_name), current_path - end -end - -Then /^(?:|I )should have the following query string:$/ do |expected_pairs| - query = URI.parse(current_url).query - actual_params = query ? CGI.parse(query) : {} - expected_params = {} - expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} - - if actual_params.respond_to? :should - actual_params.should == expected_params - else - assert_equal expected_params, actual_params - end -end - -Then /^show me the page$/ do - save_and_open_page -end diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 4bc2cc2..0000000 --- a/features/support/env.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'rubygems' -require 'bundler/setup' -require 'spork' - -Spork.prefork do - require 'cucumber/rails' - require 'capybara/rails' - require 'capybara/cucumber' - require 'capybara/session' - - require 'refinery/testing/factories' - - require 'database_cleaner' - require 'database_cleaner/cucumber' - - Dir[File.expand_path("../../../spec/factories/*.rb", __FILE__)].each {|f| require f} - - include ::Devise::Controllers::UrlHelpers - - # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In - # order to ease the transition to Capybara we set the default here. If you'd - # prefer to use XPath just remove this line and adjust any selectors in your - # steps to use the XPath syntax. - Capybara.default_selector = :css - - # By default, any exception happening in your Rails application will bubble up - # to Cucumber so that your scenario will fail. This is a different from how - # your application behaves in the production environment, where an error page will - # be rendered instead. - # - # Sometimes we want to override this default behaviour and allow Rails to rescue - # exceptions and display an error page (just like when the app is running in production). - # Typical scenarios where you want to do this is when you test your error pages. - # There are two ways to allow Rails to rescue exceptions: - # - # 1) Tag your scenario (or feature) with @allow-rescue - # - # 2) Set the value below to true. Beware that doing this globally is not - # recommended as it will mask a lot of errors for you! - # - ActionController::Base.allow_rescue = false - - DatabaseCleaner.strategy = :truncation - - Before { DatabaseCleaner.start } - After { DatabaseCleaner.clean } -end - -Spork.each_run do - # This code will be run each time you run your specs. -end diff --git a/features/support/paths.rb b/features/support/paths.rb deleted file mode 100644 index f69b8fe..0000000 --- a/features/support/paths.rb +++ /dev/null @@ -1,18 +0,0 @@ -def path_to(page_name) - case page_name - when /the list of blog posts/ - refinery_admin_blog_posts_path - when /the new blog posts? form/ - new_refinery_admin_blog_post_path - else - begin - if page_name =~ /the blog post titled "?([^\"]*)"?/ and (page = BlogPost.find_by_title($1)).present? - self.url_for(page.url) - else - nil - end - rescue - nil - end - end -end diff --git a/features/support/selectors.rb b/features/support/selectors.rb deleted file mode 100644 index 44e34a4..0000000 --- a/features/support/selectors.rb +++ /dev/null @@ -1,39 +0,0 @@ -module HtmlSelectorsHelpers - # Maps a name to a selector. Used primarily by the - # - # When /^(.+) within (.+)$/ do |step, scope| - # - # step definitions in web_steps.rb - # - def selector_for(locator) - case locator - - when "the page" - "html > body" - - # Add more mappings here. - # Here is an example that pulls values out of the Regexp: - # - # when /^the (notice|error|info) flash$/ - # ".flash.#{$1}" - - # You can also return an array to use a different selector - # type, like: - # - # when /the header/ - # [:xpath, "//header"] - - # This allows you to provide a quoted selector as the scope - # for "within" steps as was previously the default for the - # web steps: - when /^"(.+)"$/ - $1 - - else - raise "Can't find mapping from \"#{locator}\" to a selector.\n" + - "Now, go and add a mapping in #{__FILE__}" - end - end -end - -World(HtmlSelectorsHelpers) diff --git a/features/tags.feature b/features/tags.feature deleted file mode 100644 index 24dff2a..0000000 --- a/features/tags.feature +++ /dev/null @@ -1,26 +0,0 @@ -@blog @blog_tags -Feature: Blog Post Tags - Blog posts can be assigned tags - - Background: - Given I am a logged in refinery user - - Scenario: The blog post new/edit form has tag_list - When I am on the new blog post form - Then I should see "Tags" - - Scenario: The blog post new/edit form saves tag_list - When I am on the new blog post form - And I fill in "Title" with "This is my blog post" - And I fill in "blog_post_body" with "And I love it" - And I fill in "Tags" with "chicago, bikes, beers, babes" - And I press "Save" - - Then there should be 1 blog post - And the blog post should have the tags "chicago, bikes, beers, babes" - - Scenario: The blog has a "tagged" route & view - Given there is a blog post titled "I love my city" and tagged "chicago" - When I visit the tagged posts page for "chicago" - Then I should see "Chicago" - And I should see "I love my city" \ No newline at end of file diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb index 1eaf27a..d7d2a9f 100644 --- a/spec/requests/blog_posts_spec.rb +++ b/spec/requests/blog_posts_spec.rb @@ -17,4 +17,22 @@ describe "blog posts" do response.content_type.should eq("application/rss+xml") end end + + describe "list tagged posts" do + context "when has tagged blog posts" do + before(:each) do + @tag_name = "chicago" + @blog_post = Factory.create(:blog_post, + :title => "I Love my city", + :tag_list => @tag_name) + tag = ::Refinery::BlogPost.tag_counts_on(:tags).first + visit tagged_posts_path(tag.id, @tag_name.parameterize) + end + + it "should have one tagged post" do + page.should have_content(@tag_name) + page.should have_content(@blog_post.title) + end + end + end end diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 12b7b8f..6d6f734 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -55,6 +55,28 @@ describe "manage blog posts" do ::Refinery::BlogPost.last.categories.first.title.should eq(blog_category.title) end end + + describe "create blog post with tags" do + before(:each) do + @tag_list = "chicago, bikes, beers, babes" + fill_in "Title", :with => "This is a tagged blog post" + fill_in "blog_post_body", :with => "And I also love it" + fill_in "Tags", :with => @tag_list + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + ::Refinery::BlogPost.all.size.should eq(1) + end + + it "should have the specified tags" do + ::Refinery::BlogPost.last.tag_list.should eq(@tag_list.split(', ')) + end + end end end From 82ca14af894df6a1fd791d0ff3737394ee3919e1 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 15:53:53 -0700 Subject: [PATCH 041/248] Update Rakefile to include rspec task --- Rakefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Rakefile b/Rakefile index 0c5b448..f64a55d 100644 --- a/Rakefile +++ b/Rakefile @@ -20,6 +20,11 @@ RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_files.include('lib/**/*.rb') end +require 'rspec/core/rake_task' + +desc "Run specs" +RSpec::Core::RakeTask.new + APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) load 'rails/tasks/engine.rake' load 'refinery/tasks/testing.rake' From 0516a2cc0088533dcccd1cd004f132c90125515f Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 15:54:53 -0700 Subject: [PATCH 042/248] Update gemspec --- refinerycms-blog.gemspec | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 2c65de2..3ac5762 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -157,8 +157,6 @@ Gem::Specification.new do |s| app/views/refinery/shared/admin/_autocomplete.html.erb changelog.md config - config/cucumber.yml - config/environment.rb config/locales config/locales/bg.yml config/locales/cs.yml @@ -188,20 +186,6 @@ Gem::Specification.new do |s| db/migrate/20110803223529_add_primary_key_to_categorizations.rb db/seeds db/seeds/refinerycms_blog.rb - features - features/authors.feature - features/category.feature - features/step_definitions - features/step_definitions/authors_steps.rb - features/step_definitions/category_steps.rb - features/step_definitions/tags_steps.rb - features/step_definitions/user_steps.rb - features/step_definitions/web_steps.rb - features/support - features/support/env.rb - features/support/paths.rb - features/support/selectors.rb - features/tags.feature Gemfile Gemfile.lock Guardfile @@ -215,6 +199,7 @@ Gem::Specification.new do |s| lib/refinery/blog/tabs.rb lib/refinery/blog/version.rb lib/refinerycms-blog.rb + lib/tasks Rakefile readme.md refinerycms-blog.gemspec @@ -353,6 +338,8 @@ Gem::Specification.new do |s| spec/dummy/script spec/dummy/script/rails spec/dummy/tmp + spec/dummy/tmp/capybara + spec/dummy/tmp/capybara/capybara-20110804121811333867014.html spec/dummy/tmp/dragonfly spec/dummy/tmp/dragonfly/cache spec/dummy/tmp/dragonfly/cache/body @@ -497,9 +484,36 @@ Gem::Specification.new do |s| spec/dummy/tmp/index/test/Refinery::BlogCategory/49_49.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/49_50.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/49_51.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_52.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_53.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_54.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_55.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_56.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/49_57.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/50.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_48.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_49.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_50.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_51.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_52.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_53.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_54.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_55.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_56.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/50_57.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/51.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_48.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_49.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_50.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_51.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_52.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_53.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_54.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_55.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_56.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/51_57.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/52.ind + spec/dummy/tmp/index/test/Refinery::BlogCategory/52_48.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/53.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/54.ind spec/dummy/tmp/index/test/Refinery::BlogCategory/55.ind @@ -558,6 +572,7 @@ Gem::Specification.new do |s| spec/dummy/tmp/index/test/Refinery::BlogPost/116_111.ind spec/dummy/tmp/index/test/Refinery::BlogPost/116_111_112.ind spec/dummy/tmp/index/test/Refinery::BlogPost/116_114_117.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/116_97_103.ind spec/dummy/tmp/index/test/Refinery::BlogPost/119_105_116.ind spec/dummy/tmp/index/test/Refinery::BlogPost/121_111_117.ind spec/dummy/tmp/index/test/Refinery::BlogPost/49.ind @@ -587,12 +602,18 @@ Gem::Specification.new do |s| spec/dummy/tmp/index/test/Refinery::BlogPost/51_49.ind spec/dummy/tmp/index/test/Refinery::BlogPost/51_50.ind spec/dummy/tmp/index/test/Refinery::BlogPost/51_51.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_52.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_53.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_54.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_55.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/51_56.ind spec/dummy/tmp/index/test/Refinery::BlogPost/52.ind spec/dummy/tmp/index/test/Refinery::BlogPost/53.ind spec/dummy/tmp/index/test/Refinery::BlogPost/55.ind spec/dummy/tmp/index/test/Refinery::BlogPost/56.ind spec/dummy/tmp/index/test/Refinery::BlogPost/57.ind spec/dummy/tmp/index/test/Refinery::BlogPost/97.ind + spec/dummy/tmp/index/test/Refinery::BlogPost/97_108_115.ind spec/dummy/tmp/index/test/Refinery::BlogPost/97_110_100.ind spec/dummy/tmp/index/test/Refinery::BlogPost/97_110_111.ind spec/dummy/tmp/index/test/Refinery::BlogPost/97_114_101.ind From 87f478e664bc9e85e8165878d0736b0401b5b6d0 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 17:38:39 -0700 Subject: [PATCH 043/248] Update testing setup task to reflect new namespace --- Rakefile | 2 +- readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index f64a55d..ef3229e 100644 --- a/Rakefile +++ b/Rakefile @@ -31,4 +31,4 @@ load 'refinery/tasks/testing.rake' Bundler::GemHelper.install_tasks -task :default => 'refinery:testing:setup' +task :default => 'refinery:testing:engine:setup' diff --git a/readme.md b/readme.md index ca11075..a9da413 100644 --- a/readme.md +++ b/readme.md @@ -37,7 +37,7 @@ The version of Refinery to develop this engine against is defined in the gemspec Setup the test environment - $ bundle exec rake refinery:testing:setup + $ bundle exec rake refinery:testing:engine:setup Run the test suite with [Guard](https://github.com/guard/guard) From ad784342dd7628fdbbc35ff3753f32bacb376629 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 4 Aug 2011 17:49:18 -0700 Subject: [PATCH 044/248] test database will be initialized before rake rspec is run --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index ef3229e..0fb4407 100644 --- a/Rakefile +++ b/Rakefile @@ -23,7 +23,7 @@ end require 'rspec/core/rake_task' desc "Run specs" -RSpec::Core::RakeTask.new +RSpec::Core::RakeTask.new(:spec => 'refinery:testing:engine:init_test_database') APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) load 'rails/tasks/engine.rake' From cfba1b86d16da0a4e5c5c070f349974eb29807fe Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sat, 6 Aug 2011 04:44:35 -0700 Subject: [PATCH 045/248] Add Rails3.1 assets gemfile entry into Gemfile (required to start Rails dummy app) Bump dummy app head --- Gemfile | 8 ++++++++ spec/dummy | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index dab5e38..b445476 100644 --- a/Gemfile +++ b/Gemfile @@ -5,4 +5,12 @@ source "http://rubygems.org" # gem 'refinerycms-generators', :path => '~/Code/refinerycms-generators' # gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' +gem 'jquery-rails' + +group :assets do + gem 'sass-rails', "~> 3.1.0.rc" + gem 'coffee-rails', "~> 3.1.0.rc" + gem 'uglifier' +end + gemspec diff --git a/spec/dummy b/spec/dummy index f672041..36f851b 160000 --- a/spec/dummy +++ b/spec/dummy @@ -1 +1 @@ -Subproject commit f6720415b9f53b2a3a3b2c9b9d597e3188e2c615 +Subproject commit 36f851b7d5eca685475eb3a232e1d8dabfb1653a From 45d8663de5a58740ac6bcf6c18a377aeb6fa0cd5 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 10 Aug 2011 17:03:37 -0700 Subject: [PATCH 046/248] Dummy app is no longer a submodule, now part of the projected - generated by testing generator Remove remaining traces of cucumber --- .gitmodules | 3 - script/cucumber | 10 - spec/dummy | 1 - spec/dummy/.gitignore | 165 ++++++++++++ spec/dummy/Rakefile | 13 + spec/dummy/app/assets/images/.gitkeep | 0 spec/dummy/app/assets/javascripts/admin.js | 7 + .../app/assets/javascripts/application.js | 9 + .../app/assets/stylesheets/application.css | 1 + .../assets/stylesheets/application.css.backup | 1 + .../app/assets/stylesheets/formatting.css | 4 + spec/dummy/app/assets/stylesheets/home.css | 4 + spec/dummy/app/assets/stylesheets/theme.css | 4 + .../app/controllers/application_controller.rb | 3 + spec/dummy/app/helpers/application_helper.rb | 2 + spec/dummy/app/mailers/.gitkeep | 0 spec/dummy/app/models/.gitkeep | 0 .../views/layouts/application.html.erb.backup | 14 + .../dummy/app/views/sitemap/index.xml.builder | 25 ++ spec/dummy/config.ru | 4 + spec/dummy/config/application.rb | 43 ++++ spec/dummy/config/boot.rb | 10 + spec/dummy/config/database.yml | 26 ++ spec/dummy/config/database.yml.mysql | 20 ++ spec/dummy/config/database.yml.postgresql | 55 ++++ spec/dummy/config/database.yml.sqlite3 | 26 ++ spec/dummy/config/environment.rb | 5 + spec/dummy/config/environments/development.rb | 31 +++ spec/dummy/config/environments/production.rb | 55 ++++ spec/dummy/config/environments/test.rb | 43 ++++ .../initializers/backtrace_silencers.rb | 7 + spec/dummy/config/initializers/devise.rb | 144 +++++++++++ spec/dummy/config/initializers/inflections.rb | 10 + spec/dummy/config/initializers/mime_types.rb | 5 + .../dummy/config/initializers/secret_token.rb | 7 + .../config/initializers/session_store.rb | 8 + .../config/initializers/wrap_parameters.rb | 12 + spec/dummy/config/locales/en.yml | 5 + spec/dummy/config/routes.rb | 58 +++++ spec/dummy/db/migrate/.gitkeep | 0 ...reate_refinerycms_authentication_schema.rb | 48 ++++ ...13234706_create_refinerycms_core_schema.rb | 25 ++ ...234707_create_refinerycms_images_schema.rb | 23 ++ ...3234708_create_refinerycms_pages_schema.rb | 56 ++++ ...709_create_refinerycms_resources_schema.rb | 21 ++ ...4710_create_refinerycms_settings_schema.rb | 26 ++ ...529_add_value_type_to_refinery_settings.rb | 13 + ...5252_add_missing_indexes_to_roles_users.rb | 11 + ...1206013505_change_to_devise_users_table.rb | 31 +++ ...216194133_remove_cached_slug_from_pages.rb | 17 ++ .../20101217113424_add_locale_to_slugs.rb | 15 ++ .../20101217113425_translate_page_plugin.rb | 38 +++ ...184757_add_remember_created_at_to_users.rb | 7 + ...move_duplicate_user_image_sizes_setting.rb | 22 ++ ...7025652_translate_custom_title_on_pages.rb | 41 +++ ...540_remove_translated_fields_from_pages.rb | 17 ++ ...5213325_remove_password_salt_from_users.rb | 17 ++ .../migrate/20110329222114_create_seo_meta.rb | 86 +++++++ ...10714071142_create_add_template_columns.rb | 11 + spec/dummy/db/schema.rb | 239 ++++++++++++++++++ spec/dummy/db/seed/.gitkeep | 0 spec/dummy/db/seeds/pages.rb | 63 +++++ spec/dummy/lib/assets/.gitkeep | 0 spec/dummy/log/.gitkeep | 0 spec/dummy/public/404.html | 26 ++ spec/dummy/public/422.html | 26 ++ spec/dummy/public/500.html | 26 ++ spec/dummy/public/favicon.ico | 0 spec/dummy/script/rails | 6 + spec/dummy/version.rb | 5 + spec/spec_helper.rb | 26 +- spec/support/database_cleaner.rb | 15 ++ spec/support/devise.rb | 8 + spec/support/refinery.rb | 8 + 74 files changed, 1776 insertions(+), 37 deletions(-) delete mode 100644 .gitmodules delete mode 100755 script/cucumber delete mode 160000 spec/dummy create mode 100644 spec/dummy/.gitignore create mode 100644 spec/dummy/Rakefile create mode 100644 spec/dummy/app/assets/images/.gitkeep create mode 100644 spec/dummy/app/assets/javascripts/admin.js create mode 100644 spec/dummy/app/assets/javascripts/application.js create mode 100644 spec/dummy/app/assets/stylesheets/application.css create mode 100644 spec/dummy/app/assets/stylesheets/application.css.backup create mode 100644 spec/dummy/app/assets/stylesheets/formatting.css create mode 100644 spec/dummy/app/assets/stylesheets/home.css create mode 100644 spec/dummy/app/assets/stylesheets/theme.css create mode 100644 spec/dummy/app/controllers/application_controller.rb create mode 100644 spec/dummy/app/helpers/application_helper.rb create mode 100644 spec/dummy/app/mailers/.gitkeep create mode 100644 spec/dummy/app/models/.gitkeep create mode 100644 spec/dummy/app/views/layouts/application.html.erb.backup create mode 100644 spec/dummy/app/views/sitemap/index.xml.builder create mode 100644 spec/dummy/config.ru create mode 100644 spec/dummy/config/application.rb create mode 100644 spec/dummy/config/boot.rb create mode 100644 spec/dummy/config/database.yml create mode 100644 spec/dummy/config/database.yml.mysql create mode 100644 spec/dummy/config/database.yml.postgresql create mode 100644 spec/dummy/config/database.yml.sqlite3 create mode 100644 spec/dummy/config/environment.rb create mode 100644 spec/dummy/config/environments/development.rb create mode 100644 spec/dummy/config/environments/production.rb create mode 100644 spec/dummy/config/environments/test.rb create mode 100644 spec/dummy/config/initializers/backtrace_silencers.rb create mode 100644 spec/dummy/config/initializers/devise.rb create mode 100644 spec/dummy/config/initializers/inflections.rb create mode 100644 spec/dummy/config/initializers/mime_types.rb create mode 100644 spec/dummy/config/initializers/secret_token.rb create mode 100644 spec/dummy/config/initializers/session_store.rb create mode 100644 spec/dummy/config/initializers/wrap_parameters.rb create mode 100644 spec/dummy/config/locales/en.yml create mode 100644 spec/dummy/config/routes.rb create mode 100644 spec/dummy/db/migrate/.gitkeep create mode 100644 spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb create mode 100644 spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb create mode 100644 spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb create mode 100644 spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb create mode 100644 spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb create mode 100644 spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb create mode 100644 spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb create mode 100644 spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb create mode 100644 spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb create mode 100644 spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb create mode 100644 spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb create mode 100644 spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb create mode 100644 spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb create mode 100644 spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb create mode 100644 spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb create mode 100644 spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb create mode 100644 spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb create mode 100644 spec/dummy/db/migrate/20110329222114_create_seo_meta.rb create mode 100644 spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb create mode 100644 spec/dummy/db/schema.rb create mode 100644 spec/dummy/db/seed/.gitkeep create mode 100644 spec/dummy/db/seeds/pages.rb create mode 100644 spec/dummy/lib/assets/.gitkeep create mode 100644 spec/dummy/log/.gitkeep create mode 100644 spec/dummy/public/404.html create mode 100644 spec/dummy/public/422.html create mode 100644 spec/dummy/public/500.html create mode 100644 spec/dummy/public/favicon.ico create mode 100755 spec/dummy/script/rails create mode 100644 spec/dummy/version.rb create mode 100644 spec/support/database_cleaner.rb create mode 100644 spec/support/devise.rb create mode 100644 spec/support/refinery.rb diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4d704f3..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "spec/dummy"] - path = spec/dummy - url = git://github.com/enmasse-entertainment/refinerycms-engine-dummy.git diff --git a/script/cucumber b/script/cucumber deleted file mode 100755 index 7fa5c92..0000000 --- a/script/cucumber +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby - -vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -if vendored_cucumber_bin - load File.expand_path(vendored_cucumber_bin) -else - require 'rubygems' unless ENV['NO_RUBYGEMS'] - require 'cucumber' - load Cucumber::BINARY -end diff --git a/spec/dummy b/spec/dummy deleted file mode 160000 index 36f851b..0000000 --- a/spec/dummy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 36f851b7d5eca685475eb3a232e1d8dabfb1653a diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore new file mode 100644 index 0000000..d80f252 --- /dev/null +++ b/spec/dummy/.gitignore @@ -0,0 +1,165 @@ +.bundle +db/*.sqlite3 +log/*.log +tmp/ +# Rails +.bundle +db/*.sqlite3 +db/*.sqlite3-journal +*.log +tmp +tmp/**/* +config/memcached.yml +config/vagrant.yml +config/mogilefs.yml +config/resque.yml +config/app_config.yml +config/database.yml +config/unicorn.rb +bin/* + +# Documentation +doc/api +doc/app +.yardoc +.yardopts + +# Public Uploads +public/system/* +public/themes/* + +# Public Cache +public/javascripts/cache +public/stylesheets/cache + +# Vendor Cache +vendor/cache + +# Acts as Indexed +index/**/* + +# Refinery Specific +*.tmproj +*.autobackupbyrefinery.* +refinerycms-*.gem +.autotest + +# Mac +.DS_Store + +# Windows +Thumbs.db + +# NetBeans +nbproject + +# Eclipse +.project + +# Redcar +.redcar + +# Rubinius +*.rbc + +# Vim +*.swp +*.swo + +# RubyMine +.idea + +# E-texteditor +.eprj + +# Backup +*~ + +# Capybara Bug +capybara-*html + +# sass +.sass-cache +.sass-cache/* + +# vagrant +.vagrant + +# chef +.chef +# Rails +.bundle +db/*.sqlite3 +db/*.sqlite3-journal +*.log +tmp +tmp/**/* + +# Documentation +doc/api +doc/app +.yardoc +.yardopts +coverage + +# Public Uploads +public/system/* +public/themes/* + +# Public Cache +public/javascripts/cache +public/stylesheets/cache + +# Vendor Cache +vendor/cache + +# Acts as Indexed +index/**/* + +# Refinery Specific +*.tmproj +*.autobackupbyrefinery.* +refinerycms-*.gem +.autotest + +# Mac +.DS_Store + +# Windows +Thumbs.db + +# NetBeans +nbproject + +# Eclipse +.project + +# Redcar +.redcar + +# Rubinius +*.rbc + +# Vim +*.swp +*.swo + +# RubyMine +.idea + +# E-texteditor +.eprj + +# Backup +*~ + +# Capybara Bug +capybara-*html + +# sass +.sass-cache +.sass-cache/* + +#rvm +.rvmrc +.rvmrc.* diff --git a/spec/dummy/Rakefile b/spec/dummy/Rakefile new file mode 100644 index 0000000..852eb68 --- /dev/null +++ b/spec/dummy/Rakefile @@ -0,0 +1,13 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +unless File.exist?(db_yml = File.expand_path('../config/database.yml', __FILE__)) + require 'fileutils' + FileUtils.cp "#{db_yml}.sqlite3", db_yml + puts "Copied #{db_yml}.sqlite3 to #{db_yml}" +end + +require File.expand_path('../config/application', __FILE__) + +Dummy::Application.load_tasks diff --git a/spec/dummy/app/assets/images/.gitkeep b/spec/dummy/app/assets/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/assets/javascripts/admin.js b/spec/dummy/app/assets/javascripts/admin.js new file mode 100644 index 0000000..23c4fb9 --- /dev/null +++ b/spec/dummy/app/assets/javascripts/admin.js @@ -0,0 +1,7 @@ +// Use this to customize the wymeditor boot process +// Just mirror the options specified in boot_wym.js with the new options here. +// This will completely override anything specified in boot_wym.js for that key. +// e.g. skin: 'something_else' +var custom_wymeditor_boot_options = { + +}; \ No newline at end of file diff --git a/spec/dummy/app/assets/javascripts/application.js b/spec/dummy/app/assets/javascripts/application.js new file mode 100644 index 0000000..37c7bfc --- /dev/null +++ b/spec/dummy/app/assets/javascripts/application.js @@ -0,0 +1,9 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/spec/dummy/app/assets/stylesheets/application.css b/spec/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/application.css @@ -0,0 +1 @@ + diff --git a/spec/dummy/app/assets/stylesheets/application.css.backup b/spec/dummy/app/assets/stylesheets/application.css.backup new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/application.css.backup @@ -0,0 +1 @@ + diff --git a/spec/dummy/app/assets/stylesheets/formatting.css b/spec/dummy/app/assets/stylesheets/formatting.css new file mode 100644 index 0000000..1132188 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/formatting.css @@ -0,0 +1,4 @@ +/* + Override default refinery formatting below. + Formatting applies to backend WYSIWYG editors and all frontend. +*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/home.css b/spec/dummy/app/assets/stylesheets/home.css new file mode 100644 index 0000000..824db99 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/home.css @@ -0,0 +1,4 @@ +/* + Override default refinery homepage styles here. + These only apply to the homepage of your site. +*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/theme.css b/spec/dummy/app/assets/stylesheets/theme.css new file mode 100644 index 0000000..8205050 --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/theme.css @@ -0,0 +1,4 @@ +/* + Override default refinery 'theme' styles here. + These only apply when using custom WYMeditor CSS. +*/ \ No newline at end of file diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..e8065d9 --- /dev/null +++ b/spec/dummy/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery +end diff --git a/spec/dummy/app/helpers/application_helper.rb b/spec/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/spec/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/spec/dummy/app/mailers/.gitkeep b/spec/dummy/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/models/.gitkeep b/spec/dummy/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/views/layouts/application.html.erb.backup b/spec/dummy/app/views/layouts/application.html.erb.backup new file mode 100644 index 0000000..9a8a761 --- /dev/null +++ b/spec/dummy/app/views/layouts/application.html.erb.backup @@ -0,0 +1,14 @@ + + + + Dummy + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/spec/dummy/app/views/sitemap/index.xml.builder b/spec/dummy/app/views/sitemap/index.xml.builder new file mode 100644 index 0000000..8e89852 --- /dev/null +++ b/spec/dummy/app/views/sitemap/index.xml.builder @@ -0,0 +1,25 @@ +xml.instruct! + +xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do + + @locales.each do |locale| + ::I18n.locale = locale + ::Refinery::Page.live.in_menu.includes(:parts).each do |page| + # exclude sites that are external to our own domain. + page_url = if page.url.is_a?(Hash) + # This is how most pages work without being overriden by link_url + page.url.merge({:only_path => false}) + elsif page.url.to_s !~ /^http/ + # handle relative link_url addresses. + [request.protocol, request.host_with_port, page.url].join + end + + # Add XML entry only if there is a valid page_url found above. + xml.url do + xml.loc url_for(page_url) + xml.lastmod page.updated_at.to_date + end if page_url.present? and page.show_in_menu? + end + end + +end diff --git a/spec/dummy/config.ru b/spec/dummy/config.ru new file mode 100644 index 0000000..1989ed8 --- /dev/null +++ b/spec/dummy/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Dummy::Application diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb new file mode 100644 index 0000000..60df716 --- /dev/null +++ b/spec/dummy/config/application.rb @@ -0,0 +1,43 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +require 'bundler/setup' +Bundler.require +require 'refinerycms-blog' + +module Dummy + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable the asset pipeline + config.assets.enabled = true + end +end + diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb new file mode 100644 index 0000000..eba0681 --- /dev/null +++ b/spec/dummy/config/boot.rb @@ -0,0 +1,10 @@ +require 'rubygems' +gemfile = File.expand_path('../../../../Gemfile', __FILE__) + +if File.exist?(gemfile) + ENV['BUNDLE_GEMFILE'] = gemfile + require 'bundler' + Bundler.setup +end + +$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml new file mode 100644 index 0000000..c2da158 --- /dev/null +++ b/spec/dummy/config/database.yml @@ -0,0 +1,26 @@ +# SQLite version 3.x +development: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/development.sqlite3 + timeout: 5000 + +# Warning: The database defined as 'test' will be erased and +# re-generated from your development database when you run 'rake'. +# Do not set this db to the same as development or production. +test: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/test.sqlite3 + timeout: 5000 + +# Warning: The database defined as 'cucumber' will be erased and +# re-generated from your development database when you run 'rake'. +# Do not set this db to the same as development or production. +cucumber: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/cucumber.sqlite3 + timeout: 5000 + +production: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/production.sqlite3 + timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/database.yml.mysql b/spec/dummy/config/database.yml.mysql new file mode 100644 index 0000000..75cca95 --- /dev/null +++ b/spec/dummy/config/database.yml.mysql @@ -0,0 +1,20 @@ +development: &development + adapter: mysql2 + host: localhost + username: root + password: + database: your_local_database + +test: &test + adapter: mysql2 + host: localhost + username: root + password: + database: your_test_database + +production: &production + adapter: mysql2 + host: localhost + database: your_production_database + username: your_production_database_login + password: your_production_database_password diff --git a/spec/dummy/config/database.yml.postgresql b/spec/dummy/config/database.yml.postgresql new file mode 100644 index 0000000..2146d1f --- /dev/null +++ b/spec/dummy/config/database.yml.postgresql @@ -0,0 +1,55 @@ +# PostgreSQL. Versions 7.4 and 8.x are supported. +# +# Install the pg driver: +# gem install pg +# On Mac OS X with macports: +# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config +# On Windows: +# gem install pg +# Choose the win32 build. +# Install PostgreSQL and put its /bin directory on your path. +# +# Configure Using Gemfile +# gem 'pg' +# +development: + adapter: postgresql + encoding: unicode + database: refinery_database_development + pool: 5 + username: postgres + password: postgres + + # Connect on a TCP socket. Omitted by default since the client uses a + # domain socket that doesn't need configuration. Windows does not have + # domain sockets, so uncomment these lines. + #host: localhost + #port: 5432 + + # Schema search path. The server defaults to $user,public + #schema_search_path: myapp,sharedapp,public + + # Minimum log levels, in increasing order: + # debug5, debug4, debug3, debug2, debug1, + # log, notice, warning, error, fatal, and panic + # The server defaults to notice. + #min_messages: warning + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: postgresql + encoding: unicode + database: refinery_database_test + pool: 5 + username: postgres + password: postgres + +production: + adapter: postgresql + encoding: unicode + database: refinery_database_production + pool: 5 + username: postgres + password: postgres diff --git a/spec/dummy/config/database.yml.sqlite3 b/spec/dummy/config/database.yml.sqlite3 new file mode 100644 index 0000000..c2da158 --- /dev/null +++ b/spec/dummy/config/database.yml.sqlite3 @@ -0,0 +1,26 @@ +# SQLite version 3.x +development: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/development.sqlite3 + timeout: 5000 + +# Warning: The database defined as 'test' will be erased and +# re-generated from your development database when you run 'rake'. +# Do not set this db to the same as development or production. +test: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/test.sqlite3 + timeout: 5000 + +# Warning: The database defined as 'cucumber' will be erased and +# re-generated from your development database when you run 'rake'. +# Do not set this db to the same as development or production. +cucumber: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/cucumber.sqlite3 + timeout: 5000 + +production: + adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 + database: db/production.sqlite3 + timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb new file mode 100644 index 0000000..3da5eb9 --- /dev/null +++ b/spec/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Dummy::Application.initialize! diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb new file mode 100644 index 0000000..8604338 --- /dev/null +++ b/spec/dummy/config/environments/development.rb @@ -0,0 +1,31 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Do not compress assets + config.assets.compress = false +end +Refinery.rescue_not_found = false +# When true will use Amazon's Simple Storage Service on your production machine +# instead of the default file system for resources and images +Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb new file mode 100644 index 0000000..17a630b --- /dev/null +++ b/spec/dummy/config/environments/production.rb @@ -0,0 +1,55 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = true # Refinery CMS requires this to be true + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Specifies the header that your server uses for sending files + # (comment out if your front-end server doesn't support this) + config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify +end +Refinery.rescue_not_found = true +# When true will use Amazon's Simple Storage Service on your production machine +# instead of the default file system for resources and images +Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb new file mode 100644 index 0000000..9e84bae --- /dev/null +++ b/spec/dummy/config/environments/test.rb @@ -0,0 +1,43 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = false + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end +Refinery.rescue_not_found = false +# When true will use Amazon's Simple Storage Service on your production machine +# instead of the default file system for resources and images +Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/initializers/backtrace_silencers.rb b/spec/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/spec/dummy/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/dummy/config/initializers/devise.rb b/spec/dummy/config/initializers/devise.rb new file mode 100644 index 0000000..0d00106 --- /dev/null +++ b/spec/dummy/config/initializers/devise.rb @@ -0,0 +1,144 @@ +require 'devise' + +# Use this hook to configure devise mailer, warden hooks and so forth. The first +# four configuration values can also be set straight in your models. +::Devise.setup do |config| + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in DeviseMailer. + # config.mailer_sender = "please-change-me@config-initializers-devise.com" + + # Configure the class responsible to send e-mails. + # config.mailer = "::Devise::Mailer" + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating an user. By default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating an user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + config.authentication_keys = [ :login ] + + # Tell if authentication through request.params is enabled. True by default. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. False by default. + # config.http_authenticatable = false + + # Set this to true to use Basic Auth for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication + # config.http_authentication_realm = "Application" + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # config.stretches = 20 + + # Define which will be the encryption algorithm. Devise also supports encryptors + # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then + # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1 + # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :bcrypt + + # Setup a pepper to generate the encrypted password. + # config.pepper = "2e20a8abdd34d729ba6d05f679e513cfea9fbb1e83c81f84b29e9e4fdbd4ee59b56a32200064082a15a72b05a4d4a6a2c3784a09c0554b3a47a67cc8333ccbc7" + + # ==> Configuration for :confirmable + # The time you want to give your user to confirm his account. During this time + # he will be able to access your application without confirming. Default is nil. + # When confirm_within is zero, the user won't be able to sign in without confirming. + # You can use this to let your user access some features of your application + # without confirming the account, but blocking it after a certain period + # (ie 2 days). + # config.confirm_within = 2.days + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # If true, a valid remember token can be re-used between multiple browsers. + # config.remember_across_browsers = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # ==> Configuration for :validatable + # Range for password length + config.password_length = 4..20 + + # Regex to use to validate the email address + # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. + # config.timeout_in = 10.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = true + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes. + # config.default_scope = :user + + # Configure sign_out behavior. + # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope). + # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes. + # config.sign_out_all_scopes = false + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. Default is [:html] + # config.navigational_formats = [:html, :iphone] + + # ==> Warden configuration + # If you want to use other strategies, that are not (yet) supported by Devise, + # you can configure them inside the config.warden block. The example below + # allows you to setup OAuth, using http://github.com/roman/warden_oauth + # + # config.warden do |manager| + # manager.oauth(:twitter) do |twitter| + # twitter.consumer_secret = + # twitter.consumer_key = + # twitter.options :site => 'http://twitter.com' + # end + # manager.default_strategies(:scope => :user).unshift :twitter_oauth + # end +end diff --git a/spec/dummy/config/initializers/inflections.rb b/spec/dummy/config/initializers/inflections.rb new file mode 100644 index 0000000..9e8b013 --- /dev/null +++ b/spec/dummy/config/initializers/inflections.rb @@ -0,0 +1,10 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end diff --git a/spec/dummy/config/initializers/mime_types.rb b/spec/dummy/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/spec/dummy/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/spec/dummy/config/initializers/secret_token.rb b/spec/dummy/config/initializers/secret_token.rb new file mode 100644 index 0000000..7a99397 --- /dev/null +++ b/spec/dummy/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Dummy::Application.config.secret_token = '75470fb2f9c361e0509af41d5835fdb3fee2e588a44c68596c6201976f994e0689c434b6e8360dbc45c0d424c1811a5cf1e3f4f0550be9b784fed60fb4e5d29d' diff --git a/spec/dummy/config/initializers/session_store.rb b/spec/dummy/config/initializers/session_store.rb new file mode 100644 index 0000000..952473f --- /dev/null +++ b/spec/dummy/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# Dummy::Application.config.session_store :active_record_store diff --git a/spec/dummy/config/initializers/wrap_parameters.rb b/spec/dummy/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..16c3243 --- /dev/null +++ b/spec/dummy/config/initializers/wrap_parameters.rb @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActionController::Base.wrap_parameters format: [:json] + +# Disable root element in JSON by default. +if defined?(ActiveRecord) + ActiveRecord::Base.include_root_in_json = false +end diff --git a/spec/dummy/config/locales/en.yml b/spec/dummy/config/locales/en.yml new file mode 100644 index 0000000..179c14c --- /dev/null +++ b/spec/dummy/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb new file mode 100644 index 0000000..bb509f2 --- /dev/null +++ b/spec/dummy/config/routes.rb @@ -0,0 +1,58 @@ +Dummy::Application.routes.draw do + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/spec/dummy/db/migrate/.gitkeep b/spec/dummy/db/migrate/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb b/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb new file mode 100644 index 0000000..f9b6c2e --- /dev/null +++ b/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb @@ -0,0 +1,48 @@ +class CreateRefinerycmsAuthenticationSchema < ActiveRecord::Migration + def self.up + # Postgres apparently requires the roles_users table to exist before creating the roles table. + create_table ::Refinery::RolesUsers.table_name, :id => false, :force => true do |t| + t.integer "user_id" + t.integer "role_id" + end unless ::Refinery::RolesUsers.table_exists? + + create_table ::Refinery::Role.table_name, :force => true do |t| + t.string "title" + end unless ::Refinery::Role.table_exists? + + unless ::Refinery::UserPlugin.table_exists? + create_table ::Refinery::UserPlugin.table_name, :force => true do |t| + t.integer "user_id" + t.string "name" + t.integer "position" + end + + add_index ::Refinery::UserPlugin.table_name, ["name"], :name => "index_#{::Refinery::UserPlugin.table_name}_on_title" + add_index ::Refinery::UserPlugin.table_name, ["user_id", "name"], :name => "index_unique_#{::Refinery::UserPlugin.table_name}", :unique => true + + end + + unless ::Refinery::User.table_exists? + create_table ::Refinery::User.table_name, :force => true do |t| + t.string "login", :null => false + t.string "email", :null => false + t.string "crypted_password", :null => false + t.string "password_salt", :null => false + t.string "persistence_token" + t.datetime "created_at" + t.datetime "updated_at" + t.string "perishable_token" + end + + add_index ::Refinery::User.table_name, ["id"], :name => "index_#{::Refinery::User.table_name}_on_id" + end + end + + def self.down + [::User].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb new file mode 100644 index 0000000..c2dd42c --- /dev/null +++ b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb @@ -0,0 +1,25 @@ +class CreateRefinerycmsCoreSchema < ActiveRecord::Migration + def self.up + unless Slug.table_exists? + create_table ::Slug.table_name, :force => true do |t| + t.string "name" + t.integer "sluggable_id" + t.integer "sequence", :default => 1, :null => false + t.string "sluggable_type", :limit => 40 + t.string "scope", :limit => 40 + t.datetime "created_at" + end + + add_index ::Slug.table_name, ["name", "sluggable_type", "scope", "sequence"], :name => "index_#{::Slug.table_name}_on_n_s_s_and_s", :unique => true + add_index ::Slug.table_name, ["sluggable_id"], :name => "index_#{::Slug.table_name}_on_sluggable_id" + end + end + + def self.down + [::Slug].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb b/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb new file mode 100644 index 0000000..6c4e079 --- /dev/null +++ b/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb @@ -0,0 +1,23 @@ +class CreateRefinerycmsImagesSchema < ActiveRecord::Migration + def self.up + create_table ::Refinery::Image.table_name, :force => true do |t| + t.string "image_mime_type" + t.string "image_name" + t.integer "image_size" + t.integer "image_width" + t.integer "image_height" + t.datetime "created_at" + t.datetime "updated_at" + t.string "image_uid" + t.string "image_ext" + end unless ::Refinery::Image.table_exists? + end + + def self.down + [::Image].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb b/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb new file mode 100644 index 0000000..4458726 --- /dev/null +++ b/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb @@ -0,0 +1,56 @@ +class CreateRefinerycmsPagesSchema < ActiveRecord::Migration + def self.up + unless ::Refinery::PagePart.table_exists? + create_table ::Refinery::PagePart.table_name, :force => true do |t| + t.integer "refinery_page_id" + t.string "title" + t.text "body" + t.integer "position" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index ::Refinery::PagePart.table_name, ["id"], :name => "index_#{::Refinery::PagePart.table_name}_on_id" + add_index ::Refinery::PagePart.table_name, ["refinery_page_id"], :name => "index_#{::Refinery::PagePart.table_name}_on_page_id" + end + + unless ::Refinery::Page.table_exists? + create_table ::Refinery::Page.table_name, :force => true do |t| + t.string "title" + t.integer "parent_id" + t.integer "position" + t.string "path" + t.datetime "created_at" + t.datetime "updated_at" + t.string "meta_keywords" + t.text "meta_description" + t.boolean "show_in_menu", :default => true + t.string "link_url" + t.string "menu_match" + t.boolean "deletable", :default => true + t.string "custom_title" + t.string "custom_title_type", :default => "none" + t.boolean "draft", :default => false + t.string "browser_title" + t.boolean "skip_to_first_child", :default => false + t.integer "lft" + t.integer "rgt" + t.integer "depth" + end + + add_index ::Refinery::Page.table_name, ["depth"], :name => "index_#{::Refinery::Page.table_name}_on_depth" + add_index ::Refinery::Page.table_name, ["id"], :name => "index_#{::Refinery::Page.table_name}_on_id" + add_index ::Refinery::Page.table_name, ["lft"], :name => "index_#{::Refinery::Page.table_name}_on_lft" + add_index ::Refinery::Page.table_name, ["parent_id"], :name => "index_#{::Refinery::Page.table_name}_on_parent_id" + add_index ::Refinery::Page.table_name, ["rgt"], :name => "index_#{::Refinery::Page.table_name}_on_rgt" + end + end + + def self.down + [::Page, ::Refinery::PagePart].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb b/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb new file mode 100644 index 0000000..360f469 --- /dev/null +++ b/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb @@ -0,0 +1,21 @@ +class CreateRefinerycmsResourcesSchema < ActiveRecord::Migration + def self.up + create_table ::Refinery::Resource.table_name, :force => true do |t| + t.string "file_mime_type" + t.string "file_name" + t.integer "file_size" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_uid" + t.string "file_ext" + end unless ::Refinery::Resource.table_exists? + end + + def self.down + [::Resource].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb b/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb new file mode 100644 index 0000000..955389f --- /dev/null +++ b/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb @@ -0,0 +1,26 @@ +class CreateRefinerycmsSettingsSchema < ActiveRecord::Migration + def self.up + unless ::Refinery::Setting.table_exists? + create_table ::Refinery::Setting.table_name, :force => true do |t| + t.string "name" + t.text "value" + t.boolean "destroyable", :default => true + t.datetime "created_at" + t.datetime "updated_at" + t.string "scoping" + t.boolean "restricted", :default => false + t.string "callback_proc_as_string" + end + + add_index ::Refinery::Setting.table_name, ["name"], :name => "index_#{::Refinery::Setting.table_name}_on_name" + end + end + + def self.down + [::Refinery::Setting].reject{|m| + !(defined?(m) and m.respond_to?(:table_name)) + }.each do |model| + drop_table model.table_name if model.table_exists? + end + end +end diff --git a/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb b/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb new file mode 100644 index 0000000..d13aa01 --- /dev/null +++ b/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb @@ -0,0 +1,13 @@ +class AddValueTypeToRefinerySettings < ActiveRecord::Migration + def self.up + add_column ::Refinery::Setting.table_name, :form_value_type, :string + + ::Refinery::Setting.reset_column_information + end + + def self.down + remove_column ::Refinery::Setting.table_name, :form_value_type + + ::Refinery::Setting.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb b/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb new file mode 100644 index 0000000..e72d81f --- /dev/null +++ b/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb @@ -0,0 +1,11 @@ +class AddMissingIndexesToRolesUsers < ActiveRecord::Migration + def self.up + add_index ::Refinery::RolesUsers.table_name, [:role_id, :user_id] + add_index ::Refinery::RolesUsers.table_name, [:user_id, :role_id] + end + + def self.down + remove_index ::Refinery::RolesUsers.table_name, :column => [:role_id, :user_id] + remove_index ::Refinery::RolesUsers.table_name, :column => [:user_id, :role_id] + end +end diff --git a/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb b/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb new file mode 100644 index 0000000..8beef83 --- /dev/null +++ b/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb @@ -0,0 +1,31 @@ +class ChangeToDeviseUsersTable < ActiveRecord::Migration + def self.up + add_column ::Refinery::User.table_name, :current_sign_in_at, :datetime + add_column ::Refinery::User.table_name, :last_sign_in_at, :datetime + add_column ::Refinery::User.table_name, :current_sign_in_ip, :string + add_column ::Refinery::User.table_name, :last_sign_in_ip, :string + add_column ::Refinery::User.table_name, :sign_in_count, :integer + add_column ::Refinery::User.table_name, :remember_token, :string + add_column ::Refinery::User.table_name, :reset_password_token, :string + + rename_column ::Refinery::User.table_name, :crypted_password, :encrypted_password + rename_column ::Refinery::User.table_name, :login, :username + + ::Refinery::User.reset_column_information + end + + def self.down + remove_column ::Refinery::User.table_name, :current_sign_in_at + remove_column ::Refinery::User.table_name, :last_sign_in_at + remove_column ::Refinery::User.table_name, :current_sign_in_ip + remove_column ::Refinery::User.table_name, :last_sign_in_ip + remove_column ::Refinery::User.table_name, :sign_in_count + remove_column ::Refinery::User.table_name, :remember_token + remove_column ::Refinery::User.table_name, :reset_password_token + + rename_column ::Refinery::User.table_name, :encrypted_password, :crypted_password + rename_column ::Refinery::User.table_name, :username, :login + + ::Refinery::User.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb b/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb new file mode 100644 index 0000000..341bc8f --- /dev/null +++ b/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb @@ -0,0 +1,17 @@ +class RemoveCachedSlugFromPages < ActiveRecord::Migration + def self.up + if ::Refinery::Page.column_names.map(&:to_s).include?('cached_slug') + say_with_time("Removing cached_slug column from ::Refinery::Page table") do + remove_column ::Refinery::Page.table_name, :cached_slug + end + else + say "Nothing done, no cached_slug field found in ::Refinery::Page table" + end + + ::Refinery::Page.reset_column_information + end + + def self.down + # Don't add this column back, it breaks stuff. + end +end diff --git a/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb b/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb new file mode 100644 index 0000000..4b56f03 --- /dev/null +++ b/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb @@ -0,0 +1,15 @@ +class AddLocaleToSlugs < ActiveRecord::Migration + def self.up + add_column ::Slug.table_name, :locale, :string, :limit => 5 + + add_index ::Slug.table_name, :locale + + ::Slug.reset_column_information + end + + def self.down + remove_column :slugs, :locale + + ::Slug.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb new file mode 100644 index 0000000..bdb0a43 --- /dev/null +++ b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb @@ -0,0 +1,38 @@ +class TranslatePagePlugin < ActiveRecord::Migration + def self.up + say_with_time("Creating ::Refinery::PagePart translation table") do + ::Refinery::PagePart.create_translation_table!({ + :body => :text + }, { + :migrate_data => true + }) + end + + say_with_time("Creating ::Refinery::Page translation table") do + ::Refinery::Page.create_translation_table!({ + :title => :string, + :meta_keywords => :string, + :meta_description => :text, + :browser_title => :string + }, { + :migrate_data => true + }) + end + + puts "seeds pages" + if (seed_file = Rails.root.join('db', 'seeds', 'pages.rb')).file? + load seed_file.to_s unless ::Refinery::Page.where(:link_url => '/').any? + end + + say_with_time("Updating slugs") do + ::Slug.update_all(:locale => I18n.locale) + end + end + + def self.down + say_with_time("Dropping ::Refinery::Page and ::Refinery::PagePart translation tables") do + ::Refinery::Page.drop_translation_table! :migrate_data => true + ::Refinery::PagePart.drop_translation_table! :migrate_data => true + end + end +end diff --git a/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb b/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb new file mode 100644 index 0000000..78c9f68 --- /dev/null +++ b/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb @@ -0,0 +1,7 @@ +class AddRememberCreatedAtToUsers < ActiveRecord::Migration + def change + add_column ::Refinery::User.table_name, :remember_created_at, :datetime + + ::Refinery::User.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb b/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb new file mode 100644 index 0000000..9b6db2b --- /dev/null +++ b/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb @@ -0,0 +1,22 @@ +class RemoveDuplicateUserImageSizesSetting < ActiveRecord::Migration + def self.up + if (settings = ::Refinery::Setting.where(:name => :user_image_sizes)).count > 1 + default_value = { :small => '110x110>', :medium => '225x255>', :large => '450x450>' } + + if (non_default_setting = settings.detect { |setting| setting[:value] != default_value }) + settings.detect { |setting| setting[:value] == default_value }.destroy + non_default_setting[:destroyable] = false + non_default_setting.save + else + settings.detect { |setting| setting[:destroyable] == true }.destroy + end + say "Removed duplicate user image sizes settings" + else + say "Nothing done, no duplicate settings found" + end + end + + def self.down + # there is no step down ... + end +end diff --git a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb new file mode 100644 index 0000000..2bcecc7 --- /dev/null +++ b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb @@ -0,0 +1,41 @@ +class TranslateCustomTitleOnPages < ActiveRecord::Migration + def self.up + unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title) + add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string + + say_with_time("Re-save custom_title") do + ::Refinery::Page.all.each do |page| + say "updating custom_title field for page##{page.id}" + page.update_attribute(:custom_title, page.untranslated_attributes['custom_title']) + end + end + else + say "Nothing done, ::Refinery::Page.translation_class table already includes a custom_title field" + end + + ::Refinery::Page.translation_class.reset_column_information + end + + def self.down + say_with_time("Re-save custom_title") do + ::Refinery::Page.all.each do |page| + if page.attributes['custom_title'].nil? + say "Nothing done, page##{page.id} custom_title field is nil" + else + say "updating custom_title field for page #{page.id}" + ::Refinery::Page.update_all({ + :custom_title => page.attributes['custom_title'] + }, { + :id => page.id.to_s + }) + end + end + end + + remove_column ::Refinery::Page.translation_class.table_name, :custom_title + + ::Refinery::Page.translated_attribute_names.delete(:custom_title) + + ::Refinery::Page.translation_class.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb b/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb new file mode 100644 index 0000000..452daee --- /dev/null +++ b/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb @@ -0,0 +1,17 @@ +class RemoveTranslatedFieldsFromPages < ActiveRecord::Migration + def self.up + ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| + remove_column ::Refinery::Page.table_name, column_name if ::Refinery::Page.column_names.map(&:to_sym).include?(column_name) + end + + ::Refinery::Page.reset_column_information + end + + def self.down + ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| + add_column ::Refinery::Page.table_name, column_name, Page::Translation.columns.detect{|c| c.name.to_sym == column_name}.type + end + + ::Refinery::Page.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb b/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb new file mode 100644 index 0000000..4197125 --- /dev/null +++ b/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb @@ -0,0 +1,17 @@ +class RemovePasswordSaltFromUsers < ActiveRecord::Migration + def self.up + remove_column ::Refinery::User.table_name, :password_salt + # Make the current password invalid :( + ::Refinery::User.all.each do |u| + u.update_attribute(:encrypted_password, u.encrypted_password[29..-1]) + end + + ::Refinery::User.reset_column_information + end + + def self.down + add_column ::Refinery::User.table_name, :password_salt, :string + + ::Refinery::User.reset_column_information + end +end diff --git a/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb b/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb new file mode 100644 index 0000000..cb8c268 --- /dev/null +++ b/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb @@ -0,0 +1,86 @@ +class CreateSeoMeta < ActiveRecord::Migration + + def self.up + create_table :seo_meta do |t| + t.integer :seo_meta_id + t.string :seo_meta_type + + t.string :browser_title + t.string :meta_keywords + t.text :meta_description + + t.timestamps + end + + add_index :seo_meta, :id + add_index :seo_meta, [:seo_meta_id, :seo_meta_type] + + # Grab the attributes of the records that currently exist + existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) + + # Remove columns + ::SeoMeta.attributes.keys.each do |field| + if ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) + remove_column ::Refinery::Page.translation_class.table_name, field + end + end + + # Reset column information because otherwise the old columns will still exist. + ::Refinery::Page.translation_class.reset_column_information + + # Re-attach seo_meta + ::Refinery::Page.translation_class.send :is_seo_meta + + # Migrate data + existing_translations.each do |translation| + ::Refinery::Page.translation_class.find(translation['id']).update_attributes( + ::SeoMeta.attributes.keys.inject({}) {|attributes, name| + attributes.merge(name => translation[name.to_s]) + } + ) + end + + # Reset column information again because otherwise the old columns will still exist. + ::Refinery::Page.reset_column_information + end + + def self.down + # Grab the attributes of the records that currently exist + existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) + + # Add columns back to your model + ::Refinery::SeoMeta.attributes.each do |field, field_type| + unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) + add_column ::Refinery::Page.translation_class.table_name, field, field_type + end + end + + # Reset column information because otherwise the new columns won't exist yet. + ::Refinery::Page.translation_class.reset_column_information + + # Migrate data + existing_translations.each do |translation| + ::Refinery::Page.translation_class.update_all( + ::Refinery::SeoMeta.attributes.keys.inject({}) {|attributes, name| + attributes.merge(name => translation[name.to_s]) + }, :id => translation['id'] + ) + end + + ::Refinery::SeoMeta.attributes.keys.each do |k| + ::Refinery::Page.translation_class.module_eval %{ + def #{k} + end + + def #{k}=(*args) + end + } + end + + # Reset column information again because otherwise the old columns will still exist. + ::Refinery::Page.reset_column_information + + drop_table :seo_meta + end + +end diff --git a/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb b/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb new file mode 100644 index 0000000..eb98ed1 --- /dev/null +++ b/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb @@ -0,0 +1,11 @@ +class CreateAddTemplateColumns < ActiveRecord::Migration + def self.up + add_column ::Refinery::Page.table_name, :view_template, :string + add_column ::Refinery::Page.table_name, :layout_template, :string + end + + def self.down + remove_column ::Refinery::Page.table_name, :layout_template + remove_column ::Refinery::Page.table_name, :view_template + end +end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb new file mode 100644 index 0000000..3d96369 --- /dev/null +++ b/spec/dummy/db/schema.rb @@ -0,0 +1,239 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20110803223529) do + + create_table "refinery_blog_categories", :force => true do |t| + t.string "title" + t.datetime "created_at" + t.datetime "updated_at" + t.string "cached_slug" + end + + add_index "refinery_blog_categories", ["id"], :name => "index_refinery_blog_categories_on_id" + + create_table "refinery_blog_categories_blog_posts", :force => true do |t| + t.integer "blog_category_id" + t.integer "blog_post_id" + end + + add_index "refinery_blog_categories_blog_posts", ["blog_category_id", "blog_post_id"], :name => "index_blog_categories_blog_posts_on_bc_and_bp" + + create_table "refinery_blog_comments", :force => true do |t| + t.integer "blog_post_id" + t.boolean "spam" + t.string "name" + t.string "email" + t.text "body" + t.string "state" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_blog_comments", ["id"], :name => "index_refinery_blog_comments_on_id" + + create_table "refinery_blog_posts", :force => true do |t| + t.string "title" + t.text "body" + t.boolean "draft" + t.datetime "published_at" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "user_id" + t.string "cached_slug" + t.string "custom_url" + t.text "custom_teaser" + end + + add_index "refinery_blog_posts", ["id"], :name => "index_refinery_blog_posts_on_id" + + create_table "refinery_images", :force => true do |t| + t.string "image_mime_type" + t.string "image_name" + t.integer "image_size" + t.integer "image_width" + t.integer "image_height" + t.datetime "created_at" + t.datetime "updated_at" + t.string "image_uid" + t.string "image_ext" + end + + create_table "refinery_page_part_translations", :force => true do |t| + t.integer "refinery_page_part_id" + t.string "locale" + t.text "body" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_page_part_translations", ["refinery_page_part_id"], :name => "index_f9716c4215584edbca2557e32706a5ae084a15ef" + + create_table "refinery_page_parts", :force => true do |t| + t.integer "refinery_page_id" + t.string "title" + t.text "body" + t.integer "position" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_page_parts", ["id"], :name => "index_refinery_page_parts_on_id" + add_index "refinery_page_parts", ["refinery_page_id"], :name => "index_refinery_page_parts_on_page_id" + + create_table "refinery_page_translations", :force => true do |t| + t.integer "refinery_page_id" + t.string "locale" + t.string "title" + t.string "custom_title" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "refinery_page_translations", ["refinery_page_id"], :name => "index_d079468f88bff1c6ea81573a0d019ba8bf5c2902" + + create_table "refinery_pages", :force => true do |t| + t.integer "parent_id" + t.integer "position" + t.string "path" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "show_in_menu", :default => true + t.string "link_url" + t.string "menu_match" + t.boolean "deletable", :default => true + t.string "custom_title_type", :default => "none" + t.boolean "draft", :default => false + t.boolean "skip_to_first_child", :default => false + t.integer "lft" + t.integer "rgt" + t.integer "depth" + t.string "view_template" + t.string "layout_template" + end + + add_index "refinery_pages", ["depth"], :name => "index_refinery_pages_on_depth" + add_index "refinery_pages", ["id"], :name => "index_refinery_pages_on_id" + add_index "refinery_pages", ["lft"], :name => "index_refinery_pages_on_lft" + add_index "refinery_pages", ["parent_id"], :name => "index_refinery_pages_on_parent_id" + add_index "refinery_pages", ["rgt"], :name => "index_refinery_pages_on_rgt" + + create_table "refinery_resources", :force => true do |t| + t.string "file_mime_type" + t.string "file_name" + t.integer "file_size" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_uid" + t.string "file_ext" + end + + create_table "refinery_roles", :force => true do |t| + t.string "title" + end + + create_table "refinery_roles_users", :id => false, :force => true do |t| + t.integer "user_id" + t.integer "role_id" + end + + add_index "refinery_roles_users", ["role_id", "user_id"], :name => "index_refinery_roles_users_on_role_id_and_user_id" + add_index "refinery_roles_users", ["user_id", "role_id"], :name => "index_refinery_roles_users_on_user_id_and_role_id" + + create_table "refinery_settings", :force => true do |t| + t.string "name" + t.text "value" + t.boolean "destroyable", :default => true + t.datetime "created_at" + t.datetime "updated_at" + t.string "scoping" + t.boolean "restricted", :default => false + t.string "callback_proc_as_string" + t.string "form_value_type" + end + + add_index "refinery_settings", ["name"], :name => "index_refinery_settings_on_name" + + create_table "refinery_user_plugins", :force => true do |t| + t.integer "user_id" + t.string "name" + t.integer "position" + end + + add_index "refinery_user_plugins", ["name"], :name => "index_refinery_user_plugins_on_title" + add_index "refinery_user_plugins", ["user_id", "name"], :name => "index_unique_refinery_user_plugins", :unique => true + + create_table "refinery_users", :force => true do |t| + t.string "username", :null => false + t.string "email", :null => false + t.string "encrypted_password", :null => false + t.string "persistence_token" + t.datetime "created_at" + t.datetime "updated_at" + t.string "perishable_token" + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.integer "sign_in_count" + t.string "remember_token" + t.string "reset_password_token" + t.datetime "remember_created_at" + end + + add_index "refinery_users", ["id"], :name => "index_refinery_users_on_id" + + create_table "seo_meta", :force => true do |t| + t.integer "seo_meta_id" + t.string "seo_meta_type" + t.string "browser_title" + t.string "meta_keywords" + t.text "meta_description" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "seo_meta", ["id"], :name => "index_seo_meta_on_id" + add_index "seo_meta", ["seo_meta_id", "seo_meta_type"], :name => "index_seo_meta_on_seo_meta_id_and_seo_meta_type" + + create_table "slugs", :force => true do |t| + t.string "name" + t.integer "sluggable_id" + t.integer "sequence", :default => 1, :null => false + t.string "sluggable_type", :limit => 40 + t.string "scope", :limit => 40 + t.datetime "created_at" + t.string "locale", :limit => 5 + end + + add_index "slugs", ["locale"], :name => "index_slugs_on_locale" + add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_n_s_s_and_s", :unique => true + add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id" + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context" + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + + create_table "tags", :force => true do |t| + t.string "name" + end + +end diff --git a/spec/dummy/db/seed/.gitkeep b/spec/dummy/db/seed/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb new file mode 100644 index 0000000..677f17d --- /dev/null +++ b/spec/dummy/db/seeds/pages.rb @@ -0,0 +1,63 @@ +module Refinery + ::Refinery::Page.reset_column_information + + # Check whether all columns are applied yet by seo_meta. + unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k| + ::Refinery::Page.translation_class.instance_methods.include?(k) + } + # Make pages model seo_meta because not all columns are accessible. + ::Refinery::Page.translation_class.send :is_seo_meta + end + + page_position = -1 + + unless ::Refinery::Page.where(:menu_match => "^/$").any? + home_page = ::Refinery::Page.create!({:title => "Home", + :deletable => false, + :link_url => "/", + :menu_match => "^/$", + :position => (page_position += 1)}) + home_page.parts.create({ + :title => "Body", + :body => "

Welcome to our site. This is just a place holder page while we gather our content.

", + :position => 0 + }) + home_page.parts.create({ + :title => "Side Body", + :body => "

This is another block of content over here.

", + :position => 1 + }) + + home_page_position = -1 + page_not_found_page = home_page.children.create(:title => "Page not found", + :menu_match => "^/404$", + :show_in_menu => false, + :deletable => false, + :position => (home_page_position += 1)) + page_not_found_page.parts.create({ + :title => "Body", + :body => "

Sorry, there was a problem...

The page you requested was not found.

Return to the home page

", + :position => 0 + }) + else + page_position += 1 + end + + unless ::Refinery::Page.by_title("About").any? + about_us_page = ::Refinery::Page.create(:title => "About", + :deletable => true, + :position => (page_position += 1)) + about_us_page.parts.create({ + :title => "Body", + :body => "

This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.

", + :position => 0 + }) + about_us_page.parts.create({ + :title => "Side Body", + :body => "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.

", + :position => 1 + }) + else + page_position += 1 + end +end diff --git a/spec/dummy/lib/assets/.gitkeep b/spec/dummy/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/log/.gitkeep b/spec/dummy/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/public/404.html b/spec/dummy/public/404.html new file mode 100644 index 0000000..9a48320 --- /dev/null +++ b/spec/dummy/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/spec/dummy/public/422.html b/spec/dummy/public/422.html new file mode 100644 index 0000000..83660ab --- /dev/null +++ b/spec/dummy/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/spec/dummy/public/500.html b/spec/dummy/public/500.html new file mode 100644 index 0000000..b80307f --- /dev/null +++ b/spec/dummy/public/500.html @@ -0,0 +1,26 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+

We've been notified about this issue and we'll take a look at it shortly.

+
+ + diff --git a/spec/dummy/public/favicon.ico b/spec/dummy/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/script/rails b/spec/dummy/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/spec/dummy/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/spec/dummy/version.rb b/spec/dummy/version.rb new file mode 100644 index 0000000..ed35a95 --- /dev/null +++ b/spec/dummy/version.rb @@ -0,0 +1,5 @@ +module Refinery + module TestApp + VERSION = "0.0.1" + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5a8d67c..8438536 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,38 +12,18 @@ Spork.prefork do require 'rspec/rails' require 'capybara/rspec' - require 'database_cleaner' - - require 'refinery/testing/factories' - require 'refinery/testing/controller_macros' - require 'refinery/testing/request_macros' + require 'factory_girl' Rails.backtrace_cleaner.remove_silencers! Dir[ - File.expand_path("../support/*.rb", __FILE__), - File.expand_path("../factories/*.rb", __FILE__) + File.expand_path("../support/**/*.rb", __FILE__), + File.expand_path("../factories/**/*.rb", __FILE__) ].each {|f| require f} RSpec.configure do |config| config.mock_with :rspec config.use_transactional_fixtures = false - - config.before(:suite) do - DatabaseCleaner.strategy = :truncation - end - - config.before(:each) do - DatabaseCleaner.start - end - - config.after(:each) do - DatabaseCleaner.clean - end - - config.include Devise::TestHelpers, :type => :controller - config.extend Refinery::ControllerMacros::Authentication, :type => :controller - config.extend Refinery::RequestMacros::Authentication, :type => :request end end diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb new file mode 100644 index 0000000..a104c53 --- /dev/null +++ b/spec/support/database_cleaner.rb @@ -0,0 +1,15 @@ +require 'database_cleaner' + +RSpec.configure do |config| + config.before(:suite) do + DatabaseCleaner.strategy = :truncation + end + + config.before(:each) do + DatabaseCleaner.start + end + + config.after(:each) do + DatabaseCleaner.clean + end +end diff --git a/spec/support/devise.rb b/spec/support/devise.rb new file mode 100644 index 0000000..9dc6823 --- /dev/null +++ b/spec/support/devise.rb @@ -0,0 +1,8 @@ +require 'devise' + +RSpec.configure do |config| + config.mock_with :rspec + config.use_transactional_fixtures = false + + config.include Devise::TestHelpers, :type => :controller +end diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb new file mode 100644 index 0000000..2b180db --- /dev/null +++ b/spec/support/refinery.rb @@ -0,0 +1,8 @@ +require 'refinery/testing/factories' +require 'refinery/testing/controller_macros' +require 'refinery/testing/request_macros' + +RSpec.configure do |config| + config.extend Refinery::ControllerMacros::Authentication, :type => :controller + config.extend Refinery::RequestMacros::Authentication, :type => :request +end From eca7a1a591abcae796aa4b8f168d9f313fdfffb0 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 11 Aug 2011 03:08:12 -0700 Subject: [PATCH 047/248] Remove spork as a development dependency Add spork to development & test group in Gemfile Fix ControllerMacros and RequestMacros namespace in refinery support file --- Gemfile | 9 +++++++-- spec/spec_helper.rb | 20 ++++++++++++++++---- spec/support/refinery.rb | 4 ++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index b445476..27048b3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source "http://rubygems.org" +gemspec + ## Uncomment the following lines to develop against a local clone of refinery # gem 'refinerycms', :path => '~/Code/refinerycms' # gem 'refinerycms-generators', :path => '~/Code/refinerycms-generators' @@ -7,10 +9,13 @@ source "http://rubygems.org" gem 'jquery-rails' +group :development, :test do + gem 'spork', '0.9.0.rc9', :platforms => :ruby + gem 'guard-spork', :platforms => :ruby +end + group :assets do gem 'sass-rails', "~> 3.1.0.rc" gem 'coffee-rails', "~> 3.1.0.rc" gem 'uglifier' end - -gemspec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8438536..75db576 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,6 @@ require 'rubygems' -require 'spork' -Spork.prefork do +def setup_environment # Loading more in this block will cause your tests to run faster. However, # if you change any configuration or code from libraries loaded here, you'll # need to restart spork for it take effect. @@ -27,6 +26,19 @@ Spork.prefork do end end -Spork.each_run do - # This code will be run each time you run your specs. +def each_run +end + +# If spork is available in the Gemfile it'll be used but we don't force it. +unless (begin; require 'spork'; rescue LoadError; nil end).nil? + Spork.prefork do + setup_environment + end + + Spork.each_run do + each_run + end +else + setup_environment + each_run end diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb index 2b180db..85d28ce 100644 --- a/spec/support/refinery.rb +++ b/spec/support/refinery.rb @@ -3,6 +3,6 @@ require 'refinery/testing/controller_macros' require 'refinery/testing/request_macros' RSpec.configure do |config| - config.extend Refinery::ControllerMacros::Authentication, :type => :controller - config.extend Refinery::RequestMacros::Authentication, :type => :request + config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller + config.extend Refinery::Testing::RequestMacros::Authentication, :type => :request end From 83d407c8bb0d363489fb27169e9b1751dd7e75c3 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 12 Aug 2011 11:26:37 +1200 Subject: [PATCH 048/248] Need to use edge everything, excluding spec/dummy from the gemspec. --- Gemfile | 10 +- lib/gemspec.rb | 6 +- refinerycms-blog.gemspec | 450 +-------------------------------------- 3 files changed, 15 insertions(+), 451 deletions(-) diff --git a/Gemfile b/Gemfile index 27048b3..6d86771 100644 --- a/Gemfile +++ b/Gemfile @@ -3,9 +3,9 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against a local clone of refinery -# gem 'refinerycms', :path => '~/Code/refinerycms' -# gem 'refinerycms-generators', :path => '~/Code/refinerycms-generators' -# gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' +gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +gem 'refinerycms-generators', :git => 'git://github.com/resolve/refinerycms-generators.git' +gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' gem 'jquery-rails' @@ -15,7 +15,7 @@ group :development, :test do end group :assets do - gem 'sass-rails', "~> 3.1.0.rc" - gem 'coffee-rails', "~> 3.1.0.rc" + gem 'sass-rails', "~> 3.1.0.rc.5" + gem 'coffee-rails', "~> 3.1.0.rc.5" gem 'uglifier' end diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 5627a98..d9d329e 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -2,7 +2,7 @@ require File.expand_path('../refinery/blog/version', __FILE__) version = ::Refinery::Blog::Version.to_s raise "Could not get version so gemspec can not be built" if version.nil? -files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.gem$}} +files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.gem$} or f =~ %r{^spec/dummy}} gemspec = < 1.1.0' + s.add_dependency 'refinerycms-core', '~> 2.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.1.0' # Development dependencies - s.add_development_dependency 'refinerycms-testing', '~> 1.1.0' + s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' s.files = %w( #{files.join("\n ")} diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 3ac5762..5a3c10e 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-08-04} + s.date = %q{2011-08-12} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -13,13 +13,13 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 1.1.0' + s.add_dependency 'refinerycms-core', '~> 2.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.1.0' # Development dependencies - s.add_development_dependency 'refinerycms-testing', '~> 1.1.0' + s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' s.files = %w( app @@ -187,7 +187,6 @@ Gem::Specification.new do |s| db/seeds db/seeds/refinerycms_blog.rb Gemfile - Gemfile.lock Guardfile lib lib/gemspec.rb @@ -199,451 +198,12 @@ Gem::Specification.new do |s| lib/refinery/blog/tabs.rb lib/refinery/blog/version.rb lib/refinerycms-blog.rb - lib/tasks Rakefile readme.md refinerycms-blog.gemspec script - script/cucumber script/rails spec - spec/dummy - spec/dummy/app - spec/dummy/app/assets - spec/dummy/app/assets/javascripts - spec/dummy/app/assets/javascripts/admin.js - spec/dummy/app/assets/javascripts/application.js - spec/dummy/app/assets/stylesheets - spec/dummy/app/assets/stylesheets/application.css - spec/dummy/app/assets/stylesheets/application.css.backup - spec/dummy/app/assets/stylesheets/formatting.css - spec/dummy/app/assets/stylesheets/home.css - spec/dummy/app/assets/stylesheets/theme.css - spec/dummy/app/controllers - spec/dummy/app/controllers/application_controller.rb - spec/dummy/app/helpers - spec/dummy/app/helpers/application_helper.rb - spec/dummy/app/mailers - spec/dummy/app/models - spec/dummy/app/views - spec/dummy/app/views/layouts - spec/dummy/app/views/layouts/application.html.erb.backup - spec/dummy/app/views/sitemap - spec/dummy/app/views/sitemap/index.xml.builder - spec/dummy/config - spec/dummy/config/application.rb - spec/dummy/config/boot.rb - spec/dummy/config/database.yml - spec/dummy/config/database.yml.mysql - spec/dummy/config/database.yml.postgresql - spec/dummy/config/database.yml.sqlite3 - spec/dummy/config/environment.rb - spec/dummy/config/environments - spec/dummy/config/environments/development.rb - spec/dummy/config/environments/production.rb - spec/dummy/config/environments/test.rb - spec/dummy/config/initializers - spec/dummy/config/initializers/backtrace_silencers.rb - spec/dummy/config/initializers/devise.rb - spec/dummy/config/initializers/inflections.rb - spec/dummy/config/initializers/mime_types.rb - spec/dummy/config/initializers/secret_token.rb - spec/dummy/config/initializers/session_store.rb - spec/dummy/config/initializers/wrap_parameters.rb - spec/dummy/config/locales - spec/dummy/config/locales/en.yml - spec/dummy/config/routes.rb - spec/dummy/config.ru - spec/dummy/db - spec/dummy/db/development.sqlite3 - spec/dummy/db/migrate - spec/dummy/db/migrate/20110802081556_create_refinerycms_core_schema.rb - spec/dummy/db/migrate/20110802081557_add_locale_to_slugs.rb - spec/dummy/db/migrate/20110802081558_create_refinerycms_settings_schema.rb - spec/dummy/db/migrate/20110802081559_add_value_type_to_refinery_settings.rb - spec/dummy/db/migrate/20110802081560_create_refinerycms_authentication_schema.rb - spec/dummy/db/migrate/20110802081561_add_missing_indexes_to_roles_users.rb - spec/dummy/db/migrate/20110802081562_change_to_devise_users_table.rb - spec/dummy/db/migrate/20110802081563_add_remember_created_at_to_users.rb - spec/dummy/db/migrate/20110802081564_remove_password_salt_from_users.rb - spec/dummy/db/migrate/20110802081565_create_refinerycms_images_schema.rb - spec/dummy/db/migrate/20110802081566_create_refinerycms_pages_schema.rb - spec/dummy/db/migrate/20110802081567_translate_page_plugin.rb - spec/dummy/db/migrate/20110802081568_remove_cached_slug_from_pages.rb - spec/dummy/db/migrate/20110802081569_translate_custom_title_on_pages.rb - spec/dummy/db/migrate/20110802081570_remove_translated_fields_from_pages.rb - spec/dummy/db/migrate/20110802081571_create_seo_meta.rb - spec/dummy/db/migrate/20110802081572_create_add_template_columns.rb - spec/dummy/db/migrate/20110802081573_create_refinerycms_resources_schema.rb - spec/dummy/db/schema.rb - spec/dummy/db/seeds - spec/dummy/db/seeds/pages.rb - spec/dummy/db/seeds.rb - spec/dummy/db/test.sqlite3 - spec/dummy/index - spec/dummy/index/development - spec/dummy/index/development/Refinery::Page - spec/dummy/index/development/Refinery::Page/102_111_117.ind - spec/dummy/index/development/Refinery::Page/104_111_109.ind - spec/dummy/index/development/Refinery::Page/110_111_116.ind - spec/dummy/index/development/Refinery::Page/112_97_103.ind - spec/dummy/index/development/Refinery::Page/97_98_111.ind - spec/dummy/index/development/Refinery::Page/98_108_111.ind - spec/dummy/index/development/Refinery::Page/size - spec/dummy/index/development/Refinery::Page/version - spec/dummy/index/development/Refinery::Setting - spec/dummy/index/development/Refinery::Setting/100_101_102.ind - spec/dummy/index/development/Refinery::Setting/100_114_97.ind - spec/dummy/index/development/Refinery::Setting/102_114_111.ind - spec/dummy/index/development/Refinery::Setting/112_97_103.ind - spec/dummy/index/development/Refinery::Setting/115_105_116.ind - spec/dummy/index/development/Refinery::Setting/115_116_114.ind - spec/dummy/index/development/Refinery::Setting/116_101_97.ind - spec/dummy/index/development/Refinery::Setting/117_115_101.ind - spec/dummy/index/development/Refinery::Setting/97_110_97.ind - spec/dummy/index/development/Refinery::Setting/97_112_112.ind - spec/dummy/index/development/Refinery::Setting/97_117_116.ind - spec/dummy/index/development/Refinery::Setting/98_108_111.ind - spec/dummy/index/development/Refinery::Setting/99_111_109.ind - spec/dummy/index/development/Refinery::Setting/size - spec/dummy/index/development/Refinery::Setting/version - spec/dummy/index/test - spec/dummy/index/test/Refinery::Setting - spec/dummy/index/test/Refinery::Setting/100_114_97.ind - spec/dummy/index/test/Refinery::Setting/102_114_111.ind - spec/dummy/index/test/Refinery::Setting/112_97_103.ind - spec/dummy/index/test/Refinery::Setting/115_105_116.ind - spec/dummy/index/test/Refinery::Setting/115_116_114.ind - spec/dummy/index/test/Refinery::Setting/116_101_97.ind - spec/dummy/index/test/Refinery::Setting/117_115_101.ind - spec/dummy/index/test/Refinery::Setting/97_110_97.ind - spec/dummy/index/test/Refinery::Setting/97_112_112.ind - spec/dummy/index/test/Refinery::Setting/97_117_116.ind - spec/dummy/index/test/Refinery::Setting/98_108_111.ind - spec/dummy/index/test/Refinery::Setting/99_111_109.ind - spec/dummy/index/test/Refinery::Setting/size - spec/dummy/index/test/Refinery::Setting/version - spec/dummy/lib - spec/dummy/lib/assets - spec/dummy/log - spec/dummy/log/development.log - spec/dummy/log/test.log - spec/dummy/public - spec/dummy/public/404.html - spec/dummy/public/422.html - spec/dummy/public/500.html - spec/dummy/public/favicon.ico - spec/dummy/Rakefile - spec/dummy/README.md - spec/dummy/script - spec/dummy/script/rails - spec/dummy/tmp - spec/dummy/tmp/capybara - spec/dummy/tmp/capybara/capybara-20110804121811333867014.html - spec/dummy/tmp/dragonfly - spec/dummy/tmp/dragonfly/cache - spec/dummy/tmp/dragonfly/cache/body - spec/dummy/tmp/dragonfly/cache/meta - spec/dummy/tmp/index - spec/dummy/tmp/index/development - spec/dummy/tmp/index/development/Refinery::BlogCategory - spec/dummy/tmp/index/development/Refinery::BlogCategory/103_97_109.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/115_104_111.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/118_105_100.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/49.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/49_48.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/49_49.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/49_50.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/50.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/51.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/52.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/53.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/54.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/55.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/56.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/57.ind - spec/dummy/tmp/index/development/Refinery::BlogCategory/size - spec/dummy/tmp/index/development/Refinery::BlogCategory/version - spec/dummy/tmp/index/development/Refinery::BlogComment - spec/dummy/tmp/index/development/Refinery::BlogComment/101_120_97.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/102_111_114.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/105_115.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/106_111_101.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/110_101_119.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/111_110_101.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/112_101_114.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/112_105_99.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/115_104_111.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/116_104_101.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/117_112.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/119_104_105.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/98_101_115.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/99_111_109.ind - spec/dummy/tmp/index/development/Refinery::BlogComment/size - spec/dummy/tmp/index/development/Refinery::BlogComment/version - spec/dummy/tmp/index/development/Refinery::BlogPost - spec/dummy/tmp/index/development/Refinery::BlogPost/102_111_114.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/103_111_105.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/103_117_121.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/104_111_116.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/104_97_120.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/105_110.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/105_115.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/105_116.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/106_111_101.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/107_105_119.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/108_111_110.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/110_101_119.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/111_107_97.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/112.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/112_101_97.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/112_111_115.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/112_97_114.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/114_101.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/114_101_102.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/114_101_97.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/115_104_111.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/115_116_111.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/115_116_117.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/115_97_107.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/116_101_110.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/116_104_101.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/116_111.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/116_111_112.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/116_114_117.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/119_105_116.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/121_111_117.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_48.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_49.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_50.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_51.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_52.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_53.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_54.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_55.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_56.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/49_57.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_48.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_49.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_50.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_51.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_52.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_53.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_54.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_55.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_56.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/50_57.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/51.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/51_48.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/51_49.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/51_50.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/51_51.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/52.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/53.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/55.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/56.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/57.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/97.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/97_110_111.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/97_114_101.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/97_98_111.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/98_108_111.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/98_108_97.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/98_114_101.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/99_101_110.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/99_104_105.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/99_109_115.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/99_111_109.ind - spec/dummy/tmp/index/development/Refinery::BlogPost/size - spec/dummy/tmp/index/development/Refinery::BlogPost/version - spec/dummy/tmp/index/development/Refinery::Setting - spec/dummy/tmp/index/development/Refinery::Setting/102_114_111.ind - spec/dummy/tmp/index/development/Refinery::Setting/112_97_103.ind - spec/dummy/tmp/index/development/Refinery::Setting/115_104_97.ind - spec/dummy/tmp/index/development/Refinery::Setting/115_105_116.ind - spec/dummy/tmp/index/development/Refinery::Setting/115_116_114.ind - spec/dummy/tmp/index/development/Refinery::Setting/116_101_97.ind - spec/dummy/tmp/index/development/Refinery::Setting/117_115_101.ind - spec/dummy/tmp/index/development/Refinery::Setting/97_110_97.ind - spec/dummy/tmp/index/development/Refinery::Setting/97_112_112.ind - spec/dummy/tmp/index/development/Refinery::Setting/97_117_116.ind - spec/dummy/tmp/index/development/Refinery::Setting/98_108_111.ind - spec/dummy/tmp/index/development/Refinery::Setting/99_111_109.ind - spec/dummy/tmp/index/development/Refinery::Setting/99_97_99.ind - spec/dummy/tmp/index/development/Refinery::Setting/size - spec/dummy/tmp/index/development/Refinery::Setting/version - spec/dummy/tmp/index/test - spec/dummy/tmp/index/test/Refinery::BlogCategory - spec/dummy/tmp/index/test/Refinery::BlogCategory/103_97_109.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/115_104_111.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/118_105_100.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_48.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_49.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_50.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_51.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_52.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_53.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_54.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_55.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_56.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/49_57.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_48.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_49.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_50.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_51.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_52.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_53.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_54.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_55.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_56.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/50_57.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_48.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_49.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_50.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_51.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_52.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_53.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_54.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_55.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_56.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/51_57.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/52.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/52_48.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/53.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/54.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/55.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/56.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/57.ind - spec/dummy/tmp/index/test/Refinery::BlogCategory/size - spec/dummy/tmp/index/test/Refinery::BlogCategory/version - spec/dummy/tmp/index/test/Refinery::BlogComment - spec/dummy/tmp/index/test/Refinery::BlogComment/101_120_97.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/102_111_114.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/105_115.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/106_111_101.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/110_101_119.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/111_110_101.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/112_101_114.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/112_105_99.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/115_104_111.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/116_104_101.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/117_112.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/119_104_105.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/98_101_115.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/99_111_109.ind - spec/dummy/tmp/index/test/Refinery::BlogComment/size - spec/dummy/tmp/index/test/Refinery::BlogComment/version - spec/dummy/tmp/index/test/Refinery::BlogPost - spec/dummy/tmp/index/test/Refinery::BlogPost/102_111_114.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/103_111_105.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/103_117_121.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/104_111_116.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/104_97_120.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/105.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/105_110.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/105_115.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/105_116.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/106_111_101.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/107_105_119.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/108_111_110.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/108_111_118.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/109_121.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/110_101_119.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/111_107_97.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/112.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/112_101_97.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/112_111_115.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/112_97_114.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/114_101.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/114_101_102.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/114_101_97.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/115_104_111.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/115_116_111.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/115_116_117.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/115_97_107.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/116_101_110.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/116_104_101.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/116_104_105.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/116_111.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/116_111_112.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/116_114_117.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/116_97_103.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/119_105_116.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/121_111_117.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_48.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_49.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_50.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_51.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_52.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_53.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_54.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_55.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_56.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/49_57.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_48.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_49.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_50.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_51.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_52.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_53.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_54.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_55.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_56.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/50_57.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_48.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_49.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_50.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_51.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_52.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_53.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_54.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_55.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/51_56.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/52.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/53.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/55.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/56.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/57.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/97.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/97_108_115.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/97_110_100.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/97_110_111.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/97_114_101.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/97_98_111.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/98_108_111.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/98_108_97.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/98_114_101.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/99_101_110.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/99_104_105.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/99_105_116.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/99_109_115.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/99_111_109.ind - spec/dummy/tmp/index/test/Refinery::BlogPost/size - spec/dummy/tmp/index/test/Refinery::BlogPost/version - spec/dummy/tmp/index/test/Refinery::Setting - spec/dummy/tmp/index/test/Refinery::Setting/102_114_111.ind - spec/dummy/tmp/index/test/Refinery::Setting/112_97_103.ind - spec/dummy/tmp/index/test/Refinery::Setting/115_104_97.ind - spec/dummy/tmp/index/test/Refinery::Setting/115_105_116.ind - spec/dummy/tmp/index/test/Refinery::Setting/115_116_114.ind - spec/dummy/tmp/index/test/Refinery::Setting/116_101_97.ind - spec/dummy/tmp/index/test/Refinery::Setting/117_115_101.ind - spec/dummy/tmp/index/test/Refinery::Setting/97_110_97.ind - spec/dummy/tmp/index/test/Refinery::Setting/97_112_112.ind - spec/dummy/tmp/index/test/Refinery::Setting/97_117_116.ind - spec/dummy/tmp/index/test/Refinery::Setting/97_99_116.ind - spec/dummy/tmp/index/test/Refinery::Setting/98_108_111.ind - spec/dummy/tmp/index/test/Refinery::Setting/99_111_109.ind - spec/dummy/tmp/index/test/Refinery::Setting/size - spec/dummy/tmp/index/test/Refinery::Setting/version spec/factories spec/factories/blog_categories.rb spec/factories/blog_comments.rb @@ -659,6 +219,10 @@ Gem::Specification.new do |s| spec/requests/blog_posts_spec.rb spec/requests/manage_blog_posts_spec.rb spec/spec_helper.rb + spec/support + spec/support/database_cleaner.rb + spec/support/devise.rb + spec/support/refinery.rb todo.md ) From 7ae6e146b24d44186ef7c5c75d1fd53591612446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 12 Aug 2011 08:55:00 +0300 Subject: [PATCH 049/248] Use arel 2.1.4 for now because 2.1.5 got yanked. --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index 6d86771..e2c37f6 100644 --- a/Gemfile +++ b/Gemfile @@ -19,3 +19,5 @@ group :assets do gem 'coffee-rails', "~> 3.1.0.rc.5" gem 'uglifier' end + +gem 'arel', '2.1.4' # 2.1.5 is broken. see https://github.com/rails/arel/issues/72 From d0d5d9eb7d4d0c0af50388c92cd30384937836a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 12 Aug 2011 08:59:15 +0300 Subject: [PATCH 050/248] There's no test directory. --- lib/gemspec.rb | 3 --- refinerycms-blog.gemspec | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index d9d329e..96ae6d2 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -31,9 +31,6 @@ Gem::Specification.new do |s| s.files = %w( #{files.join("\n ")} ) - #{"s.test_files = %w( - #{Dir.glob("test/**/*.rb").join("\n ")} - )" if File.directory?("test")} end EOF diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 5a3c10e..443a178 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -187,6 +187,7 @@ Gem::Specification.new do |s| db/seeds db/seeds/refinerycms_blog.rb Gemfile + Gemfile.lock Guardfile lib lib/gemspec.rb @@ -225,5 +226,4 @@ Gem::Specification.new do |s| spec/support/refinery.rb todo.md ) - end From fbcf2bd34a92ae32b810a4de5c6a3ead74bede41 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 12 Aug 2011 12:44:39 -0700 Subject: [PATCH 051/248] Ignore .lock files in Gemspec --- lib/gemspec.rb | 2 +- refinerycms-blog.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 96ae6d2..02fd018 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -2,7 +2,7 @@ require File.expand_path('../refinery/blog/version', __FILE__) version = ::Refinery::Blog::Version.to_s raise "Could not get version so gemspec can not be built" if version.nil? -files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.gem$} or f =~ %r{^spec/dummy}} +files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{(.gem$|^spec/dummy|.lock$)}} gemspec = < Date: Sat, 13 Aug 2011 21:57:43 +0300 Subject: [PATCH 052/248] Move factories under spec dir so that they get picked up by spec_helper. --- refinerycms-blog.gemspec | 9 +++++---- spec/{ => support}/factories/blog_categories.rb | 0 spec/{ => support}/factories/blog_comments.rb | 0 spec/{ => support}/factories/blog_posts.rb | 0 4 files changed, 5 insertions(+), 4 deletions(-) rename spec/{ => support}/factories/blog_categories.rb (100%) rename spec/{ => support}/factories/blog_comments.rb (100%) rename spec/{ => support}/factories/blog_posts.rb (100%) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 443a178..a7ba8fe 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-08-12} + s.date = %q{2011-08-13} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -206,9 +206,6 @@ Gem::Specification.new do |s| script/rails spec spec/factories - spec/factories/blog_categories.rb - spec/factories/blog_comments.rb - spec/factories/blog_posts.rb spec/models spec/models/refinery spec/models/refinery/blog_category_spec.rb @@ -223,6 +220,10 @@ Gem::Specification.new do |s| spec/support spec/support/database_cleaner.rb spec/support/devise.rb + spec/support/factories + spec/support/factories/blog_categories.rb + spec/support/factories/blog_comments.rb + spec/support/factories/blog_posts.rb spec/support/refinery.rb todo.md ) diff --git a/spec/factories/blog_categories.rb b/spec/support/factories/blog_categories.rb similarity index 100% rename from spec/factories/blog_categories.rb rename to spec/support/factories/blog_categories.rb diff --git a/spec/factories/blog_comments.rb b/spec/support/factories/blog_comments.rb similarity index 100% rename from spec/factories/blog_comments.rb rename to spec/support/factories/blog_comments.rb diff --git a/spec/factories/blog_posts.rb b/spec/support/factories/blog_posts.rb similarity index 100% rename from spec/factories/blog_posts.rb rename to spec/support/factories/blog_posts.rb From e70193ca117277a3a86432a3b6eae30d195fba95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Sun, 14 Aug 2011 00:51:41 +0300 Subject: [PATCH 053/248] Update readme. --- readme.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index a9da413..b64e192 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments. -This version of `refinerycms-blog` supports Rails 3.0.x. To use Rails 2.3.x use the [refinerycms-blog "Rails 2.3.x stable branch"](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). +This version of `refinerycms-blog` supports Rails 3.1.x. To use Rails 2.3.x use the [refinerycms-blog "Rails 2.3.x stable branch"](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). Options: @@ -11,19 +11,19 @@ Options: ## Requirements -Refinery CMS version 1.0.0 or above. +Refinery CMS version 2.0.0 or above. ## Install Open up your ``Gemfile`` and add at the bottom this line: - gem 'refinerycms-blog', '~> 1.6.1' + gem 'refinerycms-blog', '~> 2.0.0' Now, run ``bundle install`` Next, to install the blog plugin run: - rails generate refinerycms_blog + rails generate refinery:blog Finally migrate your database and you're done. From cb2bcf387cf876e9f014e15fb1d0769576bf3fdd Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 14 Aug 2011 17:40:50 -0700 Subject: [PATCH 054/248] remove empty directory from gemspec file list --- refinerycms-blog.gemspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index e08d3e4..14d757b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-08-12} + s.date = %q{2011-08-14} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -198,7 +198,6 @@ Gem::Specification.new do |s| lib/refinery/blog/tabs.rb lib/refinery/blog/version.rb lib/refinerycms-blog.rb - lib/tasks Rakefile readme.md refinerycms-blog.gemspec From 87bc12a1e47779fcfa90d24a2eb22862560ca646 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 15 Aug 2011 13:07:26 +1200 Subject: [PATCH 055/248] HI 2 U TRAVIS; This is how to run specs in this engine --- .travis.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7026561 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +script: "bundle exec rake && bundle exec rspec spec/" +notifications: + email: + - parndt@gmail.com + - ugis.ozolss@gmail.com + - joe@joesak.com +env: + - DB=postgres + - DB=mysql + - DB=sqlite3 +rvm: + - 1.8.7 + - 1.9.2 + - 1.9.3 + - rbx + - rbx-2.0 + - ree + - jruby \ No newline at end of file From 13cafc094712787bf0e5ad0b1dc0e4eb764920d9 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 14 Aug 2011 19:31:36 -0700 Subject: [PATCH 056/248] Syntax fixes for Ruby 1.8.7 --- Gemfile | 7 +++---- .../refinery/admin/blog/posts_controller.rb | 4 +--- .../refinery/blog/categories_controller.rb | 5 +---- app/controllers/refinery/blog/posts_controller.rb | 15 ++++----------- spec/dummy/config/application.rb | 7 ++++++- spec/dummy/config/initializers/session_store.rb | 2 +- spec/dummy/config/initializers/wrap_parameters.rb | 2 +- 7 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Gemfile b/Gemfile index e2c37f6..8e728e3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,7 @@ source "http://rubygems.org" -gemspec - -## Uncomment the following lines to develop against a local clone of refinery +## Uncomment the following lines to develop against edge refinery gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' -gem 'refinerycms-generators', :git => 'git://github.com/resolve/refinerycms-generators.git' gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' gem 'jquery-rails' @@ -21,3 +18,5 @@ group :assets do end gem 'arel', '2.1.4' # 2.1.5 is broken. see https://github.com/rails/arel/issues/72 + +gemspec diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index e3b0f3b..c8c38b2 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -9,9 +9,7 @@ module Refinery :order => 'published_at DESC' def uncategorized - @blog_posts = Kaminari.paginate_array(Refinery::BlogPost.uncategorized) - .page(params[:page]) - .per(Refinery::BlogPost.per_page) + @blog_posts = Kaminari.paginate_array(Refinery::BlogPost.uncategorized).page(params[:page]).per(Refinery::BlogPost.per_page) end def tags diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index a363b8c..57196c3 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -4,10 +4,7 @@ module Refinery def show @category = Refinery::BlogCategory.find(params[:id]) - @blog_posts = @category.posts - .live - .includes(:comments, :categories) - .page(params[:page]) + @blog_posts = @category.posts.live.includes(:comments, :categories).page(params[:page]) end end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 408359f..167aef3 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -54,16 +54,12 @@ module Refinery date = "#{params[:month]}/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') - @blog_posts = Refinery::BlogPost.live - .by_archive(@archive_date) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.live.by_archive(@archive_date).page(params[:page]) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') - @blog_posts = Refinery::BlogPost.live - .by_year(@archive_date) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.live.by_year(@archive_date).page(params[:page]) end respond_with (@blog_posts) end @@ -71,8 +67,7 @@ module Refinery def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @blog_posts = Refinery::BlogPost.tagged_with(@tag_name) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.tagged_with(@tag_name).page(params[:page]) end protected @@ -88,9 +83,7 @@ module Refinery end def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live - .includes(:comments, :categories) - .page(params[:page]) + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) end def find_tags diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 60df716..e67cf82 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -3,7 +3,12 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' require 'bundler/setup' -Bundler.require + +# If you have a Gemfile, require the default gems, the ones in the +# current environment and also include :assets gems if in development +# or test environments. +Bundler.require *Rails.groups(:assets) if defined?(Bundler) + require 'refinerycms-blog' module Dummy diff --git a/spec/dummy/config/initializers/session_store.rb b/spec/dummy/config/initializers/session_store.rb index 952473f..aa2f512 100644 --- a/spec/dummy/config/initializers/session_store.rb +++ b/spec/dummy/config/initializers/session_store.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' +Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information diff --git a/spec/dummy/config/initializers/wrap_parameters.rb b/spec/dummy/config/initializers/wrap_parameters.rb index 16c3243..71b88b0 100644 --- a/spec/dummy/config/initializers/wrap_parameters.rb +++ b/spec/dummy/config/initializers/wrap_parameters.rb @@ -4,7 +4,7 @@ # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActionController::Base.wrap_parameters format: [:json] +ActionController::Base.wrap_parameters :format => [:json] # Disable root element in JSON by default. if defined?(ActiveRecord) From aed0b8f173534ccaf4f2f09b3e7b705fb0b08c7b Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 14 Aug 2011 23:14:46 -0700 Subject: [PATCH 057/248] Move gemspec method to top of file http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/ --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 8e728e3..cdcebf5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source "http://rubygems.org" +gemspec + ## Uncomment the following lines to develop against edge refinery gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' @@ -18,5 +20,3 @@ group :assets do end gem 'arel', '2.1.4' # 2.1.5 is broken. see https://github.com/rails/arel/issues/72 - -gemspec From 028489bf152885929e074628e152ff5a58d2ff9b Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 15 Aug 2011 00:13:54 -0700 Subject: [PATCH 058/248] This will fix the build when runing rspec spec/. If you do not specify refinerycms-testing in the development group of the Gemfile it will not be properly loaded. --- Gemfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index cdcebf5..aa83e3f 100644 --- a/Gemfile +++ b/Gemfile @@ -3,12 +3,14 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against edge refinery -gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +# gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +gem 'refinerycms', :path => '~/Code/refinerycms' gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' gem 'jquery-rails' group :development, :test do + gem 'refinerycms-testing', '~> 2.0.0' gem 'spork', '0.9.0.rc9', :platforms => :ruby gem 'guard-spork', :platforms => :ruby end From 8434790df74a14f0d949582dd779ad2fcb4af4cc Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 15 Aug 2011 00:15:36 -0700 Subject: [PATCH 059/248] Use fuubar formatting for rspec --- .rspec | 1 + 1 file changed, 1 insertion(+) diff --git a/.rspec b/.rspec index 4d52986..a9bf51f 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,3 @@ --color spec --drb +--format Fuubar From 9363e8d8c516c48861a9a630660e982a2585d2c8 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 15 Aug 2011 00:37:43 -0700 Subject: [PATCH 060/248] Update Gemfile to what would be generated by Refinerycms --- Gemfile | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index aa83e3f..7605ced 100644 --- a/Gemfile +++ b/Gemfile @@ -3,16 +3,45 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against edge refinery -# gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' -gem 'refinerycms', :path => '~/Code/refinerycms' +gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' gem 'jquery-rails' group :development, :test do gem 'refinerycms-testing', '~> 2.0.0' - gem 'spork', '0.9.0.rc9', :platforms => :ruby - gem 'guard-spork', :platforms => :ruby + + require 'rbconfig' + + platforms :mswin, :mingw do + gem 'win32console' + gem 'rb-fchange', '~> 0.0.5' + gem 'rb-notifu', '~> 0.0.4' + end + + platforms :ruby do + gem 'spork', '0.9.0.rc9' + gem 'guard-spork' + + if Config::CONFIG['target_os'] =~ /darwin/i + gem 'rb-fsevent', '>= 0.3.9' + gem 'growl', '~> 1.0.3' + end + if Config::CONFIG['target_os'] =~ /linux/i + gem 'rb-inotify', '>= 0.5.1' + gem 'libnotify', '~> 0.1.3' + end + end + + platforms :jruby do + if Config::CONFIG['target_os'] =~ /darwin/i + gem 'growl', '~> 1.0.3' + end + if Config::CONFIG['target_os'] =~ /linux/i + gem 'rb-inotify', '>= 0.5.1' + gem 'libnotify', '~> 0.1.3' + end + end end group :assets do From d0681c273c6c3dadbf9052a5e88f209c0b3e4c47 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 18 Aug 2011 14:51:51 -0700 Subject: [PATCH 061/248] Update gemspec to require newest version of seo_meta --- Gemfile | 4 ++-- lib/gemspec.rb | 2 +- refinerycms-blog.gemspec | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 7605ced..4301b0a 100644 --- a/Gemfile +++ b/Gemfile @@ -3,8 +3,8 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against edge refinery -gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' -gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' +# gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +# gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' gem 'jquery-rails' diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 02fd018..df188fe 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-core', '~> 2.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.1.0' + s.add_dependency 'seo_meta', '~> 1.2.0.rc1' # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 9b1311a..8e8de4a 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-08-14} + s.date = %q{2011-08-18} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-core', '~> 2.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.1.0' + s.add_dependency 'seo_meta', '~> 1.2.0.rc1' # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' @@ -204,7 +204,6 @@ Gem::Specification.new do |s| script script/rails spec - spec/factories spec/models spec/models/refinery spec/models/refinery/blog_category_spec.rb From 36affef45e8b402471040d2c7d099f8e3ff7f91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Thu, 25 Aug 2011 13:57:59 +0300 Subject: [PATCH 062/248] will_paginate is back. --- app/controllers/refinery/admin/blog/posts_controller.rb | 5 ++++- app/models/refinery/blog_category.rb | 2 +- app/models/refinery/blog_post.rb | 2 +- app/views/refinery/admin/blog/categories/index.html.erb | 4 ++-- app/views/refinery/admin/blog/comments/index.html.erb | 8 ++++---- app/views/refinery/admin/blog/posts/index.html.erb | 4 ++-- .../refinery/admin/blog/posts/uncategorized.html.erb | 4 ++-- app/views/refinery/blog/categories/show.html.erb | 2 +- app/views/refinery/blog/posts/index.html.erb | 2 +- app/views/refinery/blog/posts/tagged.html.erb | 2 +- 10 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index c8c38b2..548f8c9 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -1,3 +1,5 @@ +require 'will_paginate/array' + module Refinery module Admin module Blog @@ -9,7 +11,8 @@ module Refinery :order => 'published_at DESC' def uncategorized - @blog_posts = Kaminari.paginate_array(Refinery::BlogPost.uncategorized).page(params[:page]).per(Refinery::BlogPost.per_page) + @blog_posts = Refinery::BlogPost.uncategorized.paginate(:page => params[:page], + :per_page => Refinery::BlogPost.per_page) end def tags diff --git a/app/models/refinery/blog_category.rb b/app/models/refinery/blog_category.rb index c2c8c4c..3f10d92 100644 --- a/app/models/refinery/blog_category.rb +++ b/app/models/refinery/blog_category.rb @@ -18,7 +18,7 @@ module Refinery end # how many items to show per page - paginates_per Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) end end diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb index f4bccf1..4da083c 100644 --- a/app/models/refinery/blog_post.rb +++ b/app/models/refinery/blog_post.rb @@ -96,7 +96,7 @@ module Refinery # how many items to show per page def per_page - paginates_per Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + Refinery::Setting.find_or_set(:blog_posts_per_page, 10) end end diff --git a/app/views/refinery/admin/blog/categories/index.html.erb b/app/views/refinery/admin/blog/categories/index.html.erb index 75acb77..4ad59ab 100644 --- a/app/views/refinery/admin/blog/categories/index.html.erb +++ b/app/views/refinery/admin/blog/categories/index.html.erb @@ -11,11 +11,11 @@ <% end %> <% else %> <% if @blog_categories.any? %> - <%= paginate @blog_categories %> + <%= will_paginate @blog_categories %> <%= render :partial => "sortable_list" %> - <%= paginate @blog_categories %> + <%= will_paginate @blog_categories %> <% else %>

diff --git a/app/views/refinery/admin/blog/comments/index.html.erb b/app/views/refinery/admin/blog/comments/index.html.erb index e644f51..bf2be9c 100644 --- a/app/views/refinery/admin/blog/comments/index.html.erb +++ b/app/views/refinery/admin/blog/comments/index.html.erb @@ -3,24 +3,24 @@ <% if searching? %>

<%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>

<% if @blog_comments.any? %> - <%=# paginate @blog_comments %> + <%=# will_paginate @blog_comments %>
    <%= render :partial => "blog_comments", :collection => @blog_comments %>
- <%=# paginate @blog_comments %> + <%=# will_paginate @blog_comments %> <% else %>

<%= t('search_no_results', :scope => 'admin') %>

<% end %> <% else %> <% if @blog_comments.any? %> - <%=# paginate @blog_comments %> + <%=# will_paginate @blog_comments %> <%= render :partial => "sortable_list" %> - <%=# paginate @blog_comments %> + <%=# will_paginate @blog_comments %> <% else %>

<%= t('.no_items_yet', diff --git a/app/views/refinery/admin/blog/posts/index.html.erb b/app/views/refinery/admin/blog/posts/index.html.erb index a351b1b..922353c 100644 --- a/app/views/refinery/admin/blog/posts/index.html.erb +++ b/app/views/refinery/admin/blog/posts/index.html.erb @@ -12,11 +12,11 @@ <% end %> <% else %> <% if @blog_posts.any? %> - <%= paginate @blog_posts %> + <%= will_paginate @blog_posts %> <%= render :partial => "sortable_list" %> - <%= paginate @blog_posts %> + <%= will_paginate @blog_posts %> <% else %>

diff --git a/app/views/refinery/admin/blog/posts/uncategorized.html.erb b/app/views/refinery/admin/blog/posts/uncategorized.html.erb index 7b2cd2b..030e789 100644 --- a/app/views/refinery/admin/blog/posts/uncategorized.html.erb +++ b/app/views/refinery/admin/blog/posts/uncategorized.html.erb @@ -11,11 +11,11 @@ <% end %> <% else %> <% if @blog_posts.any? %> - <%= paginate @blog_posts %> + <%= will_paginate @blog_posts %> <%= render :partial => "sortable_list" %> - <%= paginate @blog_posts %> + <%= will_paginate @blog_posts %> <% else %>

diff --git a/app/views/refinery/blog/categories/show.html.erb b/app/views/refinery/blog/categories/show.html.erb index 1ae938f..adcf1aa 100644 --- a/app/views/refinery/blog/categories/show.html.erb +++ b/app/views/refinery/blog/categories/show.html.erb @@ -4,7 +4,7 @@ <% if @blog_posts.any? %>

<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %> - <%= paginate @blog_posts %> + <%= will_paginate @blog_posts %>
<% else %>

diff --git a/app/views/refinery/blog/posts/index.html.erb b/app/views/refinery/blog/posts/index.html.erb index f347af1..4eef04f 100644 --- a/app/views/refinery/blog/posts/index.html.erb +++ b/app/views/refinery/blog/posts/index.html.erb @@ -4,7 +4,7 @@ <% if @blog_posts.any? %>

<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %> - <%= paginate @blog_posts %> + <%= will_paginate @blog_posts %>
<% else %>

<%= t('.no_blog_articles_yet') %>

diff --git a/app/views/refinery/blog/posts/tagged.html.erb b/app/views/refinery/blog/posts/tagged.html.erb index 860bd72..477d2b7 100644 --- a/app/views/refinery/blog/posts/tagged.html.erb +++ b/app/views/refinery/blog/posts/tagged.html.erb @@ -4,7 +4,7 @@ <% if @blog_posts.any? %>
<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %> - <%= paginate @blog_posts %> + <%= will_paginate @blog_posts %>
<% else %>

<%= t('.no_blog_articles_yet') %>

From 9df6580d9cc91c403e16e36070cb9fde45cbb4c9 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 29 Aug 2011 15:09:53 -0700 Subject: [PATCH 063/248] gemspec revision to support latest master branch of refinerycms --- Gemfile | 18 +++++++++--------- refinerycms-blog.gemspec | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 4301b0a..2545218 100644 --- a/Gemfile +++ b/Gemfile @@ -3,14 +3,12 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against edge refinery -# gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' -# gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git' +gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' -gem 'jquery-rails' +# Use edge Devise for now: https://github.com/resolve/refinerycms/commit/10ab4db773d9f94b374b0a4bfb2050cb70ff4353 +gem 'devise', :git => 'git://github.com/plataformatec/devise.git' -group :development, :test do - gem 'refinerycms-testing', '~> 2.0.0' - +group :development, :test do require 'rbconfig' platforms :mswin, :mingw do @@ -44,10 +42,12 @@ group :development, :test do end end +# Gems used only for assets and not required +# in production environments by default. group :assets do - gem 'sass-rails', "~> 3.1.0.rc.5" - gem 'coffee-rails', "~> 3.1.0.rc.5" + gem 'sass-rails' + gem 'coffee-rails' gem 'uglifier' end -gem 'arel', '2.1.4' # 2.1.5 is broken. see https://github.com/rails/arel/issues/72 +gem 'jquery-rails' diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 8e8de4a..24016af 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -14,9 +14,9 @@ Gem::Specification.new do |s| # Runtime dependencies s.add_dependency 'refinerycms-core', '~> 2.0.0' + s.add_dependency 'refinerycms-pages', '~> 2.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.2.0.rc1' # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' From 0791d3a2e5896b03e52bd6c04592e71506cd49b8 Mon Sep 17 00:00:00 2001 From: Michael Gall Date: Wed, 31 Aug 2011 12:15:07 +1000 Subject: [PATCH 064/248] Add attr_accessible to blog posts to interact better with page_images --- app/models/refinery/blog_post.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb index 4da083c..6b27688 100644 --- a/app/models/refinery/blog_post.rb +++ b/app/models/refinery/blog_post.rb @@ -42,6 +42,8 @@ module Refinery scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } # next is now in << self + attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids + def next BlogPost.next(self).first end From 2bd8df5d4f326b66093ffa6c5b8b53589ad1a4fd Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 31 Aug 2011 11:59:46 -0700 Subject: [PATCH 065/248] Devise edge no longer required for Rails 3-1 branch --- Gemfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Gemfile b/Gemfile index 2545218..68705db 100644 --- a/Gemfile +++ b/Gemfile @@ -5,9 +5,6 @@ gemspec ## Uncomment the following lines to develop against edge refinery gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' -# Use edge Devise for now: https://github.com/resolve/refinerycms/commit/10ab4db773d9f94b374b0a4bfb2050cb70ff4353 -gem 'devise', :git => 'git://github.com/plataformatec/devise.git' - group :development, :test do require 'rbconfig' From 34e5da13470ecda2ef83b1b526632731ca02b1b5 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 1 Sep 2011 16:18:07 -0700 Subject: [PATCH 066/248] Disable libnotifications for travis --- Gemfile | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index 68705db..2a7e717 100644 --- a/Gemfile +++ b/Gemfile @@ -13,28 +13,32 @@ group :development, :test do gem 'rb-fchange', '~> 0.0.5' gem 'rb-notifu', '~> 0.0.4' end - + platforms :ruby do gem 'spork', '0.9.0.rc9' gem 'guard-spork' - if Config::CONFIG['target_os'] =~ /darwin/i - gem 'rb-fsevent', '>= 0.3.9' - gem 'growl', '~> 1.0.3' - end - if Config::CONFIG['target_os'] =~ /linux/i - gem 'rb-inotify', '>= 0.5.1' - gem 'libnotify', '~> 0.1.3' + unless ENV['TRAVIS'] + if Config::CONFIG['target_os'] =~ /darwin/i + gem 'rb-fsevent', '>= 0.3.9' + gem 'growl', '~> 1.0.3' + end + if Config::CONFIG['target_os'] =~ /linux/i + gem 'rb-inotify', '>= 0.5.1' + gem 'libnotify', '~> 0.1.3' + end end end platforms :jruby do - if Config::CONFIG['target_os'] =~ /darwin/i - gem 'growl', '~> 1.0.3' - end - if Config::CONFIG['target_os'] =~ /linux/i - gem 'rb-inotify', '>= 0.5.1' - gem 'libnotify', '~> 0.1.3' + unless ENV['TRAVIS'] + if Config::CONFIG['target_os'] =~ /darwin/i + gem 'growl', '~> 1.0.3' + end + if Config::CONFIG['target_os'] =~ /linux/i + gem 'rb-inotify', '>= 0.5.1' + gem 'libnotify', '~> 0.1.3' + end end end end @@ -42,8 +46,8 @@ end # Gems used only for assets and not required # in production environments by default. group :assets do - gem 'sass-rails' - gem 'coffee-rails' + gem 'sass-rails', '~> 3.1.0' + gem 'coffee-rails', '~> 3.1.0' gem 'uglifier' end From 177927497131abc1e860e381e0139cab0a8c60d6 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 2 Sep 2011 13:06:38 +1200 Subject: [PATCH 067/248] Added sqlite3, pg, mysql2 to the Gemfile and added Jamie to the notifications list for TRavis. --- .travis.yml | 1 + Gemfile | 11 +++++++---- spec/dummy/db/schema.rb | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7026561..62468f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ notifications: - parndt@gmail.com - ugis.ozolss@gmail.com - joe@joesak.com + - jamie@enmasse.com env: - DB=postgres - DB=mysql diff --git a/Gemfile b/Gemfile index 2a7e717..e70beea 100644 --- a/Gemfile +++ b/Gemfile @@ -5,19 +5,22 @@ gemspec ## Uncomment the following lines to develop against edge refinery gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' -group :development, :test do +group :development, :test do require 'rbconfig' - + gem 'sqlite3' + gem 'mysql2' + gem 'pg' + platforms :mswin, :mingw do gem 'win32console' gem 'rb-fchange', '~> 0.0.5' gem 'rb-notifu', '~> 0.0.4' end - + platforms :ruby do gem 'spork', '0.9.0.rc9' gem 'guard-spork' - + unless ENV['TRAVIS'] if Config::CONFIG['target_os'] =~ /darwin/i gem 'rb-fsevent', '>= 0.3.9' diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 3d96369..afb4ec6 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. From fc68f22858fc485b99836d6b5ce254c67cdabe50 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 2 Sep 2011 13:34:06 -0700 Subject: [PATCH 068/248] update and import refinerycms migrations and seeds update Guardfile, spec_helper, and support files to match those generated by refinerycms-testing --- Guardfile | 10 +------ ...13234706_create_refinerycms_core_schema.rb | 2 +- .../20101217113425_translate_page_plugin.rb | 4 ++- ...7025652_translate_custom_title_on_pages.rb | 26 +++++++++---------- ...stom_slug_to_refinery_page_translations.rb | 11 ++++++++ ...m_title_to_menu_title_in_refinery_pages.rb | 15 +++++++++++ spec/dummy/db/schema.rb | 7 ++--- spec/dummy/db/seed/.gitkeep | 0 spec/dummy/db/seeds/pages.rb | 8 ------ spec/spec_helper.rb | 3 +++ spec/support/refinery.rb | 4 +-- 11 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb create mode 100644 spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb delete mode 100644 spec/dummy/db/seed/.gitkeep diff --git a/Guardfile b/Guardfile index 4de3a30..7774821 100644 --- a/Guardfile +++ b/Guardfile @@ -1,12 +1,4 @@ -# A sample Guardfile -# More info at https://github.com/guard/guard#readme - -guard 'rspec', :version => 2 do - watch(%r{^spec/.+_spec\.rb$}) - watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } - watch('spec/spec_helper.rb') { "spec" } - - # Rails example +guard 'rspec', :version => 2, :cli => "--format Fuubar --color --drb" do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } diff --git a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb index c2dd42c..5061efa 100644 --- a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb +++ b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb @@ -4,7 +4,7 @@ class CreateRefinerycmsCoreSchema < ActiveRecord::Migration create_table ::Slug.table_name, :force => true do |t| t.string "name" t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false + t.integer "sequence", :default => 1, :null => false t.string "sluggable_type", :limit => 40 t.string "scope", :limit => 40 t.datetime "created_at" diff --git a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb index bdb0a43..1280e88 100644 --- a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb +++ b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb @@ -13,7 +13,9 @@ class TranslatePagePlugin < ActiveRecord::Migration :title => :string, :meta_keywords => :string, :meta_description => :text, - :browser_title => :string + :browser_title => :string, + :custom_slug => :string, + :menu_title => :string }, { :migrate_data => true }) diff --git a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb index 2bcecc7..7d87d84 100644 --- a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb +++ b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb @@ -1,30 +1,30 @@ class TranslateCustomTitleOnPages < ActiveRecord::Migration def self.up - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title) - add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string + unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:menu_title) + add_column ::Refinery::Page.translation_class.table_name, :menu_title, :string - say_with_time("Re-save custom_title") do + say_with_time("Re-save menu_title") do ::Refinery::Page.all.each do |page| - say "updating custom_title field for page##{page.id}" - page.update_attribute(:custom_title, page.untranslated_attributes['custom_title']) + say "updating menu_title field for page##{page.id}" + page.update_attribute(:menu_title, page.untranslated_attributes['menu_title']) end end else - say "Nothing done, ::Refinery::Page.translation_class table already includes a custom_title field" + say "Nothing done, ::Refinery::Page.translation_class table already includes a menu_title field" end ::Refinery::Page.translation_class.reset_column_information end def self.down - say_with_time("Re-save custom_title") do + say_with_time("Re-save menu_title") do ::Refinery::Page.all.each do |page| - if page.attributes['custom_title'].nil? - say "Nothing done, page##{page.id} custom_title field is nil" + if page.attributes['menu_title'].nil? + say "Nothing done, page##{page.id} menu_title field is nil" else - say "updating custom_title field for page #{page.id}" + say "updating menu_title field for page #{page.id}" ::Refinery::Page.update_all({ - :custom_title => page.attributes['custom_title'] + :menu_title => page.attributes['menu_title'] }, { :id => page.id.to_s }) @@ -32,9 +32,9 @@ class TranslateCustomTitleOnPages < ActiveRecord::Migration end end - remove_column ::Refinery::Page.translation_class.table_name, :custom_title + remove_column ::Refinery::Page.translation_class.table_name, :menu_title - ::Refinery::Page.translated_attribute_names.delete(:custom_title) + ::Refinery::Page.translated_attribute_names.delete(:menu_title) ::Refinery::Page.translation_class.reset_column_information end diff --git a/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb new file mode 100644 index 0000000..2feb837 --- /dev/null +++ b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb @@ -0,0 +1,11 @@ +class AddCustomSlugToRefineryPageTranslations < ActiveRecord::Migration + def up + if ::Refinery::Page::Translation.column_names.map(&:to_sym).exclude?(:custom_slug) + add_column ::Refinery::Page::Translation.table_name, :custom_slug, :string, :default => nil + end + end + + def down + remove_column ::Refinery::Page::Translation.table_name, :custom_slug + end +end diff --git a/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb new file mode 100644 index 0000000..0ce6cb2 --- /dev/null +++ b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb @@ -0,0 +1,15 @@ +class RenameCustomTitleToMenuTitleInRefineryPages < ActiveRecord::Migration + def up + if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:custom_title) + rename_column ::Refinery::Page::Translation.table_name, :custom_title, :menu_title + end + remove_column ::Refinery::Page.table_name, :custom_title_type + end + + def down + if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:menu_title) + rename_column ::Refinery::Page::Translation.table_name, :menu_title, :custom_title + end + add_column ::Refinery::Page.table_name, :custom_title_type, :string + end +end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index afb4ec6..f65cc81 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110803223529) do +ActiveRecord::Schema.define(:version => 20110812055013) do create_table "refinery_blog_categories", :force => true do |t| t.string "title" @@ -95,7 +95,8 @@ ActiveRecord::Schema.define(:version => 20110803223529) do t.integer "refinery_page_id" t.string "locale" t.string "title" - t.string "custom_title" + t.string "custom_slug" + t.string "menu_title" t.datetime "created_at" t.datetime "updated_at" end @@ -112,7 +113,7 @@ ActiveRecord::Schema.define(:version => 20110803223529) do t.string "link_url" t.string "menu_match" t.boolean "deletable", :default => true - t.string "custom_title_type", :default => "none" + t.string "custom_title" t.boolean "draft", :default => false t.boolean "skip_to_first_child", :default => false t.integer "lft" diff --git a/spec/dummy/db/seed/.gitkeep b/spec/dummy/db/seed/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb index 677f17d..62d4e8d 100644 --- a/spec/dummy/db/seeds/pages.rb +++ b/spec/dummy/db/seeds/pages.rb @@ -1,14 +1,6 @@ module Refinery ::Refinery::Page.reset_column_information - # Check whether all columns are applied yet by seo_meta. - unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k| - ::Refinery::Page.translation_class.instance_methods.include?(k) - } - # Make pages model seo_meta because not all columns are accessible. - ::Refinery::Page.translation_class.send :is_seo_meta - end - page_position = -1 unless ::Refinery::Page.where(:menu_match => "^/$").any? diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 75db576..68edfe8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,6 +12,7 @@ def setup_environment require 'rspec/rails' require 'capybara/rspec' require 'factory_girl' + require 'refinerycms-testing' Rails.backtrace_cleaner.remove_silencers! @@ -23,6 +24,8 @@ def setup_environment RSpec.configure do |config| config.mock_with :rspec config.use_transactional_fixtures = false + + config.extend ActionController::Testing::Caching, :type => :controller end end diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb index 85d28ce..d761787 100644 --- a/spec/support/refinery.rb +++ b/spec/support/refinery.rb @@ -1,6 +1,4 @@ -require 'refinery/testing/factories' -require 'refinery/testing/controller_macros' -require 'refinery/testing/request_macros' +require 'refinerycms-testing' RSpec.configure do |config| config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller From 2053a022a2cc0e0417bb15a9cda4da5d0f360389 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 2 Sep 2011 14:21:19 -0700 Subject: [PATCH 069/248] remove accidental inclusion of future feature --- spec/spec_helper.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 68edfe8..a3fe107 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,8 +24,6 @@ def setup_environment RSpec.configure do |config| config.mock_with :rspec config.use_transactional_fixtures = false - - config.extend ActionController::Testing::Caching, :type => :controller end end From 0497261f39f351ab5be8862646c35669ee58579d Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 3 Sep 2011 11:44:21 +1200 Subject: [PATCH 070/248] Converted Factory to FactoryGirl to fix deprecation warnings. --- spec/dummy/db/schema.rb | 3 +- spec/models/refinery/blog_category_spec.rb | 8 +-- spec/models/refinery/blog_comment_spec.rb | 2 +- spec/models/refinery/blog_post_spec.rb | 58 +++++++++++----------- spec/requests/blog_categories_spec.rb | 4 +- spec/requests/blog_posts_spec.rb | 2 +- spec/requests/manage_blog_posts_spec.rb | 2 +- 7 files changed, 39 insertions(+), 40 deletions(-) diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index f65cc81..2cf06e5 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -95,10 +95,10 @@ ActiveRecord::Schema.define(:version => 20110812055013) do t.integer "refinery_page_id" t.string "locale" t.string "title" - t.string "custom_slug" t.string "menu_title" t.datetime "created_at" t.datetime "updated_at" + t.string "custom_slug" end add_index "refinery_page_translations", ["refinery_page_id"], :name => "index_d079468f88bff1c6ea81573a0d019ba8bf5c2902" @@ -113,7 +113,6 @@ ActiveRecord::Schema.define(:version => 20110812055013) do t.string "link_url" t.string "menu_match" t.boolean "deletable", :default => true - t.string "custom_title" t.boolean "draft", :default => false t.boolean "skip_to_first_child", :default => false t.integer "lft" diff --git a/spec/models/refinery/blog_category_spec.rb b/spec/models/refinery/blog_category_spec.rb index 9c92d14..704b6bb 100644 --- a/spec/models/refinery/blog_category_spec.rb +++ b/spec/models/refinery/blog_category_spec.rb @@ -3,16 +3,16 @@ require 'spec_helper' module Refinery describe BlogCategory do before(:each) do - @blog_category = Factory.create(:blog_category) + @blog_category = FactoryGirl.create(:blog_category) end describe "validations" do it "requires title" do - Factory.build(:blog_category, :title => "").should_not be_valid + FactoryGirl.build(:blog_category, :title => "").should_not be_valid end it "won't allow duplicate titles" do - Factory.build(:blog_category, :title => @blog_category.title).should_not be_valid + FactoryGirl.build(:blog_category, :title => @blog_category.title).should_not be_valid end end @@ -33,7 +33,7 @@ module Refinery describe "#post_count" do it "returns post count in category" do 2.times do - @blog_category.posts << Factory.create(:blog_post) + @blog_category.posts << FactoryGirl.create(:blog_post) end @blog_category.post_count.should == 2 end diff --git a/spec/models/refinery/blog_comment_spec.rb b/spec/models/refinery/blog_comment_spec.rb index 5337958..57c90e8 100644 --- a/spec/models/refinery/blog_comment_spec.rb +++ b/spec/models/refinery/blog_comment_spec.rb @@ -6,7 +6,7 @@ module Refinery context "wiring up" do before(:each) do - @comment = Factory.create(:blog_comment) + @comment = FactoryGirl.create(:blog_comment) end it "saves" do diff --git a/spec/models/refinery/blog_post_spec.rb b/spec/models/refinery/blog_post_spec.rb index 2501a24..15f8593 100644 --- a/spec/models/refinery/blog_post_spec.rb +++ b/spec/models/refinery/blog_post_spec.rb @@ -2,19 +2,19 @@ require 'spec_helper' module Refinery describe BlogPost do - let(:blog_post) { Factory.create(:blog_post) } + let(:blog_post) { FactoryGirl.create(:blog_post) } describe "validations" do it "requires title" do - Factory.build(:blog_post, :title => "").should_not be_valid + FactoryGirl.build(:blog_post, :title => "").should_not be_valid end it "won't allow duplicate titles" do - Factory.build(:blog_post, :title => blog_post.title).should_not be_valid + FactoryGirl.build(:blog_post, :title => blog_post.title).should_not be_valid end it "requires body" do - Factory.build(:blog_post, :body => nil).should_not be_valid + FactoryGirl.build(:blog_post, :body => nil).should_not be_valid end end @@ -25,7 +25,7 @@ module Refinery end it "destroys associated comments" do - Factory.create(:blog_comment, :blog_post_id => blog_post.id) + FactoryGirl.create(:blog_comment, :blog_post_id => blog_post.id) blog_post.destroy BlogComment.find_by_blog_post_id(blog_post.id).should == nil end @@ -54,11 +54,11 @@ module Refinery describe "by_archive scope" do before do - @blog_post1 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 11)) - @blog_post2 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 12)) + @blog_post1 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 11)) + @blog_post2 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 12)) #2 months before - Factory.create(:blog_post, :published_at => Date.new(2011, 1, 10)) + FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 1, 10)) end it "returns all posts from specified month" do @@ -71,9 +71,9 @@ module Refinery describe "all_previous scope" do before do - @blog_post1 = Factory.create(:blog_post, :published_at => Time.now - 2.months) - @blog_post2 = Factory.create(:blog_post, :published_at => Time.now - 1.month) - Factory.create(:blog_post, :published_at => Time.now) + @blog_post1 = FactoryGirl.create(:blog_post, :published_at => Time.now - 2.months) + @blog_post2 = FactoryGirl.create(:blog_post, :published_at => Time.now - 1.month) + FactoryGirl.create(:blog_post, :published_at => Time.now) end it "returns all posts from previous months" do @@ -84,10 +84,10 @@ module Refinery describe "live scope" do before do - @blog_post1 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -2)) - @blog_post2 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) - Factory.create(:blog_post, :draft => true) - Factory.create(:blog_post, :published_at => Time.now + 1.minute) + @blog_post1 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -2)) + @blog_post2 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) + FactoryGirl.create(:blog_post, :draft => true) + FactoryGirl.create(:blog_post, :published_at => Time.now + 1.minute) end it "returns all posts which aren't in draft and pub date isn't in future" do @@ -98,10 +98,10 @@ module Refinery describe "uncategorized scope" do before do - @uncategorized_blog_post = Factory.create(:blog_post) - @categorized_blog_post = Factory.create(:blog_post) + @uncategorized_blog_post = FactoryGirl.create(:blog_post) + @categorized_blog_post = FactoryGirl.create(:blog_post) - @categorized_blog_post.categories << Factory.create(:blog_category) + @categorized_blog_post.categories << FactoryGirl.create(:blog_category) end it "returns uncategorized posts if they exist" do @@ -112,22 +112,22 @@ module Refinery describe "#live?" do it "returns true if post is not in draft and it's published" do - Factory.create(:blog_post).live?.should be_true + FactoryGirl.create(:blog_post).live?.should be_true end it "returns false if post is in draft" do - Factory.create(:blog_post, :draft => true).live?.should be_false + FactoryGirl.create(:blog_post, :draft => true).live?.should be_false end it "returns false if post pub date is in future" do - Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => 1)).live?.should be_false + FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => 1)).live?.should be_false end end describe "#next" do before do - Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) - @blog_post = Factory.create(:blog_post) + FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) + @blog_post = FactoryGirl.create(:blog_post) end it "returns next article when called on current article" do @@ -137,8 +137,8 @@ module Refinery describe "#prev" do before do - Factory.create(:blog_post) - @blog_post = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) + FactoryGirl.create(:blog_post) + @blog_post = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) end it "returns previous article when called on current article" do @@ -148,9 +148,9 @@ module Refinery describe "#category_ids=" do before do - @cat1 = Factory.create(:blog_category, :id => 1) - @cat2 = Factory.create(:blog_category, :id => 2) - @cat3 = Factory.create(:blog_category, :id => 3) + @cat1 = FactoryGirl.create(:blog_category, :id => 1) + @cat2 = FactoryGirl.create(:blog_category, :id => 2) + @cat3 = FactoryGirl.create(:blog_category, :id => 3) blog_post.category_ids = [1,2,"","",3] end @@ -187,7 +187,7 @@ module Refinery describe "custom teasers" do it "should allow a custom teaser" do - Factory.create(:blog_post, :custom_teaser => 'This is some custom content').should be_valid + FactoryGirl.create(:blog_post, :custom_teaser => 'This is some custom content').should be_valid end end diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb index d18a552..a554891 100644 --- a/spec/requests/blog_categories_spec.rb +++ b/spec/requests/blog_categories_spec.rb @@ -5,8 +5,8 @@ describe "blog categories" do context "has one category and post" do before(:each) do - @blog_post = Factory.create(:blog_post, :title => "Refinery CMS blog post") - @blog_category = Factory.create(:blog_category, :title => "Video Games") + @blog_post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") + @blog_category = FactoryGirl.create(:blog_category, :title => "Video Games") @blog_post.categories << @blog_category @blog_post.save! end diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb index d7d2a9f..ec84b90 100644 --- a/spec/requests/blog_posts_spec.rb +++ b/spec/requests/blog_posts_spec.rb @@ -22,7 +22,7 @@ describe "blog posts" do context "when has tagged blog posts" do before(:each) do @tag_name = "chicago" - @blog_post = Factory.create(:blog_post, + @blog_post = FactoryGirl.create(:blog_post, :title => "I Love my city", :tag_list => @tag_name) tag = ::Refinery::BlogPost.tag_counts_on(:tags).first diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 6d6f734..2a299d0 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" describe "manage blog posts" do login_refinery_user - let!(:blog_category) { Factory.create(:blog_category, :title => "Video Games") } + let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } context "when no blog posts" do before(:each) { Refinery::BlogPost.destroy_all } From 4439f6afda7c99a80983556689f1b45bd3f9494c Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 3 Sep 2011 11:44:35 +1200 Subject: [PATCH 071/248] Using edge awesome_nested_set until 2.0.2 gem is released to fix deprecation warnings. --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index e70beea..da90ac6 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ gemspec ## Uncomment the following lines to develop against edge refinery gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +gem 'awesome_nested_set', :git => 'git://github.com/collectiveidea/awesome_nested_set.git' group :development, :test do require 'rbconfig' From 80ca7c1bf99befac70803309e542a4db54f1f198 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 3 Sep 2011 15:34:52 +1200 Subject: [PATCH 072/248] Config is deprecated, using RbConfig instread. --- Gemfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index da90ac6..6442971 100644 --- a/Gemfile +++ b/Gemfile @@ -23,11 +23,11 @@ group :development, :test do gem 'guard-spork' unless ENV['TRAVIS'] - if Config::CONFIG['target_os'] =~ /darwin/i + if RbConfig::CONFIG['target_os'] =~ /darwin/i gem 'rb-fsevent', '>= 0.3.9' gem 'growl', '~> 1.0.3' end - if Config::CONFIG['target_os'] =~ /linux/i + if RbConfig::CONFIG['target_os'] =~ /linux/i gem 'rb-inotify', '>= 0.5.1' gem 'libnotify', '~> 0.1.3' end @@ -36,10 +36,10 @@ group :development, :test do platforms :jruby do unless ENV['TRAVIS'] - if Config::CONFIG['target_os'] =~ /darwin/i + if RbConfig::CONFIG['target_os'] =~ /darwin/i gem 'growl', '~> 1.0.3' end - if Config::CONFIG['target_os'] =~ /linux/i + if RbConfig::CONFIG['target_os'] =~ /linux/i gem 'rb-inotify', '>= 0.5.1' gem 'libnotify', '~> 0.1.3' end From 6212e60f9e4d144f9a136f6c82b33abd47ddb237 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 2 Sep 2011 16:01:58 -0700 Subject: [PATCH 073/248] index action of blog post controller now caches and sweeps on changes fix various views which were broken and untested with rails-3-1 upgrade add request spec tests for admin blog comments Factory is now FactoryGirl Fix multiple issues around listing unmoderated comments use cleaner definitions to set per_page willpaginate attribute on models update all paginate calls to use new arel representation reorganize filter sections to be located at top of controller modify uncategorized class method to activerecord scope and perform a left outer join instead of iterate through an array to find uncategorized posts move request specs into their proper places update guardfile to ensure that request specs get run when their respective controllers are modified Fix show action for AdminBlogComments and added test Fix redirection link after approving or rejecting a comment --- Guardfile | 2 +- .../admin/blog/comments_controller.rb | 21 ++- .../refinery/admin/blog/posts_controller.rb | 20 ++- .../refinery/blog/posts_controller.rb | 7 +- app/models/refinery/blog_comment.rb | 4 +- app/models/refinery/blog_post.rb | 39 ++--- app/sweepers/refinery/blog_sweeper.rb | 25 +++ .../admin/blog/comments/_comment.html.erb | 8 +- .../blog/comments/_sortable_list.html.erb | 2 +- .../admin/blog/comments/index.html.erb | 12 +- .../admin/blog/comments/show.html.erb | 8 +- .../settings/notification_recipients.html.erb | 2 +- spec/dummy/config/environments/development.rb | 2 +- spec/requests/blog_categories_spec.rb | 23 --- spec/requests/blog_posts_spec.rb | 38 ----- spec/requests/manage_blog_posts_spec.rb | 141 ----------------- .../refinery/admin/blog/comments_spec.rb | 124 +++++++++++++++ .../refinery/admin/blog/posts_spec.rb | 143 ++++++++++++++++++ .../requests/refinery/blog/categories_spec.rb | 25 +++ spec/requests/refinery/blog/posts_spec.rb | 40 +++++ 20 files changed, 420 insertions(+), 266 deletions(-) create mode 100644 app/sweepers/refinery/blog_sweeper.rb delete mode 100644 spec/requests/blog_categories_spec.rb delete mode 100644 spec/requests/blog_posts_spec.rb delete mode 100644 spec/requests/manage_blog_posts_spec.rb create mode 100644 spec/requests/refinery/admin/blog/comments_spec.rb create mode 100644 spec/requests/refinery/admin/blog/posts_spec.rb create mode 100644 spec/requests/refinery/blog/categories_spec.rb create mode 100644 spec/requests/refinery/blog/posts_spec.rb diff --git a/Guardfile b/Guardfile index 7774821..0de2882 100644 --- a/Guardfile +++ b/Guardfile @@ -2,7 +2,7 @@ guard 'rspec', :version => 2, :cli => "--format Fuubar --color --drb" do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } - watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/controllers/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } watch(%r{^spec/support/(.+)\.rb$}) { "spec" } watch('spec/spec_helper.rb') { "spec" } watch('config/routes.rb') { "spec/routing" } diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb index 9f78caa..f14e8eb 100644 --- a/app/controllers/refinery/admin/blog/comments_controller.rb +++ b/app/controllers/refinery/admin/blog/comments_controller.rb @@ -2,37 +2,44 @@ module Refinery module Admin module Blog class CommentsController < ::Admin::BaseController + + cache_sweeper Refinery::BlogSweeper crudify :'refinery/blog_comment', :title_attribute => :name, :order => 'published_at DESC' def index - @blog_comments = Refinery::BlogComment.unmoderated + @blog_comments = Refinery::BlogComment.unmoderated.page(params[:page]) + render :action => 'index' end def approved unless params[:id].present? - @blog_comments = Refinery::BlogComment.approved + @blog_comments = Refinery::BlogComment.approved.page(params[:page]) + render :action => 'index' else @blog_comment = Refinery::BlogComment.find(params[:id]) @blog_comment.approve! - flash[:notice] = t('approved', :scope => 'admin.blog.comments', :author => @blog_comment.name) - redirect_to :action => params[:return_to] || 'index' + flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) + + redirect_to main_app.url_for(:action => params[:return_to] || 'index') end end def rejected unless params[:id].present? - @blog_comments = Refinery::BlogComment.rejected + @blog_comments = Refinery::BlogComment.rejected.page(params[:page]) + render :action => 'index' else @blog_comment = Refinery::BlogComment.find(params[:id]) @blog_comment.reject! - flash[:notice] = t('rejected', :scope => 'admin.blog.comments', :author => @blog_comment.name) - redirect_to :action => params[:return_to] || 'index' + flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) + + redirect_to main_app.url_for(:action => params[:return_to] || 'index') end end diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index 548f8c9..17ebe87 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -1,18 +1,21 @@ -require 'will_paginate/array' - module Refinery module Admin module Blog class PostsController < ::Admin::BaseController - + + cache_sweeper Refinery::BlogSweeper crudify :'refinery/blog_post', :title_attribute => :title, :order => 'published_at DESC' + + before_filter :find_all_categories, + :only => [:new, :edit, :create, :update] + + before_filter :check_category_ids, :only => :update def uncategorized - @blog_posts = Refinery::BlogPost.uncategorized.paginate(:page => params[:page], - :per_page => Refinery::BlogPost.per_page) + @blog_posts = Refinery::BlogPost.uncategorized.page(params[:page]) end def tags @@ -71,7 +74,7 @@ module Refinery unless request.xhr? render :action => 'new' else - render :partial => "/shared/admin/error_messages", + render :partial => "/refinery/admin/error_messages", :locals => { :object => @blog_post, :include_object_name => true @@ -80,11 +83,6 @@ module Refinery end end - before_filter :find_all_categories, - :only => [:new, :edit, :create, :update] - - before_filter :check_category_ids, :only => :update - protected def find_all_categories @blog_categories = Refinery::BlogCategory.find(:all) diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 167aef3..aa7d45e 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,6 +1,9 @@ module Refinery module Blog class PostsController < BlogController + + caches_page :index + # cache_sweeper Refinery::BlogSweeper, :only => [:comment] before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_blog_post, :only => [:show, :comment, :update_nav] @@ -38,10 +41,10 @@ module Refinery if Refinery::BlogComment::Moderation.enabled? flash[:notice] = t('thank_you_moderated', :scope => 'blog.posts.comments') - redirect_to blog_post_url(params[:id]) + redirect_to main_app.blog_post_url(params[:id]) else flash[:notice] = t('thank_you', :scope => 'blog.posts.comments') - redirect_to blog_post_url(params[:id], + redirect_to main_app.blog_post_url(params[:id], :anchor => "comment-#{@blog_comment.to_param}") end else diff --git a/app/models/refinery/blog_comment.rb b/app/models/refinery/blog_comment.rb index e5869a8..f7c1c84 100644 --- a/app/models/refinery/blog_comment.rb +++ b/app/models/refinery/blog_comment.rb @@ -19,6 +19,8 @@ module Refinery scope :unmoderated, :conditions => {:state => nil} scope :approved, :conditions => {:state => 'approved'} scope :rejected, :conditions => {:state => 'rejected'} + + self.per_page = Setting.find_or_set(:blog_comments_per_page, 10) def avatar_url(options = {}) options = {:size => 60} @@ -55,7 +57,7 @@ module Refinery end before_create do |comment| - unless BlogComment::Moderation.enabled? + unless Moderation.enabled? comment.state = comment.ham? ? 'approved' : 'rejected' end end diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb index 6b27688..8cd3dd9 100644 --- a/app/models/refinery/blog_post.rb +++ b/app/models/refinery/blog_post.rb @@ -40,9 +40,15 @@ module Refinery scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } - # next is now in << self + + scope :uncategorized, lambda { + live.includes(:categories).where(:categories => { Refinery::Categorization.table_name => { :blog_category_id => nil } }) + } - attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids + attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url + attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids + + self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) def next BlogPost.next(self).first @@ -67,38 +73,23 @@ module Refinery end class << self - def next current_record + def next(current_record) self.send(:with_exclusive_scope) do where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") end end def comments_allowed? - Refinery::Setting.find_or_set(:comments_allowed, true, { - :scoping => 'blog' - }) + Refinery::Setting.find_or_set(:comments_allowed, true, :scoping => 'blog') end def teasers_enabled? - Refinery::Setting.find_or_set(:teasers_enabled, true, { - :scoping => 'blog' - }) + Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') end def teaser_enabled_toggle! - currently = Refinery::Setting.find_or_set(:teasers_enabled, true, { - :scoping => 'blog' - }) - Refinery::Setting.set(:teasers_enabled, {:value => !currently, :scoping => 'blog'}) - end - - def uncategorized - BlogPost.live.reject { |p| p.categories.any? } - end - - # how many items to show per page - def per_page - Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + currently = Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') + Refinery::Setting.set(:teasers_enabled, :value => !currently, :scoping => 'blog') end end @@ -107,9 +98,7 @@ module Refinery class << self def key - Refinery::Setting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, { - :scoping => 'blog' - }) + Refinery::Setting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, :scoping => 'blog') end def enabled? diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb new file mode 100644 index 0000000..adf97fc --- /dev/null +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -0,0 +1,25 @@ +module Refinery + class BlogSweeper < ActionController::Caching::Sweeper + observe BlogPost, BlogComment + + def after_create(record) + expire_cache_for(record) + end + + def after_update(record) + expire_cache_for(record) + end + + def after_destroy(record) + expire_cache_for(record) + end + + private + + def expire_cache_for(record) + expire_page '/blog' + expire_page '/blog/feed.rss' + end + + end +end diff --git a/app/views/refinery/admin/blog/comments/_comment.html.erb b/app/views/refinery/admin/blog/comments/_comment.html.erb index 547b9e4..f5eba4d 100644 --- a/app/views/refinery/admin/blog/comments/_comment.html.erb +++ b/app/views/refinery/admin/blog/comments/_comment.html.erb @@ -5,16 +5,16 @@ <%= link_to refinery_icon_tag("application_go.png"), - blog_post_url(comment.post, :anchor => "comment-#{comment.to_param}"), + main_app.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), :title => t('.view_live_html'), :target => "_blank" unless comment.unmoderated? %> - <%= link_to refinery_icon_tag('zoom.png'), admin_blog_comment_path(comment), + <%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_admin_blog_comment_path(comment), :title => t('.read') %> <%= link_to refinery_icon_tag("cross.png"), - rejected_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + main_app.rejected_refinery_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.reject') unless comment.rejected? %> <%= link_to refinery_icon_tag("tick.png"), - approved_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + main_app.approved_refinery_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.approve') unless comment.approved? %> diff --git a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb b/app/views/refinery/admin/blog/comments/_sortable_list.html.erb index e141dee..f781ba1 100644 --- a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb +++ b/app/views/refinery/admin/blog/comments/_sortable_list.html.erb @@ -1,7 +1,7 @@
    <%= render :partial => 'comment', :collection => @blog_comments %>
-<%= render :partial => "/shared/admin/sortable_list", +<%= render :partial => "/refinery/admin/sortable_list", :locals => { :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) } %> diff --git a/app/views/refinery/admin/blog/comments/index.html.erb b/app/views/refinery/admin/blog/comments/index.html.erb index bf2be9c..059ef59 100644 --- a/app/views/refinery/admin/blog/comments/index.html.erb +++ b/app/views/refinery/admin/blog/comments/index.html.erb @@ -1,30 +1,30 @@ -<%= render :partial => '/admin/blog/submenu' %> +<%= render :partial => '/refinery/admin/blog/submenu' %>
<% if searching? %>

<%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>

<% if @blog_comments.any? %> - <%=# will_paginate @blog_comments %> + <%= will_paginate @blog_comments %>
    <%= render :partial => "blog_comments", :collection => @blog_comments %>
- <%=# will_paginate @blog_comments %> + <%= will_paginate @blog_comments %> <% else %>

<%= t('search_no_results', :scope => 'admin') %>

<% end %> <% else %> <% if @blog_comments.any? %> - <%=# will_paginate @blog_comments %> + <%= will_paginate @blog_comments %> <%= render :partial => "sortable_list" %> - <%=# will_paginate @blog_comments %> + <%= will_paginate @blog_comments %> <% else %>

<%= t('.no_items_yet', - :type => t(action_name.gsub('index', 'new'), :scope => 'admin.blog.submenu.comments').downcase) %> + :type => action_name.gsub('index', 'new')).downcase %>

<% end %> <% end %> diff --git a/app/views/refinery/admin/blog/comments/show.html.erb b/app/views/refinery/admin/blog/comments/show.html.erb index 2e72eb0..3dc50ff 100644 --- a/app/views/refinery/admin/blog/comments/show.html.erb +++ b/app/views/refinery/admin/blog/comments/show.html.erb @@ -6,14 +6,14 @@

<%= t('.actions') %>

  • - <%= link_to t('.back'), {:action => 'index'}, :class => "back_icon" %> + <%= link_to t('.back'), main_app.refinery_admin_blog_comments_path, :class => "back_icon" %>
  • - <%= link_to t('.reject'), rejected_admin_blog_comment_path(@blog_comment, :return_to => 'rejected'), + <%= link_to t('.reject'), main_app.rejected_refinery_admin_blog_comment_path(@blog_comment, :return_to => 'rejected'), :class => 'comment_cross_icon' unless @blog_comment.rejected? %>
  • - <%= link_to t('.approve'), approved_admin_blog_comment_path(@blog_comment, :return_to => 'approved'), + <%= link_to t('.approve'), main_app.approved_refinery_admin_blog_comment_path(@blog_comment, :return_to => 'approved'), :class => 'comment_tick_icon' unless @blog_comment.approved? %>
@@ -27,7 +27,7 @@ <%= link_to @blog_comment.post.title, - blog_post_url(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"), + main_app.blog_post_path(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"), :target => '_blank' %> diff --git a/app/views/refinery/admin/blog/settings/notification_recipients.html.erb b/app/views/refinery/admin/blog/settings/notification_recipients.html.erb index 41e7f2d..d321ded 100644 --- a/app/views/refinery/admin/blog/settings/notification_recipients.html.erb +++ b/app/views/refinery/admin/blog/settings/notification_recipients.html.erb @@ -14,7 +14,7 @@ <%= t('.example') %>

- <%= render :partial => "/shared/admin/form_actions", + <%= render :partial => "/refinery/admin/form_actions", :locals => { :f => nil, :continue_editing => false, diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index 8604338..c777820 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -11,7 +11,7 @@ Dummy::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_controller.perform_caching = false + config.action_controller.perform_caching = true # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb deleted file mode 100644 index a554891..0000000 --- a/spec/requests/blog_categories_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require "spec_helper" - -describe "blog categories" do - login_refinery_user - - context "has one category and post" do - before(:each) do - @blog_post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") - @blog_category = FactoryGirl.create(:blog_category, :title => "Video Games") - @blog_post.categories << @blog_category - @blog_post.save! - end - - describe "show categories blog posts" do - before(:each) { visit blog_category_path(@blog_category) } - - it "should displays categories blog posts" do - page.should have_content("Refinery CMS blog post") - page.should have_content("Video Games") - end - end - end -end diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb deleted file mode 100644 index ec84b90..0000000 --- a/spec/requests/blog_posts_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require "spec_helper" - -describe "blog posts" do - login_refinery_user - - context "when has blog posts" do - let(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } - - it "should display blog post" do - visit blog_post_path(blog_post) - page.should have_content("Refinery CMS blog post") - end - - it "should display the blog rss feed" do - get blog_rss_feed_path - response.should be_success - response.content_type.should eq("application/rss+xml") - end - end - - describe "list tagged posts" do - context "when has tagged blog posts" do - before(:each) do - @tag_name = "chicago" - @blog_post = FactoryGirl.create(:blog_post, - :title => "I Love my city", - :tag_list => @tag_name) - tag = ::Refinery::BlogPost.tag_counts_on(:tags).first - visit tagged_posts_path(tag.id, @tag_name.parameterize) - end - - it "should have one tagged post" do - page.should have_content(@tag_name) - page.should have_content(@blog_post.title) - end - end - end -end diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb deleted file mode 100644 index 2a299d0..0000000 --- a/spec/requests/manage_blog_posts_spec.rb +++ /dev/null @@ -1,141 +0,0 @@ -require "spec_helper" - -describe "manage blog posts" do - login_refinery_user - - let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } - - context "when no blog posts" do - before(:each) { Refinery::BlogPost.destroy_all } - - describe "blog post listing" do - before(:each) { visit refinery_admin_blog_posts_path } - - it "invites to create new post" do - page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.") - end - end - - describe "new blog post form" do - before(:each) do - visit refinery_admin_blog_posts_path - click_link "Create new post" - end - - it "should have Tags" do - page.should have_content("Tags") - end - - it "should have Video Games" do - page.should have_content(blog_category.title) - end - - describe "create blog post" do - before(:each) do - fill_in "Title", :with => "This is my blog post" - fill_in "blog_post_body", :with => "And I love it" - check blog_category.title - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "should be the only blog post" do - ::Refinery::BlogPost.all.size.should eq(1) - end - - it "should belong to me" do - ::Refinery::BlogPost.first.author.login.should eq(::Refinery::User.last.login) - end - - it "should save categories" do - ::Refinery::BlogPost.last.categories.count.should eq(1) - ::Refinery::BlogPost.last.categories.first.title.should eq(blog_category.title) - end - end - - describe "create blog post with tags" do - before(:each) do - @tag_list = "chicago, bikes, beers, babes" - fill_in "Title", :with => "This is a tagged blog post" - fill_in "blog_post_body", :with => "And I also love it" - fill_in "Tags", :with => @tag_list - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "should be the only blog post" do - ::Refinery::BlogPost.all.size.should eq(1) - end - - it "should have the specified tags" do - ::Refinery::BlogPost.last.tag_list.should eq(@tag_list.split(', ')) - end - end - end - end - - context "when has blog posts" do - let!(:blog_post) { Factory(:blog_post) } - - describe "blog post listing" do - before(:each) { visit refinery_admin_blog_posts_path } - - describe "edit blog post" do - it "should succeed" do - page.should have_content(blog_post.title) - - click_link("Edit this blog post") - current_path.should == edit_refinery_admin_blog_post_path(blog_post) - - fill_in "Title", :with => "hax0r" - click_button "Save" - - page.should_not have_content(blog_post.title) - page.should have_content("'hax0r' was successfully updated.") - end - end - - describe "deleting blog post" do - it "should succeed" do - page.should have_content(blog_post.title) - - click_link "Remove this blog post forever" - - page.should have_content("'#{blog_post.title}' was successfully removed.") - end - end - - describe "view live" do - it "redirects to blog post in the frontend" do - click_link "View this blog post live" - - current_path.should == blog_post_path(blog_post) - page.should have_content(blog_post.title) - end - end - end - - context "when uncategorized post" do - it "shows up in the list" do - visit uncategorized_refinery_admin_blog_posts_path - page.should have_content(blog_post.title) - end - end - - context "when categorized post" do - it "won't show up in the list" do - blog_post.categories << blog_category - blog_post.save! - - visit uncategorized_refinery_admin_blog_posts_path - page.should_not have_content(blog_post.title) - end - end - end -end diff --git a/spec/requests/refinery/admin/blog/comments_spec.rb b/spec/requests/refinery/admin/blog/comments_spec.rb new file mode 100644 index 0000000..a0213f6 --- /dev/null +++ b/spec/requests/refinery/admin/blog/comments_spec.rb @@ -0,0 +1,124 @@ +require "spec_helper" + +module Refinery + describe "AdminBlogComments" do + login_refinery_user + + describe "#index" do + context "when has no new unapproved comments" do + before(:each) do + BlogComment.delete_all + visit refinery_admin_blog_comments_path + end + + it "should list no comments" do + visit refinery_admin_blog_comments_path + + page.should have_content('there are no new comments') + end + end + + context "when has new unapproved comments" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + before(:each) { visit refinery_admin_blog_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve a comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + + it "should allow me to reject a comment" do + click_link "Reject this comment" + + page.should have_content("has been rejected") + end + end + end + + describe "#approved" do + context "when has no approved comments" do + before(:each) do + BlogComment.delete_all + visit approved_refinery_admin_blog_comments_path + end + + it "should list no comments" do + page.should have_content('there are no approved comments') + end + end + + context "when has approved comments" do + let!(:blog_comment) do + FactoryGirl.create(:blog_comment, + :state => 'approved') + end + before(:each) { visit approved_refinery_admin_blog_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to reject a comment" do + click_link "Reject this comment" + + page.should have_content("has been rejected") + end + end + end + + describe "#rejected" do + context "when has no rejected comments" do + before(:each) do + BlogComment.delete_all + visit rejected_refinery_admin_blog_comments_path + end + + it "should list no comments" do + page.should have_content('there are no rejected comments') + end + end + + context "when has rejected comments" do + let!(:blog_comment) do + FactoryGirl.create(:blog_comment, + :state => 'rejected') + end + before(:each) { visit rejected_refinery_admin_blog_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve a comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + end + end + + describe "#show" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + before(:each) { visit refinery_admin_blog_comment_path(blog_comment) } + + it "should display the comment" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve the comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + end + end +end diff --git a/spec/requests/refinery/admin/blog/posts_spec.rb b/spec/requests/refinery/admin/blog/posts_spec.rb new file mode 100644 index 0000000..73bdf93 --- /dev/null +++ b/spec/requests/refinery/admin/blog/posts_spec.rb @@ -0,0 +1,143 @@ +require "spec_helper" + +module Refinery + describe "AdminBlogPosts" do + login_refinery_user + + let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } + + context "when no blog posts" do + before(:each) { Refinery::BlogPost.destroy_all } + + describe "blog post listing" do + before(:each) { visit refinery_admin_blog_posts_path } + + it "invites to create new post" do + page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.") + end + end + + describe "new blog post form" do + before(:each) do + visit refinery_admin_blog_posts_path + click_link "Create new post" + end + + it "should have Tags" do + page.should have_content("Tags") + end + + it "should have Video Games" do + page.should have_content(blog_category.title) + end + + describe "create blog post" do + before(:each) do + fill_in "Title", :with => "This is my blog post" + fill_in "blog_post_body", :with => "And I love it" + check blog_category.title + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + ::Refinery::BlogPost.all.size.should eq(1) + end + + it "should belong to me" do + ::Refinery::BlogPost.first.author.login.should eq(::Refinery::User.last.login) + end + + it "should save categories" do + ::Refinery::BlogPost.last.categories.count.should eq(1) + ::Refinery::BlogPost.last.categories.first.title.should eq(blog_category.title) + end + end + + describe "create blog post with tags" do + before(:each) do + @tag_list = "chicago, bikes, beers, babes" + fill_in "Title", :with => "This is a tagged blog post" + fill_in "blog_post_body", :with => "And I also love it" + fill_in "Tags", :with => @tag_list + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + ::Refinery::BlogPost.all.size.should eq(1) + end + + it "should have the specified tags" do + ::Refinery::BlogPost.last.tag_list.should eq(@tag_list.split(', ')) + end + end + end + end + + context "when has blog posts" do + let!(:blog_post) { FactoryGirl.create(:blog_post) } + + describe "blog post listing" do + before(:each) { visit refinery_admin_blog_posts_path } + + describe "edit blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link("Edit this blog post") + current_path.should == edit_refinery_admin_blog_post_path(blog_post) + + fill_in "Title", :with => "hax0r" + click_button "Save" + + page.should_not have_content(blog_post.title) + page.should have_content("'hax0r' was successfully updated.") + end + end + + describe "deleting blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link "Remove this blog post forever" + + page.should have_content("'#{blog_post.title}' was successfully removed.") + end + end + + describe "view live" do + it "redirects to blog post in the frontend" do + click_link "View this blog post live" + + current_path.should == blog_post_path(blog_post) + page.should have_content(blog_post.title) + end + end + end + + context "when uncategorized post" do + it "shows up in the list" do + visit uncategorized_refinery_admin_blog_posts_path + page.should have_content(blog_post.title) + end + end + + context "when categorized post" do + it "won't show up in the list" do + blog_post.categories << blog_category + blog_post.save! + + visit uncategorized_refinery_admin_blog_posts_path + page.should_not have_content(blog_post.title) + end + end + end + end +end diff --git a/spec/requests/refinery/blog/categories_spec.rb b/spec/requests/refinery/blog/categories_spec.rb new file mode 100644 index 0000000..48a3417 --- /dev/null +++ b/spec/requests/refinery/blog/categories_spec.rb @@ -0,0 +1,25 @@ +require "spec_helper" + +module Refinery + describe "BlogCategories" do + login_refinery_user + + context "has one category and post" do + before(:each) do + @blog_post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") + @blog_category = FactoryGirl.create(:blog_category, :title => "Video Games") + @blog_post.categories << @blog_category + @blog_post.save! + end + + describe "show categories blog posts" do + before(:each) { visit blog_category_path(@blog_category) } + + it "should displays categories blog posts" do + page.should have_content("Refinery CMS blog post") + page.should have_content("Video Games") + end + end + end + end +end diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb new file mode 100644 index 0000000..eba6131 --- /dev/null +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -0,0 +1,40 @@ +require "spec_helper" + +module Refinery + describe "BlogPosts" do + login_refinery_user + + context "when has blog posts" do + let(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") } + + it "should display blog post" do + visit blog_post_path(blog_post) + page.should have_content("Refinery CMS blog post") + end + + it "should display the blog rss feed" do + get blog_rss_feed_path + response.should be_success + response.content_type.should eq("application/rss+xml") + end + end + + describe "list tagged posts" do + context "when has tagged blog posts" do + before(:each) do + @tag_name = "chicago" + @blog_post = FactoryGirl.create(:blog_post, + :title => "I Love my city", + :tag_list => @tag_name) + tag = ::Refinery::BlogPost.tag_counts_on(:tags).first + visit tagged_posts_path(tag.id, @tag_name.parameterize) + end + + it "should have one tagged post" do + page.should have_content(@tag_name) + page.should have_content(@blog_post.title) + end + end + end + end +end From 7903bdfed26f085f6d07d104ac458bc4319b1e32 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 03:20:51 -0700 Subject: [PATCH 074/248] refactor factories and add #show tests for posts controller Do not want to cache classes, but do want to reload models after factory girl: http://groups.google.com/group/factory_girl/browse_thread/thread/daa24556d90c31fc http://stackoverflow.com/questions/5145165/associationtypemismatch-and-factorygirl rails_autolink was removed from Rails 3.1 and abstracted to an external gem fix display author name and post time on comment show fix namespace for thanking and moderated flash notices --- Gemfile | 3 +- .../refinery/blog/posts_controller.rb | 4 +- .../refinery/blog/posts/_comment.html.erb | 4 +- lib/gemspec.rb | 1 + lib/refinery/blog/engine.rb | 2 + refinerycms-blog.gemspec | 27 +++++--- spec/dummy/.gitignore | 2 + .../factories/blog_categories.rb | 2 +- spec/factories/blog_comments.rb | 19 ++++++ spec/{support => }/factories/blog_posts.rb | 2 +- spec/requests/refinery/blog/posts_spec.rb | 61 ++++++++++++++++--- spec/spec_helper.rb | 29 +++++---- spec/support/database_cleaner.rb | 2 + spec/support/factories/blog_comments.rb | 8 --- 14 files changed, 123 insertions(+), 43 deletions(-) rename spec/{support => }/factories/blog_categories.rb (54%) create mode 100644 spec/factories/blog_comments.rb rename spec/{support => }/factories/blog_posts.rb (85%) delete mode 100644 spec/support/factories/blog_comments.rb diff --git a/Gemfile b/Gemfile index 6442971..66587c9 100644 --- a/Gemfile +++ b/Gemfile @@ -3,11 +3,12 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against edge refinery -gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +gem 'refinerycms', :path => "~/Code/refinerycms" # :git => 'git://github.com/resolve/refinerycms.git' gem 'awesome_nested_set', :git => 'git://github.com/collectiveidea/awesome_nested_set.git' group :development, :test do require 'rbconfig' + gem 'sqlite3' gem 'mysql2' gem 'pg' diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index aa7d45e..a22d251 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -40,10 +40,10 @@ module Refinery end if Refinery::BlogComment::Moderation.enabled? - flash[:notice] = t('thank_you_moderated', :scope => 'blog.posts.comments') + flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments') redirect_to main_app.blog_post_url(params[:id]) else - flash[:notice] = t('thank_you', :scope => 'blog.posts.comments') + flash[:notice] = t('thank_you', :scope => 'refinery.blog.posts.comments') redirect_to main_app.blog_post_url(params[:id], :anchor => "comment-#{@blog_comment.to_param}") end diff --git a/app/views/refinery/blog/posts/_comment.html.erb b/app/views/refinery/blog/posts/_comment.html.erb index 5503826..659f433 100644 --- a/app/views/refinery/blog/posts/_comment.html.erb +++ b/app/views/refinery/blog/posts/_comment.html.erb @@ -3,8 +3,8 @@ <%= simple_format auto_link(comment.message.to_s) %>

- <%= t('by', :scope => 'blog.posts.comments', :who => comment.name) %>, - <%= t('time_ago', :scope => 'blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %> + <%= t('by', :scope => 'refinery.blog.posts.comments', :who => comment.name) %>, + <%= t('time_ago', :scope => 'refinery.blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %>

diff --git a/lib/gemspec.rb b/lib/gemspec.rb index df188fe..5508df6 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -24,6 +24,7 @@ Gem::Specification.new do |s| s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.2.0.rc1' + s.add_dependency 'rails_autolink' # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index ef21472..f67d4ab 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -1,6 +1,8 @@ module Refinery module Blog class Engine < Rails::Engine + require 'rails_autolink' + config.to_prepare do require 'refinery/blog/tabs' end diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 24016af..46a86d3 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-08-18} + s.date = %q{2011-09-04} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -14,9 +14,10 @@ Gem::Specification.new do |s| # Runtime dependencies s.add_dependency 'refinerycms-core', '~> 2.0.0' - s.add_dependency 'refinerycms-pages', '~> 2.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' + s.add_dependency 'seo_meta', '~> 1.2.0.rc1' + s.add_dependency 'rails_autolink' # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' @@ -99,6 +100,9 @@ Gem::Specification.new do |s| app/models/refinery/blog_comment.rb app/models/refinery/blog_post.rb app/models/refinery/categorization.rb + app/sweepers + app/sweepers/refinery + app/sweepers/refinery/blog_sweeper.rb app/views app/views/refinery app/views/refinery/admin @@ -204,6 +208,10 @@ Gem::Specification.new do |s| script script/rails spec + spec/factories + spec/factories/blog_categories.rb + spec/factories/blog_comments.rb + spec/factories/blog_posts.rb spec/models spec/models/refinery spec/models/refinery/blog_category_spec.rb @@ -211,17 +219,18 @@ Gem::Specification.new do |s| spec/models/refinery/blog_post_spec.rb spec/rcov.opts spec/requests - spec/requests/blog_categories_spec.rb - spec/requests/blog_posts_spec.rb - spec/requests/manage_blog_posts_spec.rb + spec/requests/refinery + spec/requests/refinery/admin + spec/requests/refinery/admin/blog + spec/requests/refinery/admin/blog/comments_spec.rb + spec/requests/refinery/admin/blog/posts_spec.rb + spec/requests/refinery/blog + spec/requests/refinery/blog/categories_spec.rb + spec/requests/refinery/blog/posts_spec.rb spec/spec_helper.rb spec/support spec/support/database_cleaner.rb spec/support/devise.rb - spec/support/factories - spec/support/factories/blog_categories.rb - spec/support/factories/blog_comments.rb - spec/support/factories/blog_posts.rb spec/support/refinery.rb todo.md ) diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore index d80f252..c698a36 100644 --- a/spec/dummy/.gitignore +++ b/spec/dummy/.gitignore @@ -31,6 +31,8 @@ public/themes/* # Public Cache public/javascripts/cache public/stylesheets/cache +public/*.html +public/refinery/cache # Vendor Cache vendor/cache diff --git a/spec/support/factories/blog_categories.rb b/spec/factories/blog_categories.rb similarity index 54% rename from spec/support/factories/blog_categories.rb rename to spec/factories/blog_categories.rb index 31ec28b..9ee4f16 100644 --- a/spec/support/factories/blog_categories.rb +++ b/spec/factories/blog_categories.rb @@ -1,5 +1,5 @@ FactoryGirl.define do - factory :blog_category, :class => 'refinery/blog_category' do + factory :blog_category, :class => Refinery::BlogCategory do sequence(:title) { |n| "Shopping #{n}" } end end diff --git a/spec/factories/blog_comments.rb b/spec/factories/blog_comments.rb new file mode 100644 index 0000000..9818c07 --- /dev/null +++ b/spec/factories/blog_comments.rb @@ -0,0 +1,19 @@ +FactoryGirl.define do + factory :blog_comment, :class => Refinery::BlogComment do + name "Joe Commenter" + sequence(:email) { |n| "person#{n}@example.com" } + body "Which one is the best for picking up new shoes?" + association :post, :factory => :blog_post + + trait :approved do + state 'approved' + end + + trait :rejected do + state 'rejected' + end + + factory :approved_comment, :traits => [:approved] + factory :rejected_comment, :traits => [:rejected] + end +end diff --git a/spec/support/factories/blog_posts.rb b/spec/factories/blog_posts.rb similarity index 85% rename from spec/support/factories/blog_posts.rb rename to spec/factories/blog_posts.rb index 4586b36..0b8b888 100644 --- a/spec/support/factories/blog_posts.rb +++ b/spec/factories/blog_posts.rb @@ -1,5 +1,5 @@ FactoryGirl.define do - factory :blog_post, :class => 'refinery/blog_post' do + factory :blog_post, :class => Refinery::BlogPost do sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." draft false diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb index eba6131..4017d03 100644 --- a/spec/requests/refinery/blog/posts_spec.rb +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -5,36 +5,83 @@ module Refinery login_refinery_user context "when has blog posts" do - let(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") } + let!(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") } it "should display blog post" do visit blog_post_path(blog_post) - page.should have_content("Refinery CMS blog post") + + page.should have_content(blog_post.title) end it "should display the blog rss feed" do get blog_rss_feed_path + response.should be_success response.content_type.should eq("application/rss+xml") end end - + describe "list tagged posts" do context "when has tagged blog posts" do before(:each) do @tag_name = "chicago" @blog_post = FactoryGirl.create(:blog_post, - :title => "I Love my city", - :tag_list => @tag_name) - tag = ::Refinery::BlogPost.tag_counts_on(:tags).first - visit tagged_posts_path(tag.id, @tag_name.parameterize) + :title => "I Love my city", + :tag_list => @tag_name) + @tag = ::Refinery::BlogPost.tag_counts_on(:tags).first end it "should have one tagged post" do + visit tagged_posts_path(@tag.id, @tag_name.parameterize) + page.should have_content(@tag_name) page.should have_content(@blog_post.title) end end end + + describe "#show" do + context "when has no comments" do + let!(:blog_post) { FactoryGirl.create(:blog_post) } + + it "should display the blog post" do + visit blog_post_path(blog_post) + + page.should have_content(blog_post.title) + page.should have_content(blog_post.body) + end + end + + context "when has approved comments" do + let!(:approved_comment) { FactoryGirl.create(:approved_comment) } + + it "should display the comments" do + visit blog_post_path(approved_comment.post) + + page.should have_content(approved_comment.body) + page.should have_content("Posted by #{approved_comment.name}") + end + end + + context "when has rejected comments" do + let!(:rejected_comment) { FactoryGirl.create(:rejected_comment) } + + it "should not display the comments" do + visit blog_post_path(rejected_comment.post) + + page.should_not have_content(rejected_comment.body) + end + end + + context "when has new comments" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + + it "should not display the comments" do + visit blog_post_path(blog_comment.post) + + page.should_not have_content(blog_comment.body) + end + end + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a3fe107..b8df592 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,34 +6,39 @@ def setup_environment # need to restart spork for it take effect. # Configure Rails Environment - ENV["RAILS_ENV"] ||= 'test' + ENV["RAILS_ENV"] = 'test' require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' require 'capybara/rspec' - require 'factory_girl' - require 'refinerycms-testing' - + Rails.backtrace_cleaner.remove_silencers! + RSpec.configure do |config| + config.mock_with :rspec + end +end + +def each_run + require 'factory_girl_rails' + require 'refinerycms-testing' + + Dir[File.expand_path("../../app/models/**/*.rb", __FILE__)].each do |model| + load model + end + Dir[ File.expand_path("../support/**/*.rb", __FILE__), File.expand_path("../factories/**/*.rb", __FILE__) ].each {|f| require f} - - RSpec.configure do |config| - config.mock_with :rspec - config.use_transactional_fixtures = false - end -end - -def each_run end # If spork is available in the Gemfile it'll be used but we don't force it. unless (begin; require 'spork'; rescue LoadError; nil end).nil? Spork.prefork do setup_environment + + ActiveSupport::Dependencies.clear end Spork.each_run do diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index a104c53..40acbc9 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -1,6 +1,8 @@ require 'database_cleaner' RSpec.configure do |config| + config.use_transactional_fixtures = false + config.before(:suite) do DatabaseCleaner.strategy = :truncation end diff --git a/spec/support/factories/blog_comments.rb b/spec/support/factories/blog_comments.rb deleted file mode 100644 index 0bb5206..0000000 --- a/spec/support/factories/blog_comments.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryGirl.define do - factory :blog_comment, :class => 'refinery/blog_comment' do - name "Joe Commenter" - sequence(:email) { |n| "person#{n}@example.com" } - body "Which one is the best for picking up new shoes?" - association :post, :factory => :blog_post - end -end From ec6ed3f951917634496b0b7de3f575dc0c6de96f Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:40:12 -0700 Subject: [PATCH 075/248] accidentally had left perform_caching set to true --- spec/dummy/config/environments/development.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index c777820..8604338 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -11,7 +11,7 @@ Dummy::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_controller.perform_caching = true + config.action_controller.perform_caching = false # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false From 3431b15ef37ca4a685f3d4f6a80f0e069023d105 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:46:45 -0700 Subject: [PATCH 076/248] fix localization string for submit button on comment --- app/views/refinery/blog/posts/_comments.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/refinery/blog/posts/_comments.html.erb b/app/views/refinery/blog/posts/_comments.html.erb index b177389..9bc0a13 100644 --- a/app/views/refinery/blog/posts/_comments.html.erb +++ b/app/views/refinery/blog/posts/_comments.html.erb @@ -34,7 +34,7 @@ <%= f.text_area :message, :rows => 6 %>
- <%= f.submit t('.submit') %> + <%= f.submit t('submit', :scope => 'refinery.blog.posts.show') %>
<% end %> From ba38b63370e3d1dce2f71ecdd6a30b9e9f0ecc15 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:47:24 -0700 Subject: [PATCH 077/248] remove useless comment --- app/controllers/refinery/blog/posts_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index a22d251..3041439 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -3,7 +3,6 @@ module Refinery class PostsController < BlogController caches_page :index - # cache_sweeper Refinery::BlogSweeper, :only => [:comment] before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_blog_post, :only => [:show, :comment, :update_nav] From e35e3994d5e019e7e39cc85d171a970a284c29b5 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:48:35 -0700 Subject: [PATCH 078/248] convert expire_page parameters in blog sweeper from strings to url helpers --- app/sweepers/refinery/blog_sweeper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb index adf97fc..57a98d8 100644 --- a/app/sweepers/refinery/blog_sweeper.rb +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -17,8 +17,8 @@ module Refinery private def expire_cache_for(record) - expire_page '/blog' - expire_page '/blog/feed.rss' + expire_page main_app.blog_root_path + expire_page main_app.blog_rss_feed_path end end From 4d4ae4e682954d7430ab8089ee2671638778cf78 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:57:38 -0700 Subject: [PATCH 079/248] accidentally had refinerycms pointing to my local filesystem... --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 66587c9..97fac91 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against edge refinery -gem 'refinerycms', :path => "~/Code/refinerycms" # :git => 'git://github.com/resolve/refinerycms.git' +gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' gem 'awesome_nested_set', :git => 'git://github.com/collectiveidea/awesome_nested_set.git' group :development, :test do From b9c44d851e806f812c548dc0de43d3002c2d88a5 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 15:10:00 -0700 Subject: [PATCH 080/248] use let instead of let! when we can lazily load these fixtures --- spec/requests/refinery/blog/posts_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb index 4017d03..7c5a90f 100644 --- a/spec/requests/refinery/blog/posts_spec.rb +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -42,7 +42,7 @@ module Refinery describe "#show" do context "when has no comments" do - let!(:blog_post) { FactoryGirl.create(:blog_post) } + let(:blog_post) { FactoryGirl.create(:blog_post) } it "should display the blog post" do visit blog_post_path(blog_post) @@ -53,7 +53,7 @@ module Refinery end context "when has approved comments" do - let!(:approved_comment) { FactoryGirl.create(:approved_comment) } + let(:approved_comment) { FactoryGirl.create(:approved_comment) } it "should display the comments" do visit blog_post_path(approved_comment.post) @@ -64,7 +64,7 @@ module Refinery end context "when has rejected comments" do - let!(:rejected_comment) { FactoryGirl.create(:rejected_comment) } + let(:rejected_comment) { FactoryGirl.create(:rejected_comment) } it "should not display the comments" do visit blog_post_path(rejected_comment.post) @@ -74,7 +74,7 @@ module Refinery end context "when has new comments" do - let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + let(:blog_comment) { FactoryGirl.create(:blog_comment) } it "should not display the comments" do visit blog_post_path(blog_comment.post) From 88556fe7090c60e685d69ad14858594d03cb780a Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 15:54:51 -0700 Subject: [PATCH 081/248] Revert sweeper's expiration parameter to strings for now --- app/sweepers/refinery/blog_sweeper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb index 57a98d8..ceed5fa 100644 --- a/app/sweepers/refinery/blog_sweeper.rb +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -17,8 +17,9 @@ module Refinery private def expire_cache_for(record) - expire_page main_app.blog_root_path - expire_page main_app.blog_rss_feed_path + # TODO: Convert these to url helpers + expire_page '/blog' + expire_page '/blog/feed.rss' end end From 6be013e0c00d8ab965ff9a7933547bfb33eaebc8 Mon Sep 17 00:00:00 2001 From: Michael Gall Date: Mon, 5 Sep 2011 15:54:57 +1000 Subject: [PATCH 082/248] Second commit for ::Refinery::AdminController --- app/controllers/refinery/admin/blog/categories_controller.rb | 2 +- app/controllers/refinery/admin/blog/comments_controller.rb | 2 +- app/controllers/refinery/admin/blog/posts_controller.rb | 2 +- app/controllers/refinery/admin/blog/settings_controller.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/refinery/admin/blog/categories_controller.rb b/app/controllers/refinery/admin/blog/categories_controller.rb index 7196e8f..12f22ce 100644 --- a/app/controllers/refinery/admin/blog/categories_controller.rb +++ b/app/controllers/refinery/admin/blog/categories_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class CategoriesController < ::Admin::BaseController + class CategoriesController < ::Refinery::AdminController crudify :'refinery/blog_category', :title_attribute => :title, diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb index f14e8eb..a3df235 100644 --- a/app/controllers/refinery/admin/blog/comments_controller.rb +++ b/app/controllers/refinery/admin/blog/comments_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class CommentsController < ::Admin::BaseController + class CommentsController < ::Refinery::AdminController cache_sweeper Refinery::BlogSweeper diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index 17ebe87..0fb49ee 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class PostsController < ::Admin::BaseController + class PostsController < ::Refinery::AdminController cache_sweeper Refinery::BlogSweeper diff --git a/app/controllers/refinery/admin/blog/settings_controller.rb b/app/controllers/refinery/admin/blog/settings_controller.rb index 469a1dc..1894ac6 100644 --- a/app/controllers/refinery/admin/blog/settings_controller.rb +++ b/app/controllers/refinery/admin/blog/settings_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class SettingsController < ::Admin::BaseController + class SettingsController < ::Refinery::AdminController def notification_recipients @recipients = Refinery::BlogComment::Notification.recipients From 65cb81b4c0ba29bf95b878c0d669b2dfd5b75fa7 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 14 Sep 2011 16:25:50 -0700 Subject: [PATCH 083/248] Change current_user to current_refinery_user Fixes for https://github.com/resolve/refinerycms/commit/8294a86c13943fcd9bb966341ecfa250ae4aeaf0 --- app/controllers/refinery/admin/blog/posts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index 0fb49ee..62b6949 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -47,7 +47,7 @@ module Refinery if Refinery::BlogPost.column_names.include?("user_id") params[:blog_post].merge!({ - :user_id => current_user.id + :user_id => current_refinery_user.id }) end From 66b445ad5cf7ccb8f0c2523ff0262bf2dc0b58af Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 16 Sep 2011 18:24:34 -0700 Subject: [PATCH 084/248] Remove jquery include - now handled by asset pipeline --- app/views/refinery/blog/posts/show.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb index 3f5cf07..020c964 100644 --- a/app/views/refinery/blog/posts/show.html.erb +++ b/app/views/refinery/blog/posts/show.html.erb @@ -13,7 +13,6 @@ <%= render :partial => "/refinery/content_page", :locals => { :remove_automatic_sections => true } %> <% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> -<% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> <% content_for :javascripts do %> <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> <%#= javascript_include_tag('refinery/blog/frontend') %> From d37ef11f63904b0daa0dcf240dd5a55025423af3 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 15:35:47 -0700 Subject: [PATCH 085/248] Abstract filter methods into controller helpers This will enable users to include the controller helper into their own controllers to perform common functions - such as finding a blog post or listing all blog posts. --- .../refinery/blog/posts_controller.rb | 23 ++------------- app/controllers/refinery/blog_controller.rb | 7 ++--- .../refinery/blog_controller_helper.rb | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 app/helpers/refinery/blog_controller_helper.rb diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 3041439..a885d18 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,6 +1,8 @@ module Refinery module Blog class PostsController < BlogController + + include BlogControllerHelper caches_page :index @@ -71,27 +73,6 @@ module Refinery @tag_name = @tag.name @blog_posts = Refinery::BlogPost.tagged_with(@tag_name).page(params[:page]) end - - protected - - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 - end - end - end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end - - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - end end end diff --git a/app/controllers/refinery/blog_controller.rb b/app/controllers/refinery/blog_controller.rb index cbafdeb..b875b44 100644 --- a/app/controllers/refinery/blog_controller.rb +++ b/app/controllers/refinery/blog_controller.rb @@ -1,5 +1,7 @@ module Refinery class BlogController < ::ApplicationController + + include BlogControllerHelper helper :'refinery/blog_posts' before_filter :find_page, :find_all_blog_categories @@ -9,10 +11,5 @@ module Refinery def find_page @page = Refinery::Page.find_by_link_url("/blog") end - - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end - end end diff --git a/app/helpers/refinery/blog_controller_helper.rb b/app/helpers/refinery/blog_controller_helper.rb new file mode 100644 index 0000000..2edc2f6 --- /dev/null +++ b/app/helpers/refinery/blog_controller_helper.rb @@ -0,0 +1,28 @@ +module Refinery + module BlogControllerHelper + + protected + + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 + end + end + end + + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end + + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end + end +end From c40eb83af3c85e15314fab75cf66e2ffe3ab2ed7 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:35:58 -0700 Subject: [PATCH 086/248] remove duplicate BlogControllerHelper include --- app/controllers/refinery/blog/posts_controller.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index a885d18..ad576a5 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,8 +1,6 @@ module Refinery module Blog class PostsController < BlogController - - include BlogControllerHelper caches_page :index From de4cc6b9efdba3e1eeb398f01a46331b80895314 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:43:09 -0700 Subject: [PATCH 087/248] Namespace BlogControllerHelper to Blog::ControllerHelper --- app/controllers/refinery/blog_controller.rb | 2 +- .../refinery/blog/controller_helper.rb | 30 +++++++++++++++++++ .../refinery/blog_controller_helper.rb | 28 ----------------- 3 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 app/helpers/refinery/blog/controller_helper.rb delete mode 100644 app/helpers/refinery/blog_controller_helper.rb diff --git a/app/controllers/refinery/blog_controller.rb b/app/controllers/refinery/blog_controller.rb index b875b44..314c919 100644 --- a/app/controllers/refinery/blog_controller.rb +++ b/app/controllers/refinery/blog_controller.rb @@ -1,7 +1,7 @@ module Refinery class BlogController < ::ApplicationController - include BlogControllerHelper + include Blog::ControllerHelper helper :'refinery/blog_posts' before_filter :find_page, :find_all_blog_categories diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb new file mode 100644 index 0000000..74a189b --- /dev/null +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -0,0 +1,30 @@ +module Refinery + module Blog + module ControllerHelper + + protected + + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 + end + end + end + + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end + + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end + end + end +end diff --git a/app/helpers/refinery/blog_controller_helper.rb b/app/helpers/refinery/blog_controller_helper.rb deleted file mode 100644 index 2edc2f6..0000000 --- a/app/helpers/refinery/blog_controller_helper.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Refinery - module BlogControllerHelper - - protected - - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 - end - end - end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end - - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end - end -end From be7d341532c0e5fc92d2822eea924956ab704d54 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:48:29 -0700 Subject: [PATCH 088/248] Namespace BlogController into Blog::BaseController --- .../refinery/blog/base_controller.rb | 17 +++++++++++++++++ .../refinery/blog/categories_controller.rb | 2 +- .../refinery/blog/posts_controller.rb | 2 +- app/controllers/refinery/blog_controller.rb | 15 --------------- 4 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 app/controllers/refinery/blog/base_controller.rb delete mode 100644 app/controllers/refinery/blog_controller.rb diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/base_controller.rb new file mode 100644 index 0000000..7010283 --- /dev/null +++ b/app/controllers/refinery/blog/base_controller.rb @@ -0,0 +1,17 @@ +module Refinery + module Blog + class BaseController < ::ApplicationController + + include ControllerHelper + + helper :'refinery/blog_posts' + before_filter :find_page, :find_all_blog_categories + + protected + + def find_page + @page = Refinery::Page.find_by_link_url("/blog") + end + end + end +end diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index 57196c3..80e54d9 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -1,6 +1,6 @@ module Refinery module Blog - class CategoriesController < BlogController + class CategoriesController < BaseController def show @category = Refinery::BlogCategory.find(params[:id]) diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index ad576a5..7b09329 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,6 +1,6 @@ module Refinery module Blog - class PostsController < BlogController + class PostsController < BaseController caches_page :index diff --git a/app/controllers/refinery/blog_controller.rb b/app/controllers/refinery/blog_controller.rb deleted file mode 100644 index 314c919..0000000 --- a/app/controllers/refinery/blog_controller.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Refinery - class BlogController < ::ApplicationController - - include Blog::ControllerHelper - - helper :'refinery/blog_posts' - before_filter :find_page, :find_all_blog_categories - - protected - - def find_page - @page = Refinery::Page.find_by_link_url("/blog") - end - end -end From 362088d0272d6d61824b0539e201356cf9219dc0 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:50:38 -0700 Subject: [PATCH 089/248] Fix indent on protected methods --- .../refinery/blog/controller_helper.rb | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 74a189b..2b2add4 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -4,27 +4,27 @@ module Refinery protected - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 - end + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 end end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end + end + + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end end end end From 1b51e2343d477d2065c016d77ef73d527cb37b0e Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:57:17 -0700 Subject: [PATCH 090/248] setting indentation to 'rails way' for protected and private classes --- .../refinery/blog/base_controller.rb | 6 ++-- .../refinery/blog/controller_helper.rb | 36 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/base_controller.rb index 7010283..01892d1 100644 --- a/app/controllers/refinery/blog/base_controller.rb +++ b/app/controllers/refinery/blog/base_controller.rb @@ -9,9 +9,9 @@ module Refinery protected - def find_page - @page = Refinery::Page.find_by_link_url("/blog") - end + def find_page + @page = Refinery::Page.find_by_link_url("/blog") + end end end end diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 2b2add4..74a189b 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -4,27 +4,27 @@ module Refinery protected - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 + end end end - end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end - - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end + + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end end end end From df0664b1420f03d8cdd3f7b6960a0e542a7eb374 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 19:11:40 -0700 Subject: [PATCH 091/248] Update gemspec [ci skip] --- refinerycms-blog.gemspec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 46a86d3..50b431b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-09-04} + s.date = %q{2011-09-19} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -82,11 +82,13 @@ Gem::Specification.new do |s| app/controllers/refinery/admin/blog/posts_controller.rb app/controllers/refinery/admin/blog/settings_controller.rb app/controllers/refinery/blog + app/controllers/refinery/blog/base_controller.rb app/controllers/refinery/blog/categories_controller.rb app/controllers/refinery/blog/posts_controller.rb - app/controllers/refinery/blog_controller.rb app/helpers app/helpers/refinery + app/helpers/refinery/blog + app/helpers/refinery/blog/controller_helper.rb app/helpers/refinery/blog_posts_helper.rb app/mailers app/mailers/refinery From 5e91670a80f3f4ed50f54d3d8fdf2709d981e9c8 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 21 Sep 2011 00:56:54 -0700 Subject: [PATCH 092/248] Fix draft preview of blog posts --- .../refinery/blog/controller_helper.rb | 2 +- app/views/refinery/blog/posts/_post.html.erb | 2 +- spec/factories/blog_posts.rb | 4 ++++ spec/requests/refinery/blog/posts_spec.rb | 22 +++++++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 74a189b..c1c2a6a 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -6,7 +6,7 @@ module Refinery def find_blog_post unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog") @blog_post = Refinery::BlogPost.find(params[:id]) else error_404 diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb index 08587aa..f86f63a 100644 --- a/app/views/refinery/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -27,5 +27,5 @@ <% end %> -<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> +<%= render :partial => '/refinery/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> <%= render 'nav' if next_or_previous?(@blog_post) %> diff --git a/spec/factories/blog_posts.rb b/spec/factories/blog_posts.rb index 0b8b888..b839d02 100644 --- a/spec/factories/blog_posts.rb +++ b/spec/factories/blog_posts.rb @@ -5,5 +5,9 @@ FactoryGirl.define do draft false tag_list "chicago, shopping, fun times" published_at Time.now + + factory :blog_post_draft do + draft true + end end end diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb index 7c5a90f..025586c 100644 --- a/spec/requests/refinery/blog/posts_spec.rb +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -83,5 +83,27 @@ module Refinery end end end + + describe "#show draft preview" do + let(:blog_post) { FactoryGirl.create(:blog_post_draft) } + + context "when logged in as admin" do + it "should display the draft notification" do + visit blog_post_path(blog_post) + + page.should have_content('This page is NOT live for public viewing.') + end + end + + context "when not logged in as an admin" do + before(:each) { visit destroy_refinery_user_session_path } + + it "should not display the blog post" do + visit blog_post_path(blog_post) + + page.should have_content("The page you were looking for doesn't exist (404)") + end + end + end end end From 19ee4b8f69962bf2c861e964d7ee52a67d361097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E6=9C=88=20=E9=9B=B6?= Date: Tue, 11 Oct 2011 02:43:58 +0900 Subject: [PATCH 093/248] jp to ja correction --- config/locales/{jp.yml => ja.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename config/locales/{jp.yml => ja.yml} (99%) diff --git a/config/locales/jp.yml b/config/locales/ja.yml similarity index 99% rename from config/locales/jp.yml rename to config/locales/ja.yml index f576611..65508ce 100644 --- a/config/locales/jp.yml +++ b/config/locales/ja.yml @@ -1,4 +1,4 @@ -jp: +ja: refinery: plugins: refinerycms_blog: From 754cddb141715eb152049451fff3e1dff1ac146a Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 10 Oct 2011 19:39:51 -0700 Subject: [PATCH 094/248] Load refinerycms factories properly Expose blog factories to other gems --- lib/refinerycms-blog.rb | 4 ++++ spec/spec_helper.rb | 36 ++++++++++++------------------------ spec/support/refinery.rb | 2 ++ 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index fafedf5..135b3e1 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -19,6 +19,10 @@ module Refinery def version ::Refinery::Blog::Version.to_s end + + def factory_paths + @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] + end end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b8df592..ea550e2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,17 @@ require 'rubygems' -def setup_environment - # Loading more in this block will cause your tests to run faster. However, - # if you change any configuration or code from libraries loaded here, you'll - # need to restart spork for it take effect. - +def load_all(*patterns) + patterns.each { |pattern| Dir[pattern].sort.each { |path| load File.expand_path(path) } } +end + +def setup_environment # Configure Rails Environment ENV["RAILS_ENV"] = 'test' require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' require 'capybara/rspec' + require 'factory_girl_rails' Rails.backtrace_cleaner.remove_silencers! @@ -20,30 +21,17 @@ def setup_environment end def each_run - require 'factory_girl_rails' - require 'refinerycms-testing' + FactoryGirl.reload + ActiveSupport::Dependencies.clear - Dir[File.expand_path("../../app/models/**/*.rb", __FILE__)].each do |model| - load model - end - - Dir[ - File.expand_path("../support/**/*.rb", __FILE__), - File.expand_path("../factories/**/*.rb", __FILE__) - ].each {|f| require f} + load_all 'spec/support/**/*.rb' + load_all 'spec/factories/**/*.rb' end # If spork is available in the Gemfile it'll be used but we don't force it. unless (begin; require 'spork'; rescue LoadError; nil end).nil? - Spork.prefork do - setup_environment - - ActiveSupport::Dependencies.clear - end - - Spork.each_run do - each_run - end + Spork.prefork { setup_environment } + Spork.each_run { each_run } else setup_environment each_run diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb index d761787..575ac2b 100644 --- a/spec/support/refinery.rb +++ b/spec/support/refinery.rb @@ -1,5 +1,7 @@ require 'refinerycms-testing' +Refinery::Testing.load_factories + RSpec.configure do |config| config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller config.extend Refinery::Testing::RequestMacros::Authentication, :type => :request From 64d83c5ce459f4a0b074a8ebe573b3e03aab79b1 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Tue, 11 Oct 2011 18:21:49 -0700 Subject: [PATCH 095/248] Regenerate gemspec --- refinerycms-blog.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 50b431b..817f6b5 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-09-19} + s.date = %q{2011-10-11} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -171,7 +171,7 @@ Gem::Specification.new do |s| config/locales/es.yml config/locales/fr.yml config/locales/it.yml - config/locales/jp.yml + config/locales/ja.yml config/locales/nb.yml config/locales/nl.yml config/locales/pl.yml From 4ab9eccdee10b1f0612822d92d23a925b9c84535 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:07:00 -0700 Subject: [PATCH 096/248] Add rbenv files to gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 2c06a4c..271bed4 100644 --- a/.gitignore +++ b/.gitignore @@ -43,5 +43,10 @@ nbproject # Capybara Bug capybara-*html +# rvm .rvmrc + +#rbenv +.rbenv-version + Gemfile.lock From 1b3195bf30ac0b6803525e1a4629cb2a5e60ce8b Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:11:54 -0700 Subject: [PATCH 097/248] Remove dummy application for testing --- spec/dummy/.gitignore | 167 ------------ spec/dummy/Rakefile | 13 - spec/dummy/app/assets/images/.gitkeep | 0 spec/dummy/app/assets/javascripts/admin.js | 7 - .../app/assets/javascripts/application.js | 9 - .../app/assets/stylesheets/application.css | 1 - .../assets/stylesheets/application.css.backup | 1 - .../app/assets/stylesheets/formatting.css | 4 - spec/dummy/app/assets/stylesheets/home.css | 4 - spec/dummy/app/assets/stylesheets/theme.css | 4 - .../app/controllers/application_controller.rb | 3 - spec/dummy/app/helpers/application_helper.rb | 2 - spec/dummy/app/mailers/.gitkeep | 0 spec/dummy/app/models/.gitkeep | 0 .../views/layouts/application.html.erb.backup | 14 - .../dummy/app/views/sitemap/index.xml.builder | 25 -- spec/dummy/config.ru | 4 - spec/dummy/config/application.rb | 48 ---- spec/dummy/config/boot.rb | 10 - spec/dummy/config/database.yml | 26 -- spec/dummy/config/database.yml.mysql | 20 -- spec/dummy/config/database.yml.postgresql | 55 ---- spec/dummy/config/database.yml.sqlite3 | 26 -- spec/dummy/config/environment.rb | 5 - spec/dummy/config/environments/development.rb | 31 --- spec/dummy/config/environments/production.rb | 55 ---- spec/dummy/config/environments/test.rb | 43 ---- .../initializers/backtrace_silencers.rb | 7 - spec/dummy/config/initializers/devise.rb | 144 ----------- spec/dummy/config/initializers/inflections.rb | 10 - spec/dummy/config/initializers/mime_types.rb | 5 - .../dummy/config/initializers/secret_token.rb | 7 - .../config/initializers/session_store.rb | 8 - .../config/initializers/wrap_parameters.rb | 12 - spec/dummy/config/locales/en.yml | 5 - spec/dummy/config/routes.rb | 58 ----- spec/dummy/db/migrate/.gitkeep | 0 ...reate_refinerycms_authentication_schema.rb | 48 ---- ...13234706_create_refinerycms_core_schema.rb | 25 -- ...234707_create_refinerycms_images_schema.rb | 23 -- ...3234708_create_refinerycms_pages_schema.rb | 56 ---- ...709_create_refinerycms_resources_schema.rb | 21 -- ...4710_create_refinerycms_settings_schema.rb | 26 -- ...529_add_value_type_to_refinery_settings.rb | 13 - ...5252_add_missing_indexes_to_roles_users.rb | 11 - ...1206013505_change_to_devise_users_table.rb | 31 --- ...216194133_remove_cached_slug_from_pages.rb | 17 -- .../20101217113424_add_locale_to_slugs.rb | 15 -- .../20101217113425_translate_page_plugin.rb | 40 --- ...184757_add_remember_created_at_to_users.rb | 7 - ...move_duplicate_user_image_sizes_setting.rb | 22 -- ...7025652_translate_custom_title_on_pages.rb | 41 --- ...540_remove_translated_fields_from_pages.rb | 17 -- ...5213325_remove_password_salt_from_users.rb | 17 -- .../migrate/20110329222114_create_seo_meta.rb | 86 ------- ...10714071142_create_add_template_columns.rb | 11 - ...stom_slug_to_refinery_page_translations.rb | 11 - ...m_title_to_menu_title_in_refinery_pages.rb | 15 -- spec/dummy/db/schema.rb | 240 ------------------ spec/dummy/db/seeds/pages.rb | 55 ---- spec/dummy/lib/assets/.gitkeep | 0 spec/dummy/log/.gitkeep | 0 spec/dummy/public/404.html | 26 -- spec/dummy/public/422.html | 26 -- spec/dummy/public/500.html | 26 -- spec/dummy/public/favicon.ico | 0 spec/dummy/script/rails | 6 - spec/dummy/version.rb | 5 - 68 files changed, 1770 deletions(-) delete mode 100644 spec/dummy/.gitignore delete mode 100644 spec/dummy/Rakefile delete mode 100644 spec/dummy/app/assets/images/.gitkeep delete mode 100644 spec/dummy/app/assets/javascripts/admin.js delete mode 100644 spec/dummy/app/assets/javascripts/application.js delete mode 100644 spec/dummy/app/assets/stylesheets/application.css delete mode 100644 spec/dummy/app/assets/stylesheets/application.css.backup delete mode 100644 spec/dummy/app/assets/stylesheets/formatting.css delete mode 100644 spec/dummy/app/assets/stylesheets/home.css delete mode 100644 spec/dummy/app/assets/stylesheets/theme.css delete mode 100644 spec/dummy/app/controllers/application_controller.rb delete mode 100644 spec/dummy/app/helpers/application_helper.rb delete mode 100644 spec/dummy/app/mailers/.gitkeep delete mode 100644 spec/dummy/app/models/.gitkeep delete mode 100644 spec/dummy/app/views/layouts/application.html.erb.backup delete mode 100644 spec/dummy/app/views/sitemap/index.xml.builder delete mode 100644 spec/dummy/config.ru delete mode 100644 spec/dummy/config/application.rb delete mode 100644 spec/dummy/config/boot.rb delete mode 100644 spec/dummy/config/database.yml delete mode 100644 spec/dummy/config/database.yml.mysql delete mode 100644 spec/dummy/config/database.yml.postgresql delete mode 100644 spec/dummy/config/database.yml.sqlite3 delete mode 100644 spec/dummy/config/environment.rb delete mode 100644 spec/dummy/config/environments/development.rb delete mode 100644 spec/dummy/config/environments/production.rb delete mode 100644 spec/dummy/config/environments/test.rb delete mode 100644 spec/dummy/config/initializers/backtrace_silencers.rb delete mode 100644 spec/dummy/config/initializers/devise.rb delete mode 100644 spec/dummy/config/initializers/inflections.rb delete mode 100644 spec/dummy/config/initializers/mime_types.rb delete mode 100644 spec/dummy/config/initializers/secret_token.rb delete mode 100644 spec/dummy/config/initializers/session_store.rb delete mode 100644 spec/dummy/config/initializers/wrap_parameters.rb delete mode 100644 spec/dummy/config/locales/en.yml delete mode 100644 spec/dummy/config/routes.rb delete mode 100644 spec/dummy/db/migrate/.gitkeep delete mode 100644 spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb delete mode 100644 spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb delete mode 100644 spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb delete mode 100644 spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb delete mode 100644 spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb delete mode 100644 spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb delete mode 100644 spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb delete mode 100644 spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb delete mode 100644 spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb delete mode 100644 spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb delete mode 100644 spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb delete mode 100644 spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb delete mode 100644 spec/dummy/db/migrate/20110329222114_create_seo_meta.rb delete mode 100644 spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb delete mode 100644 spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb delete mode 100644 spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb delete mode 100644 spec/dummy/db/schema.rb delete mode 100644 spec/dummy/db/seeds/pages.rb delete mode 100644 spec/dummy/lib/assets/.gitkeep delete mode 100644 spec/dummy/log/.gitkeep delete mode 100644 spec/dummy/public/404.html delete mode 100644 spec/dummy/public/422.html delete mode 100644 spec/dummy/public/500.html delete mode 100644 spec/dummy/public/favicon.ico delete mode 100755 spec/dummy/script/rails delete mode 100644 spec/dummy/version.rb diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore deleted file mode 100644 index c698a36..0000000 --- a/spec/dummy/.gitignore +++ /dev/null @@ -1,167 +0,0 @@ -.bundle -db/*.sqlite3 -log/*.log -tmp/ -# Rails -.bundle -db/*.sqlite3 -db/*.sqlite3-journal -*.log -tmp -tmp/**/* -config/memcached.yml -config/vagrant.yml -config/mogilefs.yml -config/resque.yml -config/app_config.yml -config/database.yml -config/unicorn.rb -bin/* - -# Documentation -doc/api -doc/app -.yardoc -.yardopts - -# Public Uploads -public/system/* -public/themes/* - -# Public Cache -public/javascripts/cache -public/stylesheets/cache -public/*.html -public/refinery/cache - -# Vendor Cache -vendor/cache - -# Acts as Indexed -index/**/* - -# Refinery Specific -*.tmproj -*.autobackupbyrefinery.* -refinerycms-*.gem -.autotest - -# Mac -.DS_Store - -# Windows -Thumbs.db - -# NetBeans -nbproject - -# Eclipse -.project - -# Redcar -.redcar - -# Rubinius -*.rbc - -# Vim -*.swp -*.swo - -# RubyMine -.idea - -# E-texteditor -.eprj - -# Backup -*~ - -# Capybara Bug -capybara-*html - -# sass -.sass-cache -.sass-cache/* - -# vagrant -.vagrant - -# chef -.chef -# Rails -.bundle -db/*.sqlite3 -db/*.sqlite3-journal -*.log -tmp -tmp/**/* - -# Documentation -doc/api -doc/app -.yardoc -.yardopts -coverage - -# Public Uploads -public/system/* -public/themes/* - -# Public Cache -public/javascripts/cache -public/stylesheets/cache - -# Vendor Cache -vendor/cache - -# Acts as Indexed -index/**/* - -# Refinery Specific -*.tmproj -*.autobackupbyrefinery.* -refinerycms-*.gem -.autotest - -# Mac -.DS_Store - -# Windows -Thumbs.db - -# NetBeans -nbproject - -# Eclipse -.project - -# Redcar -.redcar - -# Rubinius -*.rbc - -# Vim -*.swp -*.swo - -# RubyMine -.idea - -# E-texteditor -.eprj - -# Backup -*~ - -# Capybara Bug -capybara-*html - -# sass -.sass-cache -.sass-cache/* - -#rvm -.rvmrc -.rvmrc.* diff --git a/spec/dummy/Rakefile b/spec/dummy/Rakefile deleted file mode 100644 index 852eb68..0000000 --- a/spec/dummy/Rakefile +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -unless File.exist?(db_yml = File.expand_path('../config/database.yml', __FILE__)) - require 'fileutils' - FileUtils.cp "#{db_yml}.sqlite3", db_yml - puts "Copied #{db_yml}.sqlite3 to #{db_yml}" -end - -require File.expand_path('../config/application', __FILE__) - -Dummy::Application.load_tasks diff --git a/spec/dummy/app/assets/images/.gitkeep b/spec/dummy/app/assets/images/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/assets/javascripts/admin.js b/spec/dummy/app/assets/javascripts/admin.js deleted file mode 100644 index 23c4fb9..0000000 --- a/spec/dummy/app/assets/javascripts/admin.js +++ /dev/null @@ -1,7 +0,0 @@ -// Use this to customize the wymeditor boot process -// Just mirror the options specified in boot_wym.js with the new options here. -// This will completely override anything specified in boot_wym.js for that key. -// e.g. skin: 'something_else' -var custom_wymeditor_boot_options = { - -}; \ No newline at end of file diff --git a/spec/dummy/app/assets/javascripts/application.js b/spec/dummy/app/assets/javascripts/application.js deleted file mode 100644 index 37c7bfc..0000000 --- a/spec/dummy/app/assets/javascripts/application.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require_tree . diff --git a/spec/dummy/app/assets/stylesheets/application.css b/spec/dummy/app/assets/stylesheets/application.css deleted file mode 100644 index 8b13789..0000000 --- a/spec/dummy/app/assets/stylesheets/application.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spec/dummy/app/assets/stylesheets/application.css.backup b/spec/dummy/app/assets/stylesheets/application.css.backup deleted file mode 100644 index 8b13789..0000000 --- a/spec/dummy/app/assets/stylesheets/application.css.backup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spec/dummy/app/assets/stylesheets/formatting.css b/spec/dummy/app/assets/stylesheets/formatting.css deleted file mode 100644 index 1132188..0000000 --- a/spec/dummy/app/assets/stylesheets/formatting.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery formatting below. - Formatting applies to backend WYSIWYG editors and all frontend. -*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/home.css b/spec/dummy/app/assets/stylesheets/home.css deleted file mode 100644 index 824db99..0000000 --- a/spec/dummy/app/assets/stylesheets/home.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery homepage styles here. - These only apply to the homepage of your site. -*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/theme.css b/spec/dummy/app/assets/stylesheets/theme.css deleted file mode 100644 index 8205050..0000000 --- a/spec/dummy/app/assets/stylesheets/theme.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery 'theme' styles here. - These only apply when using custom WYMeditor CSS. -*/ \ No newline at end of file diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb deleted file mode 100644 index e8065d9..0000000 --- a/spec/dummy/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/spec/dummy/app/helpers/application_helper.rb b/spec/dummy/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/spec/dummy/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/spec/dummy/app/mailers/.gitkeep b/spec/dummy/app/mailers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/models/.gitkeep b/spec/dummy/app/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/views/layouts/application.html.erb.backup b/spec/dummy/app/views/layouts/application.html.erb.backup deleted file mode 100644 index 9a8a761..0000000 --- a/spec/dummy/app/views/layouts/application.html.erb.backup +++ /dev/null @@ -1,14 +0,0 @@ - - - - Dummy - <%= stylesheet_link_tag "application" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/spec/dummy/app/views/sitemap/index.xml.builder b/spec/dummy/app/views/sitemap/index.xml.builder deleted file mode 100644 index 8e89852..0000000 --- a/spec/dummy/app/views/sitemap/index.xml.builder +++ /dev/null @@ -1,25 +0,0 @@ -xml.instruct! - -xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do - - @locales.each do |locale| - ::I18n.locale = locale - ::Refinery::Page.live.in_menu.includes(:parts).each do |page| - # exclude sites that are external to our own domain. - page_url = if page.url.is_a?(Hash) - # This is how most pages work without being overriden by link_url - page.url.merge({:only_path => false}) - elsif page.url.to_s !~ /^http/ - # handle relative link_url addresses. - [request.protocol, request.host_with_port, page.url].join - end - - # Add XML entry only if there is a valid page_url found above. - xml.url do - xml.loc url_for(page_url) - xml.lastmod page.updated_at.to_date - end if page_url.present? and page.show_in_menu? - end - end - -end diff --git a/spec/dummy/config.ru b/spec/dummy/config.ru deleted file mode 100644 index 1989ed8..0000000 --- a/spec/dummy/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Dummy::Application diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb deleted file mode 100644 index e67cf82..0000000 --- a/spec/dummy/config/application.rb +++ /dev/null @@ -1,48 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -require 'bundler/setup' - -# If you have a Gemfile, require the default gems, the ones in the -# current environment and also include :assets gems if in development -# or test environments. -Bundler.require *Rails.groups(:assets) if defined?(Bundler) - -require 'refinerycms-blog' - -module Dummy - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable the asset pipeline - config.assets.enabled = true - end -end - diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb deleted file mode 100644 index eba0681..0000000 --- a/spec/dummy/config/boot.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'rubygems' -gemfile = File.expand_path('../../../../Gemfile', __FILE__) - -if File.exist?(gemfile) - ENV['BUNDLE_GEMFILE'] = gemfile - require 'bundler' - Bundler.setup -end - -$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml deleted file mode 100644 index c2da158..0000000 --- a/spec/dummy/config/database.yml +++ /dev/null @@ -1,26 +0,0 @@ -# SQLite version 3.x -development: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/development.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'test' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -test: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/test.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'cucumber' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -cucumber: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/cucumber.sqlite3 - timeout: 5000 - -production: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/production.sqlite3 - timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/database.yml.mysql b/spec/dummy/config/database.yml.mysql deleted file mode 100644 index 75cca95..0000000 --- a/spec/dummy/config/database.yml.mysql +++ /dev/null @@ -1,20 +0,0 @@ -development: &development - adapter: mysql2 - host: localhost - username: root - password: - database: your_local_database - -test: &test - adapter: mysql2 - host: localhost - username: root - password: - database: your_test_database - -production: &production - adapter: mysql2 - host: localhost - database: your_production_database - username: your_production_database_login - password: your_production_database_password diff --git a/spec/dummy/config/database.yml.postgresql b/spec/dummy/config/database.yml.postgresql deleted file mode 100644 index 2146d1f..0000000 --- a/spec/dummy/config/database.yml.postgresql +++ /dev/null @@ -1,55 +0,0 @@ -# PostgreSQL. Versions 7.4 and 8.x are supported. -# -# Install the pg driver: -# gem install pg -# On Mac OS X with macports: -# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config -# On Windows: -# gem install pg -# Choose the win32 build. -# Install PostgreSQL and put its /bin directory on your path. -# -# Configure Using Gemfile -# gem 'pg' -# -development: - adapter: postgresql - encoding: unicode - database: refinery_database_development - pool: 5 - username: postgres - password: postgres - - # Connect on a TCP socket. Omitted by default since the client uses a - # domain socket that doesn't need configuration. Windows does not have - # domain sockets, so uncomment these lines. - #host: localhost - #port: 5432 - - # Schema search path. The server defaults to $user,public - #schema_search_path: myapp,sharedapp,public - - # Minimum log levels, in increasing order: - # debug5, debug4, debug3, debug2, debug1, - # log, notice, warning, error, fatal, and panic - # The server defaults to notice. - #min_messages: warning - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: postgresql - encoding: unicode - database: refinery_database_test - pool: 5 - username: postgres - password: postgres - -production: - adapter: postgresql - encoding: unicode - database: refinery_database_production - pool: 5 - username: postgres - password: postgres diff --git a/spec/dummy/config/database.yml.sqlite3 b/spec/dummy/config/database.yml.sqlite3 deleted file mode 100644 index c2da158..0000000 --- a/spec/dummy/config/database.yml.sqlite3 +++ /dev/null @@ -1,26 +0,0 @@ -# SQLite version 3.x -development: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/development.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'test' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -test: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/test.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'cucumber' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -cucumber: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/cucumber.sqlite3 - timeout: 5000 - -production: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/production.sqlite3 - timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb deleted file mode 100644 index 3da5eb9..0000000 --- a/spec/dummy/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -Dummy::Application.initialize! diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb deleted file mode 100644 index 8604338..0000000 --- a/spec/dummy/config/environments/development.rb +++ /dev/null @@ -1,31 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Do not compress assets - config.assets.compress = false -end -Refinery.rescue_not_found = false -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb deleted file mode 100644 index 17a630b..0000000 --- a/spec/dummy/config/environments/production.rb +++ /dev/null @@ -1,55 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = true # Refinery CMS requires this to be true - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Specifies the header that your server uses for sending files - # (comment out if your front-end server doesn't support this) - config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify -end -Refinery.rescue_not_found = true -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb deleted file mode 100644 index 9e84bae..0000000 --- a/spec/dummy/config/environments/test.rb +++ /dev/null @@ -1,43 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = false - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end -Refinery.rescue_not_found = false -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/initializers/backtrace_silencers.rb b/spec/dummy/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cd..0000000 --- a/spec/dummy/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/dummy/config/initializers/devise.rb b/spec/dummy/config/initializers/devise.rb deleted file mode 100644 index 0d00106..0000000 --- a/spec/dummy/config/initializers/devise.rb +++ /dev/null @@ -1,144 +0,0 @@ -require 'devise' - -# Use this hook to configure devise mailer, warden hooks and so forth. The first -# four configuration values can also be set straight in your models. -::Devise.setup do |config| - # ==> Mailer Configuration - # Configure the e-mail address which will be shown in DeviseMailer. - # config.mailer_sender = "please-change-me@config-initializers-devise.com" - - # Configure the class responsible to send e-mails. - # config.mailer = "::Devise::Mailer" - - # ==> ORM configuration - # Load and configure the ORM. Supports :active_record (default) and - # :mongoid (bson_ext recommended) by default. Other ORMs may be - # available as additional gems. - require 'devise/orm/active_record' - - # ==> Configuration for any authentication mechanism - # Configure which keys are used when authenticating an user. By default is - # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating an user, both parameters are required. Remember that those - # parameters are used only when authenticating and not when retrieving from - # session. If you need permissions, you should implement that in a before filter. - config.authentication_keys = [ :login ] - - # Tell if authentication through request.params is enabled. True by default. - # config.params_authenticatable = true - - # Tell if authentication through HTTP Basic Auth is enabled. False by default. - # config.http_authenticatable = false - - # Set this to true to use Basic Auth for AJAX requests. True by default. - # config.http_authenticatable_on_xhr = true - - # The realm used in Http Basic Authentication - # config.http_authentication_realm = "Application" - - # ==> Configuration for :database_authenticatable - # For bcrypt, this is the cost for hashing the password and defaults to 10. If - # using other encryptors, it sets how many times you want the password re-encrypted. - # config.stretches = 20 - - # Define which will be the encryption algorithm. Devise also supports encryptors - # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then - # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1 - # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) - # config.encryptor = :bcrypt - - # Setup a pepper to generate the encrypted password. - # config.pepper = "2e20a8abdd34d729ba6d05f679e513cfea9fbb1e83c81f84b29e9e4fdbd4ee59b56a32200064082a15a72b05a4d4a6a2c3784a09c0554b3a47a67cc8333ccbc7" - - # ==> Configuration for :confirmable - # The time you want to give your user to confirm his account. During this time - # he will be able to access your application without confirming. Default is nil. - # When confirm_within is zero, the user won't be able to sign in without confirming. - # You can use this to let your user access some features of your application - # without confirming the account, but blocking it after a certain period - # (ie 2 days). - # config.confirm_within = 2.days - - # ==> Configuration for :rememberable - # The time the user will be remembered without asking for credentials again. - # config.remember_for = 2.weeks - - # If true, a valid remember token can be re-used between multiple browsers. - # config.remember_across_browsers = true - - # If true, extends the user's remember period when remembered via cookie. - # config.extend_remember_period = false - - # ==> Configuration for :validatable - # Range for password length - config.password_length = 4..20 - - # Regex to use to validate the email address - # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i - - # ==> Configuration for :timeoutable - # The time you want to timeout the user session without activity. After this - # time the user will be asked for credentials again. - # config.timeout_in = 10.minutes - - # ==> Configuration for :lockable - # Defines which strategy will be used to lock an account. - # :failed_attempts = Locks an account after a number of failed attempts to sign in. - # :none = No lock strategy. You should handle locking by yourself. - # config.lock_strategy = :failed_attempts - - # Defines which strategy will be used to unlock an account. - # :email = Sends an unlock link to the user email - # :time = Re-enables login after a certain amount of time (see :unlock_in below) - # :both = Enables both strategies - # :none = No unlock strategy. You should handle unlocking by yourself. - # config.unlock_strategy = :both - - # Number of authentication tries before locking an account if lock_strategy - # is failed attempts. - # config.maximum_attempts = 20 - - # Time interval to unlock the account if :time is enabled as unlock_strategy. - # config.unlock_in = 1.hour - - # ==> Configuration for :token_authenticatable - # Defines name of the authentication token params key - # config.token_authentication_key = :auth_token - - # ==> Scopes configuration - # Turn scoped views on. Before rendering "sessions/new", it will first check for - # "users/sessions/new". It's turned off by default because it's slower if you - # are using only default views. - # config.scoped_views = true - - # Configure the default scope given to Warden. By default it's the first - # devise role declared in your routes. - # config.default_scope = :user - - # Configure sign_out behavior. - # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope). - # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes. - # config.sign_out_all_scopes = false - - # ==> Navigation configuration - # Lists the formats that should be treated as navigational. Formats like - # :html, should redirect to the sign in page when the user does not have - # access, but formats like :xml or :json, should return 401. - # If you have any extra navigational formats, like :iphone or :mobile, you - # should add them to the navigational formats lists. Default is [:html] - # config.navigational_formats = [:html, :iphone] - - # ==> Warden configuration - # If you want to use other strategies, that are not (yet) supported by Devise, - # you can configure them inside the config.warden block. The example below - # allows you to setup OAuth, using http://github.com/roman/warden_oauth - # - # config.warden do |manager| - # manager.oauth(:twitter) do |twitter| - # twitter.consumer_secret = - # twitter.consumer_key = - # twitter.options :site => 'http://twitter.com' - # end - # manager.default_strategies(:scope => :user).unshift :twitter_oauth - # end -end diff --git a/spec/dummy/config/initializers/inflections.rb b/spec/dummy/config/initializers/inflections.rb deleted file mode 100644 index 9e8b013..0000000 --- a/spec/dummy/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/spec/dummy/config/initializers/mime_types.rb b/spec/dummy/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/spec/dummy/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/spec/dummy/config/initializers/secret_token.rb b/spec/dummy/config/initializers/secret_token.rb deleted file mode 100644 index 7a99397..0000000 --- a/spec/dummy/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -Dummy::Application.config.secret_token = '75470fb2f9c361e0509af41d5835fdb3fee2e588a44c68596c6201976f994e0689c434b6e8360dbc45c0d424c1811a5cf1e3f4f0550be9b784fed60fb4e5d29d' diff --git a/spec/dummy/config/initializers/session_store.rb b/spec/dummy/config/initializers/session_store.rb deleted file mode 100644 index aa2f512..0000000 --- a/spec/dummy/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# Dummy::Application.config.session_store :active_record_store diff --git a/spec/dummy/config/initializers/wrap_parameters.rb b/spec/dummy/config/initializers/wrap_parameters.rb deleted file mode 100644 index 71b88b0..0000000 --- a/spec/dummy/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActionController::Base.wrap_parameters :format => [:json] - -# Disable root element in JSON by default. -if defined?(ActiveRecord) - ActiveRecord::Base.include_root_in_json = false -end diff --git a/spec/dummy/config/locales/en.yml b/spec/dummy/config/locales/en.yml deleted file mode 100644 index 179c14c..0000000 --- a/spec/dummy/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb deleted file mode 100644 index bb509f2..0000000 --- a/spec/dummy/config/routes.rb +++ /dev/null @@ -1,58 +0,0 @@ -Dummy::Application.routes.draw do - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => 'welcome#index' - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id(.:format)))' -end diff --git a/spec/dummy/db/migrate/.gitkeep b/spec/dummy/db/migrate/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb b/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb deleted file mode 100644 index f9b6c2e..0000000 --- a/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb +++ /dev/null @@ -1,48 +0,0 @@ -class CreateRefinerycmsAuthenticationSchema < ActiveRecord::Migration - def self.up - # Postgres apparently requires the roles_users table to exist before creating the roles table. - create_table ::Refinery::RolesUsers.table_name, :id => false, :force => true do |t| - t.integer "user_id" - t.integer "role_id" - end unless ::Refinery::RolesUsers.table_exists? - - create_table ::Refinery::Role.table_name, :force => true do |t| - t.string "title" - end unless ::Refinery::Role.table_exists? - - unless ::Refinery::UserPlugin.table_exists? - create_table ::Refinery::UserPlugin.table_name, :force => true do |t| - t.integer "user_id" - t.string "name" - t.integer "position" - end - - add_index ::Refinery::UserPlugin.table_name, ["name"], :name => "index_#{::Refinery::UserPlugin.table_name}_on_title" - add_index ::Refinery::UserPlugin.table_name, ["user_id", "name"], :name => "index_unique_#{::Refinery::UserPlugin.table_name}", :unique => true - - end - - unless ::Refinery::User.table_exists? - create_table ::Refinery::User.table_name, :force => true do |t| - t.string "login", :null => false - t.string "email", :null => false - t.string "crypted_password", :null => false - t.string "password_salt", :null => false - t.string "persistence_token" - t.datetime "created_at" - t.datetime "updated_at" - t.string "perishable_token" - end - - add_index ::Refinery::User.table_name, ["id"], :name => "index_#{::Refinery::User.table_name}_on_id" - end - end - - def self.down - [::User].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb deleted file mode 100644 index 5061efa..0000000 --- a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateRefinerycmsCoreSchema < ActiveRecord::Migration - def self.up - unless Slug.table_exists? - create_table ::Slug.table_name, :force => true do |t| - t.string "name" - t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false - t.string "sluggable_type", :limit => 40 - t.string "scope", :limit => 40 - t.datetime "created_at" - end - - add_index ::Slug.table_name, ["name", "sluggable_type", "scope", "sequence"], :name => "index_#{::Slug.table_name}_on_n_s_s_and_s", :unique => true - add_index ::Slug.table_name, ["sluggable_id"], :name => "index_#{::Slug.table_name}_on_sluggable_id" - end - end - - def self.down - [::Slug].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb b/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb deleted file mode 100644 index 6c4e079..0000000 --- a/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CreateRefinerycmsImagesSchema < ActiveRecord::Migration - def self.up - create_table ::Refinery::Image.table_name, :force => true do |t| - t.string "image_mime_type" - t.string "image_name" - t.integer "image_size" - t.integer "image_width" - t.integer "image_height" - t.datetime "created_at" - t.datetime "updated_at" - t.string "image_uid" - t.string "image_ext" - end unless ::Refinery::Image.table_exists? - end - - def self.down - [::Image].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb b/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb deleted file mode 100644 index 4458726..0000000 --- a/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb +++ /dev/null @@ -1,56 +0,0 @@ -class CreateRefinerycmsPagesSchema < ActiveRecord::Migration - def self.up - unless ::Refinery::PagePart.table_exists? - create_table ::Refinery::PagePart.table_name, :force => true do |t| - t.integer "refinery_page_id" - t.string "title" - t.text "body" - t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index ::Refinery::PagePart.table_name, ["id"], :name => "index_#{::Refinery::PagePart.table_name}_on_id" - add_index ::Refinery::PagePart.table_name, ["refinery_page_id"], :name => "index_#{::Refinery::PagePart.table_name}_on_page_id" - end - - unless ::Refinery::Page.table_exists? - create_table ::Refinery::Page.table_name, :force => true do |t| - t.string "title" - t.integer "parent_id" - t.integer "position" - t.string "path" - t.datetime "created_at" - t.datetime "updated_at" - t.string "meta_keywords" - t.text "meta_description" - t.boolean "show_in_menu", :default => true - t.string "link_url" - t.string "menu_match" - t.boolean "deletable", :default => true - t.string "custom_title" - t.string "custom_title_type", :default => "none" - t.boolean "draft", :default => false - t.string "browser_title" - t.boolean "skip_to_first_child", :default => false - t.integer "lft" - t.integer "rgt" - t.integer "depth" - end - - add_index ::Refinery::Page.table_name, ["depth"], :name => "index_#{::Refinery::Page.table_name}_on_depth" - add_index ::Refinery::Page.table_name, ["id"], :name => "index_#{::Refinery::Page.table_name}_on_id" - add_index ::Refinery::Page.table_name, ["lft"], :name => "index_#{::Refinery::Page.table_name}_on_lft" - add_index ::Refinery::Page.table_name, ["parent_id"], :name => "index_#{::Refinery::Page.table_name}_on_parent_id" - add_index ::Refinery::Page.table_name, ["rgt"], :name => "index_#{::Refinery::Page.table_name}_on_rgt" - end - end - - def self.down - [::Page, ::Refinery::PagePart].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb b/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb deleted file mode 100644 index 360f469..0000000 --- a/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb +++ /dev/null @@ -1,21 +0,0 @@ -class CreateRefinerycmsResourcesSchema < ActiveRecord::Migration - def self.up - create_table ::Refinery::Resource.table_name, :force => true do |t| - t.string "file_mime_type" - t.string "file_name" - t.integer "file_size" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_uid" - t.string "file_ext" - end unless ::Refinery::Resource.table_exists? - end - - def self.down - [::Resource].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb b/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb deleted file mode 100644 index 955389f..0000000 --- a/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb +++ /dev/null @@ -1,26 +0,0 @@ -class CreateRefinerycmsSettingsSchema < ActiveRecord::Migration - def self.up - unless ::Refinery::Setting.table_exists? - create_table ::Refinery::Setting.table_name, :force => true do |t| - t.string "name" - t.text "value" - t.boolean "destroyable", :default => true - t.datetime "created_at" - t.datetime "updated_at" - t.string "scoping" - t.boolean "restricted", :default => false - t.string "callback_proc_as_string" - end - - add_index ::Refinery::Setting.table_name, ["name"], :name => "index_#{::Refinery::Setting.table_name}_on_name" - end - end - - def self.down - [::Refinery::Setting].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb b/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb deleted file mode 100644 index d13aa01..0000000 --- a/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AddValueTypeToRefinerySettings < ActiveRecord::Migration - def self.up - add_column ::Refinery::Setting.table_name, :form_value_type, :string - - ::Refinery::Setting.reset_column_information - end - - def self.down - remove_column ::Refinery::Setting.table_name, :form_value_type - - ::Refinery::Setting.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb b/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb deleted file mode 100644 index e72d81f..0000000 --- a/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddMissingIndexesToRolesUsers < ActiveRecord::Migration - def self.up - add_index ::Refinery::RolesUsers.table_name, [:role_id, :user_id] - add_index ::Refinery::RolesUsers.table_name, [:user_id, :role_id] - end - - def self.down - remove_index ::Refinery::RolesUsers.table_name, :column => [:role_id, :user_id] - remove_index ::Refinery::RolesUsers.table_name, :column => [:user_id, :role_id] - end -end diff --git a/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb b/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb deleted file mode 100644 index 8beef83..0000000 --- a/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb +++ /dev/null @@ -1,31 +0,0 @@ -class ChangeToDeviseUsersTable < ActiveRecord::Migration - def self.up - add_column ::Refinery::User.table_name, :current_sign_in_at, :datetime - add_column ::Refinery::User.table_name, :last_sign_in_at, :datetime - add_column ::Refinery::User.table_name, :current_sign_in_ip, :string - add_column ::Refinery::User.table_name, :last_sign_in_ip, :string - add_column ::Refinery::User.table_name, :sign_in_count, :integer - add_column ::Refinery::User.table_name, :remember_token, :string - add_column ::Refinery::User.table_name, :reset_password_token, :string - - rename_column ::Refinery::User.table_name, :crypted_password, :encrypted_password - rename_column ::Refinery::User.table_name, :login, :username - - ::Refinery::User.reset_column_information - end - - def self.down - remove_column ::Refinery::User.table_name, :current_sign_in_at - remove_column ::Refinery::User.table_name, :last_sign_in_at - remove_column ::Refinery::User.table_name, :current_sign_in_ip - remove_column ::Refinery::User.table_name, :last_sign_in_ip - remove_column ::Refinery::User.table_name, :sign_in_count - remove_column ::Refinery::User.table_name, :remember_token - remove_column ::Refinery::User.table_name, :reset_password_token - - rename_column ::Refinery::User.table_name, :encrypted_password, :crypted_password - rename_column ::Refinery::User.table_name, :username, :login - - ::Refinery::User.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb b/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb deleted file mode 100644 index 341bc8f..0000000 --- a/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemoveCachedSlugFromPages < ActiveRecord::Migration - def self.up - if ::Refinery::Page.column_names.map(&:to_s).include?('cached_slug') - say_with_time("Removing cached_slug column from ::Refinery::Page table") do - remove_column ::Refinery::Page.table_name, :cached_slug - end - else - say "Nothing done, no cached_slug field found in ::Refinery::Page table" - end - - ::Refinery::Page.reset_column_information - end - - def self.down - # Don't add this column back, it breaks stuff. - end -end diff --git a/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb b/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb deleted file mode 100644 index 4b56f03..0000000 --- a/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddLocaleToSlugs < ActiveRecord::Migration - def self.up - add_column ::Slug.table_name, :locale, :string, :limit => 5 - - add_index ::Slug.table_name, :locale - - ::Slug.reset_column_information - end - - def self.down - remove_column :slugs, :locale - - ::Slug.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb deleted file mode 100644 index 1280e88..0000000 --- a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb +++ /dev/null @@ -1,40 +0,0 @@ -class TranslatePagePlugin < ActiveRecord::Migration - def self.up - say_with_time("Creating ::Refinery::PagePart translation table") do - ::Refinery::PagePart.create_translation_table!({ - :body => :text - }, { - :migrate_data => true - }) - end - - say_with_time("Creating ::Refinery::Page translation table") do - ::Refinery::Page.create_translation_table!({ - :title => :string, - :meta_keywords => :string, - :meta_description => :text, - :browser_title => :string, - :custom_slug => :string, - :menu_title => :string - }, { - :migrate_data => true - }) - end - - puts "seeds pages" - if (seed_file = Rails.root.join('db', 'seeds', 'pages.rb')).file? - load seed_file.to_s unless ::Refinery::Page.where(:link_url => '/').any? - end - - say_with_time("Updating slugs") do - ::Slug.update_all(:locale => I18n.locale) - end - end - - def self.down - say_with_time("Dropping ::Refinery::Page and ::Refinery::PagePart translation tables") do - ::Refinery::Page.drop_translation_table! :migrate_data => true - ::Refinery::PagePart.drop_translation_table! :migrate_data => true - end - end -end diff --git a/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb b/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb deleted file mode 100644 index 78c9f68..0000000 --- a/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddRememberCreatedAtToUsers < ActiveRecord::Migration - def change - add_column ::Refinery::User.table_name, :remember_created_at, :datetime - - ::Refinery::User.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb b/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb deleted file mode 100644 index 9b6db2b..0000000 --- a/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb +++ /dev/null @@ -1,22 +0,0 @@ -class RemoveDuplicateUserImageSizesSetting < ActiveRecord::Migration - def self.up - if (settings = ::Refinery::Setting.where(:name => :user_image_sizes)).count > 1 - default_value = { :small => '110x110>', :medium => '225x255>', :large => '450x450>' } - - if (non_default_setting = settings.detect { |setting| setting[:value] != default_value }) - settings.detect { |setting| setting[:value] == default_value }.destroy - non_default_setting[:destroyable] = false - non_default_setting.save - else - settings.detect { |setting| setting[:destroyable] == true }.destroy - end - say "Removed duplicate user image sizes settings" - else - say "Nothing done, no duplicate settings found" - end - end - - def self.down - # there is no step down ... - end -end diff --git a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb deleted file mode 100644 index 7d87d84..0000000 --- a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb +++ /dev/null @@ -1,41 +0,0 @@ -class TranslateCustomTitleOnPages < ActiveRecord::Migration - def self.up - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:menu_title) - add_column ::Refinery::Page.translation_class.table_name, :menu_title, :string - - say_with_time("Re-save menu_title") do - ::Refinery::Page.all.each do |page| - say "updating menu_title field for page##{page.id}" - page.update_attribute(:menu_title, page.untranslated_attributes['menu_title']) - end - end - else - say "Nothing done, ::Refinery::Page.translation_class table already includes a menu_title field" - end - - ::Refinery::Page.translation_class.reset_column_information - end - - def self.down - say_with_time("Re-save menu_title") do - ::Refinery::Page.all.each do |page| - if page.attributes['menu_title'].nil? - say "Nothing done, page##{page.id} menu_title field is nil" - else - say "updating menu_title field for page #{page.id}" - ::Refinery::Page.update_all({ - :menu_title => page.attributes['menu_title'] - }, { - :id => page.id.to_s - }) - end - end - end - - remove_column ::Refinery::Page.translation_class.table_name, :menu_title - - ::Refinery::Page.translated_attribute_names.delete(:menu_title) - - ::Refinery::Page.translation_class.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb b/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb deleted file mode 100644 index 452daee..0000000 --- a/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemoveTranslatedFieldsFromPages < ActiveRecord::Migration - def self.up - ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| - remove_column ::Refinery::Page.table_name, column_name if ::Refinery::Page.column_names.map(&:to_sym).include?(column_name) - end - - ::Refinery::Page.reset_column_information - end - - def self.down - ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| - add_column ::Refinery::Page.table_name, column_name, Page::Translation.columns.detect{|c| c.name.to_sym == column_name}.type - end - - ::Refinery::Page.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb b/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb deleted file mode 100644 index 4197125..0000000 --- a/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemovePasswordSaltFromUsers < ActiveRecord::Migration - def self.up - remove_column ::Refinery::User.table_name, :password_salt - # Make the current password invalid :( - ::Refinery::User.all.each do |u| - u.update_attribute(:encrypted_password, u.encrypted_password[29..-1]) - end - - ::Refinery::User.reset_column_information - end - - def self.down - add_column ::Refinery::User.table_name, :password_salt, :string - - ::Refinery::User.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb b/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb deleted file mode 100644 index cb8c268..0000000 --- a/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb +++ /dev/null @@ -1,86 +0,0 @@ -class CreateSeoMeta < ActiveRecord::Migration - - def self.up - create_table :seo_meta do |t| - t.integer :seo_meta_id - t.string :seo_meta_type - - t.string :browser_title - t.string :meta_keywords - t.text :meta_description - - t.timestamps - end - - add_index :seo_meta, :id - add_index :seo_meta, [:seo_meta_id, :seo_meta_type] - - # Grab the attributes of the records that currently exist - existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) - - # Remove columns - ::SeoMeta.attributes.keys.each do |field| - if ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) - remove_column ::Refinery::Page.translation_class.table_name, field - end - end - - # Reset column information because otherwise the old columns will still exist. - ::Refinery::Page.translation_class.reset_column_information - - # Re-attach seo_meta - ::Refinery::Page.translation_class.send :is_seo_meta - - # Migrate data - existing_translations.each do |translation| - ::Refinery::Page.translation_class.find(translation['id']).update_attributes( - ::SeoMeta.attributes.keys.inject({}) {|attributes, name| - attributes.merge(name => translation[name.to_s]) - } - ) - end - - # Reset column information again because otherwise the old columns will still exist. - ::Refinery::Page.reset_column_information - end - - def self.down - # Grab the attributes of the records that currently exist - existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) - - # Add columns back to your model - ::Refinery::SeoMeta.attributes.each do |field, field_type| - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) - add_column ::Refinery::Page.translation_class.table_name, field, field_type - end - end - - # Reset column information because otherwise the new columns won't exist yet. - ::Refinery::Page.translation_class.reset_column_information - - # Migrate data - existing_translations.each do |translation| - ::Refinery::Page.translation_class.update_all( - ::Refinery::SeoMeta.attributes.keys.inject({}) {|attributes, name| - attributes.merge(name => translation[name.to_s]) - }, :id => translation['id'] - ) - end - - ::Refinery::SeoMeta.attributes.keys.each do |k| - ::Refinery::Page.translation_class.module_eval %{ - def #{k} - end - - def #{k}=(*args) - end - } - end - - # Reset column information again because otherwise the old columns will still exist. - ::Refinery::Page.reset_column_information - - drop_table :seo_meta - end - -end diff --git a/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb b/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb deleted file mode 100644 index eb98ed1..0000000 --- a/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateAddTemplateColumns < ActiveRecord::Migration - def self.up - add_column ::Refinery::Page.table_name, :view_template, :string - add_column ::Refinery::Page.table_name, :layout_template, :string - end - - def self.down - remove_column ::Refinery::Page.table_name, :layout_template - remove_column ::Refinery::Page.table_name, :view_template - end -end diff --git a/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb deleted file mode 100644 index 2feb837..0000000 --- a/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddCustomSlugToRefineryPageTranslations < ActiveRecord::Migration - def up - if ::Refinery::Page::Translation.column_names.map(&:to_sym).exclude?(:custom_slug) - add_column ::Refinery::Page::Translation.table_name, :custom_slug, :string, :default => nil - end - end - - def down - remove_column ::Refinery::Page::Translation.table_name, :custom_slug - end -end diff --git a/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb deleted file mode 100644 index 0ce6cb2..0000000 --- a/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb +++ /dev/null @@ -1,15 +0,0 @@ -class RenameCustomTitleToMenuTitleInRefineryPages < ActiveRecord::Migration - def up - if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:custom_title) - rename_column ::Refinery::Page::Translation.table_name, :custom_title, :menu_title - end - remove_column ::Refinery::Page.table_name, :custom_title_type - end - - def down - if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:menu_title) - rename_column ::Refinery::Page::Translation.table_name, :menu_title, :custom_title - end - add_column ::Refinery::Page.table_name, :custom_title_type, :string - end -end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb deleted file mode 100644 index 2cf06e5..0000000 --- a/spec/dummy/db/schema.rb +++ /dev/null @@ -1,240 +0,0 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20110812055013) do - - create_table "refinery_blog_categories", :force => true do |t| - t.string "title" - t.datetime "created_at" - t.datetime "updated_at" - t.string "cached_slug" - end - - add_index "refinery_blog_categories", ["id"], :name => "index_refinery_blog_categories_on_id" - - create_table "refinery_blog_categories_blog_posts", :force => true do |t| - t.integer "blog_category_id" - t.integer "blog_post_id" - end - - add_index "refinery_blog_categories_blog_posts", ["blog_category_id", "blog_post_id"], :name => "index_blog_categories_blog_posts_on_bc_and_bp" - - create_table "refinery_blog_comments", :force => true do |t| - t.integer "blog_post_id" - t.boolean "spam" - t.string "name" - t.string "email" - t.text "body" - t.string "state" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_blog_comments", ["id"], :name => "index_refinery_blog_comments_on_id" - - create_table "refinery_blog_posts", :force => true do |t| - t.string "title" - t.text "body" - t.boolean "draft" - t.datetime "published_at" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "user_id" - t.string "cached_slug" - t.string "custom_url" - t.text "custom_teaser" - end - - add_index "refinery_blog_posts", ["id"], :name => "index_refinery_blog_posts_on_id" - - create_table "refinery_images", :force => true do |t| - t.string "image_mime_type" - t.string "image_name" - t.integer "image_size" - t.integer "image_width" - t.integer "image_height" - t.datetime "created_at" - t.datetime "updated_at" - t.string "image_uid" - t.string "image_ext" - end - - create_table "refinery_page_part_translations", :force => true do |t| - t.integer "refinery_page_part_id" - t.string "locale" - t.text "body" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_page_part_translations", ["refinery_page_part_id"], :name => "index_f9716c4215584edbca2557e32706a5ae084a15ef" - - create_table "refinery_page_parts", :force => true do |t| - t.integer "refinery_page_id" - t.string "title" - t.text "body" - t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_page_parts", ["id"], :name => "index_refinery_page_parts_on_id" - add_index "refinery_page_parts", ["refinery_page_id"], :name => "index_refinery_page_parts_on_page_id" - - create_table "refinery_page_translations", :force => true do |t| - t.integer "refinery_page_id" - t.string "locale" - t.string "title" - t.string "menu_title" - t.datetime "created_at" - t.datetime "updated_at" - t.string "custom_slug" - end - - add_index "refinery_page_translations", ["refinery_page_id"], :name => "index_d079468f88bff1c6ea81573a0d019ba8bf5c2902" - - create_table "refinery_pages", :force => true do |t| - t.integer "parent_id" - t.integer "position" - t.string "path" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "show_in_menu", :default => true - t.string "link_url" - t.string "menu_match" - t.boolean "deletable", :default => true - t.boolean "draft", :default => false - t.boolean "skip_to_first_child", :default => false - t.integer "lft" - t.integer "rgt" - t.integer "depth" - t.string "view_template" - t.string "layout_template" - end - - add_index "refinery_pages", ["depth"], :name => "index_refinery_pages_on_depth" - add_index "refinery_pages", ["id"], :name => "index_refinery_pages_on_id" - add_index "refinery_pages", ["lft"], :name => "index_refinery_pages_on_lft" - add_index "refinery_pages", ["parent_id"], :name => "index_refinery_pages_on_parent_id" - add_index "refinery_pages", ["rgt"], :name => "index_refinery_pages_on_rgt" - - create_table "refinery_resources", :force => true do |t| - t.string "file_mime_type" - t.string "file_name" - t.integer "file_size" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_uid" - t.string "file_ext" - end - - create_table "refinery_roles", :force => true do |t| - t.string "title" - end - - create_table "refinery_roles_users", :id => false, :force => true do |t| - t.integer "user_id" - t.integer "role_id" - end - - add_index "refinery_roles_users", ["role_id", "user_id"], :name => "index_refinery_roles_users_on_role_id_and_user_id" - add_index "refinery_roles_users", ["user_id", "role_id"], :name => "index_refinery_roles_users_on_user_id_and_role_id" - - create_table "refinery_settings", :force => true do |t| - t.string "name" - t.text "value" - t.boolean "destroyable", :default => true - t.datetime "created_at" - t.datetime "updated_at" - t.string "scoping" - t.boolean "restricted", :default => false - t.string "callback_proc_as_string" - t.string "form_value_type" - end - - add_index "refinery_settings", ["name"], :name => "index_refinery_settings_on_name" - - create_table "refinery_user_plugins", :force => true do |t| - t.integer "user_id" - t.string "name" - t.integer "position" - end - - add_index "refinery_user_plugins", ["name"], :name => "index_refinery_user_plugins_on_title" - add_index "refinery_user_plugins", ["user_id", "name"], :name => "index_unique_refinery_user_plugins", :unique => true - - create_table "refinery_users", :force => true do |t| - t.string "username", :null => false - t.string "email", :null => false - t.string "encrypted_password", :null => false - t.string "persistence_token" - t.datetime "created_at" - t.datetime "updated_at" - t.string "perishable_token" - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.integer "sign_in_count" - t.string "remember_token" - t.string "reset_password_token" - t.datetime "remember_created_at" - end - - add_index "refinery_users", ["id"], :name => "index_refinery_users_on_id" - - create_table "seo_meta", :force => true do |t| - t.integer "seo_meta_id" - t.string "seo_meta_type" - t.string "browser_title" - t.string "meta_keywords" - t.text "meta_description" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "seo_meta", ["id"], :name => "index_seo_meta_on_id" - add_index "seo_meta", ["seo_meta_id", "seo_meta_type"], :name => "index_seo_meta_on_seo_meta_id_and_seo_meta_type" - - create_table "slugs", :force => true do |t| - t.string "name" - t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false - t.string "sluggable_type", :limit => 40 - t.string "scope", :limit => 40 - t.datetime "created_at" - t.string "locale", :limit => 5 - end - - add_index "slugs", ["locale"], :name => "index_slugs_on_locale" - add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_n_s_s_and_s", :unique => true - add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id" - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context" - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - - create_table "tags", :force => true do |t| - t.string "name" - end - -end diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb deleted file mode 100644 index 62d4e8d..0000000 --- a/spec/dummy/db/seeds/pages.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Refinery - ::Refinery::Page.reset_column_information - - page_position = -1 - - unless ::Refinery::Page.where(:menu_match => "^/$").any? - home_page = ::Refinery::Page.create!({:title => "Home", - :deletable => false, - :link_url => "/", - :menu_match => "^/$", - :position => (page_position += 1)}) - home_page.parts.create({ - :title => "Body", - :body => "

Welcome to our site. This is just a place holder page while we gather our content.

", - :position => 0 - }) - home_page.parts.create({ - :title => "Side Body", - :body => "

This is another block of content over here.

", - :position => 1 - }) - - home_page_position = -1 - page_not_found_page = home_page.children.create(:title => "Page not found", - :menu_match => "^/404$", - :show_in_menu => false, - :deletable => false, - :position => (home_page_position += 1)) - page_not_found_page.parts.create({ - :title => "Body", - :body => "

Sorry, there was a problem...

The page you requested was not found.

Return to the home page

", - :position => 0 - }) - else - page_position += 1 - end - - unless ::Refinery::Page.by_title("About").any? - about_us_page = ::Refinery::Page.create(:title => "About", - :deletable => true, - :position => (page_position += 1)) - about_us_page.parts.create({ - :title => "Body", - :body => "

This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.

", - :position => 0 - }) - about_us_page.parts.create({ - :title => "Side Body", - :body => "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.

", - :position => 1 - }) - else - page_position += 1 - end -end diff --git a/spec/dummy/lib/assets/.gitkeep b/spec/dummy/lib/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/log/.gitkeep b/spec/dummy/log/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/public/404.html b/spec/dummy/public/404.html deleted file mode 100644 index 9a48320..0000000 --- a/spec/dummy/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
- - diff --git a/spec/dummy/public/422.html b/spec/dummy/public/422.html deleted file mode 100644 index 83660ab..0000000 --- a/spec/dummy/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
- - diff --git a/spec/dummy/public/500.html b/spec/dummy/public/500.html deleted file mode 100644 index b80307f..0000000 --- a/spec/dummy/public/500.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
-

We're sorry, but something went wrong.

-

We've been notified about this issue and we'll take a look at it shortly.

-
- - diff --git a/spec/dummy/public/favicon.ico b/spec/dummy/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/script/rails b/spec/dummy/script/rails deleted file mode 100755 index f8da2cf..0000000 --- a/spec/dummy/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/spec/dummy/version.rb b/spec/dummy/version.rb deleted file mode 100644 index ed35a95..0000000 --- a/spec/dummy/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Refinery - module TestApp - VERSION = "0.0.1" - end -end From db93751fd6b856a3eef79ddbd60d1251e6daa732 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:12:26 -0700 Subject: [PATCH 098/248] Modify Rakefile to load engine tasks and testing railtie tasks --- Rakefile | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/Rakefile b/Rakefile index 0fb4407..8b8cb49 100644 --- a/Rakefile +++ b/Rakefile @@ -4,31 +4,12 @@ begin rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end - -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'RefinerycmsBlog' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.rdoc') - rdoc.rdoc_files.include('lib/**/*.rb') -end - -require 'rspec/core/rake_task' - -desc "Run specs" -RSpec::Core::RakeTask.new(:spec => 'refinery:testing:engine:init_test_database') APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) -load 'rails/tasks/engine.rake' -load 'refinery/tasks/testing.rake' -Bundler::GemHelper.install_tasks +if File.exists?(APP_RAKEFILE) + load 'rails/tasks/engine.rake' +end -task :default => 'refinery:testing:engine:setup' +require "refinerycms-testing" +Refinery::Testing::Railtie.load_tasks From 993b4a8b1b8a994ad09f5d5be9cd2fdc7b44669c Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:24:15 -0700 Subject: [PATCH 099/248] Update engine definition Isolate engine to Refinery add engine name Add initializer to register engine with Refinery Rename plugin init initializer to be more descriptive Update plugin initializer to conform to latest master of RefineryCMS --- lib/refinery/blog/engine.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index f67d4ab..b335dbc 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -1,23 +1,32 @@ +require 'rails_autolink' + module Refinery module Blog class Engine < Rails::Engine - require 'rails_autolink' + include Refinery::Engine + + isolate_namespace Refinery + engine_name :refinery_resources config.to_prepare do require 'refinery/blog/tabs' end - initializer "init plugin", :after => :set_routes_reloader do |app| + initializer "register refinerycms_blog plugin", :after => :set_routes_reloader do |app| Refinery::Plugin.register do |plugin| plugin.pathname = root plugin.name = "refinerycms_blog" plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path plugin.menu_match = /^\/refinery\/blog\/?(posts|comments|categories)?/ plugin.activity = { - :class => Refinery::BlogPost + :class_name => :'refinery/blog_post' } end end + + config.after_initialize do + Refinery.register_engine(Refinery::Blog) + end end end end From 5dd11ffc617613ab8b21cd9e80b96810c43653d8 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:29:01 -0700 Subject: [PATCH 100/248] Remove Refinery::Application route draw call, it no longer exists --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 6ba5186..2ed6e8d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -::Refinery::Application.routes.draw do +Rails.application.routes.draw do scope(:module => 'refinery') do scope(:path => 'blog', :module => 'blog') do root :to => 'posts#index', :as => 'blog_root' From 4ddc2b3754746bf21485e6fff5ca2bebc6aa47fe Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:29:41 -0700 Subject: [PATCH 101/248] Add spec/dummy to git ignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 271bed4..7acd8b2 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ doc/* *.autobackupbyrefinery.* /refinerycms-blog*.gem .autotest +spec/dummy # Mac .DS_Store From 0de4fd9582b4ee0f83172cb736c509f839dcbc3b Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:50:26 -0700 Subject: [PATCH 102/248] Add ENGINE_ROOT constant to Rakefile for refinerycms-testing tasks --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 8b8cb49..5adcafe 100644 --- a/Rakefile +++ b/Rakefile @@ -5,6 +5,7 @@ rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end +ENGINE_ROOT = File.dirname(__FILE__) APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) if File.exists?(APP_RAKEFILE) From 8cd4a282d8f1173f4d8df496c2dd2b61ad892292 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 15:29:02 -0700 Subject: [PATCH 103/248] This is the blog engine... not hte resources engine.. --- lib/refinery/blog/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index b335dbc..8ca1f0a 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -6,7 +6,7 @@ module Refinery include Refinery::Engine isolate_namespace Refinery - engine_name :refinery_resources + engine_name :refinery_blog config.to_prepare do require 'refinery/blog/tabs' From 5a958007c5c4b3ef4af001464d75c4c00adfe870 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 18:12:32 -0700 Subject: [PATCH 104/248] Update blog generator to use Rails 3.1 base Seeds will now follow Rails 3.1 conventions --- Rakefile | 2 +- db/{seeds/refinerycms_blog.rb => seeds.rb} | 0 lib/generators/blog_generator.rb | 10 ---------- lib/generators/refinery/blog/blog_generator.rb | 16 ++++++++++++++++ lib/refinerycms-blog.rb | 3 ++- 5 files changed, 19 insertions(+), 12 deletions(-) rename db/{seeds/refinerycms_blog.rb => seeds.rb} (100%) delete mode 100644 lib/generators/blog_generator.rb create mode 100644 lib/generators/refinery/blog/blog_generator.rb diff --git a/Rakefile b/Rakefile index 5adcafe..8fb342e 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,7 @@ rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end -ENGINE_ROOT = File.dirname(__FILE__) +ENGINE_PATH = File.dirname(__FILE__) APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) if File.exists?(APP_RAKEFILE) diff --git a/db/seeds/refinerycms_blog.rb b/db/seeds.rb similarity index 100% rename from db/seeds/refinerycms_blog.rb rename to db/seeds.rb diff --git a/lib/generators/blog_generator.rb b/lib/generators/blog_generator.rb deleted file mode 100644 index 8b09bb7..0000000 --- a/lib/generators/blog_generator.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'refinery/generators' - -module ::Refinery - class BlogGenerator < ::Refinery::Generators::EngineInstaller - - source_root File.expand_path('../../../', __FILE__) - engine_name "refinerycms-blog" - - end -end diff --git a/lib/generators/refinery/blog/blog_generator.rb b/lib/generators/refinery/blog/blog_generator.rb new file mode 100644 index 0000000..34f6cd2 --- /dev/null +++ b/lib/generators/refinery/blog/blog_generator.rb @@ -0,0 +1,16 @@ +module Refinery + class BlogGenerator < Rails::Generators::Base + source_root File.expand_path('../templates', __FILE__) + + def append_load_seed_data + append_file 'db/seeds.rb', :verbose => true do + <<-EOH + +# Added by RefineryCMS Blog engine +Refinery::Blog::Engine.load_seed + EOH + end + end + + end +end diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 135b3e1..88b8afc 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -3,9 +3,10 @@ require 'bundler' Bundler.require require 'filters_spam' -require File.expand_path('../generators/blog_generator', __FILE__) module Refinery + autoload :BlogGenerator, 'generators/refinery/blog/blog_generator' + module Blog autoload :Version, 'refinery/blog/version' autoload :Tab, 'refinery/blog/tabs' From 2b73c292c8aca776031fc31f5ebf94dce93bf0a0 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 18:22:39 -0700 Subject: [PATCH 105/248] Seed data should not be loaded mid migration Column information is not totally generated and seed will be done at end of migration run --- db/migrate/20110803223522_create_blog_structure.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/migrate/20110803223522_create_blog_structure.rb b/db/migrate/20110803223522_create_blog_structure.rb index f6f5b2d..ee3fe01 100644 --- a/db/migrate/20110803223522_create_blog_structure.rb +++ b/db/migrate/20110803223522_create_blog_structure.rb @@ -36,8 +36,6 @@ class CreateBlogStructure < ActiveRecord::Migration end add_index Refinery::Categorization.table_name, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' - - load(File.expand_path('../../seeds/refinerycms_blog.rb', __FILE__)) end def down From 14daff297b2c3f2937ef6cf3e72b663903eec97a Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 19:36:54 -0700 Subject: [PATCH 106/248] Refactor require layout to match other engines --- lib/refinery/blog.rb | 29 +++++++++++++++++++++++++++++ lib/refinery/blog/engine.rb | 3 ++- lib/refinerycms-blog.rb | 32 +------------------------------- 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 lib/refinery/blog.rb diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb new file mode 100644 index 0000000..af39967 --- /dev/null +++ b/lib/refinery/blog.rb @@ -0,0 +1,29 @@ +require 'refinerycms-core' +require 'filters_spam' +require 'rails_autolink' + +module Refinery + autoload :BlogGenerator, 'generators/refinery/blog/blog_generator' + + module Blog + require 'refinery/blog/engine' if defined?(Rails) + + autoload :Version, 'refinery/blog/version' + autoload :Tab, 'refinery/blog/tabs' + + class << self + attr_accessor :root + def root + @root ||= Pathname.new(File.expand_path('../../', __FILE__)) + end + + def version + ::Refinery::Blog::Version.to_s + end + + def factory_paths + @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] + end + end + end +end diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index 8ca1f0a..078b97f 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -1,4 +1,5 @@ -require 'rails_autolink' +require 'refinerycms-blog' +require 'rails' module Refinery module Blog diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 88b8afc..e08f070 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -1,31 +1 @@ -require 'rubygems' -require 'bundler' -Bundler.require - -require 'filters_spam' - -module Refinery - autoload :BlogGenerator, 'generators/refinery/blog/blog_generator' - - module Blog - autoload :Version, 'refinery/blog/version' - autoload :Tab, 'refinery/blog/tabs' - - class << self - attr_accessor :root - def root - @root ||= Pathname.new(File.expand_path('../../', __FILE__)) - end - - def version - ::Refinery::Blog::Version.to_s - end - - def factory_paths - @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] - end - end - end -end - -require 'refinery/blog/engine' if defined?(Rails) +require 'refinery/blog' From e01e9ff9b72e7ea2a2dbb03f04169d54dbe60fdf Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 19:37:38 -0700 Subject: [PATCH 107/248] Tabs are autoloaded, don't need to explicitly require --- lib/refinery/blog/engine.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index 078b97f..63b2793 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -8,10 +8,6 @@ module Refinery isolate_namespace Refinery engine_name :refinery_blog - - config.to_prepare do - require 'refinery/blog/tabs' - end initializer "register refinerycms_blog plugin", :after => :set_routes_reloader do |app| Refinery::Plugin.register do |plugin| From 4577f788e5163fc8ae8ab2d5514f18bc4afaef69 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 12:13:16 -0700 Subject: [PATCH 108/248] No need to explicitly call load_factories for Refinery::Testing --- spec/support/refinery.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb index 575ac2b..d761787 100644 --- a/spec/support/refinery.rb +++ b/spec/support/refinery.rb @@ -1,7 +1,5 @@ require 'refinerycms-testing' -Refinery::Testing.load_factories - RSpec.configure do |config| config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller config.extend Refinery::Testing::RequestMacros::Authentication, :type => :request From 3165574730abe9515061e07fbc43433a2e4a50ad Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 12:14:03 -0700 Subject: [PATCH 109/248] Move blog tab accessor and class array to blog file from tab file --- lib/refinery/blog.rb | 8 +++++++- lib/refinery/blog/tabs.rb | 16 +++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb index af39967..326e36a 100644 --- a/lib/refinery/blog.rb +++ b/lib/refinery/blog.rb @@ -12,10 +12,16 @@ module Refinery autoload :Tab, 'refinery/blog/tabs' class << self - attr_accessor :root + attr_writer :root + attr_writer :tabs + def root @root ||= Pathname.new(File.expand_path('../../', __FILE__)) end + + def tabs + @tabs ||= [] + end def version ::Refinery::Blog::Version.to_s diff --git a/lib/refinery/blog/tabs.rb b/lib/refinery/blog/tabs.rb index 083d50b..519b90e 100644 --- a/lib/refinery/blog/tabs.rb +++ b/lib/refinery/blog/tabs.rb @@ -1,11 +1,5 @@ module Refinery - module Blog - attr_accessor :tabs - - def self.tabs - @tabs ||= [] - end - + module Blog class Tab attr_accessor :name, :partial @@ -18,11 +12,11 @@ module Refinery raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank? end - protected + protected - def initialize - ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs - end + def initialize + ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs + end end end end \ No newline at end of file From be06f1658db9094e74a7e4d86c6d11231a58a9a4 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 12:32:22 -0700 Subject: [PATCH 110/248] Add rspec rake tasks --- Rakefile | 2 ++ tasks/rspec.rake | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 tasks/rspec.rake diff --git a/Rakefile b/Rakefile index 8fb342e..320b14a 100644 --- a/Rakefile +++ b/Rakefile @@ -14,3 +14,5 @@ end require "refinerycms-testing" Refinery::Testing::Railtie.load_tasks + +load File.expand_path('../tasks/rspec.rake', __FILE__) diff --git a/tasks/rspec.rake b/tasks/rspec.rake new file mode 100644 index 0000000..a7a9ae0 --- /dev/null +++ b/tasks/rspec.rake @@ -0,0 +1,6 @@ +require 'rspec/core/rake_task' + +desc "Run specs" +RSpec::Core::RakeTask.new do |t| + t.pattern = "./spec" +end \ No newline at end of file From b1baeba3d24175ebf06c01093ebdcdea4bf51f15 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 13:05:32 -0700 Subject: [PATCH 111/248] seo meta table migration removed We should not generate the seo meta table here - it is handled by refinerycms if the user wants it --- ...20110803223525_create_seo_meta_for_blog.rb | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 db/migrate/20110803223525_create_seo_meta_for_blog.rb diff --git a/db/migrate/20110803223525_create_seo_meta_for_blog.rb b/db/migrate/20110803223525_create_seo_meta_for_blog.rb deleted file mode 100644 index b1c3c31..0000000 --- a/db/migrate/20110803223525_create_seo_meta_for_blog.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateSeoMetaForBlog < ActiveRecord::Migration - - def up - unless ::SeoMetum.table_exists? - create_table ::SeoMetum.table_name do |t| - t.integer :seo_meta_id - t.string :seo_meta_type - - t.string :browser_title - t.string :meta_keywords - t.text :meta_description - - t.timestamps - end - - add_index ::SeoMetum.table_name, :id - add_index ::SeoMetum.table_name, [:seo_meta_id, :seo_meta_type] - end - end - - def down - # can't drop the table because someone else might be using it. - end - -end From fd7ce5e692989e5fe76722291caffb4211fd0517 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 13:07:27 -0700 Subject: [PATCH 112/248] Update readme on how to test --- readme.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index b64e192..1f1ad5c 100644 --- a/readme.md +++ b/readme.md @@ -35,11 +35,14 @@ The version of Refinery to develop this engine against is defined in the gemspec ### Testing -Setup the test environment +Generate the dummy application to test against - $ bundle exec rake refinery:testing:engine:setup + $ bundle exec rake refinery:testing:dummy_app Run the test suite with [Guard](https://github.com/guard/guard) $ bundle exec guard start - \ No newline at end of file + +Or just with rake spec + + $ bundle exec rake spec From 151629f04486b534bf59162632fd03acdc1b5b41 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 13:20:11 -0700 Subject: [PATCH 113/248] Update travis.yml to use dummy app for testing --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 62468f8..cccb3ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ -script: "bundle exec rake && bundle exec rspec spec/" +before_script: + - "bundle exec rake refinery:testing:dummy_app" +script: "bundle exec rake spec" notifications: email: - parndt@gmail.com @@ -16,4 +18,4 @@ rvm: - rbx - rbx-2.0 - ree - - jruby \ No newline at end of file + - jruby From a85b7ffab0d5c6f6929145637e4f90225c37ccce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 4 Nov 2011 15:54:12 +0200 Subject: [PATCH 114/248] Specify correct path to factories. --- lib/refinery/blog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb index 326e36a..07ed824 100644 --- a/lib/refinery/blog.rb +++ b/lib/refinery/blog.rb @@ -28,7 +28,7 @@ module Refinery end def factory_paths - @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] + @factory_paths ||= [ File.expand_path("../../../spec/factories", __FILE__) ] end end end From 9936281bb8bff96da4fb4405a9479f277f95efac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Sun, 6 Nov 2011 07:26:48 +0200 Subject: [PATCH 115/248] Regenerate gemspec. Closes #146. --- refinerycms-blog.gemspec | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 817f6b5..22dfb6b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-10-11} + s.date = %q{2011-11-06} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -185,24 +185,25 @@ Gem::Specification.new do |s| db/migrate/20110803223522_create_blog_structure.rb db/migrate/20110803223523_add_user_id_to_blog_posts.rb db/migrate/20110803223524_acts_as_taggable_on_migration.rb - db/migrate/20110803223525_create_seo_meta_for_blog.rb db/migrate/20110803223526_add_cached_slugs.rb db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb db/migrate/20110803223529_add_primary_key_to_categorizations.rb - db/seeds - db/seeds/refinerycms_blog.rb + db/seeds.rb Gemfile Guardfile lib lib/gemspec.rb lib/generators - lib/generators/blog_generator.rb + lib/generators/refinery + lib/generators/refinery/blog + lib/generators/refinery/blog/blog_generator.rb lib/refinery lib/refinery/blog lib/refinery/blog/engine.rb lib/refinery/blog/tabs.rb lib/refinery/blog/version.rb + lib/refinery/blog.rb lib/refinerycms-blog.rb Rakefile readme.md @@ -234,6 +235,8 @@ Gem::Specification.new do |s| spec/support/database_cleaner.rb spec/support/devise.rb spec/support/refinery.rb + tasks + tasks/rspec.rake todo.md ) end From d18364d359359fa6564ad187d7303f8c167154cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Sun, 6 Nov 2011 21:28:25 +0200 Subject: [PATCH 116/248] Use root menthod to set engine factory path. --- lib/refinery/blog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb index 07ed824..78e1bf5 100644 --- a/lib/refinery/blog.rb +++ b/lib/refinery/blog.rb @@ -28,7 +28,7 @@ module Refinery end def factory_paths - @factory_paths ||= [ File.expand_path("../../../spec/factories", __FILE__) ] + @factory_paths ||= [ root.join("spec/factories").to_s ] end end end From 36c005ecd112b76d3c9c2d7092f22d6e06755d73 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Wed, 9 Nov 2011 22:19:07 +1300 Subject: [PATCH 117/248] Refactored everything (models, helpers) into proper namespace of Refinery::Blog. Requires refinery commit 25162b585b9c4023d39fd1a9796140bfa4ecb909 --- .../admin/blog/categories_controller.rb | 2 +- .../admin/blog/comments_controller.rb | 12 +- .../refinery/admin/blog/posts_controller.rb | 25 +- .../admin/blog/settings_controller.rb | 12 +- .../refinery/blog/base_controller.rb | 2 +- .../refinery/blog/categories_controller.rb | 4 +- .../refinery/blog/posts_controller.rb | 14 +- .../refinery/blog/controller_helper.rb | 10 +- app/helpers/refinery/blog/posts_helper.rb | 51 ++++ app/helpers/refinery/blog_posts_helper.rb | 49 ---- app/mailers/refinery/blog/comment_mailer.rb | 6 +- app/models/refinery/blog/category.rb | 26 +++ app/models/refinery/blog/comment.rb | 125 ++++++++++ app/models/refinery/blog/post.rb | 114 +++++++++ app/models/refinery/blog_category.rb | 24 -- app/models/refinery/blog_comment.rb | 135 ----------- app/models/refinery/blog_post.rb | 112 --------- app/models/refinery/categorization.rb | 4 +- app/sweepers/refinery/blog_sweeper.rb | 14 +- .../refinery/admin/blog/_submenu.html.erb | 12 +- .../refinery/admin/blog/posts/_form.html.erb | 1 - .../refinery/blog/categories/show.html.erb | 2 +- .../blog/comment_mailer/notification.html.erb | 6 +- app/views/refinery/blog/posts/_post.html.erb | 2 +- app/views/refinery/blog/posts/show.html.erb | 6 +- .../refinery/blog/shared/_categories.html.erb | 2 +- app/views/refinery/blog/shared/_post.html.erb | 2 +- .../20110803223522_create_blog_structure.rb | 16 +- ...0110803223523_add_user_id_to_blog_posts.rb | 2 +- db/migrate/20110803223526_add_cached_slugs.rb | 4 +- ...3527_add_custom_url_field_to_blog_posts.rb | 2 +- ...8_add_custom_teaser_field_to_blog_posts.rb | 2 +- db/seeds.rb | 9 +- lib/refinery/blog.rb | 5 + lib/refinery/blog/engine.rb | 2 +- spec/factories/blog_categories.rb | 2 +- spec/factories/blog_comments.rb | 2 +- spec/factories/blog_posts.rb | 2 +- spec/models/refinery/blog/category_spec.rb | 42 ++++ spec/models/refinery/blog/comment_spec.rb | 19 ++ spec/models/refinery/blog/post_spec.rb | 220 ++++++++++++++++++ spec/models/refinery/blog_category_spec.rb | 42 ---- spec/models/refinery/blog_comment_spec.rb | 22 -- spec/models/refinery/blog_post_spec.rb | 218 ----------------- .../refinery/admin/blog/comments_spec.rb | 8 +- .../refinery/admin/blog/posts_spec.rb | 46 ++-- spec/requests/refinery/blog/posts_spec.rb | 4 +- 47 files changed, 725 insertions(+), 718 deletions(-) create mode 100644 app/helpers/refinery/blog/posts_helper.rb delete mode 100644 app/helpers/refinery/blog_posts_helper.rb create mode 100644 app/models/refinery/blog/category.rb create mode 100644 app/models/refinery/blog/comment.rb create mode 100644 app/models/refinery/blog/post.rb delete mode 100644 app/models/refinery/blog_category.rb delete mode 100644 app/models/refinery/blog_comment.rb delete mode 100644 app/models/refinery/blog_post.rb create mode 100644 spec/models/refinery/blog/category_spec.rb create mode 100644 spec/models/refinery/blog/comment_spec.rb create mode 100644 spec/models/refinery/blog/post_spec.rb delete mode 100644 spec/models/refinery/blog_category_spec.rb delete mode 100644 spec/models/refinery/blog_comment_spec.rb delete mode 100644 spec/models/refinery/blog_post_spec.rb diff --git a/app/controllers/refinery/admin/blog/categories_controller.rb b/app/controllers/refinery/admin/blog/categories_controller.rb index 12f22ce..0fe4eec 100644 --- a/app/controllers/refinery/admin/blog/categories_controller.rb +++ b/app/controllers/refinery/admin/blog/categories_controller.rb @@ -3,7 +3,7 @@ module Refinery module Blog class CategoriesController < ::Refinery::AdminController - crudify :'refinery/blog_category', + crudify :'refinery/blog/category', :title_attribute => :title, :order => 'title ASC' diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb index a3df235..6c1417e 100644 --- a/app/controllers/refinery/admin/blog/comments_controller.rb +++ b/app/controllers/refinery/admin/blog/comments_controller.rb @@ -5,23 +5,23 @@ module Refinery cache_sweeper Refinery::BlogSweeper - crudify :'refinery/blog_comment', + crudify :'refinery/blog/comment', :title_attribute => :name, :order => 'published_at DESC' def index - @blog_comments = Refinery::BlogComment.unmoderated.page(params[:page]) + @blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) render :action => 'index' end def approved unless params[:id].present? - @blog_comments = Refinery::BlogComment.approved.page(params[:page]) + @blog_comments = Refinery::Blog::Comment.approved.page(params[:page]) render :action => 'index' else - @blog_comment = Refinery::BlogComment.find(params[:id]) + @blog_comment = Refinery::Blog::Comment.find(params[:id]) @blog_comment.approve! flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) @@ -31,11 +31,11 @@ module Refinery def rejected unless params[:id].present? - @blog_comments = Refinery::BlogComment.rejected.page(params[:page]) + @blog_comments = Refinery::Blog::Comment.rejected.page(params[:page]) render :action => 'index' else - @blog_comment = Refinery::BlogComment.find(params[:id]) + @blog_comment = Refinery::Blog::Comment.find(params[:id]) @blog_comment.reject! flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index 62b6949..aa40c85 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -2,20 +2,21 @@ module Refinery module Admin module Blog class PostsController < ::Refinery::AdminController - + cache_sweeper Refinery::BlogSweeper - crudify :'refinery/blog_post', + crudify :'refinery/blog/post', :title_attribute => :title, - :order => 'published_at DESC' - + :order => 'published_at DESC', + :redirect_to_url => "main_app.refinery_admin_blog_posts_path" + before_filter :find_all_categories, :only => [:new, :edit, :create, :update] - before_filter :check_category_ids, :only => :update + before_filter :check_category_ids, :only => :update def uncategorized - @blog_posts = Refinery::BlogPost.uncategorized.page(params[:page]) + @blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page]) end def tags @@ -31,7 +32,7 @@ module Refinery else '%' end - @tags = Refinery::BlogPost.tag_counts_on(:tags).where( + @tags = Refinery::Blog::Post.tag_counts_on(:tags).where( ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"] ).map { |tag| {:id => tag.id, :value => tag.name}} render :json => @tags.flatten @@ -39,19 +40,19 @@ module Refinery def create # if the position field exists, set this object as last object, given the conditions of this class. - if Refinery::BlogPost.column_names.include?("position") + if Refinery::Blog::Post.column_names.include?("position") params[:blog_post].merge!({ - :position => ((Refinery::BlogPost.maximum(:position, :conditions => "")||-1) + 1) + :position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1) }) end - if Refinery::BlogPost.column_names.include?("user_id") + if Refinery::Blog::Post.column_names.include?("user_id") params[:blog_post].merge!({ :user_id => current_refinery_user.id }) end - if (@blog_post = Refinery::BlogPost.create(params[:blog_post])).valid? + if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid? (request.xhr? ? flash.now : flash).notice = t( 'refinery.crudify.created', :what => "'#{@blog_post.title}'" @@ -85,7 +86,7 @@ module Refinery protected def find_all_categories - @blog_categories = Refinery::BlogCategory.find(:all) + @blog_categories = Refinery::Blog::Category.find(:all) end def check_category_ids diff --git a/app/controllers/refinery/admin/blog/settings_controller.rb b/app/controllers/refinery/admin/blog/settings_controller.rb index 1894ac6..ee71393 100644 --- a/app/controllers/refinery/admin/blog/settings_controller.rb +++ b/app/controllers/refinery/admin/blog/settings_controller.rb @@ -4,12 +4,12 @@ module Refinery class SettingsController < ::Refinery::AdminController def notification_recipients - @recipients = Refinery::BlogComment::Notification.recipients + @recipients = Refinery::Blog::Comment::Notification.recipients if request.post? - Refinery::BlogComment::Notification.recipients = params[:recipients] + Refinery::Blog::Comment::Notification.recipients = params[:recipients] flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients', - :recipients => Refinery::BlogComment::Notification.recipients) + :recipients => Refinery::Blog::Comment::Notification.recipients) unless request.xhr? or from_dialog? redirect_back_or_default(admin_blog_posts_path) else @@ -20,7 +20,7 @@ module Refinery end def moderation - enabled = Refinery::BlogComment::Moderation.toggle! + enabled = Refinery::Blog::Comment::Moderation.toggle! unless request.xhr? redirect_back_or_default(admin_blog_posts_path) else @@ -30,7 +30,7 @@ module Refinery end def comments - enabled = Refinery::BlogComment.toggle! + enabled = Refinery::Blog::Comment.toggle! unless request.xhr? redirect_back_or_default(admin_blog_posts_path) else @@ -40,7 +40,7 @@ module Refinery end def teasers - enabled = Refinery::BlogPost.teaser_enabled_toggle! + enabled = Refinery::Blog::Post.teaser_enabled_toggle! unless request.xhr? redirect_back_or_default(admin_blog_posts_path) else diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/base_controller.rb index 01892d1..919c180 100644 --- a/app/controllers/refinery/blog/base_controller.rb +++ b/app/controllers/refinery/blog/base_controller.rb @@ -4,7 +4,7 @@ module Refinery include ControllerHelper - helper :'refinery/blog_posts' + helper :'refinery/blog/posts' before_filter :find_page, :find_all_blog_categories protected diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index 80e54d9..60c8346 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -3,8 +3,8 @@ module Refinery class CategoriesController < BaseController def show - @category = Refinery::BlogCategory.find(params[:id]) - @blog_posts = @category.posts.live.includes(:comments, :categories).page(params[:page]) + @blog_category = Refinery::Blog::Category.find(params[:id]) + @blog_posts = @blog_category.posts.live.includes(:comments, :categories).page(params[:page]) end end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 7b09329..d3cd7a1 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -12,7 +12,7 @@ module Refinery def index # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).all) if request.format.rss? + (@blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).all) if request.format.rss? respond_with (@blog_posts) do |format| format.html format.rss @@ -20,7 +20,7 @@ module Refinery end def show - @blog_comment = Refinery::BlogComment.new + @blog_comment = Refinery::Blog::Comment.new respond_with (@blog_post) do |format| format.html { present(@blog_post) } @@ -30,7 +30,7 @@ module Refinery def comment if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? - if Refinery::BlogComment::Moderation.enabled? or @blog_comment.ham? + if Refinery::Blog::Comment::Moderation.enabled? or @blog_comment.ham? begin Refinery::Blog::CommentMailer.notification(@blog_comment, request).deliver rescue @@ -38,7 +38,7 @@ module Refinery end end - if Refinery::BlogComment::Moderation.enabled? + if Refinery::Blog::Comment::Moderation.enabled? flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments') redirect_to main_app.blog_post_url(params[:id]) else @@ -56,12 +56,12 @@ module Refinery date = "#{params[:month]}/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') - @blog_posts = Refinery::BlogPost.live.by_archive(@archive_date).page(params[:page]) + @blog_posts = Refinery::Blog::Post.live.by_archive(@archive_date).page(params[:page]) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') - @blog_posts = Refinery::BlogPost.live.by_year(@archive_date).page(params[:page]) + @blog_posts = Refinery::Blog::Post.live.by_year(@archive_date).page(params[:page]) end respond_with (@blog_posts) end @@ -69,7 +69,7 @@ module Refinery def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @blog_posts = Refinery::BlogPost.tagged_with(@tag_name).page(params[:page]) + @blog_posts = Refinery::Blog::Post.tagged_with(@tag_name).page(params[:page]) end end end diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index c1c2a6a..035275c 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -5,9 +5,9 @@ module Refinery protected def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + unless (@blog_post = Refinery::Blog::Post.find(params[:id])).try(:live?) if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) + @blog_post = Refinery::Blog::Post.find(params[:id]) else error_404 end @@ -15,15 +15,15 @@ module Refinery end def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + @blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page]) end def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) + @tags = Refinery::Blog::Post.tag_counts_on(:tags) end def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all + @blog_categories = Refinery::Blog::Category.all end end end diff --git a/app/helpers/refinery/blog/posts_helper.rb b/app/helpers/refinery/blog/posts_helper.rb new file mode 100644 index 0000000..418f360 --- /dev/null +++ b/app/helpers/refinery/blog/posts_helper.rb @@ -0,0 +1,51 @@ +module Refinery + module Blog + module PostsHelper + def blog_archive_widget + posts = Refinery::Blog::Post.select('published_at').all_previous + return nil if posts.blank? + + render :partial => "/refinery/blog/widgets/blog_archive", :locals => { :posts => posts } + end + alias_method :blog_archive_list, :blog_archive_widget + + def next_or_previous?(post) + post.next.present? or post.prev.present? + end + + def blog_post_teaser_enabled? + Refinery::Blog::Post.teasers_enabled? + end + + def blog_post_teaser(post) + if post.respond_to?(:custom_teaser) && post.custom_teaser.present? + post.custom_teaser.html_safe + else + truncate(post.body, { + :length => Refinery::Setting.find_or_set(:blog_post_teaser_length, 250), + :preserve_html_tags => true + }).html_safe + end + end + + def archive_link(post) + if post.published_at >= Time.now.end_of_year.advance(:years => -3) + post_date = post.published_at.strftime('%m/%Y') + year = post_date.split('/')[1] + month = post_date.split('/')[0] + count = Blog::Post.by_archive(Time.parse(post_date)).size + text = t("date.month_names")[month.to_i] + " #{year} (#{count})" + + link_to(text, main_app.archive_blog_posts_path(:year => year, :month => month)) + else + post_date = post.published_at.strftime('01/%Y') + year = post_date.split('/')[1] + count = Refinery::Blog::Post.by_year(Time.parse(post_date)).size + text = "#{year} (#{count})" + + link_to(text, main_app.archive_blog_posts_path(:year => year)) + end + end + end + end +end \ No newline at end of file diff --git a/app/helpers/refinery/blog_posts_helper.rb b/app/helpers/refinery/blog_posts_helper.rb deleted file mode 100644 index bfc3f40..0000000 --- a/app/helpers/refinery/blog_posts_helper.rb +++ /dev/null @@ -1,49 +0,0 @@ -module Refinery - module BlogPostsHelper - def blog_archive_widget - posts = Refinery::BlogPost.select('published_at').all_previous - return nil if posts.blank? - - render :partial => "/refinery/blog/widgets/blog_archive", :locals => { :posts => posts } - end - alias_method :blog_archive_list, :blog_archive_widget - - def next_or_previous?(post) - post.next.present? or post.prev.present? - end - - def blog_post_teaser_enabled? - Refinery::BlogPost.teasers_enabled? - end - - def blog_post_teaser(post) - if post.respond_to?(:custom_teaser) && post.custom_teaser.present? - post.custom_teaser.html_safe - else - truncate(post.body, { - :length => Refinery::Setting.find_or_set(:blog_post_teaser_length, 250), - :preserve_html_tags => true - }).html_safe - end - end - - def archive_link(post) - if post.published_at >= Time.now.end_of_year.advance(:years => -3) - post_date = post.published_at.strftime('%m/%Y') - year = post_date.split('/')[1] - month = post_date.split('/')[0] - count = BlogPost.by_archive(Time.parse(post_date)).size - text = t("date.month_names")[month.to_i] + " #{year} (#{count})" - - link_to(text, main_app.archive_blog_posts_path(:year => year, :month => month)) - else - post_date = post.published_at.strftime('01/%Y') - year = post_date.split('/')[1] - count = Refinery::BlogPost.by_year(Time.parse(post_date)).size - text = "#{year} (#{count})" - - link_to(text, main_app.archive_blog_posts_path(:year => year)) - end - end - end -end diff --git a/app/mailers/refinery/blog/comment_mailer.rb b/app/mailers/refinery/blog/comment_mailer.rb index f36ea29..dabc9e6 100644 --- a/app/mailers/refinery/blog/comment_mailer.rb +++ b/app/mailers/refinery/blog/comment_mailer.rb @@ -3,11 +3,11 @@ module Refinery class CommentMailer < ActionMailer::Base def notification(comment, request) - subject BlogComment::Notification.subject - recipients BlogComment::Notification.recipients + subject Blog::Comment::Notification.subject + recipients Blog::Comment::Notification.recipients from "\"#{RefinerySetting[:site_name]}\" " sent_on Time.now - @comment = comment + @blog_comment = comment end end diff --git a/app/models/refinery/blog/category.rb b/app/models/refinery/blog/category.rb new file mode 100644 index 0000000..dc85b50 --- /dev/null +++ b/app/models/refinery/blog/category.rb @@ -0,0 +1,26 @@ +module Refinery + module Blog + class Category < ActiveRecord::Base + + has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_category_id + has_many :posts, :through => :categorizations, :source => :blog_post + + acts_as_indexed :fields => [:title] + + validates :title, :presence => true, :uniqueness => true + + has_friendly_id :title, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') + + def post_count + posts.select(&:live?).count + end + + # how many items to show per page + self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + + end + end +end \ No newline at end of file diff --git a/app/models/refinery/blog/comment.rb b/app/models/refinery/blog/comment.rb new file mode 100644 index 0000000..55a67ba --- /dev/null +++ b/app/models/refinery/blog/comment.rb @@ -0,0 +1,125 @@ +module Refinery + module Blog + class Comment < ActiveRecord::Base + + attr_accessible :name, :email, :message + + filters_spam :author_field => :name, + :email_field => :email, + :message_field => :body + + belongs_to :post, :class_name => 'Refinery::Blog::Post', :foreign_key => 'blog_post_id' + + acts_as_indexed :fields => [:name, :email, :message] + + alias_attribute :message, :body + + validates :name, :message, :presence => true + validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } + + scope :unmoderated, :conditions => {:state => nil} + scope :approved, :conditions => {:state => 'approved'} + scope :rejected, :conditions => {:state => 'rejected'} + + self.per_page = Refinery::Setting.find_or_set(:blog_comments_per_page, 10) + + def avatar_url(options = {}) + options = {:size => 60} + require 'digest/md5' + size = ("?s=#{options[:size]}" if options[:size]) + "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" + end + + def approve! + self.update_attribute(:state, 'approved') + end + + def reject! + self.update_attribute(:state, 'rejected') + end + + def rejected? + self.state == 'rejected' + end + + def approved? + self.state == 'approved' + end + + def unmoderated? + self.state.nil? + end + + def self.toggle! + currently = Refinery::Setting.find_or_set(:comments_allowed, true, { + :scoping => 'blog' + }) + Refinery::Setting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'}) + end + + before_create do |comment| + unless Moderation.enabled? + comment.state = comment.ham? ? 'approved' : 'rejected' + end + end + + module Moderation + class << self + def enabled? + Refinery::Setting.find_or_set(:comment_moderation, true, { + :scoping => 'blog', + :restricted => false + }) + end + + def toggle! + new_value = { + :value => !Blog::Comment::Moderation.enabled?, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_moderation, new_value) + end + end + end + + module Notification + class << self + def recipients + Refinery::Setting.find_or_set(:comment_notification_recipients, (Refinery::Role[:refinery].users.first.email rescue ''), + { + :scoping => 'blog', + :restricted => false + }) + end + + def recipients=(emails) + new_value = { + :value => emails, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_notification_recipients, new_value) + end + + def subject + Refinery::Setting.find_or_set(:comment_notification_subject, "New inquiry from your website", { + :scoping => 'blog', + :restricted => false + }) + end + + def subject=(subject_line) + new_value = { + :value => subject_line, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_notification_subject, new_value) + end + end + end + + end + end +end \ No newline at end of file diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb new file mode 100644 index 0000000..883f4fc --- /dev/null +++ b/app/models/refinery/blog/post.rb @@ -0,0 +1,114 @@ +require 'acts-as-taggable-on' +require 'seo_meta' + +module Refinery + module Blog + class Post < ActiveRecord::Base + + is_seo_meta if self.table_exists? + + default_scope :order => 'published_at DESC' + #.first & .last will be reversed -- consider a with_exclusive_scope on these? + + belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true + + has_many :comments, :class_name => 'Refinery::Blog::Comment', :dependent => :destroy, :foreign_key => :blog_post_id + acts_as_taggable + + has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_post_id + has_many :categories, :through => :categorizations, :source => :blog_category + + acts_as_indexed :fields => [:title, :body] + + validates :title, :presence => true, :uniqueness => true + validates :body, :presence => true + + has_friendly_id :friendly_id_source, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') + + scope :by_archive, lambda { |archive_date| + where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) + } + + scope :by_year, lambda { |archive_year| + where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) + } + + scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } + + scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } + + scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } + + scope :uncategorized, lambda { + live.includes(:categories).where(:categories => { Refinery::Categorization.table_name => { :blog_category_id => nil } }) + } + + attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url + attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids + + self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + + def next + self.class.next(self).first + end + + def prev + self.class.previous(self).first + end + + def live? + !draft and published_at <= Time.now + end + + def category_ids=(ids) + self.categories = ids.reject{|id| id.blank?}.collect {|c_id| + Refinery::Blog::Category.find(c_id.to_i) rescue nil + }.compact + end + + def friendly_id_source + custom_url.present? ? custom_url : title + end + + class << self + def next(current_record) + self.send(:with_exclusive_scope) do + where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") + end + end + + def comments_allowed? + Refinery::Setting.find_or_set(:comments_allowed, true, :scoping => 'blog') + end + + def teasers_enabled? + Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') + end + + def teaser_enabled_toggle! + currently = Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') + Refinery::Setting.set(:teasers_enabled, :value => !currently, :scoping => 'blog') + end + end + + module ShareThis + DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + + class << self + def key + Refinery::Setting.find_or_set(:share_this_key, Blog::Post::ShareThis::DEFAULT_KEY, :scoping => 'blog') + end + + def enabled? + key = Blog::Post::ShareThis.key + key.present? and key != Blog::Post::ShareThis::DEFAULT_KEY + end + end + end + + end + end +end \ No newline at end of file diff --git a/app/models/refinery/blog_category.rb b/app/models/refinery/blog_category.rb deleted file mode 100644 index 3f10d92..0000000 --- a/app/models/refinery/blog_category.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Refinery - class BlogCategory < ActiveRecord::Base - - has_many :categorizations, :dependent => :destroy - has_many :posts, :through => :categorizations, :source => :blog_post - - acts_as_indexed :fields => [:title] - - validates :title, :presence => true, :uniqueness => true - - has_friendly_id :title, :use_slug => true, - :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), - :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - - def post_count - posts.select(&:live?).count - end - - # how many items to show per page - self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) - - end -end diff --git a/app/models/refinery/blog_comment.rb b/app/models/refinery/blog_comment.rb deleted file mode 100644 index f7c1c84..0000000 --- a/app/models/refinery/blog_comment.rb +++ /dev/null @@ -1,135 +0,0 @@ -module Refinery - class BlogComment < ActiveRecord::Base - - attr_accessible :name, :email, :message - - filters_spam :author_field => :name, - :email_field => :email, - :message_field => :body - - belongs_to :post, :class_name => 'Refinery::BlogPost', :foreign_key => 'blog_post_id' - - acts_as_indexed :fields => [:name, :email, :message] - - alias_attribute :message, :body - - validates :name, :message, :presence => true - validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } - - scope :unmoderated, :conditions => {:state => nil} - scope :approved, :conditions => {:state => 'approved'} - scope :rejected, :conditions => {:state => 'rejected'} - - self.per_page = Setting.find_or_set(:blog_comments_per_page, 10) - - def avatar_url(options = {}) - options = {:size => 60} - require 'digest/md5' - size = ("?s=#{options[:size]}" if options[:size]) - "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" - end - - def approve! - self.update_attribute(:state, 'approved') - end - - def reject! - self.update_attribute(:state, 'rejected') - end - - def rejected? - self.state == 'rejected' - end - - def approved? - self.state == 'approved' - end - - def unmoderated? - self.state.nil? - end - - def self.toggle! - currently = Refinery::Setting.find_or_set(:comments_allowed, true, { - :scoping => 'blog' - }) - Refinery::Setting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'}) - end - - before_create do |comment| - unless Moderation.enabled? - comment.state = comment.ham? ? 'approved' : 'rejected' - end - end - - module Moderation - class << self - def enabled? - Refinery::Setting.find_or_set(:comment_moderation, true, { - :scoping => 'blog', - :restricted => false - }) - end - - def toggle! - new_value = { - :value => !BlogComment::Moderation.enabled?, - :scoping => 'blog', - :restricted => false - } - if Refinery::Setting.respond_to?(:set) - Refinery::Setting.set(:comment_moderation, new_value) - else - Refinery::Setting[:comment_moderation] = new_value - end - end - end - end - - module Notification - class << self - def recipients - Refinery::Setting.find_or_set(:comment_notification_recipients, (Refinery::Role[:refinery].users.first.email rescue ''), - { - :scoping => 'blog', - :restricted => false - }) - end - - def recipients=(emails) - new_value = { - :value => emails, - :scoping => 'blog', - :restricted => false - } - if Refinery::Setting.respond_to?(:set) - Refinery::Setting.set(:comment_notification_recipients, new_value) - else - Refinery::Setting[:comment_notification_recipients] = new_value - end - end - - def subject - Refinery::Setting.find_or_set(:comment_notification_subject, "New inquiry from your website", { - :scoping => 'blog', - :restricted => false - }) - end - - def subject=(subject_line) - new_value = { - :value => subject_line, - :scoping => 'blog', - :restricted => false - } - if Refinery::Setting.respond_to?(:set) - Refinery::Setting.set(:comment_notification_subject, new_value) - else - Refinery::Setting[:comment_notification_subject] = new_value - end - end - end - end - - end -end \ No newline at end of file diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb deleted file mode 100644 index 8cd3dd9..0000000 --- a/app/models/refinery/blog_post.rb +++ /dev/null @@ -1,112 +0,0 @@ -require 'acts-as-taggable-on' -require 'seo_meta' - -module Refinery - class BlogPost < ActiveRecord::Base - - is_seo_meta if self.table_exists? - - default_scope :order => 'published_at DESC' - #.first & .last will be reversed -- consider a with_exclusive_scope on these? - - belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true - - has_many :comments, :class_name => 'Refinery::BlogComment', :dependent => :destroy - acts_as_taggable - - has_many :categorizations, :dependent => :destroy - has_many :categories, :through => :categorizations, :source => :blog_category - - acts_as_indexed :fields => [:title, :body] - - validates :title, :presence => true, :uniqueness => true - validates :body, :presence => true - - has_friendly_id :friendly_id_source, :use_slug => true, - :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), - :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - - scope :by_archive, lambda { |archive_date| - where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) - } - - scope :by_year, lambda { |archive_year| - where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) - } - - scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } - - scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } - - scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } - - scope :uncategorized, lambda { - live.includes(:categories).where(:categories => { Refinery::Categorization.table_name => { :blog_category_id => nil } }) - } - - attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url - attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids - - self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) - - def next - BlogPost.next(self).first - end - - def prev - BlogPost.previous(self).first - end - - def live? - !draft and published_at <= Time.now - end - - def category_ids=(ids) - self.categories = ids.reject{|id| id.blank?}.collect {|c_id| - Refinery::BlogCategory.find(c_id.to_i) rescue nil - }.compact - end - - def friendly_id_source - custom_url.present? ? custom_url : title - end - - class << self - def next(current_record) - self.send(:with_exclusive_scope) do - where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") - end - end - - def comments_allowed? - Refinery::Setting.find_or_set(:comments_allowed, true, :scoping => 'blog') - end - - def teasers_enabled? - Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') - end - - def teaser_enabled_toggle! - currently = Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') - Refinery::Setting.set(:teasers_enabled, :value => !currently, :scoping => 'blog') - end - end - - module ShareThis - DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - - class << self - def key - Refinery::Setting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, :scoping => 'blog') - end - - def enabled? - key = BlogPost::ShareThis.key - key.present? and key != BlogPost::ShareThis::DEFAULT_KEY - end - end - end - - end -end diff --git a/app/models/refinery/categorization.rb b/app/models/refinery/categorization.rb index c4feaec..97f0928 100644 --- a/app/models/refinery/categorization.rb +++ b/app/models/refinery/categorization.rb @@ -2,8 +2,8 @@ module Refinery class Categorization < ActiveRecord::Base set_table_name 'refinery_blog_categories_blog_posts' - belongs_to :blog_post - belongs_to :blog_category + belongs_to :blog_post, :class_name => 'Refinery::Blog::Post', :foreign_key => :blog_post_id + belongs_to :blog_category, :class_name => 'Refinery::Blog::Category', :foreign_key => :blog_category_id end end \ No newline at end of file diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb index ceed5fa..a58ac7e 100644 --- a/app/sweepers/refinery/blog_sweeper.rb +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -1,26 +1,26 @@ module Refinery class BlogSweeper < ActionController::Caching::Sweeper - observe BlogPost, BlogComment - + observe Blog::Post, Blog::Comment + def after_create(record) expire_cache_for(record) end - + def after_update(record) expire_cache_for(record) end - + def after_destroy(record) expire_cache_for(record) end - + private - + def expire_cache_for(record) # TODO: Convert these to url helpers expire_page '/blog' expire_page '/blog/feed.rss' end - + end end diff --git a/app/views/refinery/admin/blog/_submenu.html.erb b/app/views/refinery/admin/blog/_submenu.html.erb index 799c101..2915610 100644 --- a/app/views/refinery/admin/blog/_submenu.html.erb +++ b/app/views/refinery/admin/blog/_submenu.html.erb @@ -26,11 +26,11 @@ :class => 'page_add_icon' %> - <% if Refinery::BlogPost.comments_allowed? %> + <% if Refinery::Blog::Post.comments_allowed? %>
  • <%= link_to t('.settings.comments'), main_app.comments_refinery_admin_blog_settings_path, - :class => "#{Refinery::BlogPost.comments_allowed? ? 'success' : 'failure'}_icon" %> + :class => "#{Refinery::Blog::Post.comments_allowed? ? 'success' : 'failure'}_icon" %>
  • <%= link_to t('.settings.moderation'), main_app.moderation_refinery_admin_blog_settings_path, - :class => "#{Refinery::BlogComment::Moderation.enabled? ? 'success' : 'failure'}_icon" %> + :class => "#{Refinery::Blog::Comment::Moderation.enabled? ? 'success' : 'failure'}_icon" %>
  • <%= link_to t('.settings.update_notified'), @@ -87,7 +87,7 @@
  • <%= link_to t('.settings.teasers'), - main_app.teasers_refinery_admin_blog_settings_path, :class => "#{Refinery::BlogPost.teasers_enabled? ? 'success' : 'failure'}_icon" %> + main_app.teasers_refinery_admin_blog_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %>
diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/admin/blog/posts/_form.html.erb index 8a3b091..822ec8a 100644 --- a/app/views/refinery/admin/blog/posts/_form.html.erb +++ b/app/views/refinery/admin/blog/posts/_form.html.erb @@ -27,7 +27,6 @@
- <% part_index = -1 %> <%= render :partial => 'form_part', :locals => { diff --git a/app/views/refinery/blog/categories/show.html.erb b/app/views/refinery/blog/categories/show.html.erb index adcf1aa..00d9596 100644 --- a/app/views/refinery/blog/categories/show.html.erb +++ b/app/views/refinery/blog/categories/show.html.erb @@ -1,4 +1,4 @@ -<% content_for :body_content_title, @category.title %> +<% content_for :body_content_title, @blog_category.title %> <% content_for :body_content_left do %> <% if @blog_posts.any? %> diff --git a/app/views/refinery/blog/comment_mailer/notification.html.erb b/app/views/refinery/blog/comment_mailer/notification.html.erb index 800f12c..0c7dcd4 100644 --- a/app/views/refinery/blog/comment_mailer/notification.html.erb +++ b/app/views/refinery/blog/comment_mailer/notification.html.erb @@ -4,10 +4,10 @@ <%=raw t('.comment_starts') %> -<%=raw t('.from') %>: <%= @comment.name %> -<%=raw t('.email') %>: <%= @comment.email %> +<%=raw t('.from') %>: <%= @blog_comment.name %> +<%=raw t('.email') %>: <%= @blog_comment.email %> <%=raw t('.message') %>: -<%=simple_format strip_tags(@comment.body) %> +<%=simple_format strip_tags(@blog_comment.body) %> <%=raw t('.comment_ends') %> diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb index f86f63a..cbecc5f 100644 --- a/app/views/refinery/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -23,7 +23,7 @@ <%= @blog_post.body.html_safe %> - <% if Refinery::BlogPost::ShareThis.enabled? %> + <% if Refinery::Blog::Post::ShareThis.enabled? %> <% end %> diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb index 020c964..2ca168e 100644 --- a/app/views/refinery/blog/posts/show.html.erb +++ b/app/views/refinery/blog/posts/show.html.erb @@ -3,7 +3,7 @@ <%= render 'post' %>
- <% if Refinery::BlogPost.comments_allowed? %> + <% if Refinery::Blog::Post.comments_allowed? %> <%= render 'comments'%> <% end %> <% end %> @@ -17,5 +17,5 @@ <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> <%#= javascript_include_tag('refinery/blog/frontend') %> - -<% end if Refinery::BlogPost::ShareThis.enabled? %> + +<% end if Refinery::Blog::Post::ShareThis.enabled? %> diff --git a/app/views/refinery/blog/shared/_categories.html.erb b/app/views/refinery/blog/shared/_categories.html.erb index 295cae0..1280cd2 100644 --- a/app/views/refinery/blog/shared/_categories.html.erb +++ b/app/views/refinery/blog/shared/_categories.html.erb @@ -2,7 +2,7 @@

<%= t('.title') %>

    <% @blog_categories.each do |category| %> - > + > <%= link_to "#{category.title} (#{category.post_count})", main_app.blog_category_path(category) %> <% end %> diff --git a/app/views/refinery/blog/shared/_post.html.erb b/app/views/refinery/blog/shared/_post.html.erb index 18271ec..c384bcb 100644 --- a/app/views/refinery/blog/shared/_post.html.erb +++ b/app/views/refinery/blog/shared/_post.html.erb @@ -33,7 +33,7 @@ <%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), main_app.blog_post_path(post) if blog_post_teaser_enabled? %>

@@ -14,15 +14,15 @@ :class => 'page_copy_icon' %>
  • - <%= link_to t('.posts.manage'), main_app.refinery_admin_blog_posts_path, + <%= link_to t('.posts.manage'), main_app.refinery_blog_admin_posts_path, :class => 'page_icon' %>
  • - <%= link_to t('.posts.uncategorized'), main_app.uncategorized_refinery_admin_blog_posts_path, + <%= link_to t('.posts.uncategorized'), main_app.uncategorized_refinery_blog_admin_posts_path, :class => 'page_icon' %>
  • - <%= link_to t('.posts.new'), main_app.new_refinery_admin_blog_post_path, + <%= link_to t('.posts.new'), main_app.new_refinery_blog_admin_post_path, :class => 'page_add_icon' %>
  • @@ -38,15 +38,15 @@ :class => 'comments_icon' %>
  • - <%= link_to t('.comments.new'), main_app.refinery_admin_blog_comments_path, + <%= link_to t('.comments.new'), main_app.refinery_blog_admin_comments_path, :class => 'comment_icon' %>
  • - <%= link_to t('.comments.approved'), main_app.approved_refinery_admin_blog_comments_path, + <%= link_to t('.comments.approved'), main_app.approved_refinery_blog_admin_comments_path, :class => 'comment_tick_icon' %>
  • - <%= link_to t('.comments.rejected'), main_app.rejected_refinery_admin_blog_comments_path, + <%= link_to t('.comments.rejected'), main_app.rejected_refinery_blog_admin_comments_path, :class => 'comment_cross_icon' %>
  • @@ -58,36 +58,36 @@ :class => 'folder_icon' %>
  • - <%= link_to t('.categories.manage'), main_app.refinery_admin_blog_categories_path, + <%= link_to t('.categories.manage'), main_app.refinery_blog_admin_categories_path, :class => 'folder_edit_icon' %>
  • - <%= link_to t('.categories.new'), main_app.new_refinery_admin_blog_category_path(:dialog => true, :height => 325), + <%= link_to t('.categories.new'), main_app.new_refinery_blog_admin_category_path(:dialog => true, :height => 325), :class => 'folder_add_icon' %>
    • - <%= link_to t('.settings.comments'), main_app.comments_refinery_admin_blog_settings_path, + <%= link_to t('.settings.comments'), main_app.comments_refinery_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.comments_allowed? ? 'success' : 'failure'}_icon" %>
    • - <%= link_to t('.settings.moderation'), main_app.moderation_refinery_admin_blog_settings_path, + <%= link_to t('.settings.moderation'), main_app.moderation_refinery_blog_admin_settings_path, :class => "#{Refinery::Blog::Comment::Moderation.enabled? ? 'success' : 'failure'}_icon" %>
    • <%= link_to t('.settings.update_notified'), - main_app.notification_recipients_refinery_admin_blog_settings_path(:dialog => true, :height => 400), + main_app.notification_recipients_refinery_blog_admin_settings_path(:dialog => true, :height => 400), :class => 'user_comment_icon' %>
    • <%= link_to t('.settings.teasers'), - main_app.teasers_refinery_admin_blog_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %> + main_app.teasers_refinery_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %>
    diff --git a/app/views/refinery/admin/blog/categories/_category.html.erb b/app/views/refinery/blog/admin/categories/_category.html.erb similarity index 88% rename from app/views/refinery/admin/blog/categories/_category.html.erb rename to app/views/refinery/blog/admin/categories/_category.html.erb index 80cc2e3..d476439 100644 --- a/app/views/refinery/admin/blog/categories/_category.html.erb +++ b/app/views/refinery/blog/admin/categories/_category.html.erb @@ -5,11 +5,11 @@ <%= link_to refinery_icon_tag("application_edit.png"), - main_app.edit_refinery_admin_blog_category_path(category, + main_app.edit_refinery_blog_admin_category_path(category, :dialog => true, :height => 325), :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_admin_blog_category_path(category), + <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_blog_admin_category_path(category), :class => "cancel confirm-delete", :title => t('.delete'), :method => :delete, diff --git a/app/views/refinery/admin/blog/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb similarity index 100% rename from app/views/refinery/admin/blog/categories/_form.html.erb rename to app/views/refinery/blog/admin/categories/_form.html.erb diff --git a/app/views/refinery/admin/blog/categories/_sortable_list.html.erb b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb similarity index 100% rename from app/views/refinery/admin/blog/categories/_sortable_list.html.erb rename to app/views/refinery/blog/admin/categories/_sortable_list.html.erb diff --git a/app/views/refinery/admin/blog/categories/edit.html.erb b/app/views/refinery/blog/admin/categories/edit.html.erb similarity index 100% rename from app/views/refinery/admin/blog/categories/edit.html.erb rename to app/views/refinery/blog/admin/categories/edit.html.erb diff --git a/app/views/refinery/admin/blog/categories/index.html.erb b/app/views/refinery/blog/admin/categories/index.html.erb similarity index 100% rename from app/views/refinery/admin/blog/categories/index.html.erb rename to app/views/refinery/blog/admin/categories/index.html.erb diff --git a/app/views/refinery/admin/blog/categories/new.html.erb b/app/views/refinery/blog/admin/categories/new.html.erb similarity index 100% rename from app/views/refinery/admin/blog/categories/new.html.erb rename to app/views/refinery/blog/admin/categories/new.html.erb diff --git a/app/views/refinery/admin/blog/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb similarity index 86% rename from app/views/refinery/admin/blog/comments/_comment.html.erb rename to app/views/refinery/blog/admin/comments/_comment.html.erb index f5eba4d..51f2996 100644 --- a/app/views/refinery/admin/blog/comments/_comment.html.erb +++ b/app/views/refinery/blog/admin/comments/_comment.html.erb @@ -8,13 +8,13 @@ main_app.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), :title => t('.view_live_html'), :target => "_blank" unless comment.unmoderated? %> - <%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_admin_blog_comment_path(comment), + <%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_blog_admin_comment_path(comment), :title => t('.read') %> <%= link_to refinery_icon_tag("cross.png"), - main_app.rejected_refinery_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + main_app.rejected_refinery_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.reject') unless comment.rejected? %> <%= link_to refinery_icon_tag("tick.png"), - main_app.approved_refinery_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + main_app.approved_refinery_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.approve') unless comment.approved? %> diff --git a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb similarity index 100% rename from app/views/refinery/admin/blog/comments/_sortable_list.html.erb rename to app/views/refinery/blog/admin/comments/_sortable_list.html.erb diff --git a/app/views/refinery/admin/blog/comments/index.html.erb b/app/views/refinery/blog/admin/comments/index.html.erb similarity index 100% rename from app/views/refinery/admin/blog/comments/index.html.erb rename to app/views/refinery/blog/admin/comments/index.html.erb diff --git a/app/views/refinery/admin/blog/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb similarity index 83% rename from app/views/refinery/admin/blog/comments/show.html.erb rename to app/views/refinery/blog/admin/comments/show.html.erb index 3dc50ff..2aa75f1 100644 --- a/app/views/refinery/admin/blog/comments/show.html.erb +++ b/app/views/refinery/blog/admin/comments/show.html.erb @@ -6,14 +6,14 @@

    <%= t('.actions') %>

    • - <%= link_to t('.back'), main_app.refinery_admin_blog_comments_path, :class => "back_icon" %> + <%= link_to t('.back'), main_app.refinery_blog_admin_comments_path, :class => "back_icon" %>
    • - <%= link_to t('.reject'), main_app.rejected_refinery_admin_blog_comment_path(@blog_comment, :return_to => 'rejected'), + <%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'rejected'), :class => 'comment_cross_icon' unless @blog_comment.rejected? %>
    • - <%= link_to t('.approve'), main_app.approved_refinery_admin_blog_comment_path(@blog_comment, :return_to => 'approved'), + <%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'approved'), :class => 'comment_tick_icon' unless @blog_comment.approved? %>
    diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb similarity index 98% rename from app/views/refinery/admin/blog/posts/_form.html.erb rename to app/views/refinery/blog/admin/posts/_form.html.erb index f20c0cc..656c9c6 100644 --- a/app/views/refinery/admin/blog/posts/_form.html.erb +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -113,4 +113,4 @@ <% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> <% content_for :javascripts, javascript_include_tag('refinery/blog/backend') %> -<%= render 'refinery/shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => main_app.tags_refinery_admin_blog_posts_url %> +<%= render 'refinery/shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => main_app.tags_refinery_blog_admin_posts_url %> diff --git a/app/views/refinery/admin/blog/posts/_form_part.html.erb b/app/views/refinery/blog/admin/posts/_form_part.html.erb similarity index 100% rename from app/views/refinery/admin/blog/posts/_form_part.html.erb rename to app/views/refinery/blog/admin/posts/_form_part.html.erb diff --git a/app/views/refinery/admin/blog/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb similarity index 91% rename from app/views/refinery/admin/blog/posts/_post.html.erb rename to app/views/refinery/blog/admin/posts/_post.html.erb index 28704ff..c8baa80 100644 --- a/app/views/refinery/admin/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -10,9 +10,9 @@ <%= link_to refinery_icon_tag("application_go.png"), main_app.blog_post_path(post), :title => t('.view_live_html'), :target => "_blank" %> - <%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_admin_blog_post_path(post), + <%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_blog_admin_post_path(post), :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_admin_blog_post_path(post), + <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_blog_admin_post_path(post), :class => "cancel confirm-delete", :title => t('.delete'), :method => :delete, diff --git a/app/views/refinery/admin/blog/posts/_sortable_list.html.erb b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb similarity index 100% rename from app/views/refinery/admin/blog/posts/_sortable_list.html.erb rename to app/views/refinery/blog/admin/posts/_sortable_list.html.erb diff --git a/app/views/refinery/admin/blog/posts/_teaser_part.html.erb b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb similarity index 100% rename from app/views/refinery/admin/blog/posts/_teaser_part.html.erb rename to app/views/refinery/blog/admin/posts/_teaser_part.html.erb diff --git a/app/views/refinery/admin/blog/posts/edit.html.erb b/app/views/refinery/blog/admin/posts/edit.html.erb similarity index 100% rename from app/views/refinery/admin/blog/posts/edit.html.erb rename to app/views/refinery/blog/admin/posts/edit.html.erb diff --git a/app/views/refinery/admin/blog/posts/index.html.erb b/app/views/refinery/blog/admin/posts/index.html.erb similarity index 100% rename from app/views/refinery/admin/blog/posts/index.html.erb rename to app/views/refinery/blog/admin/posts/index.html.erb diff --git a/app/views/refinery/admin/blog/posts/new.html.erb b/app/views/refinery/blog/admin/posts/new.html.erb similarity index 100% rename from app/views/refinery/admin/blog/posts/new.html.erb rename to app/views/refinery/blog/admin/posts/new.html.erb diff --git a/app/views/refinery/admin/blog/posts/uncategorized.html.erb b/app/views/refinery/blog/admin/posts/uncategorized.html.erb similarity index 100% rename from app/views/refinery/admin/blog/posts/uncategorized.html.erb rename to app/views/refinery/blog/admin/posts/uncategorized.html.erb diff --git a/app/views/refinery/admin/blog/settings/notification_recipients.html.erb b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb similarity index 100% rename from app/views/refinery/admin/blog/settings/notification_recipients.html.erb rename to app/views/refinery/blog/admin/settings/notification_recipients.html.erb diff --git a/config/routes.rb b/config/routes.rb index 2ed6e8d..353d0b8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,10 +8,8 @@ Rails.application.routes.draw do match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts' get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts' - end - scope(:path => 'refinery', :as => 'refinery_admin', :module => 'admin') do - scope(:path => 'blog', :as => 'blog', :module => 'blog') do + scope(:path => 'refinery', :as => 'refinery_admin', :module => 'admin') do root :to => 'posts#index' resources :posts do collection do diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index cd764e3..47ac497 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -10,7 +10,7 @@ module Refinery Refinery::Plugin.register do |plugin| plugin.pathname = root plugin.name = "refinerycms_blog" - plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path + plugin.url = app.routes.url_helpers.refinery_blog_admin_posts_path plugin.menu_match = /refinery\/blog\/?(posts|comments|categories)?/ plugin.activity = { :class_name => :'refinery/blog/post' diff --git a/spec/requests/refinery/admin/blog/comments_spec.rb b/spec/requests/refinery/admin/blog/comments_spec.rb deleted file mode 100644 index a7367e3..0000000 --- a/spec/requests/refinery/admin/blog/comments_spec.rb +++ /dev/null @@ -1,124 +0,0 @@ -require "spec_helper" - -module Refinery - describe "AdminBlog::Comments" do - login_refinery_user - - describe "#index" do - context "when has no new unapproved comments" do - before(:each) do - Blog::Comment.delete_all - visit refinery_admin_blog_comments_path - end - - it "should list no comments" do - visit refinery_admin_blog_comments_path - - page.should have_content('there are no new comments') - end - end - - context "when has new unapproved comments" do - let!(:blog_comment) { FactoryGirl.create(:blog_comment) } - before(:each) { visit refinery_admin_blog_comments_path } - - it "should list comments" do - page.should have_content(blog_comment.body) - page.should have_content(blog_comment.name) - end - - it "should allow me to approve a comment" do - click_link "Approve this comment" - - page.should have_content("has been approved") - end - - it "should allow me to reject a comment" do - click_link "Reject this comment" - - page.should have_content("has been rejected") - end - end - end - - describe "#approved" do - context "when has no approved comments" do - before(:each) do - Blog::Comment.delete_all - visit approved_refinery_admin_blog_comments_path - end - - it "should list no comments" do - page.should have_content('there are no approved comments') - end - end - - context "when has approved comments" do - let!(:blog_comment) do - FactoryGirl.create(:blog_comment, - :state => 'approved') - end - before(:each) { visit approved_refinery_admin_blog_comments_path } - - it "should list comments" do - page.should have_content(blog_comment.body) - page.should have_content(blog_comment.name) - end - - it "should allow me to reject a comment" do - click_link "Reject this comment" - - page.should have_content("has been rejected") - end - end - end - - describe "#rejected" do - context "when has no rejected comments" do - before(:each) do - Blog::Comment.delete_all - visit rejected_refinery_admin_blog_comments_path - end - - it "should list no comments" do - page.should have_content('there are no rejected comments') - end - end - - context "when has rejected comments" do - let!(:blog_comment) do - FactoryGirl.create(:blog_comment, - :state => 'rejected') - end - before(:each) { visit rejected_refinery_admin_blog_comments_path } - - it "should list comments" do - page.should have_content(blog_comment.body) - page.should have_content(blog_comment.name) - end - - it "should allow me to approve a comment" do - click_link "Approve this comment" - - page.should have_content("has been approved") - end - end - end - - describe "#show" do - let!(:blog_comment) { FactoryGirl.create(:blog_comment) } - before(:each) { visit refinery_admin_blog_comment_path(blog_comment) } - - it "should display the comment" do - page.should have_content(blog_comment.body) - page.should have_content(blog_comment.name) - end - - it "should allow me to approve the comment" do - click_link "Approve this comment" - - page.should have_content("has been approved") - end - end - end -end diff --git a/spec/requests/refinery/admin/blog/posts_spec.rb b/spec/requests/refinery/admin/blog/posts_spec.rb deleted file mode 100644 index 53372b1..0000000 --- a/spec/requests/refinery/admin/blog/posts_spec.rb +++ /dev/null @@ -1,171 +0,0 @@ -require "spec_helper" - -module Refinery - describe "AdminBlog::Posts" do - login_refinery_user - - let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } - - context "when no blog posts" do - before(:each) { Refinery::Blog::Post.destroy_all } - - describe "blog post listing" do - before(:each) { visit refinery_admin_blog_posts_path } - - it "invites to create new post" do - page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.") - end - end - - describe "new blog post form" do - before(:each) do - visit refinery_admin_blog_posts_path - click_link "Create new post" - end - - it "should have Tags" do - page.should have_content("Tags") - end - - it "should have Video Games" do - page.should have_content(blog_category.title) - end - - describe "create blog post" do - before(:each) do - fill_in "Title", :with => "This is my blog post" - fill_in "blog_post_body", :with => "And I love it" - check blog_category.title - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "should be the only blog post" do - ::Refinery::Blog::Post.all.size.should eq(1) - end - - it "should belong to me" do - ::Refinery::Blog::Post.first.author.should eq(::Refinery::User.last) - end - - it "should save categories" do - ::Refinery::Blog::Post.last.categories.count.should eq(1) - ::Refinery::Blog::Post.last.categories.first.title.should eq(blog_category.title) - end - end - - describe "create blog post with tags" do - before(:each) do - @tag_list = "chicago, bikes, beers, babes" - fill_in "Title", :with => "This is a tagged blog post" - fill_in "blog_post_body", :with => "And I also love it" - fill_in "Tags", :with => @tag_list - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "should be the only blog post" do - ::Refinery::Blog::Post.all.size.should eq(1) - end - - it "should have the specified tags" do - ::Refinery::Blog::Post.last.tag_list.should eq(@tag_list.split(', ')) - end - end - end - end - - context "when has blog posts" do - let!(:blog_post) { FactoryGirl.create(:blog_post) } - - describe "blog post listing" do - before(:each) { visit refinery_admin_blog_posts_path } - - describe "edit blog post" do - it "should succeed" do - page.should have_content(blog_post.title) - - click_link("Edit this blog post") - current_path.should == edit_refinery_admin_blog_post_path(blog_post) - - fill_in "Title", :with => "hax0r" - click_button "Save" - - page.should_not have_content(blog_post.title) - page.should have_content("'hax0r' was successfully updated.") - end - end - - describe "deleting blog post" do - it "should succeed" do - page.should have_content(blog_post.title) - - click_link "Remove this blog post forever" - - page.should have_content("'#{blog_post.title}' was successfully removed.") - end - end - - describe "view live" do - it "redirects to blog post in the frontend" do - click_link "View this blog post live" - - current_path.should == blog_post_path(blog_post) - page.should have_content(blog_post.title) - end - end - end - - context "when uncategorized post" do - it "shows up in the list" do - visit uncategorized_refinery_admin_blog_posts_path - page.should have_content(blog_post.title) - end - end - - context "when categorized post" do - it "won't show up in the list" do - blog_post.categories << blog_category - blog_post.save! - - visit uncategorized_refinery_admin_blog_posts_path - page.should_not have_content(blog_post.title) - end - end - end - - context "with multiple users" do - let!(:other_guy) { Factory(:refinery_user, :username => "Other Guy") } - - describe "create blog post with alternate author" do - before(:each) do - visit refinery_admin_blog_posts_path - click_link "Create new post" - - fill_in "Title", :with => "This is some other guy's blog post" - fill_in "blog_post_body", :with => "I totally didn't write it." - - click_link "Advanced Options" - - select other_guy.username, :from => "Author" - - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "belongs to another user" do - ::Refinery::Blog::Post.last.author.should eq(other_guy) - end - end - end - end -end diff --git a/spec/requests/refinery/blog/admin/comments_spec.rb b/spec/requests/refinery/blog/admin/comments_spec.rb new file mode 100644 index 0000000..b1a5afe --- /dev/null +++ b/spec/requests/refinery/blog/admin/comments_spec.rb @@ -0,0 +1,128 @@ +require "spec_helper" + +module Refinery + module Blog + module Admin + describe Comment do + login_refinery_user + + describe "#index" do + context "when has no new unapproved comments" do + before(:each) do + subject.class.delete_all + visit refinery_blog_admin_comments_path + end + + it "should list no comments" do + visit refinery_blog_admin_comments_path + + page.should have_content('there are no new comments') + end + end + + context "when has new unapproved comments" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + before(:each) { visit refinery_blog_admin_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve a comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + + it "should allow me to reject a comment" do + click_link "Reject this comment" + + page.should have_content("has been rejected") + end + end + end + + describe "#approved" do + context "when has no approved comments" do + before(:each) do + subject.class.delete_all + visit approved_refinery_blog_admin_comments_path + end + + it "should list no comments" do + page.should have_content('there are no approved comments') + end + end + + context "when has approved comments" do + let!(:blog_comment) do + FactoryGirl.create(:blog_comment, + :state => 'approved') + end + before(:each) { visit approved_refinery_blog_admin_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to reject a comment" do + click_link "Reject this comment" + + page.should have_content("has been rejected") + end + end + end + + describe "#rejected" do + context "when has no rejected comments" do + before(:each) do + subject.class.delete_all + visit rejected_refinery_blog_admin_comments_path + end + + it "should list no comments" do + page.should have_content('there are no rejected comments') + end + end + + context "when has rejected comments" do + let!(:blog_comment) do + FactoryGirl.create(:blog_comment, + :state => 'rejected') + end + before(:each) { visit rejected_refinery_blog_admin_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve a comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + end + end + + describe "#show" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + before(:each) { visit refinery_blog_admin_comment_path(blog_comment) } + + it "should display the comment" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve the comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + end + end + end + end +end \ No newline at end of file diff --git a/spec/requests/refinery/admin/menu_spec.rb b/spec/requests/refinery/blog/admin/menu_spec.rb similarity index 100% rename from spec/requests/refinery/admin/menu_spec.rb rename to spec/requests/refinery/blog/admin/menu_spec.rb diff --git a/spec/requests/refinery/blog/admin/posts_spec.rb b/spec/requests/refinery/blog/admin/posts_spec.rb new file mode 100644 index 0000000..6c50c37 --- /dev/null +++ b/spec/requests/refinery/blog/admin/posts_spec.rb @@ -0,0 +1,175 @@ +require "spec_helper" + +module Refinery + module Blog + module Admin + describe Post do + login_refinery_user + + let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } + + context "when no blog posts" do + before(:each) { subject.class.destroy_all } + + describe "blog post listing" do + before(:each) { visit refinery_blog_admin_posts_path } + + it "invites to create new post" do + page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.") + end + end + + describe "new blog post form" do + before(:each) do + visit refinery_blog_admin_posts_path + click_link "Create new post" + end + + it "should have Tags" do + page.should have_content("Tags") + end + + it "should have Video Games" do + page.should have_content(blog_category.title) + end + + describe "create blog post" do + before(:each) do + fill_in "Title", :with => "This is my blog post" + fill_in "blog_post_body", :with => "And I love it" + check blog_category.title + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + subject.class.all.size.should eq(1) + end + + it "should belong to me" do + subject.class.first.author.should eq(::Refinery::User.last) + end + + it "should save categories" do + subject.class.last.categories.count.should eq(1) + subject.class.last.categories.first.title.should eq(blog_category.title) + end + end + + describe "create blog post with tags" do + before(:each) do + @tag_list = "chicago, bikes, beers, babes" + fill_in "Title", :with => "This is a tagged blog post" + fill_in "blog_post_body", :with => "And I also love it" + fill_in "Tags", :with => @tag_list + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + subject.class.all.size.should eq(1) + end + + it "should have the specified tags" do + subject.class.last.tag_list.should eq(@tag_list.split(', ')) + end + end + end + end + + context "when has blog posts" do + let!(:blog_post) { FactoryGirl.create(:blog_post) } + + describe "blog post listing" do + before(:each) { visit refinery_blog_admin_posts_path } + + describe "edit blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link("Edit this blog post") + current_path.should == edit_refinery_blog_admin_post_path(blog_post) + + fill_in "Title", :with => "hax0r" + click_button "Save" + + page.should_not have_content(blog_post.title) + page.should have_content("'hax0r' was successfully updated.") + end + end + + describe "deleting blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link "Remove this blog post forever" + + page.should have_content("'#{blog_post.title}' was successfully removed.") + end + end + + describe "view live" do + it "redirects to blog post in the frontend" do + click_link "View this blog post live" + + current_path.should == blog_post_path(blog_post) + page.should have_content(blog_post.title) + end + end + end + + context "when uncategorized post" do + it "shows up in the list" do + visit uncategorized_refinery_blog_admin_posts_path + page.should have_content(blog_post.title) + end + end + + context "when categorized post" do + it "won't show up in the list" do + blog_post.categories << blog_category + blog_post.save! + + visit uncategorized_refinery_blog_admin_posts_path + page.should_not have_content(blog_post.title) + end + end + end + + context "with multiple users" do + let!(:other_guy) { Factory(:refinery_user, :username => "Other Guy") } + + describe "create blog post with alternate author" do + before(:each) do + visit refinery_blog_admin_posts_path + click_link "Create new post" + + fill_in "Title", :with => "This is some other guy's blog post" + fill_in "blog_post_body", :with => "I totally didn't write it." + + click_link "Advanced Options" + + select other_guy.username, :from => "Author" + + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "belongs to another user" do + subject.class.last.author.should eq(other_guy) + end + end + end + end + end + end +end \ No newline at end of file From b1e4fd00943a160f3eb6ce242463c0cc07a406fc Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 17 Jan 2012 16:56:03 +1300 Subject: [PATCH 144/248] Fixed namespacing for Refinery conventions. --- Gemfile | 8 +++- Rakefile | 2 +- .../blog/admin/comments_controller.rb | 18 ++++----- .../refinery/blog/admin/posts_controller.rb | 18 ++++----- .../blog/admin/settings_controller.rb | 10 ++--- ...{base_controller.rb => blog_controller.rb} | 4 +- .../refinery/blog/categories_controller.rb | 6 +-- .../refinery/blog/posts_controller.rb | 34 ++++++++--------- .../refinery/blog/controller_helper.rb | 9 ++--- app/mailers/refinery/blog/comment_mailer.rb | 2 +- .../blog/admin/categories/_form.html.erb | 4 +- .../admin/categories/_sortable_list.html.erb | 2 +- .../blog/admin/categories/index.html.erb | 14 +++---- .../blog/admin/comments/_comment.html.erb | 2 +- .../admin/comments/_sortable_list.html.erb | 2 +- .../blog/admin/comments/index.html.erb | 16 ++++---- .../blog/admin/comments/show.html.erb | 20 +++++----- .../refinery/blog/admin/posts/_form.html.erb | 38 ++++++++----------- .../refinery/blog/admin/posts/_post.html.erb | 2 +- .../blog/admin/posts/_sortable_list.html.erb | 2 +- .../blog/admin/posts/_teaser_part.html.erb | 4 +- .../refinery/blog/admin/posts/index.html.erb | 14 +++---- .../blog/admin/posts/uncategorized.html.erb | 12 +++--- .../settings/notification_recipients.html.erb | 2 +- .../refinery/blog/categories/show.html.erb | 8 ++-- .../blog/comment_mailer/notification.html.erb | 6 +-- .../refinery/blog/posts/_comments.html.erb | 4 +- app/views/refinery/blog/posts/_nav.html.erb | 14 +++---- app/views/refinery/blog/posts/_post.html.erb | 18 ++++----- .../refinery/blog/posts/archive.html.erb | 4 +- app/views/refinery/blog/posts/index.html.erb | 6 +-- .../refinery/blog/posts/index.rss.builder | 6 +-- app/views/refinery/blog/posts/tagged.html.erb | 6 +-- .../refinery/blog/shared/_categories.html.erb | 8 ++-- app/views/refinery/blog/shared/_post.html.erb | 8 ++-- .../refinery/blog/shared/_posts.html.erb | 6 +-- .../refinery/blog/shared/_rss_feed.html.erb | 2 +- app/views/refinery/blog/shared/_tags.html.erb | 2 +- config/locales/bg.yml | 5 +-- config/locales/cs.yml | 5 +-- config/locales/de.yml | 5 +-- config/locales/en.yml | 7 ++-- config/locales/es.yml | 5 +-- config/locales/fr.yml | 5 +-- config/locales/it.yml | 5 +-- config/locales/ja.yml | 5 +-- config/locales/nb.yml | 4 +- config/locales/nl.yml | 5 +-- config/locales/pl.yml | 5 +-- config/locales/pt-BR.yml | 5 +-- config/locales/ru.yml | 5 +-- config/locales/sk.yml | 5 +-- config/locales/zh-CN.yml | 5 +-- config/routes.rb | 25 +++++++----- lib/refinery/blog/engine.rb | 2 +- refinerycms-blog.gemspec | 4 +- spec/lib/refinery/blog/engine_spec.rb | 6 +-- spec/models/refinery/blog/post_spec.rb | 26 ++++++------- .../refinery/blog/admin/comments_spec.rb | 5 --- .../refinery/blog/admin/posts_spec.rb | 10 ++--- .../requests/refinery/blog/categories_spec.rb | 15 ++++---- spec/requests/refinery/blog/posts_spec.rb | 29 ++++++-------- 62 files changed, 259 insertions(+), 282 deletions(-) rename app/controllers/refinery/blog/{base_controller.rb => blog_controller.rb} (83%) diff --git a/Gemfile b/Gemfile index 84ec8dc..e55a3f3 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,13 @@ source "http://rubygems.org" gemspec -gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +git 'git://github.com/resolve/refinerycms.git' do + gem 'refinerycms' + + group :development, :test do + gem 'refinerycms-testing' + end +end group :development, :test do require 'rbconfig' diff --git a/Rakefile b/Rakefile index de282bd..743f388 100644 --- a/Rakefile +++ b/Rakefile @@ -14,6 +14,6 @@ end require "refinerycms-testing" Refinery::Testing::Railtie.load_tasks -#Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) +Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) load File.expand_path('../tasks/rspec.rake', __FILE__) diff --git a/app/controllers/refinery/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb index 3128e97..f9addaa 100644 --- a/app/controllers/refinery/blog/admin/comments_controller.rb +++ b/app/controllers/refinery/blog/admin/comments_controller.rb @@ -10,20 +10,20 @@ module Refinery :order => 'published_at DESC' def index - @blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) + @comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) render :action => 'index' end def approved unless params[:id].present? - @blog_comments = Refinery::Blog::Comment.approved.page(params[:page]) + @comments = Refinery::Blog::Comment.approved.page(params[:page]) render :action => 'index' else - @blog_comment = Refinery::Blog::Comment.find(params[:id]) - @blog_comment.approve! - flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.approve! + flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name) redirect_to main_app.url_for(:action => params[:return_to] || 'index') end @@ -31,13 +31,13 @@ module Refinery def rejected unless params[:id].present? - @blog_comments = Refinery::Blog::Comment.rejected.page(params[:page]) + @comments = Refinery::Blog::Comment.rejected.page(params[:page]) render :action => 'index' else - @blog_comment = Refinery::Blog::Comment.find(params[:id]) - @blog_comment.reject! - flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.reject! + flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name) redirect_to main_app.url_for(:action => params[:return_to] || 'index') end diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb index 04ee663..2ed2b98 100644 --- a/app/controllers/refinery/blog/admin/posts_controller.rb +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -16,7 +16,7 @@ module Refinery before_filter :check_category_ids, :only => :update def uncategorized - @blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page]) + @posts = Refinery::Blog::Post.uncategorized.page(params[:page]) end def tags @@ -35,21 +35,21 @@ module Refinery end def new - @blog_post = ::Refinery::Blog::Post.new(:author => current_refinery_user) + @post = ::Refinery::Blog::Post.new(:author => current_refinery_user) end def create # if the position field exists, set this object as last object, given the conditions of this class. if Refinery::Blog::Post.column_names.include?("position") - params[:blog_post].merge!({ + params[:post].merge!({ :position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1) }) end - if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid? + if (@post = Refinery::Blog::Post.create(params[:post])).valid? (request.xhr? ? flash.now : flash).notice = t( 'refinery.crudify.created', - :what => "'#{@blog_post.title}'" + :what => "'#{@post.title}'" ) unless from_dialog? @@ -63,7 +63,7 @@ module Refinery end end else - render :text => "" + render :text => "" end else unless request.xhr? @@ -71,7 +71,7 @@ module Refinery else render :partial => "/refinery/admin/error_messages", :locals => { - :object => @blog_post, + :object => @post, :include_object_name => true } end @@ -80,11 +80,11 @@ module Refinery protected def find_all_categories - @blog_categories = Refinery::Blog::Category.find(:all) + @categories = Refinery::Blog::Category.find(:all) end def check_category_ids - params[:blog_post][:category_ids] ||= [] + params[:post][:category_ids] ||= [] end end end diff --git a/app/controllers/refinery/blog/admin/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb index afa6b2b..34a8d00 100644 --- a/app/controllers/refinery/blog/admin/settings_controller.rb +++ b/app/controllers/refinery/blog/admin/settings_controller.rb @@ -11,9 +11,9 @@ module Refinery flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients', :recipients => Refinery::Blog::Comment::Notification.recipients) unless request.xhr? or from_dialog? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else - render :text => "", + render :text => "", :layout => false end end @@ -22,7 +22,7 @@ module Refinery def moderation enabled = Refinery::Blog::Comment::Moderation.toggle! unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false @@ -32,7 +32,7 @@ module Refinery def comments enabled = Refinery::Blog::Comment.toggle! unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false @@ -42,7 +42,7 @@ module Refinery def teasers enabled = Refinery::Blog::Post.teaser_enabled_toggle! unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/blog_controller.rb similarity index 83% rename from app/controllers/refinery/blog/base_controller.rb rename to app/controllers/refinery/blog/blog_controller.rb index 919c180..54a8b03 100644 --- a/app/controllers/refinery/blog/base_controller.rb +++ b/app/controllers/refinery/blog/blog_controller.rb @@ -1,7 +1,7 @@ module Refinery module Blog - class BaseController < ::ApplicationController - + class BlogController < ::ApplicationController + include ControllerHelper helper :'refinery/blog/posts' diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index 60c8346..467726e 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -1,10 +1,10 @@ module Refinery module Blog - class CategoriesController < BaseController + class CategoriesController < BlogController def show - @blog_category = Refinery::Blog::Category.find(params[:id]) - @blog_posts = @blog_category.posts.live.includes(:comments, :categories).page(params[:page]) + @category = Refinery::Blog::Category.find(params[:id]) + @posts = @category.posts.live.includes(:comments, :categories).page(params[:page]) end end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 1c8cffd..d680150 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,6 +1,6 @@ module Refinery module Blog - class PostsController < BaseController + class PostsController < BlogController caches_page :index @@ -12,41 +12,41 @@ module Refinery def index # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).all) if request.format.rss? - respond_with (@blog_posts) do |format| + (@posts = Post.live.includes(:comments, :categories).all) if request.format.rss? + respond_with (@posts) do |format| format.html format.rss end end def show - @blog_comment = Refinery::Blog::Comment.new + @comment = Comment.new @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical? - respond_with (@blog_post) do |format| - format.html { present(@blog_post) } + respond_with (@post) do |format| + format.html { present(@post) } format.js { render :partial => 'post', :layout => false } end end def comment - if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? - if Refinery::Blog::Comment::Moderation.enabled? or @blog_comment.ham? + if (@comment = @post.comments.create(params[comment])).valid? + if Comment::Moderation.enabled? or @comment.ham? begin - Refinery::Blog::CommentMailer.notification(@blog_comment, request).deliver + CommentMailer.notification(@comment, request).deliver rescue logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" end end - if Refinery::Blog::Comment::Moderation.enabled? + if Comment::Moderation.enabled? flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments') - redirect_to main_app.blog_post_url(params[:id]) + redirect_to main_app.refinery_blog_post_url(params[:id]) else flash[:notice] = t('thank_you', :scope => 'refinery.blog.posts.comments') - redirect_to main_app.blog_post_url(params[:id], - :anchor => "comment-#{@blog_comment.to_param}") + redirect_to main_app.refinery_blog_post_url(params[:id], + :anchor => "comment-#{@comment.to_param}") end else render :action => 'show' @@ -58,20 +58,20 @@ module Refinery date = "#{params[:month]}/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') - @blog_posts = Refinery::Blog::Post.live.by_archive(@archive_date).page(params[:page]) + @posts = Post.live.by_archive(@archive_date).page(params[:page]) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') - @blog_posts = Refinery::Blog::Post.live.by_year(@archive_date).page(params[:page]) + @posts = Post.live.by_year(@archive_date).page(params[:page]) end - respond_with (@blog_posts) + respond_with (@posts) end def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @blog_posts = Refinery::Blog::Post.tagged_with(@tag_name).page(params[:page]) + @posts = Post.tagged_with(@tag_name).page(params[:page]) end def canonical? diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 035275c..bf4926b 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -5,9 +5,9 @@ module Refinery protected def find_blog_post - unless (@blog_post = Refinery::Blog::Post.find(params[:id])).try(:live?) + unless (@post = Refinery::Blog::Post.find(params[:id])).try(:live?) if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::Blog::Post.find(params[:id]) + @post = Refinery::Blog::Post.find(params[:id]) else error_404 end @@ -15,15 +15,14 @@ module Refinery end def find_all_blog_posts - @blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page]) + @posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page]) end def find_tags @tags = Refinery::Blog::Post.tag_counts_on(:tags) end - def find_all_blog_categories - @blog_categories = Refinery::Blog::Category.all + @categories = Refinery::Blog::Category.all end end end diff --git a/app/mailers/refinery/blog/comment_mailer.rb b/app/mailers/refinery/blog/comment_mailer.rb index 6f17f81..5b0ce7a 100644 --- a/app/mailers/refinery/blog/comment_mailer.rb +++ b/app/mailers/refinery/blog/comment_mailer.rb @@ -3,7 +3,7 @@ module Refinery class CommentMailer < ActionMailer::Base def notification(comment, request) - @blog_comment = comment + @comment = comment mail :subject => Blog::Comment::Notification.subject, :recipients => Blog::Comment::Notification.recipients, :from => "\"#{Refinery::Core.config.site_name}\" " diff --git a/app/views/refinery/blog/admin/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb index a5d3de3..90eed5d 100644 --- a/app/views/refinery/blog/admin/categories/_form.html.erb +++ b/app/views/refinery/blog/admin/categories/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for [main_app, :refinery_admin, @blog_category] do |f| -%> +<%= form_for [main_app, :refinery_admin, @category] do |f| -%> <%= render :partial => "/refinery/admin/error_messages", :locals => { :object => f.object, @@ -14,6 +14,6 @@ :locals => { :f => f, :continue_editing => false, - :delete_title => t('delete', :scope => 'refinery.admin.blog.categories.category') + :delete_title => t('delete', :scope => 'refinery.blog.admin.categories.category') } %> <% end %> diff --git a/app/views/refinery/blog/admin/categories/_sortable_list.html.erb b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb index f4e8641..8040dc0 100644 --- a/app/views/refinery/blog/admin/categories/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb @@ -1,5 +1,5 @@
      - <%= render :partial => 'category', :collection => @blog_categories %> + <%= render :partial => 'category', :collection => @categories %>
    <%= render :partial => "/refinery/admin/sortable_list", :locals => { diff --git a/app/views/refinery/blog/admin/categories/index.html.erb b/app/views/refinery/blog/admin/categories/index.html.erb index 4ad59ab..2e4313e 100644 --- a/app/views/refinery/blog/admin/categories/index.html.erb +++ b/app/views/refinery/blog/admin/categories/index.html.erb @@ -1,25 +1,25 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

    <%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>

    - <% if @blog_categories.any? %> + <% if @categories.any? %> <%= render :partial => "blog_categories", - :collection => @blog_categories %> + :collection => @categories %> <% else %>

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    <% end %> <% else %> - <% if @blog_categories.any? %> - <%= will_paginate @blog_categories %> + <% if @categories.any? %> + <%= will_paginate @categories %> <%= render :partial => "sortable_list" %> - <%= will_paginate @blog_categories %> + <%= will_paginate @categories %> <% else %>

    - <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.categories')) %> + <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.blog.admin.submenu.categories')) %>

    <% end %> diff --git a/app/views/refinery/blog/admin/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb index 51f2996..f4a7a16 100644 --- a/app/views/refinery/blog/admin/comments/_comment.html.erb +++ b/app/views/refinery/blog/admin/comments/_comment.html.erb @@ -5,7 +5,7 @@ <%= link_to refinery_icon_tag("application_go.png"), - main_app.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), + main_app.refinery_blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), :title => t('.view_live_html'), :target => "_blank" unless comment.unmoderated? %> <%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_blog_admin_comment_path(comment), diff --git a/app/views/refinery/blog/admin/comments/_sortable_list.html.erb b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb index f781ba1..9f8bbbc 100644 --- a/app/views/refinery/blog/admin/comments/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb @@ -1,5 +1,5 @@
      - <%= render :partial => 'comment', :collection => @blog_comments %> + <%= render :partial => 'comment', :collection => @comments %>
    <%= render :partial => "/refinery/admin/sortable_list", :locals => { diff --git a/app/views/refinery/blog/admin/comments/index.html.erb b/app/views/refinery/blog/admin/comments/index.html.erb index 059ef59..991980d 100644 --- a/app/views/refinery/blog/admin/comments/index.html.erb +++ b/app/views/refinery/blog/admin/comments/index.html.erb @@ -1,26 +1,26 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

    <%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>

    - <% if @blog_comments.any? %> - <%= will_paginate @blog_comments %> + <% if @comments.any? %> + <%= will_paginate @comments %>
      <%= render :partial => "blog_comments", - :collection => @blog_comments %> + :collection => @comments %>
    - <%= will_paginate @blog_comments %> + <%= will_paginate @comments %> <% else %>

    <%= t('search_no_results', :scope => 'admin') %>

    <% end %> <% else %> - <% if @blog_comments.any? %> - <%= will_paginate @blog_comments %> + <% if @comments.any? %> + <%= will_paginate @comments %> <%= render :partial => "sortable_list" %> - <%= will_paginate @blog_comments %> + <%= will_paginate @comments %> <% else %>

    <%= t('.no_items_yet', diff --git a/app/views/refinery/blog/admin/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb index 2aa75f1..df04b3e 100644 --- a/app/views/refinery/blog/admin/comments/show.html.erb +++ b/app/views/refinery/blog/admin/comments/show.html.erb @@ -1,7 +1,7 @@

    <%= t('.details')%>

    - <%= t('.age') %>: <%= time_ago_in_words(@blog_comment.created_at) %> + <%= t('.age') %>: <%= time_ago_in_words(@comment.created_at) %>

    <%= t('.actions') %>

      @@ -9,12 +9,12 @@ <%= link_to t('.back'), main_app.refinery_blog_admin_comments_path, :class => "back_icon" %>
    • - <%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'rejected'), - :class => 'comment_cross_icon' unless @blog_comment.rejected? %> + <%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@comment, :return_to => 'rejected'), + :class => 'comment_cross_icon' unless @comment.rejected? %>
    • - <%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'approved'), - :class => 'comment_tick_icon' unless @blog_comment.approved? %> + <%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@comment, :return_to => 'approved'), + :class => 'comment_tick_icon' unless @comment.approved? %>
    @@ -26,8 +26,8 @@ <%= t('.blog_post') %> - <%= link_to @blog_comment.post.title, - main_app.blog_post_path(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"), + <%= link_to @comment.post.title, + main_app.refinery_blog_post_path(@comment.post, :anchor => "comment-#{@comment.to_param}"), :target => '_blank' %> @@ -36,7 +36,7 @@ <%= t('.from') %> - <%= @blog_comment.name %> [<%= mail_to @blog_comment.email, @blog_comment.email, {:title => t('.click_to_email')} %>] + <%= @comment.name %> [<%= mail_to @comment.email, @comment.email, {:title => t('.click_to_email')} %>] @@ -44,7 +44,7 @@ <%= t('.date') %> - <%= l(Date.parse(@blog_comment.created_at.to_s), :format => :long) %> + <%= l(Date.parse(@comment.created_at.to_s), :format => :long) %> @@ -53,7 +53,7 @@

    - <%= @blog_comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "

    ") %> + <%= @comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "

    ") %>

    diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb index 656c9c6..a33baeb 100644 --- a/app/views/refinery/blog/admin/posts/_form.html.erb +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for [main_app, :refinery_admin, @blog_post] do |f| -%> +<%= form_for [main_app, :refinery_blog_admin, @post] do |f| -%> <%= render :partial => "/refinery/admin/error_messages", :locals => { :object => f.object, @@ -25,33 +25,25 @@ <% end %> - +
    <% part_index = -1 %> - <%= render :partial => 'form_part', - :locals => { - :f => f, - :part_index => (part_index += 1), - } -%> - <%= render :partial => 'teaser_part', - :locals => { - :f => f, - :part_index => (part_index += 1), - } if f.object.respond_to?(:custom_teaser) -%> + <%= render 'form_part', :f => f, :part_index => (part_index += 1) -%> + <%= render 'teaser_part', :f => f, :part_index => (part_index += 1) if f.object.respond_to?(:custom_teaser) -%> <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
    - <%= render :partial => tab.partial, :locals => {:f => f} %> + <%= render tab.partial, :f => f %>
    <% end %>

    - +
    <%= f.label :tag_list, t('refinery.blog.shared.tags.title') -%> <%= f.text_field :tag_list, :class => 'larger' -%>
    - +

    <%= link_to t('.advanced_options'), "#", @@ -65,14 +57,14 @@

    <%= render :partial => "/refinery/admin/form_actions", :locals => { :f => f, :continue_editing => true, - :delete_title => t('delete', :scope => 'refinery.admin.blog.posts.post') + :delete_title => t('delete', :scope => 'refinery.blog.admin.posts.post') } %> <% end -%> diff --git a/app/views/refinery/blog/admin/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb index c8baa80..887c830 100644 --- a/app/views/refinery/blog/admin/posts/_post.html.erb +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -7,7 +7,7 @@ - <%= link_to refinery_icon_tag("application_go.png"), main_app.blog_post_path(post), + <%= link_to refinery_icon_tag("application_go.png"), main_app.refinery_blog_post_path(post), :title => t('.view_live_html'), :target => "_blank" %> <%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_blog_admin_post_path(post), diff --git a/app/views/refinery/blog/admin/posts/_sortable_list.html.erb b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb index 18d12cc..471d4f0 100644 --- a/app/views/refinery/blog/admin/posts/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb @@ -1,5 +1,5 @@
      - <%= render :partial => 'post', :collection => @blog_posts %> + <%= render :partial => 'post', :collection => @posts %>
    <%= render :partial => "/refinery/admin/sortable_list", :locals => { diff --git a/app/views/refinery/blog/admin/posts/_teaser_part.html.erb b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb index dc9186a..461a10c 100644 --- a/app/views/refinery/blog/admin/posts/_teaser_part.html.erb +++ b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb @@ -2,9 +2,9 @@ <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%>

    - <%= link_to t('copy_body', :scope => 'refinery.admin.blog.posts.form'), "#", + <%= link_to t('copy_body', :scope => 'refinery.blog.admin.posts.form'), "#", :id => 'copy_body_link', - :title => t('copy_body_help', :scope => 'refinery.admin.blog.posts.form') %> + :title => t('copy_body_help', :scope => 'refinery.blog.admin.posts.form') %>

    diff --git a/app/views/refinery/blog/admin/posts/index.html.erb b/app/views/refinery/blog/admin/posts/index.html.erb index 922353c..8db926a 100644 --- a/app/views/refinery/blog/admin/posts/index.html.erb +++ b/app/views/refinery/blog/admin/posts/index.html.erb @@ -1,26 +1,26 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

    <%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>

    - <% if @blog_posts.any? %> + <% if @posts.any? %>
      <%= render :partial => "post", - :collection => @blog_posts %> + :collection => @posts %>
    <% else %>

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    <% end %> <% else %> - <% if @blog_posts.any? %> - <%= will_paginate @blog_posts %> + <% if @posts.any? %> + <%= will_paginate @posts %> <%= render :partial => "sortable_list" %> - <%= will_paginate @blog_posts %> + <%= will_paginate @posts %> <% else %>

    - <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.posts')) %> + <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.blog.admin.submenu.posts')) %>

    <% end %> diff --git a/app/views/refinery/blog/admin/posts/uncategorized.html.erb b/app/views/refinery/blog/admin/posts/uncategorized.html.erb index 030e789..1b3a512 100644 --- a/app/views/refinery/blog/admin/posts/uncategorized.html.erb +++ b/app/views/refinery/blog/admin/posts/uncategorized.html.erb @@ -1,21 +1,21 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

    <%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>

    - <% if @blog_posts.any? %> + <% if @posts.any? %> <%= render :partial => "blog_posts", - :collection => @blog_posts %> + :collection => @posts %> <% else %>

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    <% end %> <% else %> - <% if @blog_posts.any? %> - <%= will_paginate @blog_posts %> + <% if @posts.any? %> + <%= will_paginate @posts %> <%= render :partial => "sortable_list" %> - <%= will_paginate @blog_posts %> + <%= will_paginate @posts %> <% else %>

    diff --git a/app/views/refinery/blog/admin/settings/notification_recipients.html.erb b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb index d321ded..af2650d 100644 --- a/app/views/refinery/blog/admin/settings/notification_recipients.html.erb +++ b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb @@ -18,7 +18,7 @@ :locals => { :f => nil, :continue_editing => false, - :cancel_url => admin_blog_posts_url, + :cancel_url => refinery_blog_admin_posts_url, :hide_delete => true } %> <% end %> diff --git a/app/views/refinery/blog/categories/show.html.erb b/app/views/refinery/blog/categories/show.html.erb index 00d9596..aa4abaf 100644 --- a/app/views/refinery/blog/categories/show.html.erb +++ b/app/views/refinery/blog/categories/show.html.erb @@ -1,10 +1,10 @@ -<% content_for :body_content_title, @blog_category.title %> +<% content_for :body_content_title, @category.title %> <% content_for :body_content_left do %> - <% if @blog_posts.any? %> + <% if @posts.any? %>

    - <%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %> - <%= will_paginate @blog_posts %> + <%= render :partial => "/refinery/blog/shared/post", :collection => @posts %> + <%= will_paginate @posts %>
    <% else %>

    diff --git a/app/views/refinery/blog/comment_mailer/notification.html.erb b/app/views/refinery/blog/comment_mailer/notification.html.erb index cfadb67..a129d34 100644 --- a/app/views/refinery/blog/comment_mailer/notification.html.erb +++ b/app/views/refinery/blog/comment_mailer/notification.html.erb @@ -4,10 +4,10 @@ <%=raw t('.comment_starts') %> -<%=raw t('.from') %>: <%= @blog_comment.name %> -<%=raw t('.email') %>: <%= @blog_comment.email %> +<%=raw t('.from') %>: <%= @comment.name %> +<%=raw t('.email') %>: <%= @comment.email %> <%=raw t('.message') %>: -<%=simple_format strip_tags(@blog_comment.body) %> +<%=simple_format strip_tags(@comment.body) %> <%=raw t('.comment_ends') %> diff --git a/app/views/refinery/blog/posts/_comments.html.erb b/app/views/refinery/blog/posts/_comments.html.erb index 9bc0a13..a34d106 100644 --- a/app/views/refinery/blog/posts/_comments.html.erb +++ b/app/views/refinery/blog/posts/_comments.html.erb @@ -1,6 +1,6 @@

    +
    + + <%= f.label :source_url_title, t('.source_url_title') %> + <%= refinery_help_tag t('.source_url_title_help') %> + + <%= f.text_field :source_url_title, :class => "widest" %> +
    + +
    + + <%= f.label :source_url, t('.source_url') %> + <%= refinery_help_tag t('.source_url_help') %> + + <%= f.text_field :source_url, :class => "widest" %> +
    +
    <%= f.label :user_id, t('.author') %> diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb index 020ba41..77e43ff 100644 --- a/app/views/refinery/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -10,7 +10,13 @@ - <%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{@post.author.username}" if @post.author.present? %>. + <%= content_tag(:div, "#{t('by', :scope => 'refinery.blog.posts.show')} #{@post.author.username}", :class => "blog_author") if @post.author.present? %> + <% if @post.source_url.present? %> +
    + <%= "#{t('source', :scope => 'refinery.blog.posts.show')}: " %> + <%= link_to (@post.source_url_title.blank? ? @post.source_url : @post.source_url_title), @post.source_url %> +
    + <% end %> <% if (categories = @post.categories).any? %>