gitlab-org--gitlab-foss/lib/gitlab/seeder.rb
Dmitriy Zaporozhets 39f80884db
Improve developer seeds
Return execution of observers in seeds.
Mute email sending to letter opening in you browser.
Added `rake dev` task to reset db and add seeds.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-03-15 11:39:35 +02:00

29 lines
456 B
Ruby

module Gitlab
class Seeder
def self.quiet
mute_mailer
SeedFu.quiet = true
yield
SeedFu.quiet = false
puts "\nOK".green
end
def self.by_user(user)
begin
Thread.current[:current_user] = user
yield
ensure
Thread.current[:current_user] = nil
end
end
def self.mute_mailer
code = <<-eos
def Notify.delay
self
end
eos
eval(code)
end
end
end