Permalink
Browse files

Because railstie boot after config/initializers.So theme_park.rb must…

… exist.
  • Loading branch information...
1 parent 0b434f7 commit 4ced6cfb2106e21dd22c08172665f1bdb789b1be @zires committed Mar 15, 2012
Showing with 16 additions and 28 deletions.
  1. +12 −13 lib/generators/templates/theme_park.rb
  2. +0 −5 lib/generators/theme_park/create_generator.rb
  3. +4 −10 lib/theme_park/railtie.rb
View
25 lib/generators/templates/theme_park.rb
@@ -11,17 +11,16 @@
# |- views
# |- layouts
#
-# Uncomment below lines if you really need to.
+# Change below lines if you really need to.
# ===
-# ThemePark.setup do |config|
-#
-# config.root = "#{::Rails.root}/themes/"
-# config.prefix = 'themes'
-# config.images_path = ':root/:name/assets/images'
-# config.javascripts_path = ':root/:name/assets/javascripts'
-# config.stylesheets_path = ':root/:name/assets/stylesheets'
-# config.compiled_path = ':root/:name/assets/compiled'
-# config.views_path = ':root/:name/views'
-#
-# end
-# ===
+ThemePark.setup do |config|
+
+ config.root = "#{::Rails.root}/themes/"
+ config.prefix = 'themes'
+ config.images_path = ':root/:name/assets/images'
+ config.javascripts_path = ':root/:name/assets/javascripts'
+ config.stylesheets_path = ':root/:name/assets/stylesheets'
+ config.compiled_path = ':root/:name/assets/compiled'
+ config.views_path = ':root/:name/views'
+
+end
View
5 lib/generators/theme_park/create_generator.rb
@@ -1,11 +1,6 @@
# encoding: utf-8
require 'fileutils'
-begin
- require File.join(::Rails.root, 'config', 'initializers', 'theme_park.rb')
-rescue Exception => e
-end
-
module ThemePark
module Generators
class CreateGenerator < ::Rails::Generators::Base
View
14 lib/theme_park/railtie.rb
@@ -14,16 +14,10 @@ class Railtie < ::Rails::Railtie
initializer "ThemePark.environment", :group => :all do |app|
config = app.config
-
- config.theme_park = ThemePark.setup do |config|
- config.root = "#{::Rails.root}/themes/"
- config.prefix = 'themes'
- config.images_path = ':root/:name/assets/images'
- config.javascripts_path = ':root/:name/assets/javascripts'
- config.stylesheets_path = ':root/:name/assets/stylesheets'
- config.compiled_path = ':root/:name/assets/compiled'
- config.views_path = ':root/:name/views'
- end
+
+ # Because this is boot after initializer file.
+ # So config/initializers/theme_park.rb must exist.
+ config.theme_park = ThemePark
ActiveSupport.on_load(:action_view) do
ActionView::Helpers::AssetTagHelper.send :include, ThemePark::Rails::AssetTagHelper

0 comments on commit 4ced6cf

Please sign in to comment.