Dummy app is no longer a submodule, now part of the projected - generated by testing generator

Remove remaining traces of cucumber
This commit is contained in:
Jamie Winsor 2011-08-10 17:03:37 -07:00
parent cfba1b86d1
commit 45d8663de5
74 changed files with 1776 additions and 37 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "spec/dummy"]
path = spec/dummy
url = git://github.com/enmasse-entertainment/refinerycms-engine-dummy.git

View file

@ -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

@ -1 +0,0 @@
Subproject commit 36f851b7d5eca685475eb3a232e1d8dabfb1653a

165
spec/dummy/.gitignore vendored Normal file
View file

@ -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.*

13
spec/dummy/Rakefile Normal file
View file

@ -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

View file

View file

@ -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 = {
};

View file

@ -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 .

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,4 @@
/*
Override default refinery formatting below.
Formatting applies to backend WYSIWYG editors and all frontend.
*/

View file

@ -0,0 +1,4 @@
/*
Override default refinery homepage styles here.
These only apply to the homepage of your site.
*/

View file

@ -0,0 +1,4 @@
/*
Override default refinery 'theme' styles here.
These only apply when using custom WYMeditor CSS.
*/

View file

@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end

View file

@ -0,0 +1,2 @@
module ApplicationHelper
end

View file

View file

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Dummy</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

View file

@ -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

4
spec/dummy/config.ru Normal file
View file

@ -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

View file

@ -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

10
spec/dummy/config/boot.rb Normal file
View file

@ -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__)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dummy::Application.initialize!

View file

@ -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?)

View file

@ -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?)

View file

@ -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?)

View file

@ -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!

View file

@ -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 = <YOUR CONSUMER SECRET>
# twitter.consumer_key = <YOUR CONSUMER KEY>
# twitter.options :site => 'http://twitter.com'
# end
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
# end
end

View file

@ -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

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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

View file

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

239
spec/dummy/db/schema.rb Normal file
View file

@ -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

View file

View file

@ -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 => "<p>Welcome to our site. This is just a place holder page while we gather our content.</p>",
:position => 0
})
home_page.parts.create({
:title => "Side Body",
:body => "<p>This is another block of content over here.</p>",
: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 => "<h2>Sorry, there was a problem...</h2><p>The page you requested was not found.</p><p><a href='/'>Return to the home page</a></p>",
: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 => "<p>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.</p>",
:position => 0
})
about_us_page.parts.create({
:title => "Side Body",
:body => "<p>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.</p>",
:position => 1
})
else
page_position += 1
end
end

View file

0
spec/dummy/log/.gitkeep Normal file
View file

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
</div>
</body>
</html>

View file

6
spec/dummy/script/rails Executable file
View file

@ -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'

5
spec/dummy/version.rb Normal file
View file

@ -0,0 +1,5 @@
module Refinery
module TestApp
VERSION = "0.0.1"
end
end

View file

@ -12,38 +12,18 @@ Spork.prefork do
require 'rspec/rails' require 'rspec/rails'
require 'capybara/rspec' require 'capybara/rspec'
require 'database_cleaner' require 'factory_girl'
require 'refinery/testing/factories'
require 'refinery/testing/controller_macros'
require 'refinery/testing/request_macros'
Rails.backtrace_cleaner.remove_silencers! Rails.backtrace_cleaner.remove_silencers!
Dir[ Dir[
File.expand_path("../support/*.rb", __FILE__), File.expand_path("../support/**/*.rb", __FILE__),
File.expand_path("../factories/*.rb", __FILE__) File.expand_path("../factories/**/*.rb", __FILE__)
].each {|f| require f} ].each {|f| require f}
RSpec.configure do |config| RSpec.configure do |config|
config.mock_with :rspec config.mock_with :rspec
config.use_transactional_fixtures = false 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
end end

View file

@ -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

8
spec/support/devise.rb Normal file
View file

@ -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

8
spec/support/refinery.rb Normal file
View file

@ -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