diff --git a/Gemfile b/Gemfile index 78f995c..1a74f35 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,13 @@ source "http://rubygems.org" gem "rails", "3.0.7" -gem "capybara", ">= 0.4.0" +#gem "capybara", ">= 1.0.0.beta1" gem "sqlite3" -gem "rspec-rails", ">= 2.0.0.beta" +gem "rspec-rails", ">= 2.6.0" # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) # gem 'ruby-debug' # gem 'ruby-debug19' + +gem 'refinerycms-wordpress-import', :path => './' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..bf3b30b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,170 @@ +PATH + remote: ./ + specs: + refinerycms-wordpress-import (0.0.1) + refinerycms (~> 1.0.0) + refinerycms-blog (~> 1.3.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) + builder (~> 2.1.2) + erubis (~> 2.6.6) + i18n (~> 0.5.0) + rack (~> 1.2.1) + rack-mount (~> 0.6.14) + rack-test (~> 0.5.7) + tzinfo (~> 0.3.23) + activemodel (3.0.7) + activesupport (= 3.0.7) + builder (~> 2.1.2) + i18n (~> 0.5.0) + activerecord (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + arel (~> 2.0.2) + tzinfo (~> 0.3.23) + activeresource (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + activesupport (3.0.7) + acts_as_indexed (0.7.2) + arel (2.0.10) + awesome_nested_set (2.0.0) + activerecord (>= 3.0.0) + babosa (0.3.4) + bcrypt-ruby (2.1.4) + builder (2.1.2) + devise (1.3.4) + bcrypt-ruby (~> 2.1.2) + orm_adapter (~> 0.0.3) + warden (~> 1.0.3) + diff-lcs (1.1.2) + dragonfly (0.9.2) + rack + erubis (2.6.6) + abstract (>= 1.0.0) + filters_spam (0.3) + friendly_id_globalize3 (3.2.1.3) + babosa (~> 0.3.0) + globalize3 (0.1.0) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + i18n (0.5.0) + mail (2.2.19) + activesupport (>= 2.3.6) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.16) + orm_adapter (0.0.5) + polyglot (0.3.1) + rack (1.2.3) + rack-cache (1.0.2) + rack (>= 0.4) + rack-mount (0.6.14) + 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) + bundler (~> 1.0) + railties (= 3.0.7) + railties (3.0.7) + actionpack (= 3.0.7) + activesupport (= 3.0.7) + rake (>= 0.8.7) + thor (~> 0.14.4) + rake (0.9.1) + refinerycms (1.0.0) + 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) + devise (~> 1.3.0) + friendly_id_globalize3 (~> 3.2.1) + refinerycms-core (= 1.0.0) + refinerycms-base (1.0.0) + refinerycms-blog (1.3.2) + filters_spam (~> 0.2) + refinerycms (>= 0.9.8) + refinerycms-core (1.0.0) + 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) + refinerycms-generators (~> 1.0) + refinerycms-settings (= 1.0.0) + truncate_html (~> 0.5) + will_paginate (~> 3.0.pre) + refinerycms-dashboard (1.0.0) + refinerycms-core (= 1.0.0) + refinerycms-generators (1.0.1) + refinerycms-images (1.0.0) + dragonfly (~> 0.9.0) + rack-cache (>= 0.5.3) + refinerycms-core (= 1.0.0) + refinerycms-pages (1.0.0) + awesome_nested_set (~> 2.0) + friendly_id_globalize3 (~> 3.2.1) + globalize3 (~> 0.1) + refinerycms-core (= 1.0.0) + seo_meta (~> 1.1) + refinerycms-resources (1.0.0) + dragonfly (~> 0.9.0) + rack-cache (>= 0.5.3) + refinerycms-core (= 1.0.0) + refinerycms-settings (1.0.0) + refinerycms-base (= 1.0.0) + rspec (2.6.0) + rspec-core (~> 2.6.0) + rspec-expectations (~> 2.6.0) + rspec-mocks (~> 2.6.0) + rspec-core (2.6.3) + rspec-expectations (2.6.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.6.0) + rspec-rails (2.6.1) + actionpack (~> 3.0) + activesupport (~> 3.0) + railties (~> 3.0) + rspec (~> 2.6.0) + seo_meta (1.1.1) + refinerycms-generators (~> 1.0.1) + sqlite3 (1.3.3) + thor (0.14.6) + treetop (1.4.9) + polyglot (>= 0.3.1) + truncate_html (0.5.1) + tzinfo (0.3.27) + warden (1.0.4) + rack (>= 1.0) + will_paginate (3.0.pre2) + +PLATFORMS + ruby + +DEPENDENCIES + rails (= 3.0.7) + refinerycms-wordpress-import! + rspec-rails (>= 2.6.0) + sqlite3 diff --git a/Rakefile b/Rakefile index 6663600..0e3d032 100644 --- a/Rakefile +++ b/Rakefile @@ -7,7 +7,7 @@ rescue LoadError end require 'rake' -require 'rake/rdoctask' +require 'rdoc/task' require 'rspec/core' require 'rspec/core/rake_task' diff --git a/lib/refinerycms_wordpress_import.rb b/lib/refinerycms_wordpress_import.rb index da0fefc..00840ac 100644 --- a/lib/refinerycms_wordpress_import.rb +++ b/lib/refinerycms_wordpress_import.rb @@ -1,2 +1,8 @@ -module Refinerycms-wordpress-import -end \ No newline at end of file +require 'refinerycms' +require 'refinerycms-blog' + +module Refinery + module WordPress + + end +end diff --git a/refinerycms_wordpress_import.gemspec b/refinerycms-wordpress-import.gemspec similarity index 60% rename from refinerycms_wordpress_import.gemspec rename to refinerycms-wordpress-import.gemspec index dcde426..a45ea92 100644 --- a/refinerycms_wordpress_import.gemspec +++ b/refinerycms-wordpress-import.gemspec @@ -1,9 +1,12 @@ # Provide a simple gemspec so you can easily use your enginex # project in your rails apps through git. Gem::Specification.new do |s| - s.name = "refinerycms_wordpress_import" - s.summary = "Insert Refinerycms-wordpress-import summary." + s.name = "refinerycms-wordpress-import" + s.summary = "Import WordPress XML dumps into refinerycms(-blog)." s.description = "Insert Refinerycms-wordpress-import description." s.files = Dir["{app,lib,config}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.rdoc"] s.version = "0.0.1" -end \ No newline at end of file + + s.add_dependency 'refinerycms', '~> 1.0.0' + s.add_dependency 'refinerycms-blog', '~> 1.3.2' +end diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore new file mode 100644 index 0000000..431d0c7 --- /dev/null +++ b/spec/dummy/.gitignore @@ -0,0 +1,76 @@ +# Rails +.bundle +db/*.sqlite3 +db/*.sqlite3-journal +*.log +tmp +tmp/**/* + +# 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/* + +#rvm +.rvmrc +.rvmrc.* + diff --git a/spec/dummy/app/views/layouts/application.html.erb b/spec/dummy/app/views/layouts/application.html.erb.backup similarity index 100% rename from spec/dummy/app/views/layouts/application.html.erb rename to spec/dummy/app/views/layouts/application.html.erb.backup 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..77988e9 --- /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 + 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/environments/development.rb b/spec/dummy/config/environments/development.rb index d6a7998..ed94ce1 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -24,3 +24,4 @@ Dummy::Application.configure do config.action_dispatch.best_standards_support = :builtin end +Refinery.rescue_not_found = false \ No newline at end of file diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb index 659e583..b8a419f 100644 --- a/spec/dummy/config/environments/production.rb +++ b/spec/dummy/config/environments/production.rb @@ -29,7 +29,7 @@ Dummy::Application.configure do # Disable Rails's static asset server # In production, Apache or nginx will already do this - config.serve_static_assets = false + config.serve_static_assets = true # Refinery CMS requires this to be true # Enable serving of images, stylesheets, and javascripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" @@ -47,3 +47,4 @@ Dummy::Application.configure do # Send deprecation notices to registered listeners config.active_support.deprecation = :notify end +Refinery.rescue_not_found = true \ No newline at end of file diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index 768d8f0..588e9b9 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -33,3 +33,4 @@ Dummy::Application.configure do # Print deprecation notices to the stderr config.active_support.deprecation = :stderr end +Refinery.rescue_not_found = false \ No newline at end of file diff --git a/spec/dummy/config/initializers/devise.rb b/spec/dummy/config/initializers/devise.rb new file mode 100644 index 0000000..3fb44d2 --- /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 = [ :email ] + + # 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/db/migrate/20110601190315_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20110601190315_create_refinerycms_core_schema.rb new file mode 100644 index 0000000..3199a9c --- /dev/null +++ b/spec/dummy/db/migrate/20110601190315_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/20110601190316_add_locale_to_slugs.rb b/spec/dummy/db/migrate/20110601190316_add_locale_to_slugs.rb new file mode 100644 index 0000000..50b295f --- /dev/null +++ b/spec/dummy/db/migrate/20110601190316_add_locale_to_slugs.rb @@ -0,0 +1,13 @@ +class AddLocaleToSlugs < ActiveRecord::Migration + def self.up + add_column :slugs, :locale, :string + + add_index :slugs, :locale + end + + def self.down + remove_column :slugs, :locale + + remove_index :slugs, :locale + end +end diff --git a/spec/dummy/db/migrate/20110601190317_create_refinerycms_settings_schema.rb b/spec/dummy/db/migrate/20110601190317_create_refinerycms_settings_schema.rb new file mode 100644 index 0000000..15f0481 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190317_create_refinerycms_settings_schema.rb @@ -0,0 +1,24 @@ +class CreateRefinerycmsSettingsSchema < ActiveRecord::Migration + def self.up + create_table ::RefinerySetting.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 ::RefinerySetting.table_name, ["name"], :name => "index_#{::RefinerySetting.table_name}_on_name" + end + + def self.down + [::RefinerySetting].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/20110601190318_add_value_type_to_refinery_settings.rb b/spec/dummy/db/migrate/20110601190318_add_value_type_to_refinery_settings.rb new file mode 100644 index 0000000..1255841 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190318_add_value_type_to_refinery_settings.rb @@ -0,0 +1,9 @@ +class AddValueTypeToRefinerySettings < ActiveRecord::Migration + def self.up + add_column ::RefinerySetting.table_name, :form_value_type, :string + end + + def self.down + remove_column ::RefinerySetting.table_name, :form_value_type + end +end diff --git a/spec/dummy/db/migrate/20110601190319_create_refinerycms_authentication_schema.rb b/spec/dummy/db/migrate/20110601190319_create_refinerycms_authentication_schema.rb new file mode 100644 index 0000000..bf90973 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190319_create_refinerycms_authentication_schema.rb @@ -0,0 +1,43 @@ +class CreateRefinerycmsAuthenticationSchema < ActiveRecord::Migration + def self.up + # Postgres apparently requires the roles_users table to exist before creating the roles table. + create_table ::RolesUsers.table_name, :id => false, :force => true do |t| + t.integer "user_id" + t.integer "role_id" + end + + create_table ::Role.table_name, :force => true do |t| + t.string "title" + end + + create_table ::UserPlugin.table_name, :force => true do |t| + t.integer "user_id" + t.string "name" + t.integer "position" + end + + add_index ::UserPlugin.table_name, ["name"], :name => "index_#{::UserPlugin.table_name}_on_title" + add_index ::UserPlugin.table_name, ["user_id", "name"], :name => "index_unique_#{::UserPlugin.table_name}", :unique => true + + create_table ::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 ::User.table_name, ["id"], :name => "index_#{::User.table_name}_on_id" + end + + def self.down + [::User].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/20110601190320_add_missing_indexes_to_roles_users.rb b/spec/dummy/db/migrate/20110601190320_add_missing_indexes_to_roles_users.rb new file mode 100644 index 0000000..8ce3677 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190320_add_missing_indexes_to_roles_users.rb @@ -0,0 +1,11 @@ +class AddMissingIndexesToRolesUsers < ActiveRecord::Migration + def self.up + add_index ::RolesUsers.table_name, [:role_id, :user_id] + add_index ::RolesUsers.table_name, [:user_id, :role_id] + end + + def self.down + remove_index ::RolesUsers.table_name, :column => [:role_id, :user_id] + remove_index ::RolesUsers.table_name, :column => [:user_id, :role_id] + end +end diff --git a/spec/dummy/db/migrate/20110601190321_change_to_devise_users_table.rb b/spec/dummy/db/migrate/20110601190321_change_to_devise_users_table.rb new file mode 100644 index 0000000..d799c82 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190321_change_to_devise_users_table.rb @@ -0,0 +1,27 @@ +class ChangeToDeviseUsersTable < ActiveRecord::Migration + def self.up + add_column ::User.table_name, :current_sign_in_at, :datetime + add_column ::User.table_name, :last_sign_in_at, :datetime + add_column ::User.table_name, :current_sign_in_ip, :string + add_column ::User.table_name, :last_sign_in_ip, :string + add_column ::User.table_name, :sign_in_count, :integer + add_column ::User.table_name, :remember_token, :string + add_column ::User.table_name, :reset_password_token, :string + + rename_column ::User.table_name, :crypted_password, :encrypted_password + rename_column ::User.table_name, :login, :username + end + + def self.down + remove_column ::User.table_name, :current_sign_in_at + remove_column ::User.table_name, :last_sign_in_at + remove_column ::User.table_name, :current_sign_in_ip + remove_column ::User.table_name, :last_sign_in_ip + remove_column ::User.table_name, :sign_in_count + remove_column ::User.table_name, :remember_token + remove_column ::User.table_name, :reset_password_token + + rename_column ::User.table_name, :encrypted_password, :crypted_password + rename_column ::User.table_name, :username, :login + end +end diff --git a/spec/dummy/db/migrate/20110601190322_add_remember_created_at_to_users.rb b/spec/dummy/db/migrate/20110601190322_add_remember_created_at_to_users.rb new file mode 100644 index 0000000..3ce3b40 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190322_add_remember_created_at_to_users.rb @@ -0,0 +1,9 @@ +class AddRememberCreatedAtToUsers < ActiveRecord::Migration + def self.up + add_column :users, :remember_created_at, :datetime + end + + def self.down + remove_column :users, :remember_created_at + end +end diff --git a/spec/dummy/db/migrate/20110601190323_remove_password_salt_from_users.rb b/spec/dummy/db/migrate/20110601190323_remove_password_salt_from_users.rb new file mode 100644 index 0000000..5f1eedf --- /dev/null +++ b/spec/dummy/db/migrate/20110601190323_remove_password_salt_from_users.rb @@ -0,0 +1,13 @@ +class RemovePasswordSaltFromUsers < ActiveRecord::Migration + def self.up + remove_column :users, :password_salt + # Make the current password invalid :( + User.all.each do |u| + u.update_attribute(:encrypted_password, u.encrypted_password[29..-1]) + end + end + + def self.down + add_column :users, :password_salt, :string + end +end diff --git a/spec/dummy/db/migrate/20110601190324_create_refinerycms_images_schema.rb b/spec/dummy/db/migrate/20110601190324_create_refinerycms_images_schema.rb new file mode 100644 index 0000000..c00d8fc --- /dev/null +++ b/spec/dummy/db/migrate/20110601190324_create_refinerycms_images_schema.rb @@ -0,0 +1,23 @@ +class CreateRefinerycmsImagesSchema < ActiveRecord::Migration + def self.up + create_table ::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 + end + + def self.down + [::Image].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/20110601190325_create_refinerycms_pages_schema.rb b/spec/dummy/db/migrate/20110601190325_create_refinerycms_pages_schema.rb new file mode 100644 index 0000000..66c7776 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190325_create_refinerycms_pages_schema.rb @@ -0,0 +1,52 @@ +class CreateRefinerycmsPagesSchema < ActiveRecord::Migration + def self.up + create_table ::PagePart.table_name, :force => true do |t| + t.integer "page_id" + t.string "title" + t.text "body" + t.integer "position" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index ::PagePart.table_name, ["id"], :name => "index_#{::PagePart.table_name}_on_id" + add_index ::PagePart.table_name, ["page_id"], :name => "index_#{::PagePart.table_name}_on_page_id" + + create_table ::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 ::Page.table_name, ["depth"], :name => "index_#{::Page.table_name}_on_depth" + add_index ::Page.table_name, ["id"], :name => "index_#{::Page.table_name}_on_id" + add_index ::Page.table_name, ["lft"], :name => "index_#{::Page.table_name}_on_lft" + add_index ::Page.table_name, ["parent_id"], :name => "index_#{::Page.table_name}_on_parent_id" + add_index ::Page.table_name, ["rgt"], :name => "index_#{::Page.table_name}_on_rgt" + end + + def self.down + [::Page, ::PagePart].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/20110601190326_translate_page_plugin.rb b/spec/dummy/db/migrate/20110601190326_translate_page_plugin.rb new file mode 100644 index 0000000..fc48554 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190326_translate_page_plugin.rb @@ -0,0 +1,29 @@ +class TranslatePagePlugin < ActiveRecord::Migration + def self.up + PagePart.create_translation_table!({ + :body => :text + }, { + :migrate_data => true + }) + + Page.create_translation_table!({ + :title => :string, + :meta_keywords => :string, + :meta_description => :text, + :browser_title => :string + }, { + :migrate_data => true + }) + + if (seed_file = Rails.root.join('db', 'seeds', 'pages.rb')).file? + load seed_file.to_s unless Page.where(:link_url => '/').any? + end + + Slug.update_all(:locale => ::I18n.locale) + end + + def self.down + Page.drop_translation_table! :migrate_data => true + PagePart.drop_translation_table! :migrate_data => true + end +end diff --git a/spec/dummy/db/migrate/20110601190327_remove_cached_slug_from_pages.rb b/spec/dummy/db/migrate/20110601190327_remove_cached_slug_from_pages.rb new file mode 100644 index 0000000..12bcb5c --- /dev/null +++ b/spec/dummy/db/migrate/20110601190327_remove_cached_slug_from_pages.rb @@ -0,0 +1,11 @@ +class RemoveCachedSlugFromPages < ActiveRecord::Migration + def self.up + if ::Page.column_names.map(&:to_s).include?('cached_slug') + remove_column ::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/20110601190328_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110601190328_translate_custom_title_on_pages.rb new file mode 100644 index 0000000..00ed05f --- /dev/null +++ b/spec/dummy/db/migrate/20110601190328_translate_custom_title_on_pages.rb @@ -0,0 +1,26 @@ +class TranslateCustomTitleOnPages < ActiveRecord::Migration + def self.up + unless ::Page::Translation.column_names.map(&:to_sym).include?(:custom_title) + add_column ::Page::Translation.table_name, :custom_title, :string + + # Re-save custom_title + ::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 + ::Page.all.each do |page| + ::Page.update_all({ + :custom_title => page.attributes['custom_title'] + }, { + :id => page.id.to_s + }) unless page.attributes['custom_title'].nil? + end + + remove_column ::Page::Translation.table_name, :custom_title + end +end diff --git a/spec/dummy/db/migrate/20110601190329_remove_translated_fields_from_pages.rb b/spec/dummy/db/migrate/20110601190329_remove_translated_fields_from_pages.rb new file mode 100644 index 0000000..fb1b4d8 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190329_remove_translated_fields_from_pages.rb @@ -0,0 +1,13 @@ +class RemoveTranslatedFieldsFromPages < ActiveRecord::Migration + def self.up + ::Page.translated_attribute_names.map(&:to_sym).each do |column_name| + remove_column ::Page.table_name, column_name if ::Page.column_names.map(&:to_sym).include?(column_name) + end + end + + def self.down + ::Page.translated_attribute_names.map(&:to_sym).each do |column_name| + add_column ::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/20110601190330_create_seo_meta.rb b/spec/dummy/db/migrate/20110601190330_create_seo_meta.rb new file mode 100644 index 0000000..3366b47 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190330_create_seo_meta.rb @@ -0,0 +1,88 @@ +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 = ::Page::Translation.all.map(&:attributes) + + # Remove columns + ::SeoMeta.attributes.keys.each do |field| + if ::Page::Translation.column_names.map(&:to_sym).include?(field) + remove_column ::Page::Translation.table_name, field + end + end + + # Reset column information because otherwise the old columns will still exist. + ::Page::Translation.reset_column_information + + # Re-attach seo_meta + ::Page::Translation.module_eval do + is_seo_meta + end + + # Migrate data + existing_translations.each do |translation| + ::Page::Translation.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. + ::Page.reset_column_information + end + + def self.down + # Grab the attributes of the records that currently exist + existing_translations = ::Page::Translation.all.map(&:attributes) + + # Add columns back to your model + ::SeoMeta.attributes.each do |field, field_type| + unless ::Page::Translation.column_names.map(&:to_sym).include?(field) + add_column ::Page::Translation.table_name, field, field_type + end + end + + # Reset column information because otherwise the new columns won't exist yet. + ::Page::Translation.reset_column_information + + # Migrate data + existing_translations.each do |translation| + ::Page::Translation.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| + ::Page::Translation.module_eval %{ + def #{k} + end + + def #{k}=(*args) + end + } + end + + # Reset column information again because otherwise the old columns will still exist. + ::Page.reset_column_information + + drop_table :seo_meta + end + +end diff --git a/spec/dummy/db/migrate/20110601190331_create_refinerycms_resources_schema.rb b/spec/dummy/db/migrate/20110601190331_create_refinerycms_resources_schema.rb new file mode 100644 index 0000000..5f7a14a --- /dev/null +++ b/spec/dummy/db/migrate/20110601190331_create_refinerycms_resources_schema.rb @@ -0,0 +1,21 @@ +class CreateRefinerycmsResourcesSchema < ActiveRecord::Migration + def self.up + create_table ::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 + end + + def self.down + [::Resource].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/20110601190332_create_blog_structure.rb b/spec/dummy/db/migrate/20110601190332_create_blog_structure.rb new file mode 100644 index 0000000..197efb1 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190332_create_blog_structure.rb @@ -0,0 +1,54 @@ +class CreateBlogStructure < ActiveRecord::Migration + + def self.up + create_table :blog_posts, :id => true do |t| + t.string :title + t.text :body + t.boolean :draft + t.datetime :published_at + t.timestamps + end + + add_index :blog_posts, :id + + create_table :blog_comments, :id => true do |t| + t.integer :blog_post_id + t.boolean :spam + t.string :name + t.string :email + t.text :body + t.string :state + t.timestamps + end + + add_index :blog_comments, :id + + create_table :blog_categories, :id => true do |t| + t.string :title + t.timestamps + end + + add_index :blog_categories, :id + + create_table :blog_categories_blog_posts, :id => false 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' + + load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s) + end + + def self.down + UserPlugin.destroy_all({:name => "refinerycms_blog"}) + + Page.delete_all({:link_url => "/blog"}) + + drop_table :blog_posts + drop_table :blog_comments + drop_table :blog_categories + drop_table :blog_categories_blog_posts + end + +end diff --git a/spec/dummy/db/migrate/20110601190333_add_user_id_to_blog_posts.rb b/spec/dummy/db/migrate/20110601190333_add_user_id_to_blog_posts.rb new file mode 100644 index 0000000..cd62524 --- /dev/null +++ b/spec/dummy/db/migrate/20110601190333_add_user_id_to_blog_posts.rb @@ -0,0 +1,11 @@ +class AddUserIdToBlogPosts < ActiveRecord::Migration + + def self.up + add_column :blog_posts, :user_id, :integer + end + + def self.down + remove_column :blog_posts, :user_id + end + +end \ No newline at end of file diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb new file mode 100644 index 0000000..3a0bf84 --- /dev/null +++ b/spec/dummy/db/schema.rb @@ -0,0 +1,216 @@ +# 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 => 20110601190333) do + + create_table "blog_categories", :force => true do |t| + t.string "title" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "blog_categories", ["id"], :name => "index_blog_categories_on_id" + + create_table "blog_categories_blog_posts", :id => false, :force => 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" + + create_table "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 "blog_comments", ["id"], :name => "index_blog_comments_on_id" + + create_table "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" + end + + add_index "blog_posts", ["id"], :name => "index_blog_posts_on_id" + + create_table "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 "page_part_translations", :force => true do |t| + t.integer "page_part_id" + t.string "locale" + t.text "body" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "page_part_translations", ["page_part_id"], :name => "index_page_part_translations_on_page_part_id" + + create_table "page_parts", :force => true do |t| + t.integer "page_id" + t.string "title" + t.text "body" + t.integer "position" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "page_parts", ["id"], :name => "index_page_parts_on_id" + add_index "page_parts", ["page_id"], :name => "index_page_parts_on_page_id" + + create_table "page_translations", :force => true do |t| + t.integer "page_id" + t.string "locale" + t.string "title" + t.string "custom_title" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "page_translations", ["page_id"], :name => "index_page_translations_on_page_id" + + create_table "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" + end + + add_index "pages", ["depth"], :name => "index_pages_on_depth" + add_index "pages", ["id"], :name => "index_pages_on_id" + add_index "pages", ["lft"], :name => "index_pages_on_lft" + add_index "pages", ["parent_id"], :name => "index_pages_on_parent_id" + add_index "pages", ["rgt"], :name => "index_pages_on_rgt" + + 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 "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 "roles", :force => true do |t| + t.string "title" + end + + create_table "roles_users", :id => false, :force => true do |t| + t.integer "user_id" + t.integer "role_id" + end + + add_index "roles_users", ["role_id", "user_id"], :name => "index_roles_users_on_role_id_and_user_id" + add_index "roles_users", ["user_id", "role_id"], :name => "index_roles_users_on_user_id_and_role_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 "user_plugins", :force => true do |t| + t.integer "user_id" + t.string "name" + t.integer "position" + end + + add_index "user_plugins", ["name"], :name => "index_user_plugins_on_title" + add_index "user_plugins", ["user_id", "name"], :name => "index_unique_user_plugins", :unique => true + + create_table "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 "users", ["id"], :name => "index_users_on_id" + +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..07cf55e --- /dev/null +++ b/spec/dummy/db/seeds/pages.rb @@ -0,0 +1,42 @@ +page_position = -1 + +home_page = Page.create(:title => "Home", + :deletable => false, + :link_url => "/", + :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 + }) + +about_us_page = 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 + }) diff --git a/spec/dummy/db/seeds/refinerycms_blog.rb b/spec/dummy/db/seeds/refinerycms_blog.rb new file mode 100644 index 0000000..f958fab --- /dev/null +++ b/spec/dummy/db/seeds/refinerycms_blog.rb @@ -0,0 +1,16 @@ +User.find(:all).each do |user| + user.plugins.create(:name => "refinerycms_blog", + :position => (user.plugins.maximum(:position) || -1) +1) +end + +page = Page.create( + :title => "Blog", + :link_url => "/blog", + :deletable => false, + :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), + :menu_match => "^/blogs?(\/|\/.+?|)$" +) + +Page.default_parts.each do |default_page_part| + page.parts.create(:title => default_page_part, :body => nil) +end diff --git a/spec/dummy/public/javascripts/admin.js b/spec/dummy/public/javascripts/admin.js new file mode 100644 index 0000000..23c4fb9 --- /dev/null +++ b/spec/dummy/public/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/public/javascripts/rails.js b/spec/dummy/public/javascripts/rails.js deleted file mode 100644 index aed6aed..0000000 --- a/spec/dummy/public/javascripts/rails.js +++ /dev/null @@ -1,191 +0,0 @@ -(function() { - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - function isEventSupported(eventName) { - var el = document.createElement('div'); - eventName = 'on' + eventName; - var isSupported = (eventName in el); - if (!isSupported) { - el.setAttribute(eventName, 'return;'); - isSupported = typeof el[eventName] == 'function'; - } - el = null; - return isSupported; - } - - function isForm(element) { - return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM' - } - - function isInput(element) { - if (Object.isElement(element)) { - var name = element.nodeName.toUpperCase() - return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA' - } - else return false - } - - var submitBubbles = isEventSupported('submit'), - changeBubbles = isEventSupported('change') - - if (!submitBubbles || !changeBubbles) { - // augment the Event.Handler class to observe custom events when needed - Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap( - function(init, element, eventName, selector, callback) { - init(element, eventName, selector, callback) - // is the handler being attached to an element that doesn't support this event? - if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) || - (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) { - // "submit" => "emulated:submit" - this.eventName = 'emulated:' + this.eventName - } - } - ) - } - - if (!submitBubbles) { - // discover forms on the page by observing focus events which always bubble - document.on('focusin', 'form', function(focusEvent, form) { - // special handler for the real "submit" event (one-time operation) - if (!form.retrieve('emulated:submit')) { - form.on('submit', function(submitEvent) { - var emulated = form.fire('emulated:submit', submitEvent, true) - // if custom event received preventDefault, cancel the real one too - if (emulated.returnValue === false) submitEvent.preventDefault() - }) - form.store('emulated:submit', true) - } - }) - } - - if (!changeBubbles) { - // discover form inputs on the page - document.on('focusin', 'input, select, texarea', function(focusEvent, input) { - // special handler for real "change" events - if (!input.retrieve('emulated:change')) { - input.on('change', function(changeEvent) { - input.fire('emulated:change', changeEvent, true) - }) - input.store('emulated:change', true) - } - }) - } - - function handleRemote(element) { - var method, url, params; - - var event = element.fire("ajax:before"); - if (event.stopped) return false; - - if (element.tagName.toLowerCase() === 'form') { - method = element.readAttribute('method') || 'post'; - url = element.readAttribute('action'); - params = element.serialize(); - } else { - method = element.readAttribute('data-method') || 'get'; - url = element.readAttribute('href'); - params = {}; - } - - new Ajax.Request(url, { - method: method, - parameters: params, - evalScripts: true, - - onComplete: function(request) { element.fire("ajax:complete", request); }, - onSuccess: function(request) { element.fire("ajax:success", request); }, - onFailure: function(request) { element.fire("ajax:failure", request); } - }); - - element.fire("ajax:after"); - } - - function handleMethod(element) { - var method = element.readAttribute('data-method'), - url = element.readAttribute('href'), - csrf_param = $$('meta[name=csrf-param]')[0], - csrf_token = $$('meta[name=csrf-token]')[0]; - - var form = new Element('form', { method: "POST", action: url, style: "display: none;" }); - element.parentNode.insert(form); - - if (method !== 'post') { - var field = new Element('input', { type: 'hidden', name: '_method', value: method }); - form.insert(field); - } - - if (csrf_param) { - var param = csrf_param.readAttribute('content'), - token = csrf_token.readAttribute('content'), - field = new Element('input', { type: 'hidden', name: param, value: token }); - form.insert(field); - } - - form.submit(); - } - - - document.on("click", "*[data-confirm]", function(event, element) { - var message = element.readAttribute('data-confirm'); - if (!confirm(message)) event.stop(); - }); - - document.on("click", "a[data-remote]", function(event, element) { - if (event.stopped) return; - handleRemote(element); - event.stop(); - }); - - document.on("click", "a[data-method]", function(event, element) { - if (event.stopped) return; - handleMethod(element); - event.stop(); - }); - - document.on("submit", function(event) { - var element = event.findElement(), - message = element.readAttribute('data-confirm'); - if (message && !confirm(message)) { - event.stop(); - return false; - } - - var inputs = element.select("input[type=submit][data-disable-with]"); - inputs.each(function(input) { - input.disabled = true; - input.writeAttribute('data-original-value', input.value); - input.value = input.readAttribute('data-disable-with'); - }); - - var element = event.findElement("form[data-remote]"); - if (element) { - handleRemote(element); - event.stop(); - } - }); - - document.on("ajax:after", "form", function(event, element) { - var inputs = element.select("input[type=submit][disabled=true][data-disable-with]"); - inputs.each(function(input) { - input.value = input.readAttribute('data-original-value'); - input.removeAttribute('data-original-value'); - input.disabled = false; - }); - }); - - Ajax.Responders.register({ - onCreate: function(request) { - var csrf_meta_tag = $$('meta[name=csrf-token]')[0]; - - if (csrf_meta_tag) { - var header = 'X-CSRF-Token', - token = csrf_meta_tag.readAttribute('content'); - - if (!request.options.requestHeaders) { - request.options.requestHeaders = {}; - } - request.options.requestHeaders[header] = token; - } - } - }); -})(); diff --git a/spec/dummy/public/stylesheets/application.css b/spec/dummy/public/stylesheets/application.css new file mode 100644 index 0000000..b83dd7f --- /dev/null +++ b/spec/dummy/public/stylesheets/application.css @@ -0,0 +1,4 @@ +/* + Override default refinery application CSS below. + Formatting applies to all frontend. +*/ \ No newline at end of file diff --git a/spec/dummy/public/stylesheets/formatting.css b/spec/dummy/public/stylesheets/formatting.css new file mode 100644 index 0000000..1132188 --- /dev/null +++ b/spec/dummy/public/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/public/stylesheets/home.css b/spec/dummy/public/stylesheets/home.css new file mode 100644 index 0000000..824db99 --- /dev/null +++ b/spec/dummy/public/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/public/stylesheets/theme.css b/spec/dummy/public/stylesheets/theme.css new file mode 100644 index 0000000..8205050 --- /dev/null +++ b/spec/dummy/public/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/integration/navigation_spec.rb b/spec/integration/navigation_spec.rb index 4b535b6..514a51e 100644 --- a/spec/integration/navigation_spec.rb +++ b/spec/integration/navigation_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' -describe "Navigation" do - include Capybara - +describe "Rails project" do it "should be a valid app" do ::Rails.application.should be_a(Dummy::Application) end diff --git a/spec/refinerycms_wordpress_import_spec.rb b/spec/refinerycms_wordpress_import_spec.rb index db4c29c..3c82c27 100644 --- a/spec/refinerycms_wordpress_import_spec.rb +++ b/spec/refinerycms_wordpress_import_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe Refinerycms-wordpress-import do +describe Refinery::WordPress do it "should be valid" do - Refinerycms-wordpress-import.should be_a(Module) + Refinery::WordPress.should be_a(Module) end -end \ No newline at end of file +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ef2356f..cbc5fb4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,11 +11,6 @@ ActionMailer::Base.default_url_options[:host] = "test.com" Rails.backtrace_cleaner.remove_silencers! -# Configure capybara for integration testing -require "capybara/rails" -Capybara.default_driver = :rack_test -Capybara.default_selector = :css - # Run any available migration ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)