I come from a PHP environment where we have a "library" of sorts that contains various functionality in the form of object-oriented classes. The classes can be tied into any new project and the functionality of that class is gained without any duplication of coding efforts. In learning Ruby on Rails, I'd like to create something similar for use in developing Rails applications. Is there a best practice for said "library" of functionality? How best is this code base shared between applications? Most importantly, how can updates to said library be easily reflected across all applications? For instance, we want to have a single login/logout user capability between applications, since all of our applications will share the same userbase. I know restful_authentication exists, but I'm working on rolling my own as a learning exercise. Give a User Model, Session (login/logout) and User (registration/ activation) Controllers, and an Authentication Module, what is the best way to share this code set across applications?
on 2009-02-16 04:26
on 2009-02-16 05:00
on 2009-02-16 05:01
on 2009-02-16 06:57
But aren't plugins packaged with the application? How does that work for updates to the code?
on 2009-02-16 11:10
On 16 Feb 2009, at 05:56, ericindc wrote: > But aren't plugins packaged with the application? How does that work > for updates to the code? Plugins as git submodules. Google search will probably reveal more, but this is one I came across just now: http://woss.name/2008/04/09/using-git-submodules-t... Best regards Peter De Berdt
on 2009-02-16 13:22
I second plugins as git submodules. My company has built up a suite of standard plugins we use in apps for various things, and with git submodules it's easy to cascade updates to those plugins to all the apps that use them. I'll give you a piece of advice that took me forever to sort out. The two following commands are not equivalent: (Assuming vendor/plugins/my_plugin is the root of your submodule) $ git add vendor/plugins/my_plugin $ git add vendor/plugins/my_plugin/ The trailing slash (often added my tab completion) gives you all sorts of problems with submodules. Beware! ;) Cheers, Darrik
on 2009-02-16 13:31
> But aren't plugins packaged with the application? How does that work > for updates to the code? even in "the old days" (way back when everyone was still using subversion - must have been at least a year ago) this was possible. today (with git) it's more or less the same. store your plugin's code in a repository. inside your application checkout this plugin and everytime you commit any changes to the code in your repository, just update your plugin.