Sha256: c0f10162ea1d889a5503a09d1c29066760bbcf400069c0a76ae9739c0b5e7893

Contents?: true

Size: 720 Bytes

Versions: 9

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

require 'yaml'
require 'appmap/service/guesser'

module AppMap
  module Command
    module AgentSetup
      ConfigStruct = Struct.new(:config_file, :overwrite)

      class Config < ConfigStruct
        class FileExistsError < StandardError; end

        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
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
appmap-1.1.1 lib/appmap/command/agent_setup/config.rb
appmap-1.0.1 lib/appmap/command/agent_setup/config.rb
appmap-1.0.0 lib/appmap/command/agent_setup/config.rb
appmap-0.103.0 lib/appmap/command/agent_setup/config.rb
appmap-0.102.2 lib/appmap/command/agent_setup/config.rb
appmap-0.102.1 lib/appmap/command/agent_setup/config.rb
appmap-0.102.0 lib/appmap/command/agent_setup/config.rb
appmap-0.101.0 lib/appmap/command/agent_setup/config.rb
appmap-0.100.0 lib/appmap/command/agent_setup/config.rb