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.
78d56bb0f91c899d40f1767b3040d825?d=identicon&s=25 bingo bob (bingobob)
on 2009-02-09 11: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
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-02-09 11:45
(Received via mailing list)
don't know if this is still working, but you could give it a try:
http://gemsonrails.rubyforge.org/
78d56bb0f91c899d40f1767b3040d825?d=identicon&s=25 bingo bob (bingobob)
on 2009-02-09 12: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?
78d56bb0f91c899d40f1767b3040d825?d=identicon&s=25 bingo bob (bingobob)
on 2009-02-09 17: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
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-02-10 08: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.
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-02-10 08: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.
Ca0d1fa83b8d8f39a51c0f25b0f17336?d=identicon&s=25 Mathieu Rousseau (Guest)
on 2009-02-10 11: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
78d56bb0f91c899d40f1767b3040d825?d=identicon&s=25 bingo bob (bingobob)
on 2009-02-10 11: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...
6883e5ef03484d4fcef507d7b4f1d243?d=identicon&s=25 Matt Jones (Guest)
on 2009-02-10 18:41
(Received via mailing list)
On Feb 9, 11:25 am, bingo bob <rails-mailing-l...@andreas-s.net>
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 Jones
78d56bb0f91c899d40f1767b3040d825?d=identicon&s=25 bingo bob (bingobob)
on 2009-02-10 20: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.