class Jack::Config::Diff
Attributes
transmit[R]
Public Class Methods
new(options={})
click to toggle source
# File lib/jack/config/diff.rb, line 5 def initialize(options={}) @options = options @root = options[:root] || '.' @env_name = options[:env_name] @download = Jack::Config::Get.new(options) end
Public Instance Methods
cleanup_files()
click to toggle source
# File lib/jack/config/diff.rb, line 34 def cleanup_files return false if @options[:dirty] @download.clean(mute=true) end
compute_diff(current, local)
click to toggle source
# File lib/jack/config/diff.rb, line 19 def compute_diff(current, local) # the diff command returns 0 when there is no difference and returns 1 when there is a difference pretty_current_path = @download.current_path.sub(/.*\.elasticbeanstalk/,'.elasticbeanstalk') command = "#{diff_command} #{pretty_current_path} #{@download.local_config_path}" UI.say("=> #{command}") return if @options[:noop] sorter = YamlFormatter.new sorter.process(current) sorter.process(local) no_difference = system(command) !no_difference end
diff_command()
click to toggle source
# File lib/jack/config/diff.rb, line 39 def diff_command return ENV['JACK_DIFF'] if ENV['JACK_DIFF'] if system("type colordiff > /dev/null 2>&1") "colordiff" else "diff" end end
run()
click to toggle source
# File lib/jack/config/diff.rb, line 12 def run @download.get_current_cfg difference = compute_diff(@download.current_path, @download.local_config_path) cleanup_files difference end