Class: GDK::Command::DiffConfig

Inherits:
BaseCommand show all
Defined in:
lib/gdk/command/diff_config.rb

Defined Under Namespace

Classes: ConfigDiff

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#config, #display_help_message, #help, #initialize, #print_help, #print_ready_message, #ready_messages, validate_config?

Constructor Details

This class inherits a constructor from GDK::Command::BaseCommand

Instance Method Details

#run(_ = []) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gdk/command/diff_config.rb', line 8

def run(_ = [])
  Shellout.new(GDK::MAKE, 'touch-examples').run

  # We chdir because rake file tasks don't work with an absolute path
  results = Dir.chdir(GDK.root) do
    # Iterate over each file from files Array and print any output to
    # stderr that may have come from running `make <file>`.
    jobs.filter_map { |x| x.join[:results] }
  end

  results.each do |diff|
    output = diff.output.to_s.chomp
    next if output.empty?

    stdout.puts(diff.file)
    stdout.puts('-' * 80)
    stdout.puts(output)
    stdout.puts("\n")
  end

  true
end