lib/railsthemes/email_installer.rb in railsthemes-1.1 vs lib/railsthemes/email_installer.rb in railsthemes-1.1.1
- old
+ new
@@ -50,16 +50,30 @@
Utils.conditionally_insert_routes({
'railsthemes/email' => 'railsthemes#email',
'railsthemes/send_email' => 'railsthemes#send_email'
})
- Utils.conditionally_install_gems 'roadie', 'premailer-rails3'
+ install_mail_gems_if_necessary
create_file File.join('config', 'initializers', 'premailer.rb'), :verbose => false do
"PremailerRails.config.merge(:input_encoding => 'UTF-8', :generate_text_part => true)"
end
logger.warn 'Done installing email theme.'
+ end
+
+ def install_mail_gems_if_necessary
+ gem_names = Utils.gemspecs.map(&:name)
+ logger.debug "gem_names: #{gem_names}"
+ unless gem_names.include?('premailer-rails3')
+ if (gem_names & ['hpricot', 'nokogiri']).empty?
+ Utils.add_gem_to_gemfile 'hpricot'
+ end
+ Utils.add_gem_to_gemfile 'premailer-rails3'
+ logger.warn 'Installing assistant mail gems...'
+ Safe.system_call 'bundle'
+ logger.warn 'Done installing assistant mail gems.'
+ end
end
def install_from_archive filepath
Railsthemes::Utils.with_tempdir do |tempdir|
Utils.unarchive filepath, tempdir