Updated to latest refinerycms(-blog)

* bundle update
* new migrations
* fixed specs for new behaviour
This commit is contained in:
Marc Remolt 2011-08-12 18:44:00 +02:00
parent d3352df3a5
commit b2700960d8
14 changed files with 139 additions and 95 deletions

View File

@ -1,6 +1,6 @@
source "http://rubygems.org"
gem "rails", "3.0.7"
gem "rails", "3.0.9"
#gem "capybara", ">= 1.0.0.beta1"
gem "sqlite3"
gem "rmagick"

View File

@ -1,22 +1,22 @@
PATH
remote: ./
specs:
refinerycms-wordpress-import (0.3.0)
refinerycms-wordpress-import (0.4.0)
bundler (~> 1.0)
nokogiri (~> 1.4.4)
refinerycms (~> 1.0.0)
refinerycms-blog (~> 1.5.2)
refinerycms-blog (~> 1.6.2)
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.7)
actionpack (= 3.0.7)
mail (~> 2.2.15)
actionpack (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
actionmailer (3.0.9)
actionpack (= 3.0.9)
mail (~> 2.2.19)
actionpack (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
@ -24,19 +24,19 @@ GEM
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.7)
activesupport (= 3.0.7)
activemodel (3.0.9)
activesupport (= 3.0.9)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
arel (~> 2.0.2)
activerecord (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activeresource (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
activesupport (3.0.7)
activeresource (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
activesupport (3.0.9)
acts-as-taggable-on (2.0.6)
acts_as_indexed (0.7.3)
arel (2.0.10)
@ -51,7 +51,7 @@ GEM
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
diff-lcs (1.1.2)
dragonfly (0.9.4)
dragonfly (0.9.5)
rack
erubis (2.6.6)
abstract (>= 1.0.0)
@ -68,7 +68,7 @@ GEM
guard-bundler (0.1.3)
bundler (>= 1.0.0)
guard (>= 0.2.2)
guard-rspec (0.4.0)
guard-rspec (0.4.1)
guard (>= 0.4.0)
i18n (0.5.0)
libnotify (0.5.7)
@ -88,70 +88,72 @@ GEM
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.7)
actionmailer (= 3.0.7)
actionpack (= 3.0.7)
activerecord (= 3.0.7)
activeresource (= 3.0.7)
activesupport (= 3.0.7)
rails (3.0.9)
actionmailer (= 3.0.9)
actionpack (= 3.0.9)
activerecord (= 3.0.9)
activeresource (= 3.0.9)
activesupport (= 3.0.9)
bundler (~> 1.0)
railties (= 3.0.7)
railties (3.0.7)
actionpack (= 3.0.7)
activesupport (= 3.0.7)
railties (= 3.0.9)
railties (3.0.9)
actionpack (= 3.0.9)
activesupport (= 3.0.9)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (0.9.2)
refinerycms (1.0.0)
rdoc (3.9.2)
refinerycms (1.0.4)
bundler (~> 1.0)
refinerycms-authentication (= 1.0.0)
refinerycms-base (= 1.0.0)
refinerycms-core (= 1.0.0)
refinerycms-dashboard (= 1.0.0)
refinerycms-images (= 1.0.0)
refinerycms-pages (= 1.0.0)
refinerycms-resources (= 1.0.0)
refinerycms-settings (= 1.0.0)
refinerycms-authentication (1.0.0)
refinerycms-authentication (= 1.0.4)
refinerycms-base (= 1.0.4)
refinerycms-core (= 1.0.4)
refinerycms-dashboard (= 1.0.4)
refinerycms-images (= 1.0.4)
refinerycms-pages (= 1.0.4)
refinerycms-resources (= 1.0.4)
refinerycms-settings (= 1.0.4)
refinerycms-authentication (1.0.4)
devise (~> 1.3.0)
friendly_id_globalize3 (~> 3.2.1)
refinerycms-core (= 1.0.0)
refinerycms-base (1.0.0)
refinerycms-blog (1.5.2)
refinerycms-core (= 1.0.4)
refinerycms-base (1.0.4)
refinerycms-blog (1.6.2)
acts-as-taggable-on
filters_spam (~> 0.2)
refinerycms-core (~> 1.0.0)
refinerycms-core (~> 1.0.3)
seo_meta (~> 1.1.0)
refinerycms-core (1.0.0)
refinerycms-core (1.0.4)
acts_as_indexed (~> 0.7)
awesome_nested_set (~> 2.0)
friendly_id_globalize3 (~> 3.2.1)
globalize3 (~> 0.1)
rails (~> 3.0.7)
refinerycms-base (= 1.0.0)
rails (~> 3.0.9)
refinerycms-base (= 1.0.4)
refinerycms-generators (~> 1.0)
refinerycms-settings (= 1.0.0)
refinerycms-settings (= 1.0.4)
truncate_html (~> 0.5)
will_paginate (~> 3.0.pre)
refinerycms-dashboard (1.0.0)
refinerycms-core (= 1.0.0)
refinerycms-generators (1.0.2)
refinerycms-images (1.0.0)
will_paginate (= 3.0.pre2)
refinerycms-dashboard (1.0.4)
refinerycms-core (= 1.0.4)
refinerycms-generators (1.0.3)
refinerycms-images (1.0.4)
dragonfly (~> 0.9.0)
rack-cache (>= 0.5.3)
refinerycms-core (= 1.0.0)
refinerycms-pages (1.0.0)
refinerycms-core (= 1.0.4)
refinerycms-pages (1.0.4)
awesome_nested_set (~> 2.0)
friendly_id_globalize3 (~> 3.2.1)
globalize3 (~> 0.1)
refinerycms-core (= 1.0.0)
refinerycms-core (= 1.0.4)
seo_meta (~> 1.1)
refinerycms-resources (1.0.0)
refinerycms-resources (1.0.4)
dragonfly (~> 0.9.0)
rack-cache (>= 0.5.3)
refinerycms-core (= 1.0.0)
refinerycms-settings (1.0.0)
refinerycms-base (= 1.0.0)
refinerycms-core (= 1.0.4)
refinerycms-settings (1.0.4)
refinerycms-base (= 1.0.4)
rmagick (2.13.1)
rspec (2.6.0)
rspec-core (~> 2.6.0)
@ -177,7 +179,7 @@ GEM
tzinfo (0.3.29)
warden (1.0.5)
rack (>= 1.0)
will_paginate (3.0.pre4)
will_paginate (3.0.pre2)
PLATFORMS
ruby
@ -189,7 +191,7 @@ DEPENDENCIES
guard-bundler
guard-rspec
libnotify
rails (= 3.0.7)
rails (= 3.0.9)
refinerycms
refinerycms-blog
refinerycms-wordpress-import!

View File

@ -1,6 +1,12 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'bundler' do
watch('Gemfile')
# Uncomment next line if Gemfile contain `gemspec' command
watch(/^.+\.gemspec/)
end
guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
@ -8,19 +14,8 @@ guard 'rspec', :version => 2 do
# 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 'bundler' do
watch('Gemfile')
# Uncomment next line if Gemfile contain `gemspec' command
watch(/^.+\.gemspec/)
end

View File

@ -34,11 +34,11 @@ module Refinery
user = ::User.find_by_username(creator) || ::User.first
raise "Referenced User doesn't exist! Make sure the authors are imported first." \
unless user
begin
post = ::BlogPost.new :title => title, :body => content_formatted,
:draft => draft?, :published_at => post_date, :created_at => post_date,
:author => user, :tag_list => tag_list
post = ::BlogPost.new :title => title, :body => content_formatted,
:draft => draft?, :published_at => post_date, :created_at => post_date,
:user_id => user.id, :tag_list => tag_list
post.save!
::BlogPost.transaction do
@ -52,7 +52,7 @@ module Refinery
comment.save
end
end
rescue ActiveRecord::RecordInvalid
rescue ActiveRecord::RecordInvalid
# if the title has already been taken (WP allows duplicates here,
# refinery doesn't) append the post_id to it, making it unique
post.title = "#{title}-#{post_id}"

View File

@ -4,16 +4,16 @@ Gem::Specification.new do |s|
s.name = "refinerycms-wordpress-import"
s.summary = "Import WordPress XML dumps into refinerycms(-blog)."
s.description = "This gem imports a WordPress XML dump into refinerycms (Page, User) and refinerycms-blog (BlogPost, BlogCategory, Tag, BlogComment)"
s.version = "0.3.0"
s.version = "0.4.0"
s.date = "2011-06-13"
s.authors = ['Marc Remolt']
s.email = 'marc.remolt@googlemail.com'
s.homepage = 'https://github.com/mremolt/refinerycms-wordpress-import'
s.add_dependency 'bundler', '~> 1.0'
s.add_dependency 'refinerycms', '~> 1.0.0'
s.add_dependency 'refinerycms-blog', '~> 1.5.2'
s.add_dependency 'refinerycms-blog', '~> 1.6.2'
s.add_dependency 'nokogiri', '~> 1.4.4'
s.add_development_dependency 'rspec-rails'

View File

@ -24,4 +24,6 @@ Dummy::Application.configure do
config.action_dispatch.best_standards_support = :builtin
end
Refinery.rescue_not_found = false
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?)

View File

@ -47,4 +47,6 @@ Dummy::Application.configure do
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
Refinery.rescue_not_found = true
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?)

View File

@ -33,4 +33,6 @@ Dummy::Application.configure do
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end
Refinery.rescue_not_found = false
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?)

View File

@ -0,0 +1,11 @@
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
end
end

View File

@ -0,0 +1,9 @@
class AddCustomUrlFieldToBlogPosts < ActiveRecord::Migration
def self.up
add_column :blog_posts, :custom_url, :string
end
def self.down
remove_column :blog_posts, :custom_url
end
end

View File

@ -0,0 +1,10 @@
class AddCustomTeaserFieldToBlogPosts < ActiveRecord::Migration
def self.up
add_column :blog_posts, :custom_teaser, :text
end
def self.down
remove_column :blog_posts, :custom_teaser
end
end

View File

@ -10,12 +10,13 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110602094445) do
ActiveRecord::Schema.define(:version => 20110812162204) do
create_table "blog_categories", :force => true do |t|
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
t.string "cached_slug"
end
add_index "blog_categories", ["id"], :name => "index_blog_categories_on_id"
@ -48,6 +49,9 @@ ActiveRecord::Schema.define(:version => 20110602094445) do
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 "blog_posts", ["id"], :name => "index_blog_posts_on_id"

View File

@ -1,3 +1,12 @@
::Page.reset_column_information
# Check whether all columns are applied yet by seo_meta.
unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k|
::Page.translation_class.instance_methods.include?(k)
}
# Make pages model seo_meta because not all columns are accessible.
::Page.translation_class.send :is_seo_meta
end
page_position = -1
home_page = Page.create(:title => "Home",

View File

@ -63,6 +63,7 @@ describe Refinery::WordPress::Post, :type => :model do
@comment.body.should == comment.content
@comment.state.should == 'approved'
@comment.created_at.should == comment.date
@comment.created_at.should == comment.date
end
end
end
@ -79,16 +80,13 @@ describe Refinery::WordPress::Post, :type => :model do
@post = post.to_refinery
end
specify { BlogPost.should have(1).record }
specify { BlogPost.should have(1).record }
it "should copy the attributes from Refinery::WordPress::Post" do
@post.title.should == post.title
@post.body.should == post.content_formatted
@post.draft.should == post.draft?
@post.published_at.should == post.post_date
@post.created_at.should == post.post_date
@post.author.username.should == post.creator
end
specify { @post.title.should == post.title }
specify { @post.body.should == post.content_formatted }
specify { @post.draft.should == post.draft? }
specify { @post.published_at.should == post.post_date }
specify { @post.author.username.should == post.creator }
it "should assign a category for each Refinery::WordPress::Category" do
@post.categories.should have(post.categories.count).records