Skip to content

Commit

Permalink
Use asset dir values from install_theme.yml on reload
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Mar 3, 2010
1 parent 7c3cbbf commit 1b9f2a2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/install_theme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ def initialize(options = {})
@rails_root = File.expand_path(options[:rails_root] || File.dirname('.'))
@template_type = (options[:template_type] || detect_template).to_s
@defaults_file = options[:defaults_file] || "install_theme.yml"
@stylesheet_dir = options[:stylesheet_dir] || detect_stylesheet_dir
@javascript_dir = options[:javascript_dir] || detect_javascript_dir
@image_dir = options[:image_dir] || detect_image_dir
@layout_name = options[:layout] || "application"
@layout_name.gsub!(/\..*/, '') # allow application.html.erb to be passed in, but clean it up to 'application'
@action = options[:action]

@stdout = options[:stdout] || $stdout

load_template_defaults unless options[:ignore_defaults]

@stylesheet_dir = options[:stylesheet_dir] || @stylesheet_dir || detect_stylesheet_dir
@javascript_dir = options[:javascript_dir] || @javascript_dir || detect_javascript_dir
@image_dir = options[:image_dir] || @image_dir || detect_image_dir

@index_path = options[:index_path] || @index_path || "index.html"
@content_path = options[:content_path] || @content_path
@partials ||= {}
Expand Down Expand Up @@ -92,9 +94,12 @@ def load_template_defaults
return unless File.exist?(File.join(template_root, defaults_file))
require "yaml"
defaults = YAML.load_file(File.join(template_root, defaults_file))
@content_path = defaults["content_path"]
@partials = defaults["partials"]
@index_path = defaults["index_path"]
@content_path = defaults["content_path"]
@partials = defaults["partials"]
@index_path = defaults["index_path"]
@stylesheet_dir = defaults["stylesheet_dir"]
@image_dir = defaults["image_dir"]
@javascript_dir = defaults["javascript_dir"]
end

def convert_file_to_layout(html_path, layout_path)
Expand Down

0 comments on commit 1b9f2a2

Please sign in to comment.