Class: Producer::Core::Env

Inherits:
Baf::Env
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/producer/core/env.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remote: nil, registry: {}, **opts) ⇒ Env

Returns a new instance of Env.



10
11
12
13
14
# File 'lib/producer/core/env.rb', line 10

def initialize remote: nil, registry: {}, **opts
  super **opts
  @remote = remote
  @registry = registry
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



7
8
9
# File 'lib/producer/core/env.rb', line 7

def input
  @input
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/producer/core/env.rb', line 7

def logger
  @logger
end

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/producer/core/env.rb', line 7

def output
  @output
end

#output_errorObject (readonly)

Returns the value of attribute output_error.



7
8
9
# File 'lib/producer/core/env.rb', line 7

def output_error
  @output_error
end

#recipe_argvObject

Returns the value of attribute recipe_argv.



8
9
10
# File 'lib/producer/core/env.rb', line 8

def recipe_argv
  @recipe_argv
end

#registryObject (readonly)

Returns the value of attribute registry.



7
8
9
# File 'lib/producer/core/env.rb', line 7

def registry
  @registry
end

Instance Method Details

#[](*args) ⇒ Object Also known as: get



20
21
22
23
24
# File 'lib/producer/core/env.rb', line 20

def [] *args
  @registry.fetch *args
rescue KeyError
  raise RegistryKeyError, args.first.inspect
end

#cleanupObject



38
39
40
# File 'lib/producer/core/env.rb', line 38

def cleanup
  remote.cleanup
end

#log(message, severity = :info) ⇒ Object



34
35
36
# File 'lib/producer/core/env.rb', line 34

def log message, severity = :info
  logger.send severity, message
end

#remoteObject



16
17
18
# File 'lib/producer/core/env.rb', line 16

def remote
  @remote ||= Remote.new(target)
end