Class: Constancy::CLI::ConfigCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/constancy/cli/config_command.rb

Class Method Summary collapse

Class Method Details

.runObject



7
8
9
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
39
40
# File 'lib/constancy/cli/config_command.rb', line 7

def run
  Constancy::CLI.configure

  puts "Config file: #{Constancy.config.config_file}"
  puts " Consul URL: #{Constancy.config.consul.url}"
  puts "    Verbose: #{Constancy.config.verbose?.to_s.bold}"
  puts
  puts "Sync target defaults:"
  puts "  Chomp trailing newlines from local files: #{Constancy.config.chomp?.to_s.bold}"
  puts "  Delete remote keys with no local file: #{Constancy.config.delete?.to_s.bold}"
  puts
  puts "Sync targets:"

  Constancy.config.sync_targets.each do |target|
    if target.name
      puts "* #{target.name.bold}"
      print ' '
    else
      print '*'
    end
    puts " Datacenter: #{target.datacenter}"
    puts "   File path: #{target.path}"
    puts "      Prefix: #{target.prefix}"
    puts "   Autochomp? #{target.chomp?}"
    puts "      Delete? #{target.delete?}"
    if not target.exclude.empty?
      puts "  Exclusions:"
      target.exclude.each do |exclusion|
        puts "    - #{exclusion}"
      end
    end
    puts
  end
end