From 30690de4b52dbb6d28dba5fff26803ce00ccdb73 Mon Sep 17 00:00:00 2001 From: Alexander Shestakov Date: Sun, 18 Oct 2020 16:43:40 +0300 Subject: [PATCH 1/2] Allowing direct execution of the bundler if already in the shell --- lib/bundix/commandline.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/bundix/commandline.rb b/lib/bundix/commandline.rb index e0dce71..59c8ecc 100644 --- a/lib/bundix/commandline.rb +++ b/lib/bundix/commandline.rb @@ -100,14 +100,14 @@ def handle_magic ENV['BUNDLE_GEMFILE'] = options[:gemfile] if options[:magic] - fail unless system( - Bundix::NIX_SHELL, '-p', options[:ruby], - "bundler.override { ruby = #{options[:ruby]}; }", - "--command", "bundle lock --lockfile=#{options[:lockfile]}") - fail unless system( - Bundix::NIX_SHELL, '-p', options[:ruby], - "bundler.override { ruby = #{options[:ruby]}; }", - "--command", "bundle pack --all --path #{options[:bundle_pack_path]}") + prefix = + if ENV['IN_NIX_SHELL'] + [] + else + [Bundix::NIX_SHELL, '-p', options[:ruby], "bundler.override { ruby = #{options[:ruby]}; }", "--command"] + end + fail unless system(*prefix, "bundle lock --lockfile=#{options[:lockfile]}") + fail unless system(*prefix, "bundle pack --path #{options[:bundle_pack_path]}") end end From d4eac21c25997f4ea4cb3eea976f17fd0c0a0ffa Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Fri, 19 Feb 2021 17:36:19 +0900 Subject: [PATCH 2/2] Fix fetching under Ruby 3.0 Ruby 2.7 deprecated using open for URIs, and recommends using URI.open instead. warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open As of Ruby 3.0 the options argument is gone and bundix skips over http fetches. Additional context: https://bugs.ruby-lang.org/issues/15893#note-2 Example error: Downloading /Users/lorne/.cache/bundix/https_rubygems_org_gems_debase-ruby_core_source-0_10_12_gem from https://rubygems.org/gems/debase-ruby_core_source-0.10.12.gem wrong number of arguments (given 4, expected 1..3) Skipping debase-ruby_core_source: couldn't fetch hash for debase-ruby_core_source-0.10.12 --- lib/bundix/source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundix/source.rb b/lib/bundix/source.rb index 17012aa..43577af 100644 --- a/lib/bundix/source.rb +++ b/lib/bundix/source.rb @@ -20,7 +20,7 @@ def download(file, url) end begin - open(uri.to_s, 'r', 0600, open_options) do |net| + URI.open(uri.to_s, 'r', 0600, open_options) do |net| File.open(file, 'wb+') { |local| File.copy_stream(net, local) }