Farmbot-Web-App/db/seeds.rb

52 lines
1.9 KiB
Ruby
Raw Normal View History

# User for testing purposes:
2016-09-12 14:42:18 -06:00
unless Rails.env == "production"
2016-12-07 14:08:36 -07:00
ENV['MQTT_HOST'] = "blooper.io"
2016-11-18 15:40:25 -07:00
ENV['OS_UPDATE_SERVER'] = "http://blah.com"
ENV['FW_UPDATE_SERVER'] = "http://test.com"
2017-01-23 16:04:18 -07:00
User.delete_all
Point.delete_all
2017-01-23 16:04:18 -07:00
Device.delete_all
2017-01-31 09:52:43 -07:00
Users::Create.run!(name: "Administrator",
email: "notos@notos.com",
password: "password123",
password_confirmation: "password123",
agree_to_terms: true)
no_tos = User.last
no_tos.agreed_to_terms_at = nil
no_tos.save!
Users::Create.run!(name: "Administrator",
email: "admin@admin.com",
password: "password123",
password_confirmation: "password123",
agree_to_terms: true)
2016-12-08 16:38:28 -07:00
User.last.update_attributes(verified_at: Time.now)
2016-12-08 13:05:05 -07:00
Log.transaction do
FactoryGirl.create_list(:log, 35, device: User.last.device)
end
2017-02-01 15:31:50 -07:00
[ "http://i.imgur.com/XvFBGA4.jpg",
"http://i.imgur.com/XsFczCY.jpg" ].each do |url|
Images::Create.run!(attachment_url: url, device: User.last.device)
end
10.times do
Plant.create(
device: User.last.device,
x: rand(1...550),
y: rand(1...550),
name: Haikunator.haikunate,
img_url: "http://placehold.it/200x150",
icon_url: "/icons/Natural Food-96.png",
openfarm_slug: "tomato")
end
2017-02-07 12:26:01 -07:00
10.times do
Point.create(
device: User.last.device,
x: rand(1...550),
y: rand(1...550),
z: 5,
2017-02-13 17:37:35 -07:00
radius: rand(1...100) * 2,
meta: { created_by: "plant-detection" })
2017-02-07 12:26:01 -07:00
end
2017-01-27 11:04:01 -07:00
Peripherals::Create.run!(device:User.last.device, peripherals: [{pin: 13, label: "LED"}])
2017-01-27 16:02:48 -07:00
Tools::Create.run!(name: "Trench Digging Tool", device: User.last.device)
2016-09-12 14:42:18 -06:00
end