Class: Producer::Core::Env
- Inherits:
-
Object
- Object
- Producer::Core::Env
- Extended by:
- Forwardable
- 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.
-
#recipe_argv ⇒ Object
Returns the value of attribute recipe_argv.
-
#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
- #[](*args) ⇒ Object (also: #get)
- #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.
10 11 12 13 14 15 16 17 18 |
# File 'lib/producer/core/env.rb', line 10 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.
8 9 10 |
# File 'lib/producer/core/env.rb', line 8 def debug @debug end |
#dry_run ⇒ Object
Returns the value of attribute dry_run.
8 9 10 |
# File 'lib/producer/core/env.rb', line 8 def dry_run @dry_run end |
#error_output ⇒ Object (readonly)
Returns the value of attribute error_output.
7 8 9 |
# File 'lib/producer/core/env.rb', line 7 def error_output @error_output end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
7 8 9 |
# File 'lib/producer/core/env.rb', line 7 def input @input end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/producer/core/env.rb', line 7 def logger @logger end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/producer/core/env.rb', line 7 def output @output end |
#recipe_argv ⇒ Object
Returns the value of attribute recipe_argv.
8 9 10 |
# File 'lib/producer/core/env.rb', line 8 def recipe_argv @recipe_argv end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
7 8 9 |
# File 'lib/producer/core/env.rb', line 7 def registry @registry end |
#target ⇒ Object
Returns the value of attribute target.
8 9 10 |
# File 'lib/producer/core/env.rb', line 8 def target @target end |
#verbose ⇒ Object
Returns the value of attribute verbose.
8 9 10 |
# File 'lib/producer/core/env.rb', line 8 def verbose @verbose end |
Instance Method Details
#[](*args) ⇒ Object Also known as: get
24 25 26 27 28 |
# File 'lib/producer/core/env.rb', line 24 def [] *args @registry.fetch *args rescue KeyError raise RegistryKeyError, args.first.inspect end |
#cleanup ⇒ Object
54 55 56 |
# File 'lib/producer/core/env.rb', line 54 def cleanup remote.cleanup end |
#debug? ⇒ Boolean
46 47 48 |
# File 'lib/producer/core/env.rb', line 46 def debug? @debug end |
#dry_run? ⇒ Boolean
50 51 52 |
# File 'lib/producer/core/env.rb', line 50 def dry_run? @dry_run end |
#log(message, severity = :info) ⇒ Object
38 39 40 |
# File 'lib/producer/core/env.rb', line 38 def log , severity = :info logger.send severity, end |
#remote ⇒ Object
20 21 22 |
# File 'lib/producer/core/env.rb', line 20 def remote @remote ||= Remote.new(target) end |
#verbose? ⇒ Boolean
42 43 44 |
# File 'lib/producer/core/env.rb', line 42 def verbose? @verbose end |