Class: Rwm::Commands::Check

Inherits:
Object
  • Object
show all
Defined in:
lib/rwm/commands/check.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Check

Returns a new instance of Check.



6
7
8
# File 'lib/rwm/commands/check.rb', line 6

def initialize(argv)
  @argv = argv
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rwm/commands/check.rb', line 10

def run
  workspace = Workspace.find
  graph = DependencyGraph.load(workspace)
  checker = ConventionChecker.new(graph)
  violations = checker.check

  if violations.empty?
    puts "  All conventions passed."
    0
  else
    $stderr.puts "Convention violations found:"
    violations.each { |v| $stderr.puts "  - #{v}" }
    1
  end
end