Module: MockWS::Configuration
- Defined in:
- lib/mockws/setup.rb
Defined Under Namespace
Classes: Checker
Class Method Summary collapse
Class Method Details
.setup(force: false) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/mockws/setup.rb', line 3 def self.setup(force: false) if File.exist?(File.(MockWS::DEFAULT_CONFIG_PATH)) && !force puts 'MockWS already configured' else FileUtils.rm_rf File.(MockWS::DEFAULT_PATH) config_file = search_file_in_gem('mockws', 'config/mockws.yml') [ MockWS::DEFAULT_LOGS_PATH, MockWS::DEFAULT_CONFIG_PATH].each do |path| FileUtils.mkdir_p File.(path) end File.open(File.("#{MockWS::DEFAULT_LOGS_PATH}/#{MockWS::DEFAULT_LOG_FILENAME}"), 'w') { |file| file.write("# MockWS : beginning of log file\n") } FileUtils.cp config_file, File.(MockWS::DEFAULT_CONFIG_PATH) puts '[OK] Building config folder and initialize settings' end end |