0

I want to know, does rake task autoload a .gemspec? I ask because I'm running a rake task to automate building my gem, part of that is loading files and it prints out messages.

I should see:

Loading external libraries for rake_tasks

instead I see:

Loading external libraries for gemspec

Message are simply:

puts "Loading external libaries for #{$Loading_for}"

and $loading_for gets set depending on where the request for file loading comes from, e.g. rake_tasks, gemspec, executable, app.

Even though I'm setting $loading_for` in the rake task with:

$Loading_for = :rake_tasks

It's printing:

Loading external libaries for gemspec

The question is why is the gemspec being loaded? I'm not loading it any where from within my rakefile.

Also, another oddity is that whenever I do rake -h I get a strange warning:

WARN: Unresolved specs during Gem::Specification.reset:
      rack-test (>= 0)

It's odd becuase I have:

spec.add_development_dependency "rack-test", "0.6.3"

in my gemspec.

p.s. I'm aware of the spelling mistake with libaries, this has been fixed.

Thermatix
  • 2,757
  • 21
  • 51

1 Answers1

0

Rake is just ruby code, so unless you are not using some other gem that somehow manipulates your simple rake command. you should NOT be loading gemsec file!

I searched the rake repository on github for this $global variable and found nothing. here

Please update the question if you think you are doing something that might be affecting your natural ruby code.

  • I think you've misinterpreted what I'm asking. The problem is that the gemspec file is getting loaded without me doing anything, either rake or something else is auto-loading the gemspec. Second of all `$loading_for` is a global that I set: when running rake, or my executable or my app or building my gem (because my gemspec loads information about my gem in the same way that the app does). By setting that I can tell what is requesting a file load. – Thermatix May 12 '15 at 15:49
  • I see. personally I would run grep -r 'gemspec' and see if there is anything in that codebase calling it! hope that helps. – zotherstupidguy May 12 '15 at 23:26