It might make more sense to pass self as a parameter to your Database
object, e.g.:

  db = Database.new(self, hash_config)

Then, your database can reference the configuration object directly,
and you avoid nasty global references. This is how the deployment
strategies work, in fact. When instantiated, they receive a reference
to the configuration object.

- Jamis

On Fri, Dec 5, 2008 at 6:36 AM, bartocc <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have tasks that deal with remote and local databases (typically to
> sync your local database with the prod one).
>
> I would like to factorise this code in a class Database to be able to
> do this kind of things
>
> Database.new(hash_config).drop
> Database.new(hash_config).create
> Database.new(hash_config).sync(other_db_object)
>
> The issue I've run into is the following :
> The method "run" is only defined for the "Capistrano::Configuration"
> object instanciated when running cap.
>
> A simple hack allowed me to call run in my class. I create the
> constant CAP = self at the beginning of deploy.rb and call CAP.run in
> my class.
>
> This is not very elegant though, and I was wondering if there were a
> better, and more good practice, way to do this.
>
> Thx for your help
> Ju
> >
>

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to