class NetguruTheme::Generator
Public Instance Methods
install()
click to toggle source
# File lib/netguru_theme/generator.rb, line 6 def install return unless valid_style? render = Sass::Engine.new(File.read(source_path), params).render File.write('netguru-theme.css', render) end
version()
click to toggle source
# File lib/netguru_theme/generator.rb, line 13 def version puts "netguru_theme v#{NetguruTheme::VERSION}" end
Private Instance Methods
params()
click to toggle source
# File lib/netguru_theme/generator.rb, line 36 def params { cache: false, syntax: :scss, style: style.to_sym, filename: source_path } end
source_path()
click to toggle source
# File lib/netguru_theme/generator.rb, line 26 def source_path top_level_directory = File.dirname(File.dirname(File.dirname(__FILE__))) File.join(top_level_directory, 'app', 'assets', 'stylesheets', '_netguru-theme.scss') end
style()
click to toggle source
# File lib/netguru_theme/generator.rb, line 32 def style options[:style].nil? ? 'compressed' : options[:style] end
valid_style?()
click to toggle source
# File lib/netguru_theme/generator.rb, line 19 def valid_style? return true if %w(compressed nested expanded compact).include? style error_message = 'Invalid --style option. Allowed options: compressed '\ '(default), nested, expanded or compact.' puts error_message end