From 6a0072d36eafe6bbb9e444f1ed89b62c1af55f29 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 2 Jan 2014 10:21:01 +1100 Subject: [PATCH] don't keep installing gabbler from bench fix ab detection --- script/bench.rb | 6 ++++-- script/profile_db_generator.rb | 14 ++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/script/bench.rb b/script/bench.rb index eda5c3e5fc7..dae96933d61 100644 --- a/script/bench.rb +++ b/script/bench.rb @@ -29,7 +29,8 @@ begin require 'facter' rescue LoadError run "gem install facter" - require 'facter' + put "please rerun script" + exit end @timings = {} @@ -62,7 +63,8 @@ end puts "Ensuring config is setup" -unless %x{which ab > /dev/null 2>&1} +%x{which ab > /dev/null 2>&1} +unless $? == 0 abort "Apache Bench is not installed. Try: apt-get install apache2-utils or brew install ab" end diff --git a/script/profile_db_generator.rb b/script/profile_db_generator.rb index 19718f35ff4..244b18c829e 100644 --- a/script/profile_db_generator.rb +++ b/script/profile_db_generator.rb @@ -28,6 +28,12 @@ def unbundled_require(gem) end end +# by default, Discourse has a "system" account +if User.count > 1 + puts "Only run this script against an empty DB" + exit +end + require 'optparse' begin unbundled_require 'gabbler' @@ -37,8 +43,6 @@ rescue LoadError unbundled_require 'gabbler' end -user_id = nil - def sentence @gabbler ||= Gabbler.new.tap do |gabbler| story = File.read(File.dirname(__FILE__) + "/alice.txt") @@ -72,12 +76,6 @@ unless Rails.env == "profile" exit end -# by default, Discourse has a "system" account -if User.count > 1 - puts "Only run this script against an empty DB" - exit -end - puts "Creating 100 users" users = 100.times.map do |i| putc "."