Forum: Ruby on Rails fastercsv, freezing into vendor/gems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
bingo b. (Guest)
on 2009-02-09 12:22
I'm using fastercsv such that in my rake file I'm doing this.

require 'fastercsv'

It works fine on my Mac.

I need to freeze this gem into the app though so my rake tasks work on
the production machine.

-----------

I spent about two hours though this weekend trying to get this Gem
"frozen" into the vendor/gems folder. I tried all sorts,

I ...

- added a line to environment.rb
- used rake:freeze:gems
- used rake:install:gems
- used rake:unpack:gems
- used rake:install:gem gem='fastercsv'

Basically used all sorts of variations of the above.

Any tips for gettting this done?

cheers

bb
MaD (Guest)
on 2009-02-09 12:45
(Received via mailing list)
don't know if this is still working, but you could give it a try:
http://gemsonrails.rubyforge.org/
bingo b. (Guest)
on 2009-02-09 13:14
Ok, thanks, that does look interesting (a little old).

Thing is though - I thought I'd be able to do it with the rake tasks I
have!

e.g.

- used rake:freeze:gems
- used rake:install:gems
- used rake:unpack:gems
- used rake:install:gem gem='fastercsv'


Any other factors that could be blocking this working?
bingo b. (Guest)
on 2009-02-09 18:25
I made a little progress..
I went to vendor/
mkdir gems
went in there
and unpacked fastercsv....sent it to my webhost...

However on the webhost the line require 'fastercsv' still fails.

I read on joyent knoweldeg base running this in environment.rb might do
it...

config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
  File.directory?(lib = "#{dir}/lib") ? lib : dir
end

Will that code above solve the problem, claims to search within
vendor/gems!

bb
MaD (Guest)
on 2009-02-10 09:49
(Received via mailing list)
well, i just looked at it again. you're right: "rake gems:unpack"
should provide exactly the functionality you're looking for. however i
don't know why it's failing for you.

and on that snippet of yours: try it and tell us whether it's working
or not. looks promising.
MaD (Guest)
on 2009-02-10 09:50
(Received via mailing list)
well, i just looked at it again. you're right: "rake gems:unpack"
should provide exactly the functionality you're looking for. however i
don't know why it's failing for you.

and on that snippet of yours: try it and tell us whether it's working
or not. looks promising.
Mathieu R. (Guest)
on 2009-02-10 12:34
(Received via mailing list)
Who did you configure your gem dependency?
My environment.rb looks like this:
  config.gem "resource_controller", :version => '0.5.3'
  config.gem "rubyist-aasm", :version => '2.0.4'
  config.gem "paperclip", :version => '2.1.2'

I remember that without specifying the version rake gems:unpack would
not
work properly...




On Mon, Feb 9, 2009 at 2:25 PM, bingo bob
bingo b. (Guest)
on 2009-02-10 12:53
I put

config.gem "fastercsv", :version => "1.4.0"

in environment.rb

---

btw, i tried the code above on my webhost to search and find gems but no
dice - it still errors.

so still not there...
Matt J. (Guest)
on 2009-02-10 19:41
(Received via mailing list)
On Feb 9, 11:25 am, bingo bob <removed_email_address@domain.invalid>
wrote:
>
> config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
>   File.directory?(lib = "#{dir}/lib") ? lib : dir
> end
>
> Will that code above solve the problem, claims to search within
> vendor/gems!
>

That code *may* work, but it will probably confuse the gem loader a
little. The
problem you're having is that the 2.2 vendor gem handling stuff isn't
loaded
until the environment is; if your rake task looks like this:

task "do_something" => :environment do

end

Then move the require line *inside* the task, which should pick up the
unpacked gem.

Hope this helps!

--Matt J.
bingo b. (Guest)
on 2009-02-10 21:52
you nailed it, thanks!

I dropped the previous code and went with your method.

thanks again.
This topic is locked and can not be replied to.