Class: Boring::FontAwesome::RubyGem::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/boring/font_awesome/ruby_gem/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_font_awesome_sass_gemObject



9
10
11
12
13
14
# File 'lib/generators/boring/font_awesome/ruby_gem/install/install_generator.rb', line 9

def add_font_awesome_sass_gem
  say "Adding font_awesome_sass gem", :green
  Bundler.with_unbundled_env do
    run "bundle add font-awesome-sass"
  end
end

#import_font_awesome_stylesheetObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/boring/font_awesome/ruby_gem/install/install_generator.rb', line 16

def import_font_awesome_stylesheet
  say "Adding font awesome stylesheets", :green
  stylesheet_font_awesome_imports = <<~RUBY
    \n
    @import "font-awesome-sprockets";
    @import "font-awesome";
  RUBY

  if File.exist?("app/assets/stylesheets/application.css.scss")
    append_to_file "app/assets/stylesheets/application.css.scss", stylesheet_font_awesome_imports
  elsif File.exist?("app/assets/stylesheets/application.scss")
    append_to_file "app/assets/stylesheets/application.scss", stylesheet_font_awesome_imports
  else
    say <<~WARNING, :red
      ERROR: Looks like the application.css.scss is missing. Please rename the file and re-run the generator.
    WARNING
  end
end