Class: Matchd::CLI::Config

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/matchd/cli/config.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/matchd/cli/config.rb', line 20

def setup
  opts = options.dup

  dot_dir     = File.expand_path(opts.delete(:base))
  config_file = File.expand_path(opts.delete(:config_file), dot_dir)

  Matchd.configure { |c| c.dot_dir = dot_dir }

  empty_directory(dot_dir, opts)

  create_file(config_file, YAML.dump(Matchd::Config.config.to_h), opts)

  sample_registry = File.expand_path(File.join("examples", "registry.yml"), Matchd.root)
  create_file(Matchd::Config.registry_file, File.binread(sample_registry), opts)
end