diff --git a/lib/bundix/commandline.rb b/lib/bundix/commandline.rb index da93386..586fda8 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 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) }