Class: Jack::Config::Diff
- Inherits:
-
Object
- Object
- Jack::Config::Diff
- Defined in:
- lib/jack/config/diff.rb
Instance Attribute Summary collapse
-
#transmit ⇒ Object
readonly
Returns the value of attribute transmit.
Instance Method Summary collapse
- #cleanup_files ⇒ Object
- #diff_command ⇒ Object
- #do_diff(current, local) ⇒ Object
-
#initialize(options = {}) ⇒ Diff
constructor
A new instance of Diff.
- #run ⇒ Object
Constructor Details
Instance Attribute Details
#transmit ⇒ Object (readonly)
Returns the value of attribute transmit.
4 5 6 |
# File 'lib/jack/config/diff.rb', line 4 def transmit @transmit end |
Instance Method Details
#cleanup_files ⇒ Object
29 30 31 32 |
# File 'lib/jack/config/diff.rb', line 29 def cleanup_files return false if @options[:dirty] @download.clean(mute=true) end |
#diff_command ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/jack/config/diff.rb', line 34 def diff_command return ENV['JACK_DIFF'] if ENV['JACK_DIFF'] if system("type colordiff > /dev/null 2>&1") "colordiff" else "diff" end end |
#do_diff(current, local) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jack/config/diff.rb', line 18 def do_diff(current, local) UI.say "Comparing #{current} and #{local}" return if @options[:noop] sorter = YamlFormatter.new sorter.process(current) sorter.process(local) # need to use system so that the diff shows up properly in the terminal system(diff_command, @download.current_path, @download.local_config_path) puts "" end |
#run ⇒ Object
12 13 14 15 16 |
# File 'lib/jack/config/diff.rb', line 12 def run @download.get_current_cfg do_diff(@download.current_path, @download.local_config_path) cleanup_files end |