salesking / sepa_king

Ruby gem for creating SEPA XML files
MIT License
149 stars 118 forks source link

[BREAKING] sepa_king v0.11.1 breaks rake CLI command #79

Closed leoarnold closed 5 years ago

leoarnold commented 5 years ago

Given a project which uses RVM and has its own RVM gemset when I install sepa_king v0.11.1 using bundle install, then a binstub called rake(!) is created thereby overwriting the binstub created by the rake gem itself.

The erroneously created binstub:

#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'sepa_king' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0.a"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('sepa_king', 'rake', version)
else
gem "sepa_king", version
load Gem.bin_path("sepa_king", "rake", version)
end

loads sepa_king/bin/rake which then loads rake/exe/rake but the gem repository paths are not managed correctly, resulting in error messages like

$ rake -T
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Could not find gem 'rspec' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.

even though bundle install will show that rspec was installed all along.