Class: Foreplay::Engine

Inherits:
Object
  • Object
show all
Includes:
Defaults
Defined in:
lib/foreplay/engine.rb,
lib/foreplay/engine/port.rb,
lib/foreplay/engine/role.rb,
lib/foreplay/engine/step.rb,
lib/foreplay/engine/logger.rb,
lib/foreplay/engine/remote.rb,
lib/foreplay/engine/server.rb,
lib/foreplay/engine/secrets.rb,
lib/foreplay/engine/defaults.rb,
lib/foreplay/engine/remote/step.rb,
lib/foreplay/engine/remote/check.rb,
lib/foreplay/engine/secrets/location.rb

Defined Under Namespace

Modules: Defaults, Port Classes: Logger, Remote, Role, Secrets, Server, Step

Constant Summary

Constants included from Defaults

Defaults::DEFAULTS_KEY, Defaults::DEFAULT_CONFIG_FILE

Constants included from Foreplay

DEFAULT_PORT, PORT_GAP, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Defaults

#config_file, #defaults, #roles, #roles_all, #secrets

Methods included from Foreplay

#log, #terminate

Constructor Details

#initialize(e, f) ⇒ Engine

Returns a new instance of Engine.



15
16
17
18
19
20
21
# File 'lib/foreplay/engine.rb', line 15

def initialize(e, f)
  @environment  = e
  @filters      = f

  @defaults = nil
  @roles_all = nil
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



13
14
15
# File 'lib/foreplay/engine.rb', line 13

def environment
  @environment
end

#filtersObject (readonly)

Returns the value of attribute filters.



13
14
15
# File 'lib/foreplay/engine.rb', line 13

def filters
  @filters
end

#modeObject (readonly)

Returns the value of attribute mode.



13
14
15
# File 'lib/foreplay/engine.rb', line 13

def mode
  @mode
end

Instance Method Details

#execute(m) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/foreplay/engine.rb', line 25

def execute(m)
  @mode = m
  puts "#{mode.capitalize}ing #{environment.dup.yellow} environment, "\
       "#{explanatory_text(filters, 'role')}, #{explanatory_text(filters, 'server')}"

  actionable_roles.map { |role, instructions| threads(role, instructions) }.flatten.each(&:join)

  puts mode == :deploy ? 'Finished deployment' : 'Deployment configuration check was successful'
end