Class: CodeFormatter::Initializer

Inherits:
Object
  • Object
show all
Defined in:
lib/src/initializer.rb

Class Method Summary collapse

Class Method Details

.initObject



6
7
8
9
10
11
12
13
14
# File 'lib/src/initializer.rb', line 6

def self.init
  config = File.read(File.expand_path('../resources/sample_config.config', __FILE__))
  if File.file? SAMPLE_CONFIG_FILE
    warn %(ERROR: Initialization failed. There is already exists some #{SAMPLE_CONFIG_FILE})
  else
    Dir.mkdir(SAMPLE_CONFIG_DIR) unless Dir.exist?(SAMPLE_CONFIG_DIR)
    File.write(File.join(SAMPLE_CONFIG_DIR, SAMPLE_CONFIG_FILE), config)
  end
end

.initialized_configObject



16
17
18
19
# File 'lib/src/initializer.rb', line 16

def self.initialized_config
  return SAMPLE_CONFIG_FILE if File.exist?(SAMPLE_CONFIG_FILE)
  File.join(SAMPLE_CONFIG_DIR, SAMPLE_CONFIG_FILE)
end