lib/sifttter-redux.rb in sifttter-redux-1.0.2 vs lib/sifttter-redux.rb in sifttter-redux-1.0.4
- old
+ new
@@ -22,15 +22,14 @@
dirs = [
configuration.sifttter_redux[:dayone_local_filepath],
configuration.sifttter_redux[:sifttter_local_filepath]
]
- messenger.info_block('Removing temporary local files...') do
- dirs.each do |d|
- FileUtils.rm_rf(d)
- messenger.debug("Removed directory: #{ d }")
- end
+ messenger.info('Removing temporary local files...')
+ dirs.each do |d|
+ FileUtils.rm_rf(d)
+ messenger.debug("Removed directory: #{ d }")
end
end
# Runs a wizard that installs Dropbox Uploader on the
# local filesystem.
@@ -58,18 +57,19 @@
executable_path = File.join(dbu_path, 'dropbox_uploader.sh')
if File.directory?(dbu_path)
messenger.warn("Using pre-existing Dropbox Uploader at #{ dbu_path }...")
else
- messenger.info_block("Downloading Dropbox Uploader to #{ dbu_path }...", 'Done.', true) do
- system "git clone https://github.com/andreafabrizi/Dropbox-Uploader.git #{ dbu_path }"
- end
+ messenger.info("Downloading Dropbox Uploader to #{ dbu_path }...")
+ system "git clone https://github.com/andreafabrizi/Dropbox-Uploader.git #{ dbu_path }"
+ messenger.info('Done.')
end
# If the user has never configured Dropbox Uploader, have them do it here.
unless File.exists?(DEFAULT_DBU_CONFIG_FILEPATH)
- messenger.info_block('Initializing Dropbox Uploader...') { system "#{ executable_path }" }
+ messenger.info('Initializing Dropbox Uploader...')
+ system "#{ executable_path }"
end
configuration.add_section(:db_uploader) unless configuration.data.key?(:db_uploader)
configuration.db_uploader.merge!({
base_filepath: path,
@@ -85,11 +85,11 @@
# Creates a date range from the supplied command line
# options.
# @param [Hash] options GLI command line options
# @return [Range]
def self.get_dates_from_options(options)
- if options[:c] || options[:n] || options[:w] ||
+ if options[:c] || options[:n] || options[:w] ||
options[:y] || options[:f] || options[:t] ||
options[:d]
# Yesterday
r = DateRangeMaker.yesterday if options[:y]
@@ -111,26 +111,28 @@
if _dates.last > Date.today
messenger.warn("Ignoring overextended end date and using today's date (#{ Date.today })...")
r = (_dates.first..Date.today)
else
- r = (_dates.first.._dates.last)
+ r = _dates
end
end
else
r = DateRangeMaker.today
end
- messenger.debug { "Date range: #{ r }" }
+ messenger.debug("Date range: #{ r }")
r
end
# Initializes Sifttter Redux by downloading and
# collecting all necessary items and info.
# @param [Boolean] from_scratch
# @return [void]
def self.init(from_scratch = false)
+ messenger.section('INITIALIZING...')
+
if from_scratch
configuration.reset
configuration.add_section(:sifttter_redux)
end
@@ -145,10 +147,10 @@
pm = CLIUtils::Prefs.new(SifttterRedux::PREF_FILES['INIT'], configuration)
pm.ask
configuration.ingest_prefs(pm)
- messenger.debug {"Collected configuration values: #{ configuration.data }" }
+ messenger.debug("Collected configuration values: #{ configuration.data }")
configuration.save
@initialized = true
end
# Notifies the user that the config file needs to be