# 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: 'Emanuel', city: cities.first)

require 'usda_importer'

puts "Seeding..."

Ingredient.create!([
                       {name: 'Water', density: '1 g/ml'},
                       {name: 'Butter, Salted', density: '226 gram/cup', ndbn: '01001'},
                       {name: 'Butter, Unsalted', density: '226 gram/cup'},
                       {name: 'Flour, Bleached All Purpose', density: '130 gram/cup'},
                       {name: 'Flour, Cake', density: '120 gram/cup'},
                       {name: 'Flour, Whole Wheat', density: '130 gram/cup'},
                       {name: 'Cornstarch', density: '10 gram/tablespoon'},
                       {name: 'Cornmeal', density: '120 gram/cup'},
                       {name: 'Sugar, Granulated', density: '200 gram/cup'},
                       {name: 'Sugar, Brown, Lightly Packed', density: '210 gram/cup'},
                       {name: 'Sugar, Powdered', density: '120 gram/cup'},
                       {name: 'Chocolate Chips', density: '170 gram/cup'},
                       {name: 'Cocoa Powder', density: '100 gram/cup'},
                       {name: 'Salt, Kosher', density: '248 gram/cup'},
                       {name: 'Salt, Table', density: '304 gram/cup'},
                       {name: 'Milk, Whole', density: '1.028 gram/ml'},
                       {name: 'Milk, Skim', density: '1.032 gram/ml'},
                       {name: 'Milk, 2%', density: '1.03 gram/ml'}
                   ])

User.create!({username: 'dan', full_name: 'Dan', email: 'dan.elbert@gmail.com', password: 'qwerty', password_confirmation: 'qwerty'})

importer = UsdaImporter.new(Rails.root.join('vendor', 'data', 'usda'))
importer.import


puts "Seeds planted."
