Class: Producer::Core::Env
- Inherits:
-
Object
- Object
- Producer::Core::Env
- Defined in:
- lib/producer/core/env.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
-
#error_output ⇒ Object
readonly
Returns the value of attribute error_output.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
-
#target ⇒ Object
Returns the value of attribute target.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #[](key) ⇒ Object (also: #get)
- #[]=(key, value) ⇒ Object
- #cleanup ⇒ Object
- #debug? ⇒ Boolean
- #dry_run? ⇒ Boolean
-
#initialize(input: $stdin, output: $stdout, error_output: $stderr, remote: nil, registry: {}) ⇒ Env
constructor
A new instance of Env.
- #log(message, severity = :info) ⇒ Object
- #remote ⇒ Object
- #verbose? ⇒ Boolean
Constructor Details
#initialize(input: $stdin, output: $stdout, error_output: $stderr, remote: nil, registry: {}) ⇒ Env
Returns a new instance of Env.
7 8 9 10 11 12 13 14 |
# File 'lib/producer/core/env.rb', line 7 def initialize(input: $stdin, output: $stdout, error_output: $stderr, remote: nil, registry: {}) @verbose = @debug = @dry_run = false @input = input @output = output @error_output = error_output @remote = remote @registry = registry end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/producer/core/env.rb', line 5 def debug @debug end |
#dry_run ⇒ Object
Returns the value of attribute dry_run.
5 6 7 |
# File 'lib/producer/core/env.rb', line 5 def dry_run @dry_run end |
#error_output ⇒ Object (readonly)
Returns the value of attribute error_output.
4 5 6 |
# File 'lib/producer/core/env.rb', line 4 def error_output @error_output end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
4 5 6 |
# File 'lib/producer/core/env.rb', line 4 def input @input end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/producer/core/env.rb', line 4 def logger @logger end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
4 5 6 |
# File 'lib/producer/core/env.rb', line 4 def output @output end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
4 5 6 |
# File 'lib/producer/core/env.rb', line 4 def registry @registry end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/producer/core/env.rb', line 5 def target @target end |
#verbose ⇒ Object
Returns the value of attribute verbose.
5 6 7 |
# File 'lib/producer/core/env.rb', line 5 def verbose @verbose end |
Instance Method Details
#[](key) ⇒ Object Also known as: get
20 21 22 23 24 |
# File 'lib/producer/core/env.rb', line 20 def [](key) @registry.fetch key rescue KeyError fail RegistryKeyError, key.inspect end |
#[]=(key, value) ⇒ Object
27 28 29 |
# File 'lib/producer/core/env.rb', line 27 def []=(key, value) @registry[key] = value end |
#cleanup ⇒ Object
56 57 58 |
# File 'lib/producer/core/env.rb', line 56 def cleanup remote.cleanup end |
#debug? ⇒ Boolean
48 49 50 |
# File 'lib/producer/core/env.rb', line 48 def debug? @debug end |
#dry_run? ⇒ Boolean
52 53 54 |
# File 'lib/producer/core/env.rb', line 52 def dry_run? @dry_run end |
#log(message, severity = :info) ⇒ Object
40 41 42 |
# File 'lib/producer/core/env.rb', line 40 def log(, severity = :info) logger.send severity, end |
#remote ⇒ Object
16 17 18 |
# File 'lib/producer/core/env.rb', line 16 def remote @remote ||= Remote.new(target) end |
#verbose? ⇒ Boolean
44 45 46 |
# File 'lib/producer/core/env.rb', line 44 def verbose? @verbose end |