@@ -92,6 +92,9 @@ def port_available? port
9292puts "Populating Profile DB"
9393run ( "bundle exec ruby script/profile_db_generator.rb" )
9494
95+ puts "Getting api key"
96+ api_key = `bundle exec rake api_key:get`
97+
9598def bench ( path )
9699 puts "Running apache bench warmup"
97100 `ab -n 100 http://127.0.0.1:#{ @port } #{ path } `
@@ -107,8 +110,10 @@ def bench(path)
107110end
108111
109112begin
110- # critical cause cache may be incompatible or something
111- `rm -fr tmp/cache`
113+ # critical cause cache may be incompatible
114+ puts "precompiling assets"
115+ run ( "bundle exec rake assets:precompile" )
116+
112117 pid = spawn ( "bundle exec thin start -p #{ @port } " )
113118
114119 while port_available? @port
@@ -122,6 +127,10 @@ def bench(path)
122127 home_page = bench ( "/" )
123128 topic_page = bench ( "/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69" )
124129
130+ append = "?api_key=#{ api_key } &api_username=admin1"
131+ home_page_admin = bench ( "/#{ append } " )
132+ topic_page_admin = bench ( "/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69#{ append } " )
133+
125134 puts "Your Results: (note for timings- percentile is first, duration is second in millisecs)"
126135
127136 facts = Facter . to_hash
@@ -132,16 +141,20 @@ def bench(path)
132141 "virtual" ] . include? ( k )
133142 }
134143
144+ run ( "RAILS_ENV=profile bundle exec rake assets:clean" )
145+
135146 puts ( {
136147 "home_page" => home_page ,
137148 "topic_page" => topic_page ,
149+ "home_page_admin" => home_page_admin ,
150+ "topic_page_admin" => topic_page_admin ,
138151 "timings" => @timings ,
139152 "ruby-version" => "#{ RUBY_VERSION } -p#{ RUBY_PATCHLEVEL } " ,
140153 "rails4?" => ENV [ "RAILS4" ] == "1"
141154 } . merge ( facts ) . to_yaml )
142155
143- # TODO include Facter.to_hash ... for all facts
144156
157+ # TODO include Facter.to_hash ... for all facts
145158ensure
146159 Process . kill "KILL" , pid
147160end
0 commit comments