Class: AppMap::Command::AgentSetup::Config

Inherits:
ConfigStruct show all
Defined in:
lib/appmap/command/agent_setup/config.rb

Defined Under Namespace

Classes: FileExistsError

Instance Attribute Summary

Attributes inherited from ConfigStruct

#config_file, #overwrite

Instance Method Summary collapse

Instance Method Details

#performObject

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/appmap/command/agent_setup/config.rb', line 14

def perform
  raise FileExistsError unless overwrite || !File.exist?(config_file)

  config = {
    'name' => Service::Guesser.guess_name,
    'packages' => Service::Guesser.guess_paths.map { |path| { 'path' => path } },
    'language' => 'ruby',
    'appmap_dir' => 'tmp/appmap'
  }

  File.write(config_file, YAML.dump(config))
end