mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:49:14 +08:00
add db population
This commit is contained in:
parent
40ef4b6907
commit
d753cdb2f7
|
@ -76,11 +76,13 @@ puts "Ensuring profiling DB exists and is migrated"
|
|||
puts `bundle exec rake db:create`
|
||||
`bundle exec rake db:migrate`
|
||||
|
||||
puts "Loading Rails"
|
||||
puts "Timing loading Rails"
|
||||
measure("load_rails") do
|
||||
`bundle exec rake middleware`
|
||||
end
|
||||
|
||||
puts "Populating Profile DB"
|
||||
run("bundle exec ruby script/profile_db_generator.rb")
|
||||
|
||||
begin
|
||||
pid = spawn("bundle exec thin start -p #{port}")
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
# can be used to generate a mock db for profiling purposes
|
||||
|
||||
# we want our script to generate a consistent output, to do so
|
||||
# we monkey patch array sample so it always uses the same rng
|
||||
class Array
|
||||
RNG = Random.new(1098109928029800)
|
||||
|
||||
def sample
|
||||
self[RNG.rand(size)]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# based on https://gist.github.com/zaius/2643079
|
||||
def unbundled_require(gem)
|
||||
if defined?(::Bundler)
|
||||
|
@ -21,8 +32,9 @@ require 'optparse'
|
|||
begin
|
||||
unbundled_require 'gabbler'
|
||||
rescue LoadError
|
||||
puts "please run: gem install gabller"
|
||||
exit
|
||||
puts "installing gabbler gem"
|
||||
puts `gem install gabbler`
|
||||
unbundled_require 'gabbler'
|
||||
end
|
||||
|
||||
user_id = nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user