Class: SyntaxTree::CLI::Check

Inherits:
Action
  • Object
show all
Defined in:
lib/syntax_tree/cli.rb

Overview

An action of the CLI that ensures that the filepath is formatted as expected.

Defined Under Namespace

Classes: UnformattedError

Instance Method Summary collapse

Instance Method Details

#failureObject



106
107
108
# File 'lib/syntax_tree/cli.rb', line 106

def failure
  warn("The listed files did not match the expected format.")
end

#run(item) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/syntax_tree/cli.rb', line 94

def run(item)
  source = item.source
  raise UnformattedError if source != item.handler.format(source)
rescue StandardError
  warn("[#{Color.yellow("warn")}] #{item.filepath}")
  raise
end

#successObject



102
103
104
# File 'lib/syntax_tree/cli.rb', line 102

def success
  puts("All files matched expected format.")
end