Sha256: e1d8fa830855e6aa23e9aee5d6b201a41d9282616e415f634f164a091b697e8c

Contents?: true

Size: 839 Bytes

Versions: 18

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

module Nonnative
  class GoCommand
    def initialize(exec, output)
      @exec = exec
      @output = output
    end

    def executable(cmd, *params)
      params = params.join(' ')
      "#{exec} #{flags(cmd, params).join(' ')} #{cmd} #{params}".strip
    end

    private

    attr_reader :exec, :output

    def flags(cmd, params)
      m = File.basename(exec, File.extname(exec))
      p = params.gsub(/\W/, '')
      name = [m, cmd, p].reject(&:empty?).join('-')
      path = "#{output}/#{name}"

      [
        "-test.cpuprofile=#{path}-cpu.prof",
        "-test.memprofile=#{path}-mem.prof",
        "-test.blockprofile=#{path}-block.prof",
        "-test.mutexprofile=#{path}-mutex.prof",
        "-test.coverprofile=#{path}.cov",
        "-test.trace=#{path}-trace.out"
      ]
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
nonnative-1.56.1 lib/nonnative/go_command.rb
nonnative-1.56.0 lib/nonnative/go_command.rb
nonnative-1.55.0 lib/nonnative/go_command.rb
nonnative-1.54.0 lib/nonnative/go_command.rb
nonnative-1.53.0 lib/nonnative/go_command.rb
nonnative-1.51.1 lib/nonnative/go_command.rb
nonnative-1.48.0 lib/nonnative/go_command.rb
nonnative-1.47.0 lib/nonnative/go_command.rb
nonnative-1.46.0 lib/nonnative/go_command.rb
nonnative-1.45.0 lib/nonnative/go_command.rb
nonnative-1.44.0 lib/nonnative/go_command.rb
nonnative-1.43.0 lib/nonnative/go_command.rb
nonnative-1.42.0 lib/nonnative/go_command.rb
nonnative-1.41.0 lib/nonnative/go_command.rb
nonnative-1.40.0 lib/nonnative/go_command.rb
nonnative-1.39.0 lib/nonnative/go_command.rb
nonnative-1.38.0 lib/nonnative/go_command.rb
nonnative-1.37.0 lib/nonnative/go_command.rb