class ConfigmonkeyCli::Application
Attributes
argv[R]
connections[R]
env[R]
hooks[R]
opts[R]
Public Class Methods
dispatch(*a)
click to toggle source
¶ ↑
Setup =¶ ↑
¶ ↑
# File lib/configmonkey_cli/application.rb, line 14 def self.dispatch *a new(*a) do |app| app.load_appconfig app.parse_params begin app.dispatch app.haltpoint rescue Interrupt app.abort("Interrupted", 1) rescue SystemExit app.abort("Aborted", 2) ensure app.fire(:cm_shutdown) app.debug "#{Thread.list.length} threads remain..." end end end
new(env, argv) { |self| ... }
click to toggle source
# File lib/configmonkey_cli/application.rb, line 32 def initialize env, argv @boot = Time.current @env, @argv = env, argv @hooks = {} @connections = {} @monitor = Monitor.new @opts = { working_directory: Dir.pwd, # -i flag target_directory: "/", # -o flag hostname: `hostname`.chomp, # -f flag diff_tool: nil, # -D flag merge_tool: nil, # -M flag bell: false, # -b flag default_accept: false, # -a flag default_yes: false, # -y flag dispatch: :index, # (internal) action to dispatch simulation: false, # -n flag check_for_updates: true, # -z flag colorize: true, # -m flag debug: false, # -d flag # silent: false, # -s flag # quiet: false, # -q flag stdout: STDOUT, # (internal) STDOUT redirect } init_params yield(self) end
Public Instance Methods
find_diff_tool()
click to toggle source
# File lib/configmonkey_cli/application.rb, line 60 def find_diff_tool [ opts[:diff_tool], ENV["CM_DIFF"], ENV["THOR_DIFF"], ENV["RAILS_DIFF"], "colordiff", "git diff --no-index", "vim -d", "diff -u", ].compact.each do |cmd| if hit = `which #{cmd.split(" ").first}`.chomp.presence debug "§diff-using:(#{hit})#{cmd}" return cmd else debug "§diff-not-found:#{cmd}", 105 end end end
find_merge_tool()
click to toggle source
# File lib/configmonkey_cli/application.rb, line 80 def find_merge_tool [ opts[:merge_tool], ENV["CM_MERGE"], ENV["THOR_MERGE"], (`git config merge.tool`.chomp rescue nil), "vim -d", "diff -u", ].compact.each do |cmd| if hit = `which #{cmd.split(" ").first}`.chomp.presence debug "§merge-using:(#{hit})#{cmd}" return cmd else debug "§merge-not-found:#{cmd}", 105 end