Module: Pfm::Helpers
- Included in:
- CLI, Command::Base
- Defined in:
- lib/idlc-sdk-pfm/helpers.rb
Overview
Module of common functions that are used frequently in every namespace
Class Method Summary collapse
-
.debug(message) ⇒ Object
Only prints the given string to stdout when the environment variable DEBUG = true.
-
.err(message) ⇒ Object
Print the given string to stderr.
-
.msg(message) ⇒ Object
Print the given string to stdout.
-
.system_command(*command_args) ⇒ Object
Runs given commands using mixlib-shellout.
Class Method Details
.debug(message) ⇒ Object
Only prints the given string to stdout when the environment variable DEBUG = true
35 36 37 |
# File 'lib/idlc-sdk-pfm/helpers.rb', line 35 def debug() stdout.print("#{}\n") if ENV['DEBUG'] end |
.err(message) ⇒ Object
Print the given string to stderr
20 21 22 |
# File 'lib/idlc-sdk-pfm/helpers.rb', line 20 def err() stderr.print("#{}\n") end |
.msg(message) ⇒ Object
Print the given string to stdout
27 28 29 |
# File 'lib/idlc-sdk-pfm/helpers.rb', line 27 def msg() stdout.print("#{}\n") end |
.system_command(*command_args) ⇒ Object
Runs given commands using mixlib-shellout
9 10 11 12 13 14 15 |
# File 'lib/idlc-sdk-pfm/helpers.rb', line 9 def system_command(*command_args) cmd = Mixlib::ShellOut.new(*command_args) cmd.run_command err(cmd.stderr) msg(cmd.stdout) cmd end |