Class: Capistrano::Configuration

### Home Classes Methods

### In Files

- lib/capistrano/configuration.rb
- lib/capistrano/configuration/filter.rb
- lib/capistrano/configuration/question.rb
- lib/capistrano/configuration/server.rb
- lib/capistrano/configuration/servers.rb

### Parent

Object

### Namespace

- CLASS Capistrano::Configuration::Filter
- CLASS Capistrano::Configuration::Question
- CLASS Capistrano::Configuration::Server
- CLASS Capistrano::Configuration::Servers

### Methods

- ::env
- ::new
- ::reset!
- #add_cmdline_filter
- #ask
- #backend
- #configure_backend
- #delete
- #fetch
- #filter
- #keys
- #primary
- #role
- #role_properties_for
- #roles_for
- #server
- #set
- #set_if_empty
- #setup_filters
- #timestamp

### Files

- Capfile
- Capfile

### Class/Module Index

Quicksearch

- Capistrano
- Capistrano::Application
- Capistrano::Configuration
- Capistrano::Configuration::Filter
- Capistrano::Configuration::Question
- Capistrano::Configuration::Server
- Capistrano::Configuration::Server::Properties
- Capistrano::Configuration::Servers
- Capistrano::DSL
- Capistrano::DSL::Env
- Capistrano::DSL::Paths
- Capistrano::DSL::Stages
- Capistrano::Git
- Capistrano::Git::DefaultStrategy
- Capistrano::Hg
- Capistrano::Hg::DefaultStrategy
- Capistrano::SCM
- Capistrano::Svn
- Capistrano::Svn::DefaultStrategy
- Capistrano::TaskEnhancements
- Capistrano::UploadTask
- Capistrano::VersionValidator
- Object

No matching classes.

# Capistrano::Configuration

### Attributes

backend[W]

### Public Class Methods

env() click to toggle source

    # File lib/capistrano/configuration.rb, line 13
    def self.env
      @env ||= new
    end

new(config = nil) click to toggle source

    # File lib/capistrano/configuration.rb, line 9
    def initialize(config = nil)
      @config ||= config
    end

reset!() click to toggle source

    # File lib/capistrano/configuration.rb, line 17
    def self.reset!
      @env = new
    end

### Public Instance Methods

add_cmdline_filter(type, values) click to toggle source

    # File lib/capistrano/configuration.rb, line 107
    def add_cmdline_filter(type, values)
      cmdline_filters << Filter.new(type, values)
    end

ask(key, default=nil, options={}) click to toggle source

    # File lib/capistrano/configuration.rb, line 21
    def ask(key, default=nil, options={})
      question = Question.new(key, default, options)
      set(key, question)
    end

backend() click to toggle source

    # File lib/capistrano/configuration.rb, line 74
    def backend
      @backend ||= SSHKit
    end

configure_backend() click to toggle source

    # File lib/capistrano/configuration.rb, line 80
    def configure_backend
      backend.configure do |sshkit|
        sshkit.format           = fetch(:format)
        sshkit.output_verbosity = fetch(:log_level)
        sshkit.default_env      = fetch(:default_env)
        sshkit.backend          = fetch(:sshkit_backend, SSHKit::Backend::Netssh)
        sshkit.backend.configure do |backend|
          backend.pty                = fetch(:pty)
          backend.connection_timeout = fetch(:connection_timeout)
          backend.ssh_options        = (backend.ssh_options || {}).merge(fetch(:ssh_options,{}))
        end
      end
    end

delete(key) click to toggle source

    # File lib/capistrano/configuration.rb, line 34
    def delete(key)
      config.delete(key)
    end

fetch(key, default=nil, &block) click to toggle source

    # File lib/capistrano/configuration.rb, line 38
    def fetch(key, default=nil, &block)
      value = fetch_for(key, default, &block)
      while callable_without_parameters?(value)
        value = set(key, value.call)
      end
      return value
    end

filter(list) click to toggle source

    # File lib/capistrano/configuration.rb, line 111
    def filter list
      setup_filters if @filters.nil?
      @filters.reduce(list) { |l,f| f.filter l }
    end

keys() click to toggle source

    # File lib/capistrano/configuration.rb, line 46
    def keys
      config.keys
    end

primary(role) click to toggle source

    # File lib/capistrano/configuration.rb, line 70
    def primary(role)
      servers.fetch_primary(role)
    end

role(name, hosts, options={}) click to toggle source

    # File lib/capistrano/configuration.rb, line 50
    def role(name, hosts, options={})
      if name == :all
        raise ArgumentError.new("#{name} reserved name for role. Please choose another name")
      end

      servers.add_role(name, hosts, options)
    end

role_properties_for(names, &block) click to toggle source

    # File lib/capistrano/configuration.rb, line 66
    def role_properties_for(names, &block)
      servers.role_properties_for(names, &block)
    end

roles_for(names) click to toggle source

    # File lib/capistrano/configuration.rb, line 62
    def roles_for(names)
      servers.roles_for(names)
    end

server(name, properties={}) click to toggle source

    # File lib/capistrano/configuration.rb, line 58
    def server(name, properties={})
      servers.add_host(name, properties)
    end

set(key, value) click to toggle source

    # File lib/capistrano/configuration.rb, line 26
    def set(key, value)
      config[key] = value
    end

set_if_empty(key, value) click to toggle source

    # File lib/capistrano/configuration.rb, line 30
    def set_if_empty(key, value)
      config[key] = value unless config.has_key? key
    end

setup_filters() click to toggle source

    # File lib/capistrano/configuration.rb, line 98
    def setup_filters
      @filters = cmdline_filters.clone
      @filters << Filter.new(:role, ENV['ROLES']) if ENV['ROLES']
      @filters << Filter.new(:host, ENV['HOSTS']) if ENV['HOSTS']
      fh = fetch_for(:filter,{})
      @filters << Filter.new(:host, fh[:host]) if fh[:host]
      @filters << Filter.new(:role, fh[:role]) if fh[:role]
    end

timestamp() click to toggle source

    # File lib/capistrano/configuration.rb, line 94
    def timestamp
      @timestamp ||= Time.now.utc
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.