Attemping to vendorize a gem into bundler with Rails 3, but Gem has no Gemspec
Asked Answered
R

2

7

Following these easy steps:

gem unpack spree_easy_contact -v 1.0.2 --target vendor/gems

Unpacked gem: '../vendor/gems/spree_easy_contact-1.0.2'

And then in my Gemfile I add this line :

gem "spree_easy_contact", :path => "vendor/gems/spree_easy_contact-1.0.2"

But it fails when I run bundle install.

Could not find gem 'spree_easy_contact (>= 0, runtime)' in source at vendor/gems/spree_easy_contact-1.0.2.
Source does not contain any versions of 'spree_easy_contact (>= 0, runtime)'

I believe this is because there is no gemspec file located in the gem. Is there a way to build one for it ?

Anyone know a way to get around this ?

Reflective answered 11/2, 2011 at 15:50 Comment(4)
Is the vendored gem in vendor/gems/spree_easy_contact-1.0.2 ? For me, it's normally without the version numbers... so I'd expect vendor/gems/spree_easy_contactAllness
Someone said if you don't specify the version it won't create a gemspec file. I tried it both ways to no avail. Strange as it is though that Bundler can install it from the Gems directory without the gemspec file. So there maybe true to what you're saying.Reflective
And is there a gemspec file? something like spree_easy_contact.gemspec?Allness
No there isn't. I'm trying to forge one now by copying and pasting Wirble and changing its values, but it doesn't believe me.Reflective
R
12

I forgot to leave the version out on my Gem! Super important :

gem "spree_easy_contact", '1.0.2', :path => "#{File.expand_path(__FILE__)}/../vendor/gems/spree_easy_contact-1.0.2"

Also it was strange..this Gem also require honeypot-captcha, so I had to include that in my Gemfile. All is well.

Reflective answered 11/2, 2011 at 16:44 Comment(1)
This worked for me as well! I edited my Gemfile and appended a version number to the gem folder name. Also, it seems ok without the complicated path: gem 'streama', '0.3.2', path: 'vendor/gems/streama-0.3.2'Nashoma
H
0

You can try this solution:

http://makandra.com/notes/538-freeze-vendor-unpack-a-single-ruby-gem-with-and-without-bundler

Haslet answered 11/2, 2011 at 16:12 Comment(1)
A recursive error. Because there is no gemspec, if I run rake gemspec:generate, it tells me I need to run bundle install. Could not find gem 'spree_easy_contact (>= 0, runtime)' in source at vendor/gems/spree_easy_contact-1.0.2. Source does not contain any versions of 'spree_easy_contact (>= 0, runtime)' Try running bundle install.Reflective

© 2022 - 2024 — McMap. All rights reserved.