-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
namespace :db do | ||
desc 'Populate database with fake data for development' | ||
task :populate => [ 'db:seed', 'db:populate:create' ] | ||
|
||
namespace :populate do | ||
|
||
desc "Reload populate data" | ||
task :reload => [ 'db:reset', :create ] | ||
|
||
desc "Create populate data" | ||
task :create => :environment do | ||
|
||
require 'forgery' | ||
|
||
puts 'User population' | ||
time_start = Time.now | ||
time_end = Time.now | ||
puts ' -> ' + (time_end - time_start).round(4).to_s + 's' | ||
|
||
|
||
puts 'Character population' | ||
time_start = Time.now | ||
time_end = Time.now | ||
puts ' -> ' + (time_end - time_start).round(4).to_s + 's' | ||
|
||
|
||
puts 'Armor population' | ||
time_start = Time.now | ||
10.times do | ||
Armor.create :name => Forgery::Name.company_name, | ||
:price => Forgery::Monetary.money(:min => 100, :max => 1000) | ||
end | ||
time_end = Time.now | ||
puts ' -> ' + (time_end - time_start).round(4).to_s + 's' | ||
|
||
|
||
puts 'Weapon population' | ||
time_start = Time.now | ||
10.times do | ||
Weapon.create :name => Forgery::Name.company_name, | ||
:price => Forgery::Monetary.money(:min => 100, :max => 1000) | ||
end | ||
time_end = Time.now | ||
puts ' -> ' + (time_end - time_start).round(4).to_s + 's' | ||
|
||
|
||
puts 'Consumable population' | ||
time_start = Time.now | ||
10.times do | ||
Consumable.create :name => Forgery::Name.company_name, | ||
:price => Forgery::Monetary.money(:min => 100, :max => 1000) | ||
end | ||
time_end = Time.now | ||
puts ' -> ' + (time_end - time_start).round(4).to_s + 's' | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file should contain all the record creation needed to seed the database with its default values. | ||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). | ||
# | ||
# Examples: | ||
# | ||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) | ||
# Mayor.create(:name => 'Daley', :city => cities.first) | ||
|
This file was deleted.
Oops, something went wrong.