todays_top_desserts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +21 -0
- data/NOTES.md +37 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/todays-top-desserts +6 -0
- data/lib/todays_top_desserts/cli.rb +82 -0
- data/lib/todays_top_desserts/recipe.rb +29 -0
- data/lib/todays_top_desserts/scraper.rb +48 -0
- data/lib/todays_top_desserts/version.rb +3 -0
- data/lib/todays_top_desserts.rb +9 -0
- data/spec.md +9 -0
- data/todays_top_desserts.gemspec +40 -0
- metadata +152 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a7a622167bd9b5451488b4e33d4c72a668f27bfd8370fe06723eef908aeabbba
|
|
4
|
+
data.tar.gz: 79493fffc756620934ab0adbba32aeccebafbde52832f8184b275a71eb89192d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 18512ccfeb3d2e0026e0ae91e277a603979cb3755f8d4b8df3e03dc254a745762a78a1a45cf2e97ee92d0d7ebe8567062374b5685ac6aef32802578246e6c6d9
|
|
7
|
+
data.tar.gz: 20d92d9452681b5dba405230ed3e9d47261dc79ab7e4848b661089e2e85750c7060a0099448b9b46ee0d714fbf3fe253bb64493626f5a725192bd0dcb9931e23
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at <github email address>. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
todays_top_desserts (0.1.0)
|
|
5
|
+
nokogiri (~> 1.8.2)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
coderay (1.1.2)
|
|
11
|
+
colorize (0.8.1)
|
|
12
|
+
diff-lcs (1.3)
|
|
13
|
+
method_source (0.9.0)
|
|
14
|
+
mini_portile2 (2.3.0)
|
|
15
|
+
nokogiri (1.8.2)
|
|
16
|
+
mini_portile2 (~> 2.3.0)
|
|
17
|
+
pry (0.11.3)
|
|
18
|
+
coderay (~> 1.1.0)
|
|
19
|
+
method_source (~> 0.9.0)
|
|
20
|
+
rake (10.4.2)
|
|
21
|
+
rspec (3.7.0)
|
|
22
|
+
rspec-core (~> 3.7.0)
|
|
23
|
+
rspec-expectations (~> 3.7.0)
|
|
24
|
+
rspec-mocks (~> 3.7.0)
|
|
25
|
+
rspec-core (3.7.1)
|
|
26
|
+
rspec-support (~> 3.7.0)
|
|
27
|
+
rspec-expectations (3.7.0)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.7.0)
|
|
30
|
+
rspec-mocks (3.7.0)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.7.0)
|
|
33
|
+
rspec-support (3.7.0)
|
|
34
|
+
|
|
35
|
+
PLATFORMS
|
|
36
|
+
ruby
|
|
37
|
+
|
|
38
|
+
DEPENDENCIES
|
|
39
|
+
bundler (~> 1.16)
|
|
40
|
+
colorize
|
|
41
|
+
pry
|
|
42
|
+
rake (~> 10.0)
|
|
43
|
+
rspec (~> 3.0)
|
|
44
|
+
todays_top_desserts!
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.16.1
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 <github username>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/NOTES.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Here are today's most made desserts from Allrecipes:
|
|
2
|
+
1. Dessert name 1
|
|
3
|
+
2. Dessert name 2
|
|
4
|
+
3. Dessert name 3
|
|
5
|
+
4. Dessert name 4
|
|
6
|
+
5. Dessert name 5
|
|
7
|
+
6. Dessert name 6
|
|
8
|
+
7. Dessert name 7
|
|
9
|
+
8. Dessert name 8
|
|
10
|
+
9. Dessert name 9
|
|
11
|
+
10. Dessert name 10
|
|
12
|
+
|
|
13
|
+
Which recipe would you like to see? (Enter the corresponding number 1 through 10.)
|
|
14
|
+
|
|
15
|
+
Here is the recipe:
|
|
16
|
+
|
|
17
|
+
Name
|
|
18
|
+
|
|
19
|
+
Ingredients:
|
|
20
|
+
#list of ingredients
|
|
21
|
+
|
|
22
|
+
Instructions:
|
|
23
|
+
#recipe instructions
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
What is a recipe?
|
|
27
|
+
a recipe has a name
|
|
28
|
+
a recipe has an author
|
|
29
|
+
a recipe has a description
|
|
30
|
+
a recipe has a serving size
|
|
31
|
+
a recipe has a prep time
|
|
32
|
+
a recipe has a cook time
|
|
33
|
+
a recipe has a ready in time
|
|
34
|
+
a recipe has a calorie count
|
|
35
|
+
a recipe has ingredients
|
|
36
|
+
a recipe has instructions
|
|
37
|
+
a recipe has a URL
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# TodaysTopDesserts
|
|
2
|
+
|
|
3
|
+
This Ruby gem installs a CLI that gives you the recipes for the top ten desserts being made today according to Allrecipes.com.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'todays_top_desserts'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install todays_top_desserts
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Run the CLI by entering in the following line:
|
|
24
|
+
|
|
25
|
+
$ todays-top-desserts
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<github username>/todays_top_desserts. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
40
|
+
|
|
41
|
+
## Code of Conduct
|
|
42
|
+
|
|
43
|
+
Everyone interacting in the TodaysTopDesserts project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<github username>/todays_top_desserts/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "todays_top_desserts"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
class TodaysTopDesserts::CLI
|
|
2
|
+
|
|
3
|
+
def call
|
|
4
|
+
create_recipes
|
|
5
|
+
add_attributes_to_recipes
|
|
6
|
+
list_desserts
|
|
7
|
+
menu
|
|
8
|
+
goodbye
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create_recipes
|
|
12
|
+
#scrapes name and url of recipes
|
|
13
|
+
recipes_array = TodaysTopDesserts::Scraper.scrape_desserts
|
|
14
|
+
|
|
15
|
+
#creates recipes using the array from the scrape_desserts method
|
|
16
|
+
TodaysTopDesserts::Recipe.create_from_collection(recipes_array)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def add_attributes_to_recipes
|
|
20
|
+
#scrapes additional attributes from the individual recipe's page and adds the attributes to the Recipe
|
|
21
|
+
TodaysTopDesserts::Recipe.today.each do |recipe|
|
|
22
|
+
attributes = TodaysTopDesserts::Scraper.scrape_recipe(recipe.url)
|
|
23
|
+
recipe.add_recipe_attributes(attributes)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def list_desserts
|
|
28
|
+
puts ""
|
|
29
|
+
puts "Here are today's most made desserts:"
|
|
30
|
+
puts ""
|
|
31
|
+
@recipes = TodaysTopDesserts::Recipe.today
|
|
32
|
+
@recipes.each.with_index(1) do |recipe, i|
|
|
33
|
+
puts "#{i}.".colorize(:light_black) + " #{recipe.name}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def menu
|
|
39
|
+
input = nil
|
|
40
|
+
while input != "exit"
|
|
41
|
+
puts ""
|
|
42
|
+
puts "Please enter either the number of the recipe you'd like to view, 'list' to see the list of recipes again, or 'exit' to close the program:"
|
|
43
|
+
input = gets.strip.downcase
|
|
44
|
+
if input.to_i > 0 && input.to_i < 11
|
|
45
|
+
the_recipe = @recipes[input.to_i-1]
|
|
46
|
+
puts ""
|
|
47
|
+
puts "#{the_recipe.name}".colorize(:cyan).bold
|
|
48
|
+
puts "by #{the_recipe.author}" if the_recipe.author != ""
|
|
49
|
+
puts ""
|
|
50
|
+
puts "#{the_recipe.description}".italic if the_recipe.description != ""
|
|
51
|
+
puts ""
|
|
52
|
+
puts "Ready in: ".colorize(:light_black) + "#{the_recipe.ready_time}" if the_recipe.ready_time != ""
|
|
53
|
+
puts "Prep time: ".colorize(:light_black) + "#{the_recipe.prep_time}" if the_recipe.prep_time != ""
|
|
54
|
+
puts "Cook time: ".colorize(:light_black) + "#{the_recipe.cook_time}" if the_recipe.cook_time != ""
|
|
55
|
+
puts "Serving size: ".colorize(:light_black) + "#{the_recipe.serving_size}" if the_recipe.serving_size != ""
|
|
56
|
+
puts "Calorie count: ".colorize(:light_black) + "#{the_recipe.calorie_count}" if the_recipe.calorie_count != ""
|
|
57
|
+
puts ""
|
|
58
|
+
puts "INGREDIENTS:".colorize(:light_red).underline
|
|
59
|
+
the_recipe.ingredients.each do |ingredient|
|
|
60
|
+
puts "#{ingredient}"
|
|
61
|
+
end
|
|
62
|
+
puts ""
|
|
63
|
+
puts "INSTRUCTIONS:".colorize(:light_red).underline
|
|
64
|
+
the_recipe.instructions.each.with_index(1) do |instruction, i|
|
|
65
|
+
puts "#{i}.".colorize(:light_black) + " #{instruction}"
|
|
66
|
+
end
|
|
67
|
+
elsif input == "list"
|
|
68
|
+
list_desserts
|
|
69
|
+
elsif input == "exit"
|
|
70
|
+
else
|
|
71
|
+
puts ""
|
|
72
|
+
puts "Not sure what you meant by that."
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def goodbye
|
|
78
|
+
puts ""
|
|
79
|
+
puts "Hope you bake something delicious today! See you later!"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class TodaysTopDesserts::Recipe
|
|
2
|
+
attr_accessor :name, :author, :description, :serving_size, :prep_time, :cook_time, :ready_time, :calorie_count, :ingredients, :instructions, :url
|
|
3
|
+
|
|
4
|
+
@@all = []
|
|
5
|
+
|
|
6
|
+
def initialize(recipe_hash)
|
|
7
|
+
#initializes new recipe with a hash of attributes
|
|
8
|
+
recipe_hash.each {|key, value| self.send(("#{key}="), value)}
|
|
9
|
+
@@all << self
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.create_from_collection(recipes_array)
|
|
13
|
+
#creates new recipes from an array of hashes that include recipe attributes
|
|
14
|
+
recipes_array.each do |hash|
|
|
15
|
+
recipe = TodaysTopDesserts::Recipe.new(hash)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def add_recipe_attributes(attributes_hash)
|
|
20
|
+
#adds attributes to existing recipes
|
|
21
|
+
attributes_hash.each {|key, value| self.send(("#{key}="), value)}
|
|
22
|
+
self
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.today
|
|
26
|
+
#returns all instances of TodaysTopDesserts::Recipe
|
|
27
|
+
@@all
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
class TodaysTopDesserts::Scraper
|
|
2
|
+
|
|
3
|
+
def self.scrape_desserts
|
|
4
|
+
#returns an array of recipes with a name and url.
|
|
5
|
+
page = Nokogiri::HTML(open("https://www.allrecipes.com/recipes/79/desserts/"))
|
|
6
|
+
|
|
7
|
+
desserts = []
|
|
8
|
+
|
|
9
|
+
page.css("article.list-recipes")[0].css("li")[0..9].each do |dessert|
|
|
10
|
+
desserts << {
|
|
11
|
+
:name => dessert.css("img").attr("title").text,
|
|
12
|
+
:url => dessert.css("a").attr("href").value
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desserts
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.scrape_recipe(recipe_url)
|
|
21
|
+
#returns a hash of recipe attributes
|
|
22
|
+
page = Nokogiri::HTML(open(recipe_url))
|
|
23
|
+
|
|
24
|
+
recipe = {}
|
|
25
|
+
|
|
26
|
+
recipe[:author] = page.css(".submitter__name").text.strip
|
|
27
|
+
recipe[:description] = page.css(".submitter__description").text.strip
|
|
28
|
+
recipe[:serving_size] = page.css("#metaRecipeServings").attr("content").value
|
|
29
|
+
recipe[:prep_time] = page.css("time[itemprop='prepTime']").text.strip
|
|
30
|
+
recipe[:cook_time] = page.css("time[itemprop='cookTime']").text.strip
|
|
31
|
+
recipe[:ready_time] = page.css("time[itemprop='totalTime']").text.strip
|
|
32
|
+
recipe[:calorie_count] = page.css(".calorie-count").text.strip
|
|
33
|
+
|
|
34
|
+
recipe[:ingredients] = []
|
|
35
|
+
page.css("span[itemprop='ingredients']").each do |ingredient|
|
|
36
|
+
recipe[:ingredients] << ingredient.text.strip
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
recipe[:instructions] = []
|
|
40
|
+
page.css("ol[itemprop='recipeInstructions'] span.recipe-directions__list--item").each do |instruction|
|
|
41
|
+
recipe[:instructions] << instruction.text.strip
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
recipe
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require 'open-uri'
|
|
2
|
+
require 'nokogiri'
|
|
3
|
+
require 'colorize'
|
|
4
|
+
require 'pry'
|
|
5
|
+
|
|
6
|
+
require_relative "todays_top_desserts/version"
|
|
7
|
+
require_relative "todays_top_desserts/recipe"
|
|
8
|
+
require_relative "todays_top_desserts/cli"
|
|
9
|
+
require_relative "todays_top_desserts/scraper"
|
data/spec.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Specifications for the CLI Assessment
|
|
2
|
+
|
|
3
|
+
Specs:
|
|
4
|
+
- [x] Have a CLI for interfacing with the application
|
|
5
|
+
- CLI class allows for user to talk to the application and obtain recipes from a top ten list.
|
|
6
|
+
- [x] Pull data from an external source
|
|
7
|
+
- Pulls data from allrecipes.com.
|
|
8
|
+
- [x] Implement both list and detail views
|
|
9
|
+
- Provides a list of the top ten desserts from Allrecipes, then allows the user to select a dessert to view the full recipe.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "todays_top_desserts/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "todays_top_desserts"
|
|
8
|
+
spec.version = TodaysTopDesserts::VERSION
|
|
9
|
+
spec.authors = ["krystlebarnes"]
|
|
10
|
+
spec.email = ["krystlecbarnes@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Find the recipes for today's top desserts.}
|
|
13
|
+
spec.description = %q{This Ruby gem installs a CLI that gives you the recipes for the top ten desserts being made today according to Allrecipes.com.}
|
|
14
|
+
spec.homepage = "https://github.com/krystlebarnes/todays-top-desserts-cli-app"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
+
# if spec.respond_to?(:metadata)
|
|
20
|
+
# spec.metadata["allowed_push_host"] = 'http://mygemserver.com'
|
|
21
|
+
# else
|
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
+
# "public gem pushes."
|
|
24
|
+
# end
|
|
25
|
+
|
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = "bin"
|
|
30
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ["lib"]
|
|
32
|
+
|
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
36
|
+
spec.add_development_dependency "pry"
|
|
37
|
+
spec.add_development_dependency "colorize"
|
|
38
|
+
|
|
39
|
+
spec.add_dependency "nokogiri", "~> 1.8.2"
|
|
40
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: todays_top_desserts
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- krystlebarnes
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.16'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.16'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: colorize
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: nokogiri
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 1.8.2
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 1.8.2
|
|
97
|
+
description: This Ruby gem installs a CLI that gives you the recipes for the top ten
|
|
98
|
+
desserts being made today according to Allrecipes.com.
|
|
99
|
+
email:
|
|
100
|
+
- krystlecbarnes@gmail.com
|
|
101
|
+
executables:
|
|
102
|
+
- console
|
|
103
|
+
- setup
|
|
104
|
+
- todays-top-desserts
|
|
105
|
+
extensions: []
|
|
106
|
+
extra_rdoc_files: []
|
|
107
|
+
files:
|
|
108
|
+
- ".gitignore"
|
|
109
|
+
- ".rspec"
|
|
110
|
+
- ".travis.yml"
|
|
111
|
+
- CODE_OF_CONDUCT.md
|
|
112
|
+
- Gemfile
|
|
113
|
+
- Gemfile.lock
|
|
114
|
+
- LICENSE.txt
|
|
115
|
+
- NOTES.md
|
|
116
|
+
- README.md
|
|
117
|
+
- Rakefile
|
|
118
|
+
- bin/console
|
|
119
|
+
- bin/setup
|
|
120
|
+
- bin/todays-top-desserts
|
|
121
|
+
- lib/todays_top_desserts.rb
|
|
122
|
+
- lib/todays_top_desserts/cli.rb
|
|
123
|
+
- lib/todays_top_desserts/recipe.rb
|
|
124
|
+
- lib/todays_top_desserts/scraper.rb
|
|
125
|
+
- lib/todays_top_desserts/version.rb
|
|
126
|
+
- spec.md
|
|
127
|
+
- todays_top_desserts.gemspec
|
|
128
|
+
homepage: https://github.com/krystlebarnes/todays-top-desserts-cli-app
|
|
129
|
+
licenses:
|
|
130
|
+
- MIT
|
|
131
|
+
metadata: {}
|
|
132
|
+
post_install_message:
|
|
133
|
+
rdoc_options: []
|
|
134
|
+
require_paths:
|
|
135
|
+
- lib
|
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
|
+
requirements:
|
|
138
|
+
- - ">="
|
|
139
|
+
- !ruby/object:Gem::Version
|
|
140
|
+
version: '0'
|
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
requirements: []
|
|
147
|
+
rubyforge_project:
|
|
148
|
+
rubygems_version: 2.7.3
|
|
149
|
+
signing_key:
|
|
150
|
+
specification_version: 4
|
|
151
|
+
summary: Find the recipes for today's top desserts.
|
|
152
|
+
test_files: []
|