Module: Capistrano::Configuration::Loading::ClassMethods

Defined in:
lib/capistrano/configuration/loading.rb

Instance Method Summary collapse

Instance Method Details

#current_featureObject

Used internally to determine what the current “feature” being required is. This is used to track which files load which recipes via require.


39
40
41
# File 'lib/capistrano/configuration/loading.rb', line 39

def current_feature
  Thread.current[:capistrano_current_feature]
end

#current_feature=(feature) ⇒ Object

Used internally to specify the current file being required, so that any recipes loaded by that file can be remembered. This allows recipes loaded via require to be correctly reloaded in different Configuration instances in the same Ruby instance.


47
48
49
# File 'lib/capistrano/configuration/loading.rb', line 47

def current_feature=(feature)
  Thread.current[:capistrano_current_feature] = feature
end

#instance(require_config = false) ⇒ Object

Used by third-party task bundles to identify the capistrano configuration that is loading them. Its return value is not reliable in other contexts. If require_config is not false, an exception will be raised if the current configuration is not set.


15
16
17
18
19
20
21
# File 'lib/capistrano/configuration/loading.rb', line 15

def instance(require_config=false)
  config = Thread.current[:capistrano_configuration]
  if require_config && config.nil?
    raise LoadError, "Please require this file from within a Capistrano recipe"
  end
  config
end

#instance=(config) ⇒ Object

Used internally by Capistrano to specify the current configuration before loading a third-party task bundle.


25
26
27
# File 'lib/capistrano/configuration/loading.rb', line 25

def instance=(config)
  Thread.current[:capistrano_configuration] = config
end

#recipes_per_featureObject

Used internally by Capistrano to track which recipes have been loaded via require, so that they may be successfully reloaded when require is called again.


32
33
34
# File 'lib/capistrano/configuration/loading.rb', line 32

def recipes_per_feature
  @recipes_per_feature ||= {}
end