Module: Orats::Commands::Diff::Compare
- Included in:
- Exec
- Defined in:
- lib/orats/commands/diff/compare.rb
Instance Method Summary collapse
- #local_to_user(label, keyword, flag_path, local) ⇒ Object
- #remote_to_local(label, keyword, remote, local) ⇒ Object
- #remote_to_local_galaxyfiles ⇒ Object
- #remote_to_local_gem_versions ⇒ Object
Instance Method Details
#local_to_user(label, keyword, flag_path, local) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/orats/commands/diff/compare.rb', line 60 def local_to_user(label, keyword, flag_path, local) user = yield log_local_info label, "Compare this version of orats' #{label} to yours", 'path', flag_path missing_count = log_unmatched(local, user, 'missing', :red) extra_count = log_unmatched(user, local, 'extra', :yellow) if missing_count > 0 log_results "#{missing_count} #{keyword} are missing", "Your ansible run will likely fail with this #{label}" else log_results 'Everything appears to be in order', "No missing #{keyword} were found" end if extra_count > 0 log_results "#{extra_count} extra #{keyword} were detected:", "No problem but remember to add them to future #{label}" else log_results "No extra #{keyword} were found:", "Extra #{keyword} are fine but you have none" end end |
#remote_to_local(label, keyword, remote, local) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/orats/commands/diff/compare.rb', line 40 def remote_to_local(label, keyword, remote, local) item_diff = remote - local item_diff_count = item_diff.size log_remote_info label, "Compare this version of orats' #{label} to the latest version", 'file', File.basename(Common::RELATIVE_PATHS[label.to_sym]) item_diff.each do |line| log_status_bottom 'missing', line, :red, true unless local.include?(line) end if item_diff_count > 0 log_results "#{item_diff_count} new #{keyword} are available", 'You may benefit from upgrading to the latest orats' else log_results 'Everything appears to be in order', "No missing #{keyword} were found" end end |
#remote_to_local_galaxyfiles ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/orats/commands/diff/compare.rb', line 10 def remote_to_local_galaxyfiles galaxyfile_diff = @remote_galaxyfile - @local_galaxyfile local_galaxyfile_as_string = @local_galaxyfile.join local_galaxyfile_roles = @local_galaxyfile.size roles_diff_count = galaxyfile_diff.size log_status_top 'roles', "Compare this version of orats' roles to the latest version:", :green if roles_diff_count == 0 log_status_bottom 'message', "All #{local_galaxyfile_roles} roles are up to date", :yellow else log_status_bottom 'message', "There are #{roles_diff_count} differences", :yellow galaxyfile_diff.each do |line| name = line.split(',').first status = 'outdated' color = :yellow unless local_galaxyfile_as_string.include?(name) status = 'missing' color = :red end log_status_bottom status, name, color, true end log_results 'The latest version of orats may benefit you', 'Check github to see if the changes interest you' end end |
#remote_to_local_gem_versions ⇒ Object
5 6 7 8 |
# File 'lib/orats/commands/diff/compare.rb', line 5 def remote_to_local_gem_versions log_remote_info 'gem', 'Compare this version of orats to the latest orats version', 'version', "Latest: #{@remote_gem_version}, Yours: v#{VERSION}" end |