From 0d78901271cf5539746ac395cc2fdd28ec4100a5 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Mon, 11 Dec 2023 13:08:48 +0100 Subject: [PATCH] Fix Standard issues --- exe/litestream | 2 +- lib/litestream/upstream.rb | 2 +- rakelib/package.rake | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/exe/litestream b/exe/litestream index 8dd7929..7441799 100755 --- a/exe/litestream +++ b/exe/litestream @@ -8,6 +8,6 @@ begin puts command.inspect exec(*command) rescue Litestream::Commands::UnsupportedPlatformException, Litestream::Commands::ExecutableNotFoundException => e - STDERR.puts("ERROR: " + e.message) + warn("ERROR: " + e.message) exit 1 end diff --git a/lib/litestream/upstream.rb b/lib/litestream/upstream.rb index aa01547..80f98f3 100644 --- a/lib/litestream/upstream.rb +++ b/lib/litestream/upstream.rb @@ -8,7 +8,7 @@ module Upstream "arm64-darwin" => "litestream-#{VERSION}-darwin-arm64.zip", "arm64-linux" => "litestream-#{VERSION}-linux-arm64.tar.gz", "x86_64-darwin" => "litestream-#{VERSION}-darwin-amd64.zip", - "x86_64-linux" => "litestream-#{VERSION}-linux-amd64.tar.gz", + "x86_64-linux" => "litestream-#{VERSION}-linux-amd64.tar.gz" } end end diff --git a/rakelib/package.rake b/rakelib/package.rake index db6bd7c..0e3dc31 100644 --- a/rakelib/package.rake +++ b/rakelib/package.rake @@ -1,4 +1,3 @@ -# coding: utf-8 # # Rake tasks to manage native gem packages with binary executables from benbjohnson/litestream # @@ -93,7 +92,7 @@ Litestream::Upstream::NATIVE_PLATFORMS.each do |platform, filename| warn "Downloading #{exepath} from #{release_url} ..." # lazy, but fine for now. - URI.open(release_url) do |remote| + URI.open(release_url) do |remote| # standard:disable Security/Open if release_url.end_with?(".zip") Zip::File.open_buffer(remote) do |zip_file| zip_file.extract("litestream", exepath) @@ -102,15 +101,13 @@ Litestream::Upstream::NATIVE_PLATFORMS.each do |platform, filename| Zlib::GzipReader.wrap(remote) do |gz| Gem::Package::TarReader.new(gz) do |reader| reader.seek("litestream") do |file| - File.open(exepath, "wb") do |local| - local.write(file.read) - end + File.binwrite(exepath, file.read) end end end end end - FileUtils.chmod(0755, exepath, verbose: true) + FileUtils.chmod(0o755, exepath, verbose: true) end end end