Groups Images Directory Web
Recently Visited Groups | Help | Sign in
Google Groups Home
Group info
Members: 2137
Language: English
Group categories:
Computers > Software
Computers > Programming
More group info »
Recent pages and files
capistrano-f-a-q    

This Page is specific to Capistrano version 1.4.1

For Cap 2 see here 

 

Table of Contents:

  •   Can I use Capistrano for non-Rails-related tasks

  •   Can Cap tasks be called directly from with rails applications 

  •   Can a task inherit its calling task\\\'s server scope  

     

     

Answers:

 

Q.  Can I use Capistrano for non-Rails-related tasks 

A.  Yes you can. See beIow:

  • A thread discussing this issue. (circa Feb 2007)
    http://groups.google.com/group/capistrano/browse_thread/thread/e8f20581af22d3d6
     
  • Also see this by Charles Brian Quinn : http://trac.highgroove.com/deployment 
  • Mike Bailey: 
    • "With the latest Capistrano, you don\\\\47t need a rails project at all.

      Put your recipes into any of the following files:

      - /etc/capistrano.conf  (windows: #{ENV["HOMEDRIVE"]}#{ENV
      ["HOMEPATH"]}")
      - ~/.caprc (windows: ENV["SystemRoot"])
      - config/deploy.rb (windows: config\\\\\\\\deploy.rb)  "
  • Jamis Buck
    • "Even better: if capistrano finds a file named \\\'capfile\\\' in the  
      current directory, it\\\'ll read that automatically. \\\'config/deploy.rb\\\'  
      is intended specifically for rails projects, so for non-rails  
      projects it\\\\47s kind of klunky. Use \\\\47capfile\\\\47 for those instead."

Q.  Can Cap tasks be called directly from with rails applications

A. Yep. 

   require \\\'capistrano\\\'

   config = Capistrano::Configuration.new
   config.load "standard" # load the standard recipes, if you want
   config.load "/path/to/my/recipes" # if you want

   config.set :some_variable, "some value" # if you want

   config.actor.the_task_to_run 


Q.  Can a task inherit its calling task\\\'s server scope

A.  No.

The scope(1) of a task does not apply to the tasks it calls.

role :proxy, lb.example.com
role :file, store.example.com
role :db, db.example.com

task :after_setup, :roles =\\\> :proxy do
 generate_apache_config
end

task generate_apache_config do
  ...
  WARNING: code here will execute on all servers !
  ...
end

The scope restrictions must be repeated on all the tasks definitions.


(1) The scope defines on which servers a task will be run. It is
    defined through the :roles, :only, :except and :hosts values
    specified in a task declaration. Remember also that setting
    :no_release =\\\> true on a role definition globally prevents a
    server from taking part of the release.
    By default, the scope of a task is all servers with a role
    assigned.


Change History:

    Feb-05-2007 :: Amr Malik :: Added Question 1

    Feb-06-2007 :: AEAM

    Mar-16-2007 :: The Zed 

 

Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google