Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gemspec's usage of git ls-files introduces runtime dependency on git #4

Closed
zeha opened this issue Jun 16, 2011 · 5 comments
Closed

Comments

@zeha
Copy link

zeha commented Jun 16, 2011

When using this gem with bundler, git ls-files gets executed during application startup, therefore git becomes a runtime requirement for this gem.
I can see what value the git ls-files calls provide in the gemspec, but feel strongly that this shouldn't require git during runtime.

We're using your gem like this in the Gemfile:

source 'http://rubygems.org'
gem 'require_relative', :git => 'git://github.com/steveklabnik/require_relative.git'
gem 'other_gem'

Error message:

 [ pid=5918 thr=10183040 file=utils.rb:176 time=2011-06-16 21:00:36.470 ]: *** Exception Errno::ENOENT in PhusionPassenger::Rack::ApplicationSpawner (No such file or directory - git ls-files) (process 5918, thread #<Thread:0x0000000136c300>):
    from /app/path/bundled/ruby/1.9.1/bundler/gems/require_relative-a1b8f7ea2987/require_relative.gemspec:18:in ``'
    from /app/path/bundled/ruby/1.9.1/bundler/gems/require_relative-a1b8f7ea2987/require_relative.gemspec:18:in `block in <main>'
    from /usr/lib/ruby/1.9.1/rubygems/specification.rb:349:in `initialize'
    from /app/path/bundled/ruby/1.9.1/bundler/gems/require_relative-a1b8f7ea2987/require_relative.gemspec:5:in `new'
    from /app/path/bundled/ruby/1.9.1/bundler/gems/require_relative-a1b8f7ea2987/require_relative.gemspec:5:in `<main>'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler.rb:239:in `eval'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler.rb:239:in `rescue in block in load_gemspec'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler.rb:234:in `block in load_gemspec'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler.rb:232:in `chdir'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler.rb:232:in `load_gemspec'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/source.rb:347:in `block in load_spec_files'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/source.rb:346:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/source.rb:346:in `load_spec_files'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/source.rb:563:in `load_spec_files'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/source.rb:379:in `local_specs'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/source.rb:548:in `specs'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/definition.rb:147:in `block in resolve'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/definition.rb:145:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/definition.rb:145:in `resolve'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/definition.rb:90:in `specs'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/definition.rb:135:in `specs_for'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/definition.rb:124:in `requested_specs'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/environment.rb:23:in `requested_specs'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/runtime.rb:11:in `setup'
    from /var/lib/gems/1.9.1/gems/bundler-1.0.14/lib/bundler.rb:107:in `setup'
@steveklabnik
Copy link
Owner

I've never noticed this because git is the first thing I install on any computer, ever. If you can give me something that's as easy to use as git-ls, I'd consider a patch, but i'm not super concerned about this, to be honest.

@zeha
Copy link
Author

zeha commented Jun 16, 2011

I don't think there's any really cross-platform replacement you could stick in there. Not even the current git ls-files calls are cross-platform.

So I could give you some find(1) command line, but it would still suck ;)

@steveklabnik
Copy link
Owner

I'm not super concerned about cross-platform, exactly. Though obviously that's important. I'm surprised you haven't run into this with other gems, because this is a pretty common pattern. In fact, this line was created by the gem creation tools that (bundler itself makes)[https://github.com/carlhuda/bundler/blob/1-0-stable/lib/bundler/templates/newgem/newgem.gemspec.tt#L16]. So... yeah.

Is there a reason you don't have git installed?

@zeha
Copy link
Author

zeha commented Jun 16, 2011

There's no specific reason except that this happens in a production environment which is automatically rebuilt from scratch, and currently we're not installing git there.

Another thing to consider is probably startup time (all these git calls aren't free ;) ), but if this is a common pattern, oh well.

@zeha zeha closed this as completed Jun 16, 2011
@steveklabnik
Copy link
Owner

Ahh, see, the first thing I do in production is install git, because I use it to deploy. ;)

Anyway, if you figure something out, let me know. I'd love for you to use my gem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants