Module: Lono::Cfn::Preview::DiffViewer

Included in:
Codediff, Param, Sets::Preview::Codediff
Defined in:
lib/lono/cfn/preview/diff_viewer.rb

Instance Method Summary collapse

Instance Method Details

#diff_viewerObject



14
15
16
17
# File 'lib/lono/cfn/preview/diff_viewer.rb', line 14

def diff_viewer
  return ENV['LONO_DIFF'] if ENV['LONO_DIFF']
  system("type colordiff > /dev/null") ? "colordiff" : "diff"
end

#show_diff(existing_path, new_path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/lono/cfn/preview/diff_viewer.rb', line 3

def show_diff(existing_path, new_path)
  command = "#{diff_viewer} #{existing_path} #{new_path}"
  puts "Running: #{command}"
  out = `#{command}`
  if out.strip == ''
    puts "There were no differences."
  else
    puts out
  end
end