lib/sifttter_redux.rb in sifttter-redux-0.4.0 vs lib/sifttter_redux.rb in sifttter-redux-0.4.1

- old
+ new

@@ -32,56 +32,55 @@ # # Initializes Sifttter Redux by downloading and # collecting all necessary items and info. # @return Void # ---------------------------------------------------- - def self.init + def self.init(already_initialized = false) # Re-initialize the configuration data. - Configuration.reset - Configuration.add_section('sifttter_redux') - Configuration['sifttter_redux'].merge!('config_location' => Configuration.config_path) + Configuration::add_section('sifttter_redux') unless Configuration::section_exists?('sifttter_redux') + Configuration['sifttter_redux'].merge!('version' => VERSION, 'config_location' => Configuration::config_path) # Run the wizard to download Dropbox Uploader. - DBU::install_wizard + DBU::install_wizard(already_initialized = already_initialized) # Collect other misc. preferences. - CLIMessage.section_block('COLLECTING PREFERENCES...') do + CLIMessage::section_block('COLLECTING PREFERENCES...') do pref_prompts = [ { prompt: 'Location for downloaded Sifttter files from Dropbox', - default: SFT_LOCAL_FILEPATH, + default: already_initialized ? Configuration['sifttter_redux']['sifttter_local_filepath'] : SFT_LOCAL_FILEPATH, key: 'sifttter_local_filepath', section: 'sifttter_redux' }, { prompt: 'Location of Sifttter files in Dropbox', - default: SFT_REMOTE_FILEPATH, + default: already_initialized ? Configuration['sifttter_redux']['sifttter_remote_filepath'] : SFT_REMOTE_FILEPATH, key: 'sifttter_remote_filepath', section: 'sifttter_redux' }, { prompt: 'Location for downloaded Day One files from Dropbox', - default: DO_LOCAL_FILEPATH, + default: already_initialized ? Configuration['sifttter_redux']['dayone_local_filepath'] : DO_LOCAL_FILEPATH, key: 'dayone_local_filepath', section: 'sifttter_redux' }, { prompt: 'Location of Day One files in Dropbox', - default: DO_REMOTE_FILEPATH, + default: already_initialized ? Configuration['sifttter_redux']['dayone_remote_filepath'] : DO_REMOTE_FILEPATH, key: 'dayone_remote_filepath', section: 'sifttter_redux' } ] pref_prompts.each do |prompt| - pref = CLIMessage.prompt(prompt[:prompt], prompt[:default]) + pref = CLIMessage::prompt(prompt[:prompt], prompt[:default]) Configuration[prompt[:section]].merge!(prompt[:key] => pref) end end - Methadone::CLILogging.info("Configuration values: #{ Configuration.dump }") + Methadone::CLILogging.info("Configuration values: #{ Configuration::dump }") - Configuration.save + Configuration::save end # ---------------------------------------------------- # verbose method # \ No newline at end of file