Marnen Laibow-Koser wrote:
> On Dec 29, 2:52�pm, Robert Walker <[email protected]>
> wrote:
>> sa 125 wrote:
>> > How would I go about installing rails plugins offline? I cannot connect
>> > to the web on my work computer, though I have a dedicated internet
>> > machine for downloads and such.
>>
>> This is precisely why I generally prefer gems over plugins,
>
> How does using gems help at all? It seems to me that gems would
> suffer from precisely the same problem as plugins here.
It helps because the more common gems are likely already installed on my
system. All I need to do for a new project is to add the gem dependency
to the environment.rb file. The command to install a plugin wants to go
out and download the plugin from the internet. Yes, obviously, if I
don't have the gem installed I would still need an internet connection,
but I don't have to do any coping or hacking around to copy a plugin
from some obscure location in my local system.
Example:
config.gem "rubist-aasm", :lib => "aasm"
This line added to my environment.rb file is all I need to do in a new
project to use the aasm gem that I likely already have installed on my
system.
> And I think an unfortunate one. Unless there's something I don't
> understand about gem packaging (which is quite possible :) ), it seems
> to me that while it's easy to install a plugin into one app without
> affecting the whole environment, it's hard to do so for a gem. (Yes,
> I know about frozen gems, but the usual way of doing that is to
> install the gem on the development computer first, then freeze it into
> the app.) I often need to install gems on my local machine in order
> to work on clients' projects (after all, not everyone freezes their
> gems), and I wish it wasn't necessary -- I don't want to change my
> entire operating environment for the sake of one project.
>
Gems are the "standard" packaging for Ruby (not specifically Rails).
Using gems is natural for Ruby developers and using gem dependencies in
Rails is a more natural fit than plugins for sharing code.
I think of them in a similar way as I think about "Frameworks" in my
Cocoa development. I like that there is basically one way to share code
between different applications when doing Mac development. Plugins, in
my mind, are a different thing. A plugin architecture is a means of
extending an application's capabilities and not simply a means of
sharing code between different applications. So yes, maybe plugins do
have a place in this context, but that is not generally how Rails
plugins are used.
I realize this is subjective, but I do prefer sharing code through gems
rather than plugins.
> I like gems for things like RSpec that I actually use on every
> project. But I hope the day never comes when I have to install a
> special-purpose gem for just one app because it doesn't exist as a
> plugin.
>
Rspec is actually a really good example. It was a plugin and is now a
gem. I prefer it as a gem because I might want to share it between
multiple applications. I only have to maintain one repository of
"framework" code. If I need a specific application to depend on a
specific version of rSpec I simply tell it that in it's environment.rb
file.
config.gem "rspec-rails", :lib => "spec", :version => "1.1.11"
Then I can see all my dependencies quickly and easily in a terminal:
$ rake gems
- [I] rubyist-aasm
- [I] rspec-rails
- [I] rspec = 1.1.11
- [ ] hoe >= 1.8.1
- [ ] rubyforge >= 1.0.1
- [I] rake = 0.8.3
I = Installed
F = Frozen
R = Framework (loaded before rails starts)
And manage my application's environment with the various rake gems:xxx
commands.
--
Posted via http://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---