require 'nokogiri'
require 'open-uri'
SITE = "https://www.jancisrobinson.com/learn/grape-varieties/"

red_page = Nokogiri::HTML(open(SITE+"red"))
white_page = Nokogiri::HTML(open(SITE+"white"))

grapes = []

red_nodeset = red_page.css(".info-table li a")
red_nodeset.each do |node|
  grapes << node.attr("href").split("/").last.gsub("-", " ").capitalize
end

white_nodeset = white_page.css(".info-table li a")
white_nodeset.each do |node|
  grapes << node.attr("href").split("/").last.gsub("-", " ").capitalize
end

grapes.uniq.each do |grape|
  Varietal.create(varietal_name: grape)
end

Aroma.create(aroma_name: "Burning rubber")
Aroma.create(aroma_name: "Burnt toast")
Aroma.create(aroma_name: "Coffee")
Aroma.create(aroma_name: "Smoky")
Aroma.create(aroma_name: "Toasted bread")
Aroma.create(aroma_name: "Acetaldehyde")
Aroma.create(aroma_name: "Rotten eggs")
Aroma.create(aroma_name: "Struck match")
Aroma.create(aroma_name: "Earthy")
Aroma.create(aroma_name: "Mold")
Aroma.create(aroma_name: "Floral")
Aroma.create(aroma_name: "Elderflower")
Aroma.create(aroma_name: "Orange blossom")
Aroma.create(aroma_name: "Rose")
Aroma.create(aroma_name: "Violet")
Aroma.create(aroma_name: "Fruity")
Aroma.create(aroma_name: "Berry")
Aroma.create(aroma_name: "Citrus")
Aroma.create(aroma_name: "Lactic")
Aroma.create(aroma_name: "Yeasty")
Aroma.create(aroma_name: "Mineral")
Aroma.create(aroma_name: "Flint")
Aroma.create(aroma_name: "Petrol/kerosene")
Aroma.create(aroma_name: "Wet stones")
Aroma.create(aroma_name: "Almond")
Aroma.create(aroma_name: "Marzipan")
Aroma.create(aroma_name: "Chestnut")
Aroma.create(aroma_name: "Coconut")
Aroma.create(aroma_name: "Hazelnuts")
Aroma.create(aroma_name: "Black pepper")
Aroma.create(aroma_name: "Liquorice")
Aroma.create(aroma_name: "Spicy")
Aroma.create(aroma_name: "Vanilla")
Aroma.create(aroma_name: "Barley sugar")
Aroma.create(aroma_name: "Biscuit")
Aroma.create(aroma_name: "Caramel")
Aroma.create(aroma_name: "Chocolate")
Aroma.create(aroma_name: "Honey")
Aroma.create(aroma_name: "Molasses")
Aroma.create(aroma_name: "Straw")
Aroma.create(aroma_name: "Tea")
Aroma.create(aroma_name: "Tobacco")
Aroma.create(aroma_name: "Currant leaves")
Aroma.create(aroma_name: "Eucalyptus")
Aroma.create(aroma_name: "Geranium leaves")
Aroma.create(aroma_name: "Grassy")
Aroma.create(aroma_name: "Green pepper")
Aroma.create(aroma_name: "Mint")
Aroma.create(aroma_name: "Nettles")
Aroma.create(aroma_name: "Oaky")
Aroma.create(aroma_name: "Pine")
Aroma.create(aroma_name: "Wet wood")
Aroma.create(aroma_name: "Bacon fat")
Aroma.create(aroma_name: "Leather")
Aroma.create(aroma_name: "Game")
Aroma.create(aroma_name: "Meaty")

Country.create(country_name: "Italy")
Country.create(country_name: "France")
Country.create(country_name: "Portugal")
Country.create(country_name: "Spain")
Country.create(country_name: "United Kingdom")
Country.create(country_name: "Germany")
Country.create(country_name: "Chile")
Country.create(country_name: "Argentina")
Country.create(country_name: "United States")
Country.create(country_name: "Canada")
Country.create(country_name: "South Africa")
Country.create(country_name: "Australia")
Country.create(country_name: "New Zealand")

TastingTerm.create(term: "Acidic", definition: "A wine with a noticeable sense of acidity. It's detected by the mouth watering sensation.")
TastingTerm.create(term: "Alcoholic", definition:	"A wine that has an unbalanced presence of too much alcohol.")
TastingTerm.create(term: "Astringent", definition:	"An overly tannic white wine.")
TastingTerm.create(term: "Balanced", definition:	"A wine that incorporates all its main components—tannins, acid, sweetness, and alcohol—in a manner where no one single component stands out.")
TastingTerm.create(term: "Big", definition:	"A wine with intense flavor, or high in alcohol.")
TastingTerm.create(term: "Bitter", definition:	"An unpleasant perception of tannins.")
TastingTerm.create(term: "Buttery", definition:	"A wine that has gone through malolactic fermentation and has a rich, creamy mouthfeel with flavors reminiscent of butter.")
TastingTerm.create(term: "Chewy", definition:	"The sense of tannins that is not overwhelming. It is not necessarily a negative attribute for wine.")
TastingTerm.create(term: "Chocolaty", definition:	"The flavors and mouthfeel associated with chocolate, typically among rich red wines such as Cabernet Sauvignon and Pinot noir.")
TastingTerm.create(term: "Closed", definition:	"A wine that is not very aromatic.")
TastingTerm.create(term: "Cloying", definition:	"A wine with a sticky or sickly sweet character that is not balanced with acidity.")
TastingTerm.create(term: "Coarse", definition:	"A wine with a rough texture or mouthfeel. Usually applies the perception of tannins.")
TastingTerm.create(term: "Complex", definition:	"A wine that gives a perception of being multi-layered in terms of flavors and aromas.")
TastingTerm.create(term: "Concentrated", definition:	"Intense flavors.")
TastingTerm.create(term: "Connected", definition:	"A sense of the wine's ability to relay its place of origin or terroir.")
TastingTerm.create(term: "Corked", definition:	"A wine that has cork taint.")
TastingTerm.create(term: "Crisp", definition:	"A pleasing sense of acidity in the wine.")
TastingTerm.create(term: "Depth", definition:	"A wine with several layers of flavor. An aspect of complexity.")
TastingTerm.create(term: "Dirty", definition:	"A wine with off flavors and aromas that most likely resulted from poor hygiene during the fermentation or bottling process.")
TastingTerm.create(term: "Dry", definition:	"A wine that is lacking the perception of sweetness.")
TastingTerm.create(term: "Earthy", definition:	"This can mean a wine with aromas and flavor reminiscent of earth, such as forest floor or mushrooms. It can also refer to the drying impression felt on the palate caused by high levels of geosmin that occur naturally in grapes.")
TastingTerm.create(term: "Elegant", definition:	"A wine that possess finesse with subtle flavors that are in balance.")
TastingTerm.create(term: "Expressive", definition: "A wine with clearly projected aromas and flavors.")
TastingTerm.create(term: "Extracted", definition:	"A wine with concentrated flavors, often from extended skin contact, trading a rougher youth for enhanced ageability.")
TastingTerm.create(term: "Fallen", definition: "over	A wine that, at a relatively young age, has already gone past its peak (or optimal) drinking period and is rapidly declining in quality is said to have 'fallen over'.")
TastingTerm.create(term: "Firm", definition:	"A stronger sense of tannins.")
TastingTerm.create(term: "Flabby", definition:	"A lacking sense of acidity.")
TastingTerm.create(term: "Flat", definition:	"In relation to sparkling wines, flat refers to a wine that has lost its effervescence. In all other wines the term is used interchangeably with flabby to denote a wine that is lacking acidity, particularly on the finish.")
TastingTerm.create(term: "Foxy", definition:	"The musty odor and flavor of wines made from Vitis labrusca grapes native to North America, usually something undesirable.")
TastingTerm.create(term: "Fresh", definition:	"A positive perception of acidity.")
TastingTerm.create(term: "Full", definition:	"Wine with heavy weight or body, due to its alcohol content. It can also refer to a wine that is full in flavor and extract.")
TastingTerm.create(term: "Grassy", definition:	"An herbaceous or vegetal element of a wine—ranging from freshly mown lawn grass to lemon grass flavors.")
TastingTerm.create(term: "Green", definition:	"Usually negative, this can apply to a white wine with vegetal notes, or a red wine with bell pepper or herbal notes. Typically used to describe a wine made from unripe fruit.")
TastingTerm.create(term: "Hard", definition: "Overly tannic wine.")
TastingTerm.create(term: "Heavy", definition:	"A wine that is very alcoholic with too much sense of body.")
TastingTerm.create(term: "Herbal", definition:	"A wine with a flavour or aroma 'reminiscent of herbs'.")
TastingTerm.create(term: "Herbaceous", definition:	"The herbal, vegetal aromas and flavors that maybe derived from varietal characteristics or decisions made in the winemaking process-such as harvesting under-ripened grapes or using aggressive extraction techniques for a red wine fermented in stainless steel.")
TastingTerm.create(term: "Hollow", definition:	"A wine lacking the sense of fruit.")
TastingTerm.create(term: "Hot", definition:	"Overly alcoholic wine.")
TastingTerm.create(term: "Jammy", definition:	"A wine that is rich in fruit but maybe lacking in tannins.")
TastingTerm.create(term: "Lean", definition:	"The sense of acidity in the wine that lacks a perception of fruit.")
TastingTerm.create(term: "Leathery", definition:	"A red wine high in tannins, with a thick and soft taste.")
TastingTerm.create(term: "Legs", definition:	"The tracks of liquid that cling to the sides of a glass after the contents have been swirled. Often said to be related to the alcohol or glycerol content of a wine. Also called tears.")
TastingTerm.create(term: "Musty", definition:	"A wine with a 'dank, old-attic smell' arising from processing moldy grapes or using dirty storage containers.")
TastingTerm.create(term: "Oaky", definition:	"A wine with a noticeable perception of the effects of oak. This can include the sense of vanilla, sweet spices like nutmeg, a creamy body and a smoky or toasted flavor.")
TastingTerm.create(term: "Oxidized", definition:	"A wine that has experienced too much exposure to oxidation, considered faulty, and may exhibit sherry-like odors.")
TastingTerm.create(term: "Petrolly", definition:	"A wine containing a high concentration of trimethyldihydronaphthalene, whose scent is evocative of the odour of petrol, kerosene or paraffin. A petrolly character is considered a highly desirable characteristic in mature Rieslings.")
TastingTerm.create(term: "Powerful", definition:	"A wine with a high level of alcohol that is not excessively alcoholic.")
TastingTerm.create(term: "Raisiny", definition:	"A wine (usually red) with a slight taste of raisins resulting from the use of grapes that were overripe when picked.")
TastingTerm.create(term: "Reticent", definition:	"A wine that is not exhibiting much aroma or bouquet characteristics perhaps due to its youth. It can be described as the sense that a wine is 'holding back'.")
TastingTerm.create(term: "Rich", definition:	"A sense of sweetness in the wine that is not excessive.")
TastingTerm.create(term: "Rough", definition:	"A wine with coarse texture, usually a young tannic wine.")
TastingTerm.create(term: "Round", definition:	"A wine that has a good sense of body that is not overly tannic.")
TastingTerm.create(term: "Smokey", definition:	"A wine exhibiting the aromas and flavors of the various types of smoke, such as tobacco smoke, roasting fire smoke and a toasty smoke derived from oak influences.")
TastingTerm.create(term: "Smooth", definition:	"A wine with a pleasing texture. Typically refers to a wine with soft tannins.")
TastingTerm.create(term: "Soft", definition:	"A wine that is not overly tannic.")
TastingTerm.create(term: "Sour", definition:	"A wine with unbalanced, puckery acidity. Often applies to mistreated wines with excessive acetic acid, giving a vinegar-like bite.")
TastingTerm.create(term: "Spicy", definition:	"A wine with aromas and flavors reminiscent of various spices such as black pepper and cinnamon. While this can be a characteristic of the grape varietal, many spicy notes are imparted from oak influences.")
TastingTerm.create(term: "Supple", definition:	"A wine that is not overly tannic.")
TastingTerm.create(term: "Sweet", definition:	"A wine with a noticeable sense of sugar levels (aka Residual sugar).")
TastingTerm.create(term: "Tannic", definition:	"A wine with aggressive tannins.It's detected by the drying sensation felt on the teeth, gums, tongue and inner cheeks. It comes from the skin, seeds and stems of grapes. Think of drinking dark black tea without any milk or sugar.")
TastingTerm.create(term: "Tar", definition:	"A wine with aromas and flavors reminiscent of Tar. Barolo and Amarone wines often exhibit such characteristic.")
TastingTerm.create(term: "Tart", definition:	"A wine with high levels of acidity. Tartness or acidity is detected by the mouth watering sensation.")
TastingTerm.create(term: "Toasty", definition:	"A sense of the charred or smoky taste from an oaked wine.")
TastingTerm.create(term: "Vanillin", definition:	"An oak induced characteristic aroma reminiscent of vanilla.")
TastingTerm.create(term: "Vegetal", definition:	"A wine with aromas and flavor reminiscent of vegetation as opposed to fruit or floral notes.")
TastingTerm.create(term: "Vinegary", definition:	"A wine with 'the harsh aroma of vinegar' usually resulting from the presence of acetic acid.")
