class AttributesFor::Generators::InstallGenerator
Public Instance Methods
copy_translations()
click to toggle source
# File lib/generators/attributes_for/install_generator.rb, line 7 def copy_translations copy_file 'attributes_for.en.yml', 'config/locales/attributes_for.en.yml' end
inject_stylesheets()
click to toggle source
# File lib/generators/attributes_for/install_generator.rb, line 11 def inject_stylesheets in_root do { "css" => { require_string: " *= require font-awesome", where: {before: %r{.*require_self}}, }, "css.scss" => { require_string: "@import \"font-awesome\";", where: {after: %r{\A}}, }, }.each do |extension, strategy| file = "app/assets/stylesheets/application.#{extension}" if File.exists?(Rails.root.join(file)) unless File.foreach(file).grep(/#{strategy[:require_string]}/).any? inject_into_file file, strategy[:require_string] + "\n", strategy[:where] end end end end end