lib/railsthemes/theme_installer.rb in railsthemes-2.1.0 vs lib/railsthemes/theme_installer.rb in railsthemes-2.1.1
- old
+ new
@@ -26,20 +26,21 @@
end
def install_from_directory source_filepath
copy_theme_portions source_filepath, [
['controllers', 'app'],
- ['helpers', 'app'],
- ['layouts', 'app/views'],
- ['stylesheets', 'app/assets'],
+ ['doc', ''],
+ ['fonts', 'app/assets'],
+ ['helpers', 'app'],
+ ['images', 'app/assets'],
['javascripts', 'app/assets'],
- ['doc', ''],
- ['images', 'app/assets'],
- ['mailers', 'app'],
- ['views', 'app'],
- ['fonts', 'app/assets'],
- ['vendor', ''],
+ ['layouts', 'app/views'],
+ ['lib', ''],
+ ['mailers', 'app'],
+ ['stylesheets', 'app/assets'],
+ ['vendor', ''],
+ ['views', 'app'],
]
logger.warn 'Done installing.'
return Utils.read_file(File.join(source_filepath, 'theme_name')).chomp
end
@@ -49,10 +50,11 @@
create_railsthemes_demo_routes
add_needed_gems
Utils.set_layout_in_application_controller theme_name
add_to_asset_precompilation_list theme_name
comment_out_formtastic_if_user_does_not_use_formtastic theme_name
+ add_sass_module_line
end
def remove_unwanted_public_files
['index', '404', '422', '500'].each do |filename|
Utils.remove_file "public/#{filename}.html"
@@ -155,9 +157,30 @@
f.puts line
if !added && (line =~ /Precompile additional assets/ || line =~ /config\.assets\.precompile/)
f.puts " config.assets.precompile += %w( railsthemes_#{theme_name}.js railsthemes_#{theme_name}.css )"
f.puts " config.assets.precompile += %w( coderay.css )"
added = true
+ end
+ end
+ end
+ end
+ end
+
+ def add_sass_module_line
+ config_lines = Utils.lines('config/application.rb')
+ count = config_lines.grep(/sass.rb/).count
+ if count == 0
+ Utils.safe_write('config/application.rb') do |f|
+ config_lines.each do |line|
+ f.puts line
+ if line =~ / < Rails::Application/
+ f.puts <<-EOS
+ # RailsThemes
+ if config.respond_to?(:sass)
+ require "#\{config.root}/lib/railsthemes/sass.rb"
+ end
+
+ EOS
end
end
end
end
end