Module: TFClient

Defined in:
lib/textflight-client.rb,
lib/textflight-client/logging.rb,
lib/textflight-client/version.rb,
lib/textflight-client/tfprompt.rb,
lib/textflight-client/models/nav.rb,
lib/textflight-client/environment.rb,
lib/textflight-client/models/scan.rb,
lib/textflight-client/models/local.rb,
lib/textflight-client/models/model.rb,
lib/textflight-client/string_utils.rb,
lib/textflight-client/models/status.rb,
lib/textflight-client/command_parser.rb,
lib/textflight-client/response_parser.rb,
lib/textflight-client/models/status_report.rb

Defined Under Namespace

Modules: Color, DotDir, Models, StringUtils Classes: CommandParser, Environment, ResponseParser, TFPrompt

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.debug(msg) ⇒ Object

magenta



17
18
19
20
21
# File 'lib/textflight-client/logging.rb', line 17

def self.debug(msg)
  if ENV["DEBUG"] == "1"
    puts Color.magenta("DEBUG: #{msg}") if msg
  end
end

.deprecated(version, msg) ⇒ void

This method returns an undefined value.

Prints a deprecated message that includes the line number.

Parameters:

  • version (String)

    Indicates when the feature was deprecated.

  • msg (String)

    Deprecation message (possibly suggesting alternatives)



23
24
25
26
27
28
29
30
31
# File 'lib/textflight-client.rb', line 23

def self.deprecated(version, msg)

  stack = Kernel.caller(0, 6)[1..-1].join("\n")

  msg = "deprecated '#{version}' - #{msg}\n#{stack}"

  $stderr.puts "\033[34mWARN: #{msg}\033[0m"
  $stderr.flush
end

.error(msg) ⇒ Object

red



29
30
31
# File 'lib/textflight-client/logging.rb', line 29

def self.error(msg)
  puts Color.red("ERROR: #{msg}") if msg
end

.info(msg) ⇒ Object

green



24
25
26
# File 'lib/textflight-client/logging.rb', line 24

def self.info(msg)
  puts Color.green(" INFO: #{msg}") if msg
end

.log_unix_cmd(msg) ⇒ Object

cyan



5
6
7
8
9
# File 'lib/textflight-client/logging.rb', line 5

def self.log_unix_cmd(msg)
  if ENV["DEBUG"] == "1"
    puts Color.cyan("SHELL: #{msg}") if msg
  end
end

.warn(msg) ⇒ Object

blue



12
13
14
# File 'lib/textflight-client/logging.rb', line 12

def self.warn(msg)
  puts Color.blue(" WARN: #{msg}") if msg
end