Sha256: 919e734ccadc560c8706e2864ac2b83f03e955cd192c9a356e6ee286091bce52

Contents?: true

Size: 647 Bytes

Versions: 12

Compression:

Stored size: 647 Bytes

Contents

module Lono::Cfn::Preview
  module DiffViewer
    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

    def diff_viewer
      return ENV['LONO_DIFF'] if ENV['LONO_DIFF']
      colordiff_installed = system("type colordiff > /dev/null 2>&1")
      unless colordiff_installed
        puts "INFO: colordiff it not available. Recommend installing it."
      end
      colordiff_installed ? "colordiff" : "diff"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/cfn/preview/diff_viewer.rb
lono-7.5.1 lib/lono/cfn/preview/diff_viewer.rb
lono-7.5.0 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.11 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.10 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.9 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.8 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.7 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.6 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.5 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.4 lib/lono/cfn/preview/diff_viewer.rb
lono-7.4.3 lib/lono/cfn/preview/diff_viewer.rb