class Converter
Public Class Methods
new(type = :free, src_path = './flat-ui', options = {})
click to toggle source
# File lib/tasks/converter.rb, line 44 def initialize(type = :free, src_path = './flat-ui', options = {}) @logger = Logger.new(options[:log_level]) @src_path = File.expand_path(src_path) @type = type @output_dir = type == :free ? 'flat-ui' : 'flat-ui-pro' @dest_path = { js: File.join('vendor/assets/javascripts', @output_dir), scss: File.join('vendor/assets/stylesheets', @output_dir), fonts: File.join('vendor/assets/fonts', @output_dir), images: File.join('vendor/assets/images', @output_dir) } end
Public Instance Methods
free?()
click to toggle source
# File lib/tasks/converter.rb, line 81 def free? !pro? end
pro?()
click to toggle source
# File lib/tasks/converter.rb, line 85 def pro? @type == :pro end
process_flat_ui!()
click to toggle source
# File lib/tasks/converter.rb, line 59 def process_flat_ui! log_status 'Convert Flat UI from LESS to SASS' log " type: #{@output_dir}" log " input: #{@src_path}" log " output:" log " js: #{@dest_path[:js]}" log " scss: #{@dest_path[:scss]}" log " fonts: #{@dest_path[:fonts]}" log " images: #{@dest_path[:images]}" setup_file_structure! process_flat_ui_stylesheet_assets! process_flat_ui_javascript_assets! process_flat_ui_font_assets! process_flat_ui_image_assets! end
save_file(path, content, mode='w')
click to toggle source
# File lib/tasks/converter.rb, line 77 def save_file(path, content, mode='w') File.open(path, mode) { |file| file.write(content) } end
Private Instance Methods
setup_file_structure!()
click to toggle source
# File lib/tasks/converter.rb, line 91 def setup_file_structure! @dest_path.each do |_, v| FileUtils.rm_rf(v) FileUtils.mkdir_p(v) end FileUtils.mkdir_p("#{@dest_path[:scss]}/modules") end