class Bootswatch::Fontawesome::Generators::InstallGenerator
Constants
- DEFAULT_RAILS_APP_CSS_FILE
- DEFAULT_THEME_NAME
Public Instance Methods
add_assets()
click to toggle source
# File lib/generators/bootswatch/fontawesome/install/install_generator.rb, line 30 def add_assets if use_default_theme_name? if File.exist?(DEFAULT_RAILS_APP_CSS_FILE) unless File.read(DEFAULT_RAILS_APP_CSS_FILE).include?('font-awesome') insert_into_file DEFAULT_RAILS_APP_CSS_FILE, " *= require #{theme_name}/font-awesome\n", :before => "*/" end end else if File.exist?("app/assets/stylesheets/#{theme_name}.css") unless File.read("app/assets/stylesheets/#{theme_name}.css").include?('font-awesome') insert_into_file "app/assets/stylesheets/#{theme_name}.css", " *= require #{theme_name}/font-awesome\n", :before => "*/" end end end end
add_stylesheets()
click to toggle source
# File lib/generators/bootswatch/fontawesome/install/install_generator.rb, line 59 def add_stylesheets stylesheets_dest_path = "app/assets/stylesheets/#{theme_name}" empty_directory stylesheets_dest_path less_variables = File.readlines(find_in_source_paths('variables.less')) less_imports = File.read(find_in_source_paths('font-awesome.less')).scan(Less::Rails::ImportProcessor::IMPORT_SCANNER).flatten.compact.uniq template 'font-awesome.less.tt', File.join(stylesheets_dest_path,'font-awesome.less'), {less_imports: less_imports, less_variables: less_variables, theme_name: theme_name, theme_info: theme_info} end
theme_info()
click to toggle source
# File lib/generators/bootswatch/fontawesome/install/install_generator.rb, line 26 def theme_info "#{use_default_theme_name? ? 'bootstrap'.capitalize : theme_name.capitalize}" end
theme_name()
click to toggle source
# File lib/generators/bootswatch/fontawesome/install/install_generator.rb, line 18 def theme_name file_name end
use_default_theme_name?()
click to toggle source
# File lib/generators/bootswatch/fontawesome/install/install_generator.rb, line 22 def use_default_theme_name? theme_name === DEFAULT_THEME_NAME end