Class: Rake::RemoteChef

Inherits:
Object
  • Object
show all
Defined in:
lib/rake/remote_chef.rb,
lib/rake/remote_chef/version.rb

Defined Under Namespace

Classes: Core

Constant Summary collapse

VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.load(options = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rake/remote_chef.rb', line 28

def self.load options = {}
  options = {:config => options} if String === options
  order = [:bootstrap, :core]
  order += options.keys - order

  recipes = {
    :config => 'config/chef.rb',
    :bootstrap => 'bootstrap/omnibus',
    :core => 'core'
  }.merge(options)

  order.each do |flavor|
    recipe = recipes[flavor]
    next if recipe.nil? or flavor == :config
    require "rake/remote_chef/#{recipe}"
  end

  set :ruby_path, '/opt/chef'
  set(:rsync_flags) {['-rlptDzP', '--exclude', '.git', '-e', "ssh #{ssh_flags.join(' ')}"]}

  Kernel.load recipes[:config]
  Kernel.load "config/chef_#{ENV['to']}.rb" if ENV['to']
end

.run_list(role, runlist) ⇒ Object



16
17
18
19
20
# File 'lib/rake/remote_chef.rb', line 16

def self.run_list role, runlist
  @runlist ||= {}
  @runlist[role] ||= []
  (@runlist[role] += runlist).uniq!
end

.run_list_for(*roles) ⇒ Object



22
23
24
25
# File 'lib/rake/remote_chef.rb', line 22

def self.run_list_for *roles
  roles.unshift(:default)
  roles.map {|r| @runlist[r] }.flatten.uniq.compact
end