lib/sifttter_redux/sifttter.rb in sifttter-redux-0.4.4 vs lib/sifttter_redux/sifttter.rb in sifttter-redux-0.4.6

- old
+ new

@@ -3,12 +3,10 @@ # Sifttter Module # # Wrapper module for Sifttter itself # ====================================================== module Sifttter - include SifttterRedux::OS - # ---------------------------------------------------- # run_sifttter method # # Modified form of Sifttter # @@ -16,13 +14,11 @@ # Based on tp-dailylog.rb by Brett Terpstra 2012 # @param date The date to use when scanning Sifttter # @return Void # ---------------------------------------------------- def self.run(date) - uuid_command = 'uuidgen' if OS.mac? - uuid_command = 'uuid' if OS.linux? - uuid = %x{#{ uuid_command }}.gsub(/-/, '').strip + uuid = SecureRandom.uuid.upcase.gsub(/-/, '').strip date_for_title = date.strftime('%B %d, %Y') datestamp = date.to_time.utc.iso8601 starred = false @@ -49,9 +45,14 @@ date_regex = "(?:#{ date.strftime("%B") } 0?#{ date.strftime("%-d") }, #{ date.strftime("%Y") })" time_regex = "(?:\d{1,2}:\d{1,2}\s?[AaPpMm]{2})" files = `find #{ Configuration['sifttter_redux']['sifttter_local_filepath'] } -type f -name "*.txt" | grep -v -i daily | sort` + if files.empty? + m = "Couldn't download Sifttter files; is #{ Configuration['sifttter_redux']['sifttter_remote_filepath'] } the correct remote filepath?" + CLIMessage.error(m) + return + end projects = [] files.split("\n").each do |file| if File.exists?(file.strip) f = File.open(file.strip, encoding: 'UTF-8')