technicalpickles / jeweler

Opinionated tool for creating and managing Rubygem projects
MIT License
1.48k stars 164 forks source link

"stack level too deep" raises on Windows #231

Closed tetradice closed 11 years ago

tetradice commented 12 years ago

Hi.

I used JewelerTask on Windows. Then, some jeweler's tasks couldn't be executed.

$ rake version -t
** Invoke version (first_time)
** Invoke version_required (first_time)
** Execute version_required
rake aborted!
stack level too deep
D:/ruby/lib/ruby/1.9.1/gems/jeweler-1.8.4/lib/jeweler.rb:155

I think that following code can't work on Windows. Because, Windows root is not "/".

  def git_base_dir(base_dir = nil)
    if base_dir
      base_dir = File.dirname(base_dir)
    else
      base_dir = File.expand_path(self.base_dir || ".")
    end
    return nil if base_dir==File.dirname("/")
    return base_dir if File.exists?(File.join(base_dir, '.git'))
    return git_base_dir(base_dir)
  end    

(from jeweler.rb, line 154 - 163)

I suggest following fix.

Before:

return nil if base_dir==File.dirname("/")

After:

return nil if Pathname.new(base_dir).root?
emilsoman commented 11 years ago

Been around for a while, closing this. @tetradice , if you still run into this problem feel free to reopen. It would be nice if somebody working on windows could send in a pull request.