hangry 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/README.md +14 -4
- data/Rakefile +6 -0
- data/hangry.gemspec +1 -0
- data/lib/hangry/data_vocabulary_recipe_parser.rb +38 -0
- data/lib/hangry/hrecipe_parser.rb +21 -5
- data/lib/hangry/recipe_parser.rb +12 -1
- data/lib/hangry/schema_org_recipe_parser.rb +31 -3
- data/lib/hangry/version.rb +1 -1
- data/lib/hangry.rb +17 -1
- data/spec/fixtures/bigoven.html +1566 -0
- data/spec/fixtures/epicurious.html +1779 -3433
- data/spec/fixtures/myrecipes.com.html +1104 -0
- data/spec/real_examples/all_recipes_spec.rb +15 -0
- data/spec/real_examples/big_oven_spec.rb +45 -0
- data/spec/real_examples/epicurious_spec.rb +1 -1
- data/spec/real_examples/myrecipes_com_spec.rb +43 -0
- metadata +33 -12
@@ -21,6 +21,21 @@ describe Hangry do
|
|
21
21
|
]
|
22
22
|
}
|
23
23
|
its(:name) { should == "Roasted Vegetable and Couscous Salad" }
|
24
|
+
its(:nutrition) do
|
25
|
+
should == {
|
26
|
+
calories: '305',
|
27
|
+
cholesterol: '0mg',
|
28
|
+
fiber: '4.3g',
|
29
|
+
protein: '6.8g',
|
30
|
+
saturated_fat: '2.2g',
|
31
|
+
sodium: '217mg',
|
32
|
+
sugar: '4.1g',
|
33
|
+
total_carbohydrates: '38.3g',
|
34
|
+
total_fat: '14.2g',
|
35
|
+
trans_fat: nil,
|
36
|
+
unsaturated_fat: nil
|
37
|
+
}
|
38
|
+
end
|
24
39
|
its(:instructions) { should == nil }
|
25
40
|
its(:prep_time) { should == 15 }
|
26
41
|
its(:published_date) { should == nil }
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'hangry'
|
3
|
+
|
4
|
+
describe Hangry do
|
5
|
+
|
6
|
+
context "bigoven.com recipe" do
|
7
|
+
subject { Hangry.parse(File.read("spec/fixtures/bigoven.html")) }
|
8
|
+
|
9
|
+
its(:author) do
|
10
|
+
# BigOven puts the author element outside of the hRecipe element...
|
11
|
+
should == nil
|
12
|
+
end
|
13
|
+
its(:cook_time) { should == nil }
|
14
|
+
its(:description) { should == "I had never tried fish tacos until my son, fresh out of boot camp, asked me to make them. I found a basic recipe, then adapted it from there, and now it's one of my favorite things to eat!" }
|
15
|
+
its(:ingredients) {
|
16
|
+
should == [
|
17
|
+
"1 package of tortillas ; small", "0.5 cup sour cream", "0.25 cup salsa ; favorite", "1 Salt", "1 Pepper",
|
18
|
+
"1 pound Cod ; Flounder or Haddock work too", "1 egg", "2 tablespoons milk", "1 tablespoon Flour",
|
19
|
+
"1 tablespoon corn meal", "2 tablespoons of olive oil ; you could use peanut oil or butter also",
|
20
|
+
"2 limes ; fresh, you'll use the juice", "1 tablespoon cider vinegar", "1 red onion ; small; diced",
|
21
|
+
"1 tomato ; diced", "2 cups red cabbage ; shredded", "cilantro ; chopped fine; optional", "Jalapenos ; optional",
|
22
|
+
"Seasoning mix", "1 Ground Cumin", "1 Ground Coriander", "Hot sauce"
|
23
|
+
]
|
24
|
+
}
|
25
|
+
its(:instructions) do
|
26
|
+
instructions = <<-eos
|
27
|
+
As with any recipe, adaptation to your taste is the key to success and your culinary enjoyment. This recipe is a preparation of optional ingredients, then you build the tacos as you like them. 1. Cut across the cabbage on the end opposite the stem in 1/4 inch rounds, then turn the rings and cut again to shred into small bite size pieces. Place the cabbage in a gallon freezer bag. Add 1 tablespoon of lime juice, the vinegar and season with salt pepper, cumin and coriander as you like. Shake the bag every direction to mix the ingredients and let sit while you prepare everything else. 2. For the fish - Cut the fish into fillets that you will later pull apart with two forks. Mix the egg and milk together. Mix the flour and cornmeal, and add seasonings that you like. I have a 22 herb/spice mix that I've come up with that I mix in with the flour and corn meal. Coriander, cumin, salt and pepper, garlic and onion powder are a good start. I'll post the mix as a separate recipe. 3. Bathe the fish in the mile/egg mixture, and dredge in the flour/seasoning mixture on both sides. Set aside until all the fish is ready. 4. Heat the oil or butter in a pan on medium high, and cook the fish, about 4 minutes per side. Take the fish out of the pan with tongs, set on a cutting board and squeeze lime juice over it. Let it cool. 5. Prepare the tomato, onion and cilantro and set out in small bowls. Mix the salsa of your choice and sour cream. 6. When the fish has cooled, use one fork to anchor it and shred with the another, flaking off small pieces. Place in a bowl. 7. Set out the cabbage in a small bowl. 8. Heat the tortillas in a microwave. Place two on a plate, and build up your tacos with sour cream mix, fish, onion, tomato, tomato, jalapenos, hot sauce - whatever you like! Fold over and dig in, with a nice IPA or crisp white wine!
|
28
|
+
eos
|
29
|
+
should == instructions.strip
|
30
|
+
end
|
31
|
+
its(:name) { should == "Steve's Fish Tacos" }
|
32
|
+
its(:nutrition) { should == nil }
|
33
|
+
its(:prep_time) { should == nil }
|
34
|
+
its(:published_date) { should == nil }
|
35
|
+
its(:total_time) { should == 45 }
|
36
|
+
its(:yield) { should == "6 Servings" }
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
@@ -8,7 +8,7 @@ describe Hangry do
|
|
8
8
|
its(:author) { should == "by Janet Taylor McCracken" }
|
9
9
|
its(:cook_time) { should == nil }
|
10
10
|
its(:description) { should == "A simple Moroccan-spiced aioli is mixed in with the ground turkey to keep the burgers moist and give them tons of flavor. Smoked paprika is available in the spice aisle of most supermarkets." }
|
11
|
-
its(:prep_time) { should ==
|
11
|
+
its(:prep_time) { should == 40 }
|
12
12
|
its(:total_time) { should == 40 }
|
13
13
|
its(:ingredients) {
|
14
14
|
should == [
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'hangry'
|
3
|
+
|
4
|
+
describe Hangry do
|
5
|
+
|
6
|
+
context "myrecipes.com recipe" do
|
7
|
+
subject { Hangry.parse(File.read("spec/fixtures/myrecipes.com.html")) }
|
8
|
+
|
9
|
+
its(:author) { should == "Southern Living" }
|
10
|
+
its(:cook_time) { should == nil }
|
11
|
+
its(:description) { should == "" } # not valid HTML to have a p inside of an h2...
|
12
|
+
its(:ingredients) {
|
13
|
+
should == [
|
14
|
+
"2 cups all-purpose flour", "2 teaspoons baking soda", "1/2 teaspoon salt", "2 teaspoons ground cinnamon",
|
15
|
+
"3 large eggs", "2 cups sugar", "3/4 cup vegetable oil", "3/4 cup buttermilk", "2 teaspoons vanilla extract",
|
16
|
+
"2 cups grated carrot", "1 (8-ounce) can crushed pineapple, drained", "1 (3 1/2-ounce) can flaked coconut",
|
17
|
+
"1 cup chopped pecans or walnuts", "Buttermilk Glaze", "Cream Cheese Frosting"
|
18
|
+
]
|
19
|
+
}
|
20
|
+
its(:instructions) do
|
21
|
+
instructions = <<-eos
|
22
|
+
Line 3 (9-inch) round cakepans with wax paper; lightly grease and flour wax paper. Set pans aside. Stir together first 4 ingredients. Beat eggs and next 4 ingredients at medium speed with an electric mixer until smooth. Add flour mixture, beating at low speed until blended. Fold in carrot and next 3 ingredients. Pour batter into prepared cakepans. Bake at 350° for 25 to 30 minutes or until a wooden pick inserted in center comes out clean. Drizzle Buttermilk Glaze evenly over layers; cool in pans on wire racks 15 minutes. Remove from pans, and cool completely on wire racks. Spread Cream Cheese Frosting between layers and on top and sides of cake.
|
23
|
+
eos
|
24
|
+
should == instructions.strip
|
25
|
+
end
|
26
|
+
it "should have nil nutrition attributes" do
|
27
|
+
subject.nutrition.each do |attribute, value|
|
28
|
+
value.should be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
its(:name) { should == "Best Carrot Cake" }
|
32
|
+
its(:prep_time) { should == nil }
|
33
|
+
its(:published_date) { should == Date.parse("OCTOBER 1997") }
|
34
|
+
its(:total_time) { should == nil }
|
35
|
+
its(:yield) { should == "1 (9-inch) cake" }
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hangry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70299202813480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70299202813480
|
14
25
|
- !ruby/object:Gem::Dependency
|
15
26
|
name: rspec
|
16
|
-
requirement: &
|
27
|
+
requirement: &70299202812940 !ruby/object:Gem::Requirement
|
17
28
|
none: false
|
18
29
|
requirements:
|
19
30
|
- - ! '>='
|
@@ -21,10 +32,10 @@ dependencies:
|
|
21
32
|
version: '0'
|
22
33
|
type: :development
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *70299202812940
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: pry
|
27
|
-
requirement: &
|
38
|
+
requirement: &70299202812440 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '0'
|
33
44
|
type: :development
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70299202812440
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: activesupport
|
38
|
-
requirement: &
|
49
|
+
requirement: &70299202811840 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ~>
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: '3.0'
|
44
55
|
type: :runtime
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70299202811840
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: iso8601
|
49
|
-
requirement: &
|
60
|
+
requirement: &70299202811260 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ~>
|
@@ -54,10 +65,10 @@ dependencies:
|
|
54
65
|
version: 0.4.0
|
55
66
|
type: :runtime
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70299202811260
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: nokogiri
|
60
|
-
requirement: &
|
71
|
+
requirement: &70299202810720 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ~>
|
@@ -65,7 +76,7 @@ dependencies:
|
|
65
76
|
version: '1.5'
|
66
77
|
type: :runtime
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *70299202810720
|
69
80
|
description: A recipe microformat parser.
|
70
81
|
email:
|
71
82
|
- ian@iancanderson.com
|
@@ -74,23 +85,29 @@ extensions: []
|
|
74
85
|
extra_rdoc_files: []
|
75
86
|
files:
|
76
87
|
- .gitignore
|
88
|
+
- .travis.yml
|
77
89
|
- Gemfile
|
78
90
|
- LICENSE
|
79
91
|
- README.md
|
80
92
|
- Rakefile
|
81
93
|
- hangry.gemspec
|
82
94
|
- lib/hangry.rb
|
95
|
+
- lib/hangry/data_vocabulary_recipe_parser.rb
|
83
96
|
- lib/hangry/hrecipe_parser.rb
|
84
97
|
- lib/hangry/recipe_parser.rb
|
85
98
|
- lib/hangry/schema_org_recipe_parser.rb
|
86
99
|
- lib/hangry/version.rb
|
87
100
|
- spec/fixtures/allrecipes.html
|
101
|
+
- spec/fixtures/bigoven.html
|
88
102
|
- spec/fixtures/epicurious.html
|
89
103
|
- spec/fixtures/food_network_schema_org.html
|
104
|
+
- spec/fixtures/myrecipes.com.html
|
90
105
|
- spec/hangry_spec.rb
|
91
106
|
- spec/real_examples/all_recipes_spec.rb
|
107
|
+
- spec/real_examples/big_oven_spec.rb
|
92
108
|
- spec/real_examples/epicurious_spec.rb
|
93
109
|
- spec/real_examples/food_network_spec.rb
|
110
|
+
- spec/real_examples/myrecipes_com_spec.rb
|
94
111
|
homepage: https://github.com/iancanderson/hangry
|
95
112
|
licenses: []
|
96
113
|
post_install_message:
|
@@ -117,9 +134,13 @@ specification_version: 3
|
|
117
134
|
summary: Parses microformatted recipe HTML into a plain-old-ruby Recipe object.
|
118
135
|
test_files:
|
119
136
|
- spec/fixtures/allrecipes.html
|
137
|
+
- spec/fixtures/bigoven.html
|
120
138
|
- spec/fixtures/epicurious.html
|
121
139
|
- spec/fixtures/food_network_schema_org.html
|
140
|
+
- spec/fixtures/myrecipes.com.html
|
122
141
|
- spec/hangry_spec.rb
|
123
142
|
- spec/real_examples/all_recipes_spec.rb
|
143
|
+
- spec/real_examples/big_oven_spec.rb
|
124
144
|
- spec/real_examples/epicurious_spec.rb
|
125
145
|
- spec/real_examples/food_network_spec.rb
|
146
|
+
- spec/real_examples/myrecipes_com_spec.rb
|