I had doubts regarding how to use jeweler and how to make sure I get everything that jeweler provides, this are the bumps I had to go through.
I didn't know about the existence of options for jeweler, so I didn't know I could do this:
jeweler --rspec your_gem
You can learn about all the options available to you with just:
jeweler or jeweler -h
And the default is:
jeweler --shoulda --rdoc --bundler your_gem
If you have git installed, its going to pickup your information automatically.
Weird enough, when I created a gemset for the new gem, somehow rake wasn't there. Maybe add rake to the generated Gemfile, would do the trick, but this is a default gem for any gemset, don't know why it wasn't there. It is on my global gemset.
Bundler says to put gemspec in your Gemfile, DO NOT DO IT. It causes a lot of trouble.
All your dependencies goes into your Gemfile only, remove all dependencies listings from your Rakefile.
The meta information you provide in your Rakefile, isn't the same thing as your_gem.gemspec . After you've done setting it up on Rakefile, remember no dependencies here, just run:
Jeweler generates your gemspec.
What about development dependencies in the Gemfile? Seems less than ideal to have these become gem dependencies. ie rspec, minitest, cucumber, etc...
group :development do
Jeweler will handle that for you.
It doesn't appear to. Which is why I made the comment.
If I simply do rake gemspec, rspec is added to the list of gem dependencies.
Am I doing something wrong?
Don't worry about that.
If you look closely at your gemspec, you will notice this lines.
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
Its because of a change in the internal of Rubygems, so it check for the rubygem version, if its an old version it adds as (add_dependency) the newer version have (add_development_dependency) and (add_runtime_dependency).
Its just compatibility stuff.
This just bit me. I just released a gem with the wrong dependencies because I have updated jeweler. This should have been opt-in, otherwise a bunch of people using jeweler are going to release gems with the wrong dependencies because you are automatically importing from the Gemfile.
I'm not a jeweler contributor/developer, but this seems to be affecting more people than just me. Can't all dependencies be at the Gemfile? and Why?
I have solved the problem of jeweler and bundler playing well together. Behold: http://github.com/dkastner/bueller
A lot of jeweler's functionality can actually be delegated to bundler. Bueller's only real job is to create gem skeletons, bump version numbers, and push out releases. You can now simply point your Gemfile to your gemspec. It also does away with the need to regenerate your gemspec all the time.
I have actually moved over to just using bundler to create my gems.
jeweler and bueller have too much functionality and litter my project with too many files.
This bit me as well I had a gem release then noticed it had a runtime dependency on itself so you couldn't install the gem without install a previous older version of the gem first.... Grumble, if possible, a better default to avoid this would be good. Trust me it is really hard to search for gem circular dependency.
@retr0h Agreed. While I used to really like using jeweler back back when bundle gem didn't exist, I prefer using bundle gem now as it generates simpler code. If anyone is having trouble getting jeweler to work and you're using a recent version of gem, I recommend you try using bundle gem instead.
Also, I feel like it would make sense add any useful information in this issue to the documentation and then close this issue.