A failure that escapes my comprehension

Luis Lavena luislavena at gmail.com
Tue Jan 17 18:51:23 EST 2012

On Tue, Jan 17, 2012 at 8:29 PM, Luis Lavena <luislavena at gmail.com> wrote:
>> Look line 142 in rubygems/installer.rb, it is explicitly looking for /^#!/, not what a windows wrapper uses.
> From above output seems to be that first line does match with the
> regexp, so why is not valid?
> Continue to investigate, will report later :-)

So, regexp matches, things works, but here is the thing:

    ruby_executable = false
    existing = nil

    open generated_bin, 'rb' do |io|
      next unless io.gets =~ /^#!/ # shebang
      io.gets # blankline

      # TODO detect a specially formatted comment instead of trying
      # to run a regexp against ruby code.
      next unless io.gets =~ /This file was generated by RubyGems/

      ruby_executable = true
      existing = io.read.slice(/^gem (['"])(.*?)(\1),/, 2)


    if ruby_executable then
      question << existing

      return if ask_yes_no "#{question}\nOverwrite the executable?", false

      conflict = "installed executable from #{existing}"


ruby_executable is set to true, meaning the generated_bin was
installed from another gem.

Now, the spec is attempting to compare that with an executable that
was not installed from another gem, and is failing.

util_conflict_executable is being used to generate the 'conflict' gem
and its executable.

I'm missing something? because the test is not very descriptive.

Thank you for your time.
Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the RubyGems-Developers mailing list