Method: Doing::Configuration#update_deprecated_config
- Defined in:
- lib/doing/configuration.rb
#update_deprecated_config ⇒ Object
Method for transitioning from ~/.doingrc to ~/.config/doing/config.yml
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/doing/configuration.rb', line 291 def update_deprecated_config # return # Until further notice return if File.exist?(default_config_file) old_file = File.join(Util.user_home, '.doingrc') return unless File.exist?(old_file) Doing.logger.log_now(:warn, 'Deprecated:', "main config file location has changed to #{config_file}") res = Prompt.yn("Move #{old_file} to new location, preserving settings?", default_response: true) return unless res if File.exist?(default_config_file) res = Prompt.yn("#{default_config_file} already exists, overwrite it?", default_response: false) unless res @config_file = old_file return end end FileUtils.mv old_file, default_config_file, force: true Doing.logger.log_now(:warn, 'Config:', "Config file moved to #{default_config_file}") Doing.logger.log_now(:warn, 'Config:', %(If ~/.doingrc exists in the future, it will be considered a local config and its values will override the default configuration.)) Process.exit 0 end |