Module: Gauntlt::Support::ProfileHelper

Defined in:
lib/gauntlt/attack_adapters/support/profile_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_to_profile(k, v) ⇒ Object


8
9
10
11
# File 'lib/gauntlt/attack_adapters/support/profile_helper.rb', line 8

def add_to_profile(k,v)
  puts "Overwriting profile value for #{k}" if gauntlt_profile.has_key?(k)
  gauntlt_profile[k] = v
end

#add_to_profile_from_environment(k, v) ⇒ Object


13
14
15
16
# File 'lib/gauntlt/attack_adapters/support/profile_helper.rb', line 13

def add_to_profile_from_environment(k,v)
  puts "Overwriting profile with env value for #{k}" if gauntlt_profile.has_key?(k)
  gauntlt_profile[k] = ENV[v]
end

#gauntlt_profileObject


4
5
6
# File 'lib/gauntlt/attack_adapters/support/profile_helper.rb', line 4

def gauntlt_profile
  @gauntlt_profile ||= {}
end

#run_with_profile(command_template) ⇒ Object


18
19
20
21
22
23
24
25
26
# File 'lib/gauntlt/attack_adapters/support/profile_helper.rb', line 18

def run_with_profile(command_template)
  command = command_template.dup

  gauntlt_profile.each do |name, value|
    command.gsub!( "<#{name}>", value )
  end

  run command
end