Class: Dip::Commands::Console::Inject

Inherits:
Dip::Command show all
Defined in:
lib/dip/commands/console.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Dip::Command

exec_program, exec_subprocess

Constructor Details

#initialize(shell: nil) ⇒ Inject

Returns a new instance of Inject.



208
209
210
211
212
# File 'lib/dip/commands/console.rb', line 208

def initialize(shell: nil)
  @shell = Console.detect_shell(shell)
  @aliases = []
  @out = []
end

Instance Attribute Details

#aliases ⇒ Object (readonly)

Returns the value of attribute aliases.



206
207
208
# File 'lib/dip/commands/console.rb', line 206

def aliases
  @aliases
end

#out ⇒ Object (readonly)

Returns the value of attribute out.



206
207
208
# File 'lib/dip/commands/console.rb', line 206

def out
  @out
end

Instance Method Details

#execute ⇒ Object



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/dip/commands/console.rb', line 214

def execute
  # Runs on every automatic shell reload (e.g. on `cd`), so it only needs
  # the interaction command names, not full schema conformance — skip the
  # `json-schema` require and validation pass that every other command pays.
  with_validation_skipped do
    if Dip.config.exist?
      add_aliases(*Dip.config.interaction.keys) if Dip.config.interaction
      add_aliases("compose", "up", "stop", "down", "provision", "build")
    end
  end

  clear_aliases

  puts out.join("\n\n")
end