Class: DnsMadeEasy::CLI::Launcher

Inherits:
Object
  • Object
show all
Defined in:
lib/dnsmadeeasy/cli/launcher.rb

Overview

Entrypoint used by the executable and in-process CLI specs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = Kernel) ⇒ Launcher

Returns a new instance of Launcher.



14
15
16
17
18
19
20
# File 'lib/dnsmadeeasy/cli/launcher.rb', line 14

def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = Kernel)
  @argv = argv
  @stdin = stdin
  @stdout = stdout
  @stderr = stderr
  @kernel = kernel
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



12
13
14
# File 'lib/dnsmadeeasy/cli/launcher.rb', line 12

def argv
  @argv
end

#kernelObject (readonly)

Returns the value of attribute kernel.



12
13
14
# File 'lib/dnsmadeeasy/cli/launcher.rb', line 12

def kernel
  @kernel
end

#stderrObject (readonly)

Returns the value of attribute stderr.



12
13
14
# File 'lib/dnsmadeeasy/cli/launcher.rb', line 12

def stderr
  @stderr
end

#stdinObject (readonly)

Returns the value of attribute stdin.



12
13
14
# File 'lib/dnsmadeeasy/cli/launcher.rb', line 12

def stdin
  @stdin
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



12
13
14
# File 'lib/dnsmadeeasy/cli/launcher.rb', line 12

def stdout
  @stdout
end

Instance Method Details

#execute!Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dnsmadeeasy/cli/launcher.rb', line 22

def execute!
  return  if 

  Input.stdin = stdin
  command.call(arguments: argv, out: stdout, err: stderr)
rescue SystemExit => e
  e.status
rescue StandardError => e
  stderr.puts(e.message)
  1
end