Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'enmasse-entertainment/decorators'
- Loading branch information
Showing
7 changed files
with
166 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
module Refinery | ||
module Core | ||
class Engine < ::Rails::Engine | ||
isolate_namespace ::Refinery | ||
|
||
def self.load_decorators | ||
Dir.glob(File.join(Rails.root, "app/decorators/**/*_decorator.rb")) do |c| | ||
Rails.application.config.cache_classes ? require(c) : load(c) | ||
end | ||
end | ||
|
||
config.autoload_paths += %W( #{config.root}/lib ) | ||
|
||
# Attach ourselves to the Rails application. | ||
config.before_configuration do | ||
::Refinery::Core.attach_to_application! | ||
end | ||
|
||
refinery.after_inclusion &method(:load_decorators).to_proc | ||
|
||
# Wrap errors in spans and cache vendored assets. | ||
config.to_prepare do | ||
# This wraps errors in span not div | ||
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | ||
"<span class=\"fieldWithErrors\">#{html_tag}</span>".html_safe | ||
end | ||
end | ||
|
||
# set per_page globally | ||
config.to_prepare do | ||
WillPaginate.per_page = 20 | ||
end | ||
|
||
# Register the plugin | ||
config.after_initialize do | ||
::Refinery::Plugin.register do |plugin| | ||
plugin.pathname = root | ||
plugin.name = 'refinery_core' | ||
plugin.class_name = 'RefineryEngine' | ||
plugin.version = ::Refinery.version | ||
plugin.hide_from_menu = true | ||
plugin.always_allow_access = true | ||
plugin.menu_match = /refinery\/(refinery_core)$/ | ||
end | ||
|
||
# Register the dialogs plugin | ||
::Refinery::Plugin.register do |plugin| | ||
plugin.pathname = root | ||
plugin.name = 'refinery_dialogs' | ||
plugin.version = ::Refinery.version | ||
plugin.hide_from_menu = true | ||
plugin.always_allow_access = true | ||
plugin.menu_match = /refinery\/(refinery_)?dialogs/ | ||
end | ||
end | ||
|
||
initializer 'add catch all routes' do |app| | ||
app.routes_reloader.paths << File.expand_path('../../catch_all_routes.rb', __FILE__) | ||
end | ||
|
||
initializer 'add presenters' do |app| | ||
app.config.autoload_paths += [ | ||
Rails.root.join('app', 'presenters'), | ||
Rails.root.join('vendor', '**', '**', 'app', 'presenters'), | ||
Refinery.roots.map{|r| r.join('**', 'app', 'presenters')} | ||
].flatten | ||
end | ||
|
||
initializer 'configure acts_as_indexed' do |app| | ||
ActsAsIndexed.configure do |config| | ||
config.index_file = Rails.root.join('tmp', 'index') | ||
config.index_file_depth = 3 | ||
config.min_word_size = 3 | ||
end | ||
end | ||
|
||
initializer "refinery.assets.precompile" do |app| | ||
app.config.assets.precompile += [ | ||
"refinery/*", | ||
"refinery/icons/*", | ||
"wymeditor/lang/*", | ||
"wymeditor/skins/refinery/*", | ||
"wymeditor/skins/refinery/**/*", | ||
"modernizr-min.js", | ||
"dd_belatedpng.js" | ||
] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require 'spec_helper' | ||
require "generator_spec/test_case" | ||
|
||
module Refinery | ||
describe CmsGenerator do | ||
include GeneratorSpec::TestCase | ||
destination File.expand_path("../../tmp", __FILE__) | ||
|
||
before(:each) do | ||
prepare_destination | ||
run_generator | ||
end | ||
|
||
specify do | ||
destination_root.should have_structure { | ||
directory "app" do | ||
directory "decorators" do | ||
directory "controllers" do | ||
directory "refinery" do | ||
file ".gitkeep" | ||
end | ||
end | ||
directory "models" do | ||
directory "refinery" do | ||
file ".gitkeep" | ||
end | ||
end | ||
end | ||
directory "views" do | ||
directory "sitemap" do | ||
file "index.xml.builder" | ||
end | ||
end | ||
end | ||
directory "db" do | ||
file "seeds.rb" | ||
end | ||
directory "config" do | ||
file "database.yml.mysql" | ||
file "database.yml.postgresql" | ||
file "database.yml.sqlite3" | ||
directory "initializers" do | ||
file "devise.rb" | ||
end | ||
end | ||
} | ||
end | ||
end | ||
end |