Closed aia closed 12 years ago
I'm not sure this is quite the right path. In general, you don't want to require rubygems in your executables. With bundler based projects, you can bundle exec stuff that is in bin/, so might be worth checking out how that works
bundle exec would work. I think a conditional require in the bin/executable is less confusing. Running an executable just as an executable is what people used to. After all, Jewler is trying to use "#!/usr/bin/env ruby" as a shell and not the bundler. Doing a rubygems require in the library does not make sense because the library will be required at some point somewhere before it gets executed.
Side note, but the commit for this actually has a commented out require :)
I don't think I ever saw this with 1.8 because I turned on rubygems by default for my ruby. Recently turned that off though, since rvm doesn't really recommend it.
Anyways, I'm not sure which is preferred, because I suspect there's weird edge cases either way we go (requiring rubygems or not). I do know that using bundler on a project, you can just bundle exec stuff out of the bin directory as if it was a bin in your Gemfile.
Just kidding, found a better way. I looked up how bundler's gemspec
works and copied that :)
bundle exec jeweler
will be the preferred way of running in development, or through a rubygems wrapper (ie that it installs when you gem install jeweler
) otherwise.
Sounds good :-)
Still need to require rubygems for ruby 1.8 compatibility