39f80884db
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>
29 lines
456 B
Ruby
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
|