lib/railsthemes/email_installer.rb in railsthemes-2.0.1 vs lib/railsthemes/email_installer.rb in railsthemes-2.0.2

- old
+ new

@@ -1,40 +1,39 @@ module Railsthemes class EmailInstaller include Railsthemes::Logging - def email_stylesheet_filenames theme_name - Dir["app/assets/stylesheets/railsthemes_#{theme_name}/*_email.css.*"] + def email_stylesheet_filenames + Dir["app/assets/stylesheets/railsthemes/*_email.css.*"] end def install_from_file_system source_filepath - theme_name = Utils.read_file(File.join(source_filepath, 'theme_name')).chomp - if email_stylesheet_filenames(theme_name).count > 0 + if email_stylesheet_filenames.count > 0 logger.warn 'Installing email...' logger.info "Source filepath: #{source_filepath}" unless File.directory?(source_filepath) Safe.log_and_abort 'Expected a directory to install email theme from, but found none.' end - add_to_asset_precompilation_list theme_name + add_to_asset_precompilation_list install_mail_gems_if_necessary logger.warn 'Done installing email.' true else false end end - def add_to_asset_precompilation_list theme_name - filenames = email_stylesheet_filenames(theme_name).map do |filename| - "railsthemes_#{theme_name}/#{File.basename(filename.gsub(/\.erb$/, ''))}" + def add_to_asset_precompilation_list + filenames = email_stylesheet_filenames.map do |filename| + "railsthemes/#{File.basename(filename.gsub(/\.erb$/, ''))}" end updated_or_new_line = " config.assets.precompile += %w( #{filenames.join(' ')} )" config_lines = Utils.lines('config/environments/production.rb') - email_regex = /^\s*config.assets.precompile\s*\+=\s*%w\(\s*railsthemes_#{theme_name}\/\w*email\.css.*\)$/ + email_regex = /^\s*config.assets.precompile\s*\+=\s*%w\(\s*railsthemes\/\w*email\.css.*\)$/ count = config_lines.grep(email_regex).count if count == 0 # precompile line we want not found, add it added = false # only want to add the new line once Utils.safe_write('config/environments/production.rb') do |f| config_lines.each do |line|