Class: Autosiege::CLI
- Inherits:
-
Object
- Object
- Autosiege::CLI
- Includes:
- Mixlib::CLI
- Defined in:
- lib/autosiege/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.run ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/autosiege/cli.rb', line 46 def self.run cli = new begin cli. rescue OptionParser::InvalidOption puts cli.opt_parser exit 1 end cli.run end |
Instance Method Details
#run ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/autosiege/cli.rb', line 58 def run if config[:setup] setup exit 0 else ENV['SIEGE_LOGFILE'] = config[:logfile] cmd = "siege --concurrent=#{config[:concurrency]} --internet --time 1m --rc=#{config[:config_file]} --log --file=#{config[:urls_file]}" puts cmd system cmd end end |
#setup ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/autosiege/cli.rb', line 70 def setup system "mkdir -p log" system "touch log/siege.log" system "mkdir -p config/siege" siegefile = File.("../../../conf/siegerc", __FILE__) system "cp #{siegefile} config/siege/siegerc" urlsfile = File.("../../../conf/urls.txt", __FILE__) system "cp #{urlsfile} config/siege/urls.txt" end |