Sha256: 65fe9b0bc38de8a83e847ba58034fdc366897c962867415ce3b733db98ecdbee
Contents?: true
Size: 935 Bytes
Versions: 1
Compression:
Stored size: 935 Bytes
Contents
# coding: utf-8 # TODO: Separate Gem? class Siege DEFAULTS = { duration: '30s', users: 15, rc: File.expand_path('../siege/data/siegerc', __FILE__) } OPTIONS = { benchmark: '-b', duration: '-t', file: '-f', header: '-H', internet: '-i', quiet: '-q', user_agent: '-A', users: '-c', rc: '-R', delay: '-d', verbose: '-v' } attr_reader :conf, :results def initialize(urls, conf) @url_file = TempFile.with_content urls @conf = DEFAULTS.merge conf @results = Results.for executor end def executor puts "Sieging with:\n\tsiege #{cli_opts} -f#{@url_file.name} 2>&1" `siege #{cli_opts} -f#{@url_file.name} 2>&1` end def cli_opts @conf.flat_map { |opt, val| OPTIONS[opt] + val.to_s }. join(' '). gsub(/(\-\w) true/, '\1'). gsub(/\-\w false/, '') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bombard-0.0.4 | lib/siege.rb |