Module: Charmkit::Base

Includes:
Helpers
Defined in:
lib/charmkit/hook.rb

Instance Method Summary collapse

Methods included from Helpers

#action, #action=, #cat, #cmd, #config, #file, #hook_path, inline_template, #is_installed?, #log, #package, #path, #relation, #relation=, #resource, #status, #template, #unit

Instance Method Details

#depsObject

Access deps class



29
30
31
# File 'lib/charmkit/hook.rb', line 29

def deps
  Dependencies
end

#use(name, options = {}) ⇒ Object

Include scrolls to be used within hook execution

Note: Idea lifted from github.com/mckomo/metaxa

Examples:

use :nginx
nginx.add_host server: "test.com"

Parameters:

  • name (Symbol)

    symbol of scroll

  • options (Hash) (defaults to: {})

    (NotImplemented) Options to be passed to scroll



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/charmkit/hook.rb', line 13

def use(name, options = {})
  require "charmkit/scrolls/#{name.to_s}"
  name_ref = name
  if options[:alias]
    name_ref = options[:alias]
  end

  var_module = Module.new do
    attr_accessor name_ref.to_sym
  end
  extend var_module
  set(name_ref, to_const(name.to_s).new)
end