views:

28

answers:

1

Stupid question, and forgive me for asking, but someone is asking me, and I am not a super expert with Rails yet.

Suppose I have some Rails gem I write. Now suppose a customer has some other framework, like Django or CakePHP, and I want to provide the functionality offered by my gem (eg. CRUD for automotive data) to them as a module in their framework. Could I somehow make it so they could interface my gem with Django or CakePHP?

Obviously I could do something with some API magic--and I'll probably end up going that route. But I just want to know whether there is a way to directly interface with Gems from a non-Rails application.

+1  A: 

Not really. Gem's are by their very nature Ruby. They of course don't need to be for a Rails application they can be used with any ruby program you write, but really are the preferred method of packaging ruby libraries and programs.

Alternatively if the Ruby Gem in question is executable and your Ruby Gem's path is in your shell's path variable you can executed the gems binary like any command line tool and thus use it with anything.

Like like how Rails gives you the rails command.

Joseph Silvashy
Makes sense. That's exactly what I thought: they're just like PEAR and PECL packages for PHP.
Chad Johnson