Module: SwitchTower
- Defined in:
- lib/switchtower/cli.rb,
lib/switchtower/ssh.rb,
lib/switchtower/actor.rb,
lib/switchtower/utils.rb,
lib/switchtower/logger.rb,
lib/switchtower/command.rb,
lib/switchtower/gateway.rb,
lib/switchtower/scm/baz.rb,
lib/switchtower/scm/bzr.rb,
lib/switchtower/scm/cvs.rb,
lib/switchtower/version.rb,
lib/switchtower/scm/base.rb,
lib/switchtower/transfer.rb,
lib/switchtower/scm/darcs.rb,
lib/switchtower/extensions.rb,
lib/switchtower/scm/perforce.rb,
lib/switchtower/configuration.rb,
lib/switchtower/scm/subversion.rb,
lib/switchtower/generators/rails/loader.rb
Defined Under Namespace
Modules: Generators, SCM, Version Classes: Actor, CLI, Command, Configuration, ExtensionProxy, Gateway, Logger, SSH, Transfer
Constant Summary collapse
- EXTENSIONS =
{}
Class Method Summary collapse
-
.configuration(require_config = false) ⇒ Object
Used by third-party task bundles to identify the switchtower configuration that is loading them.
-
.configuration=(config) ⇒ Object
Used internally by SwitchTower to specify the current configuration before loading a third-party task bundle.
- .plugin(name, mod) ⇒ Object
- .remove_plugin(name) ⇒ Object
-
.str2roles(string) ⇒ Object
A helper method for converting a comma-delimited string into an array of roles.
Class Method Details
.configuration(require_config = false) ⇒ Object
Used by third-party task bundles to identify the switchtower configuration that is loading them. It’s 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.
13 14 15 16 17 18 19 |
# File 'lib/switchtower/utils.rb', line 13 def self.configuration(require_config=false) config = Thread.current[:switchtower_configuration] if require_config && config.nil? raise "Please require this file from within a SwitchTower recipe" end config end |
.configuration=(config) ⇒ Object
Used internally by SwitchTower to specify the current configuration before loading a third-party task bundle.
23 24 25 |
# File 'lib/switchtower/utils.rb', line 23 def self.configuration=(config) Thread.current[:switchtower_configuration] = config end |
.plugin(name, mod) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/switchtower/extensions.rb', line 17 def self.plugin(name, mod) return false if EXTENSIONS.has_key?(name) SwitchTower::Actor.class_eval <<-STR, __FILE__, __LINE__+1 def #{name} @__#{name}_proxy ||= SwitchTower::ExtensionProxy.new(self, SwitchTower::EXTENSIONS[#{name.inspect}]) end STR EXTENSIONS[name] = mod return true end |
.remove_plugin(name) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/switchtower/extensions.rb', line 30 def self.remove_plugin(name) if EXTENSIONS.delete(name) SwitchTower::Actor.send(:remove_method, name) return true end return false end |
.str2roles(string) ⇒ Object
A helper method for converting a comma-delimited string into an array of roles.
4 5 6 7 |
# File 'lib/switchtower/utils.rb', line 4 def self.str2roles(string) list = string.split(/,/).map { |s| s.strip.to_sym } list.empty? ? nil : list end |