Class: Divvy::Provisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/divvy/provisioner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, target_package, server_options) ⇒ Provisioner

Returns a new instance of Provisioner.



3
4
5
6
7
# File 'lib/divvy/provisioner.rb', line 3

def initialize(host, target_package, server_options)
  @target_package = Divvy.packages[target_package]
  raise "Package #{target_package} not found!" unless @target_package
  @server = Server.new(host, server_options)
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



9
10
11
# File 'lib/divvy/provisioner.rb', line 9

def server
  @server
end

#target_packageObject (readonly)

Returns the value of attribute target_package.



9
10
11
# File 'lib/divvy/provisioner.rb', line 9

def target_package
  @target_package
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/divvy/provisioner.rb', line 11

def run
  start_time = Time.now
  print_package(target_package)
  install_plan = normalize(target_package)
  puts "Normalized install order: #{install_plan.map { |package| package.name }.join(', ')}"
  install_plan.each do |package|
    PackageRunner.new(server, package).process
  end
  puts "Took #{Time.now - start_time} seconds"
end