Class: Roast::Cogs::Cmd::Config

Inherits:
Roast::Cog::Config show all
Defined in:
lib/roast/cogs/cmd.rb

Overview

Configure the ‘cmd` cog

See sorbet/rbi/shims/lib/roast/config_context.rbi for full class documentation.

Instance Attribute Summary

Attributes inherited from Roast::Cog::Config

#values

Instance Method Summary collapse

Methods inherited from Roast::Cog::Config

#[], #[]=, #abort_on_failure!, #abort_on_failure?, #async!, #async?, field, #initialize, #merge, #no_abort_on_failure!, #no_async!, #use_current_working_directory!, #valid_working_directory, #validate!, #working_directory

Constructor Details

This class inherits a constructor from Roast::Cog::Config

Instance Method Details

#display!Object

Configure the cog to write both STDOUT and STDERR to the console

#### See Also

  • ‘no_display!`

  • ‘show_stdout!`

  • ‘show_stderr!`

: () -> void



137
138
139
140
# File 'lib/roast/cogs/cmd.rb', line 137

def display!
  @values[:show_stdout] = true
  @values[:show_stderr] = true
end

#display?Boolean

Check if the cog is configured to display any output while running

#### See Also

  • ‘display!`

  • ‘no_display!`

  • ‘show_stdout?`

  • ‘show_stderr?`

: () -> bool

Returns:

  • (Boolean)


167
168
169
# File 'lib/roast/cogs/cmd.rb', line 167

def display?
  show_stdout? || show_stderr?
end

#fail_on_error!Object

Configure the cog to consider itself failed if the command returns a non-zero exit status

Enabled by default. When enabled, a non-zero exit status will mark the cog as failed, which may also abort the workflow depending on the cog’s ‘abort_on_failure` configuration.

#### Inverse Methods

  • ‘no_fail_on_error!`

#### See Also

  • ‘fail_on_error?`

  • ‘abort_on_failure!`

: () -> void



24
25
26
# File 'lib/roast/cogs/cmd.rb', line 24

def fail_on_error!
  @values[:fail_on_error] = true
end

#fail_on_error?Boolean

Check if the cog is configured to fail when the command returns a non-zero exit status

#### See Also

  • ‘fail_on_error!`

  • ‘no_fail_on_error!`

: () -> bool

Returns:

  • (Boolean)


51
52
53
# File 'lib/roast/cogs/cmd.rb', line 51

def fail_on_error?
  @values[:fail_on_error] != false
end

#no_display!Object Also known as: quiet!

Configure the cog to write __no output__ to the console, neither STDOUT nor STDERR

#### Alias Methods

  • ‘quiet!`

#### See Also

  • ‘display!`

  • ‘no_show_stdout!`

  • ‘no_show_stderr!`

: () -> void



153
154
155
156
# File 'lib/roast/cogs/cmd.rb', line 153

def no_display!
  @values[:show_stdout] = false
  @values[:show_stderr] = false
end

#no_fail_on_error!Object

Configure the cog __not__ to consider itself failed if the command returns a non-zero exit status

When disabled, the cog will complete successfully regardless of the command’s exit status. The exit status will still be available in the output for inspection.

#### Inverse Methods

  • ‘fail_on_error!`

#### See Also

  • ‘fail_on_error?`

: () -> void



40
41
42
# File 'lib/roast/cogs/cmd.rb', line 40

def no_fail_on_error!
  @values[:fail_on_error] = false
end

#no_show_stderr!Object

Configure the cog __not__ to write STDERR to the console

#### See Also

  • ‘show_stderr!`

  • ‘show_stderr?`

  • ‘no_display!`

: () -> void



114
115
116
# File 'lib/roast/cogs/cmd.rb', line 114

def no_show_stderr!
  @values[:show_stderr] = false
end

#no_show_stdout!Object

Configure the cog __not__ to write STDOUT to the console

#### See Also

  • ‘show_stdout!`

  • ‘show_stdout?`

  • ‘no_display!`

: () -> void



77
78
79
# File 'lib/roast/cogs/cmd.rb', line 77

def no_show_stdout!
  @values[:show_stdout] = false
end

#show_stderr!Object

Configure the cog to write STDERR to the console

Disabled by default.

#### See Also

  • ‘no_show_stderr!`

  • ‘show_stderr?`

  • ‘display!`

: () -> void



102
103
104
# File 'lib/roast/cogs/cmd.rb', line 102

def show_stderr!
  @values[:show_stderr] = true
end

#show_stderr?Boolean

Check if the cog is configured to write STDERR to the console

#### See Also

  • ‘show_stderr!`

  • ‘no_show_stderr!`

: () -> bool

Returns:

  • (Boolean)


125
126
127
# File 'lib/roast/cogs/cmd.rb', line 125

def show_stderr?
  !!@values[:show_stderr]
end

#show_stdout!Object

Configure the cog to write STDOUT to the console

Disabled by default.

#### See Also

  • ‘no_show_stdout!`

  • ‘show_stdout?`

  • ‘display!`

: () -> void



65
66
67
# File 'lib/roast/cogs/cmd.rb', line 65

def show_stdout!
  @values[:show_stdout] = true
end

#show_stdout?Boolean

Check if the cog is configured to write STDOUT to the console

#### See Also

  • ‘show_stdout!`

  • ‘no_show_stdout!`

: () -> bool

Returns:

  • (Boolean)


88
89
90
# File 'lib/roast/cogs/cmd.rb', line 88

def show_stdout?
  !!@values[:show_stdout]
end