class Makitzo::Config
Constants
- MERGER
Public Class Methods
method_added(method_name)
click to toggle source
# File lib/makitzo/config.rb, line 14 def self.method_added(method_name) if SSH::Context.protected_context_methods.include?(method_name.to_s) raise "The method name '#{method_name}' is used internally by SSH sessions. Please rename your helper." end end
new(app)
click to toggle source
# File lib/makitzo/config.rb, line 6 def initialize(app) @app = app @options_stack = [] @terminal = HighLine.new @store = nil @concurrency = nil @helpers = Module.new do def self.method_added(method_name) if SSH::Context.protected_context_methods.include?(method_name.to_s) raise "The method name '#{method_name}' is used internally by SSH sessions. Please rename your helper." end end end @mutex = Mutex.new initialize_roles initialize_hosts end
Public Instance Methods
concurrency()
click to toggle source
# File lib/makitzo/config.rb, line 33 def concurrency @concurrency end
concurrency=(concurrency)
click to toggle source
# File lib/makitzo/config.rb, line 29 def concurrency=(concurrency) @concurrency = concurrency end
helpers(&block)
click to toggle source
Helpers
# File lib/makitzo/config.rb, line 52 def helpers(&block) @helpers.class_eval(&block) if block_given? @helpers end
memoize(&block)
click to toggle source
# File lib/makitzo/config.rb, line 60 def memoize(&block) MemoizedProc.new(&block) end
merged_options(extra_options = {})
click to toggle source
# File lib/makitzo/config.rb, line 98 def merged_options(extra_options = {}) opts = @options_stack.inject({}) { |m,hsh| m.update(hsh, &MERGER) } opts.update(extra_options, &MERGER) end
password_prompt(prompt = 'Enter password: ')
click to toggle source
# File lib/makitzo/config.rb, line 74 def password_prompt(prompt = 'Enter password: ') ask(prompt) { |q| q.echo = false } end
resolve_role(thing)
click to toggle source
# File lib/makitzo/config.rb, line 139 def resolve_role(thing) if thing.is_a?(::Makitzo::World::Role) thing else role_for_name!(thing.to_s) end end
store()
click to toggle source
# File lib/makitzo/config.rb, line 44 def store raise Store::MissingStoreError if @store.nil? @store end
store=(store)
click to toggle source
# File lib/makitzo/config.rb, line 40 def store=(store) @store = store end
synchronize(&block)
click to toggle source
# File lib/makitzo/config.rb, line 64 def synchronize(&block) @mutex.synchronize(&block) end
with_options(options) { || ... }
click to toggle source
Options
# File lib/makitzo/config.rb, line 81 def with_options(options) begin @options_stack.push(options) yield if block_given? ensure @options_stack.pop end end