fastercsv, freezing into vendor/gems

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.

don't know if this is still working, but you could give it a try: http://gemsonrails.rubyforge.org/

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

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.

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.

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…

I put

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

in environment.rb

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 Jones

you nailed it, thanks!

I dropped the previous code and went with your method.

thanks again.