class Capistrano::Doctor::VariablesDoctor
Prints a table of all Capistrano
variables and their current values. If there are unrecognized variables, print warnings for them.
Constants
- WHITELIST
These are keys that are recognized by
Capistrano
, but do not have values set by default.
Attributes
env[R]
Public Class Methods
new(env=Capistrano::Configuration.env)
click to toggle source
# File lib/capistrano/doctor/variables_doctor.rb, line 24 def initialize(env=Capistrano::Configuration.env) @env = env end
Public Instance Methods
call()
click to toggle source
# File lib/capistrano/doctor/variables_doctor.rb, line 28 def call title("Variables") values = inspect_all_values table(variables.keys.sort_by(&:to_s)) do |key, row| row.yellow if suspicious_keys.include?(key) row << key.inspect row << values[key] end puts if suspicious_keys.any? suspicious_keys.sort_by(&:to_s).each do |key| warning("#{key.inspect} is not a recognized Capistrano setting "\ "(#{location(key)})") end end
Private Instance Methods
inspect_all_values()
click to toggle source
# File lib/capistrano/doctor/variables_doctor.rb, line 54 def inspect_all_values variables.keys.each_with_object({}) do |key, inspected| inspected[key] = if env.is_question?(key) "<ask>" else variables.peek(key).inspect end end end
location(key)
click to toggle source
# File lib/capistrano/doctor/variables_doctor.rb, line 68 def location(key) loc = variables.source_locations(key).first loc && loc.sub(/^#{Regexp.quote(Dir.pwd)}/, "").sub(/:in.*/, "") end
suspicious_keys()
click to toggle source
# File lib/capistrano/doctor/variables_doctor.rb, line 64 def suspicious_keys (variables.untrusted_keys & variables.unused_keys) - WHITELIST end
variables()
click to toggle source
# File lib/capistrano/doctor/variables_doctor.rb, line 50 def variables env.variables end