# Problems unpacking log4r

**URL:** <https://www.ruby-forum.com/t/problems-unpacking-log4r/180630>\
**Category:** Rails\
**Created:** [December 24, 2009, 5:41am UTC](https://www.ruby-forum.com/t/problems-unpacking-log4r/180630 "2009-12-24T05:41:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e0b2c6/32.png) [@yoram](https://www.ruby-forum.com/u/yoram)\
**Post date:** [December 24, 2009, 5:41am UTC](https://www.ruby-forum.com/t/problems-unpacking-log4r/180630/1 "2009-12-24T05:41:53Z")

</div>

I was just starting to use log4r and everything was going peachy until I  
tired to unpack it into my local vendor/gems. The next time I tried to  
load my rails environment, I got:

config.gem: Unpacked gem log4r-1.1.2 in vendor/gems has no specification  
file. Run ‘rake gems:refresh\_specs’ to fix this

and:

no such file to load – log4r

So - I dutifully tried running rake gems:refresh\_specs, only to get:

rake aborted!  
undefined method `installed\_source\_index’ for  
#Gem::SourceIndex:0x2b4a6fc

As a result, I was stuck. I could no longer load my environment.

After a lot of head scratching, a co-developer recommended renaming the  
‘src’ folder in the log4r gems dir to ‘lib’.

This magically works. I can now load my environment, although I still  
get that pesky message about the specification file missing.

Any suggestion sas to how to clean this up would be very much  
appreciated.

Yoram

---

<div class="post-metadata">

**Author:** ![yoram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e0b2c6/32.png) [@yoram](https://www.ruby-forum.com/u/yoram)\
**Post date:** [December 25, 2009, 6:52pm UTC](https://www.ruby-forum.com/t/problems-unpacking-log4r/180630/2 "2009-12-25T18:52:15Z")

</div>

On Dec 23, 11:41 pm, Yoram B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I was just starting to use log4r and everything was going peachy until I  
> tired to unpack it into my local vendor/gems.

Let me guess - you used a bare “gem unpack” command to do this, right?  
Not going to work…

> After a lot of head scratching, a co-developer recommended renaming the  
> ‘src’ folder in the log4r gems dir to ‘lib’.
> 
> This magically works. I can now load my environment, although I still  
> get that pesky message about the specification file missing.
> 
> Any suggestion sas to how to clean this up would be very much  
> appreciated.

To start, rm -rf the mess in vendor/gems/log4r-1.1.2. A quick look at  
log4r shows that it’s not going to work without the .specification  
file, as it uses a nonstandard location (src/) for it’s source files.  
Renaming src/ to lib/ worked (for suitably small values of “work”)  
because the default location that’s assumed for doing a ‘require’ on a  
gem is lib/\<gem\_name\>.rb.

After tidying up, go ahead and run “rake gems:unpack”, which should  
_correctly_ unpack the gem into vendor/gems.

Note that any “require” statements referring to log4r before it’s  
loaded (ie, in environment.rb or environments/\*.rb) WILL FAIL in  
strange ways, as the gem loader will be trying to grab log4r from the  
system repository instead of vendor/gems.

Hope this helps!

–Matt J.

> ## Yoram
> 
> Posted viahttp://www.ruby-forum.com/.

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).
