lib/filbunke/client.rb in filbunke-1.1.6 vs lib/filbunke/client.rb in filbunke-1.1.7

- old
+ new

@@ -34,11 +34,11 @@ @callbacks.each do |callback| callback.on_update(file) end yield file else - @logger.log "Unable to get file #{file.url}/#{file.path}!" + @logger.log "Unable to get file #{file.url} ==> #{file.path}!" failure = true end else raise "Unsupported protocol for file: #{file.inspect}" end @@ -113,10 +113,16 @@ end end def update_http_file!(file, local_file_path) begin + + if file.state == "DELETED" then + delete_file!(local_file_path) + return true + end + uri = URI.parse(file.url) file_http=Net::HTTP.new(uri.host, uri.port) file_http.start do |http| request = Net::HTTP::Get.new(uri.path) request.basic_auth @repository.user, @repository.pass if @repository.user @@ -129,9 +135,10 @@ @logger.log "Failed to update file #{uri}, error code = #{response.code}" end return true end rescue StandardError => e + @logger.log "Failed to update file #{uri}: #{e.message}" return false end end def write_file!(file_path, contents)