bin/srd in sifttter-redux-1.0.2 vs bin/srd in sifttter-redux-1.0.4

- old
+ new

@@ -68,16 +68,17 @@ configuration.current_version = configuration.sifttter_redux[:version] configuration.last_version = SifttterRedux::NEWEST_CONFIG_VERSION # Compare the two versions and, if needed, update. configuration.compare_version do |c, l| - messenger.debug { "Upgrading from #{ c } to #{ l }" } + messenger.debug("Upgrading from #{ c } to #{ l }") SifttterRedux.update_config_file exit!(0) end else # Force the user to init if they try to run any command other than `init` first. + messenger.info('You need to initialize Sifttter Redux first!') SifttterRedux.init(true) exit!(0) end true end @@ -87,13 +88,13 @@ # Use skips_post before a command to skip this # block on that command only end on_error do |exception| - messenger.error(exception.to_s) - exit!(1) - true + # messenger.error(exception.to_s) + # exit!(1) + # true end # ====================================================== # Commands # ====================================================== @@ -132,13 +133,13 @@ dbu.verbose = SifttterRedux.verbose dbu.local_target = configuration.sifttter_redux[:sifttter_local_filepath] dbu.remote_target = configuration.sifttter_redux[:sifttter_remote_filepath] dbu.message = 'Downloading Sifttter files...' - messenger.info_block(dbu.message || dbu::DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do - dbu.download - end + messenger.info(dbu.message || dbu::DEFAULT_MESSAGE) + dbu.download + messenger.info('Done.') # Process a new Sifttter entry for each date. dates.each do |date| SifttterRedux::Sifttter.run(date) end @@ -147,13 +148,13 @@ unless Dir[configuration.sifttter_redux[:dayone_local_filepath] + '/*'].empty? dbu.local_target = "#{ configuration.sifttter_redux[:dayone_local_filepath] }/*" dbu.remote_target = configuration.sifttter_redux[:dayone_remote_filepath] dbu.message = 'Uploading Day One entries to Dropbox...' - messenger.info_block(dbu.message || SifttterRedux::DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do - dbu.upload - end + messenger.info(dbu.message || dbu::DEFAULT_MESSAGE) + dbu.upload + messenger.info('Done.') end # Remove any downloaded local files that we no longer need. SifttterRedux.cleanup_temp_files end @@ -200,34 +201,34 @@ dbu.verbose = SifttterRedux.verbose dbu.local_target = configuration.sifttter_redux[:sifttter_local_filepath] dbu.remote_target = configuration.sifttter_redux[:sifttter_remote_filepath] dbu.message = "Backing up Sifttter files to #{ filename }..." - messenger.info_block(dbu.message || dbu::DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do - dbu.download - end + messenger.info(dbu.message || dbu::DEFAULT_MESSAGE) + dbu.download + messenger.info('Done.') # Archive the Sifttter files. Archive::Zip.archive(filename, configuration.sifttter_redux[:sifttter_local_filepath]) # Replace the old scheme with the new one. Dir.glob(configuration.sifttter_redux[:sifttter_local_filepath] + '/*.txt').each do |file| t = File.read(file) t.gsub!(/^- /, "@begin\n@date ") t.gsub!(/ - /, "\n- ") t.gsub!(/\s?@done/, '@end') - messenger.debug { "Replacing contents of file: #{ file }"} + messenger.debug("Replacing contents of file: #{ file }") File.open(file, 'w') { |f| f.write(t) } end # Upload the new Sifttter files back to Dropbox. dbu.local_target = "#{ configuration.sifttter_redux[:sifttter_local_filepath] }" dbu.remote_target = Pathname.new(configuration.sifttter_redux[:sifttter_remote_filepath]).dirname.to_s dbu.message = "Uploading revised Sifttter files to Dropbox..." - messenger.info_block(dbu.message || dbu::DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do - dbu.upload - end + messenger.info(dbu.message || dbu::DEFAULT_MESSAGE) + dbu.upload + messenger.info('Done.') # Remove any downloaded local files that we no longer need. SifttterRedux.cleanup_temp_files end end