class Icomoon::Cli::Config
Constants
- CONFIG_FILE_NAME
Public Class Methods
config_file_exists?()
click to toggle source
# File lib/icomoon/cli/config.rb, line 33 def config_file_exists? File.exists? CONFIG_FILE_NAME end
config_file_full_path()
click to toggle source
# File lib/icomoon/cli/config.rb, line 37 def config_file_full_path File.expand_path(CONFIG_FILE_NAME) end
read()
click to toggle source
# File lib/icomoon/cli/config.rb, line 7 def read if !File.exists? config_file_full_path fail Icomoon::Cli::Error, 'Config file not found.' end content = JSON.parse(File.read(config_file_full_path)) Struct.new( :icons_set_name, :icons_file_path, :fonts_file_dir, :css_class ).new( content['icons_set_name'], content['icons_file_path'], content['fonts_file_dir'], content['css_class'] ) end
write(config)
click to toggle source
# File lib/icomoon/cli/config.rb, line 27 def write(config) Icomoon::Cli::Writer.write(CONFIG_FILE_NAME) do |file| file.puts(JSON.pretty_generate(config)) end end