popular-recipes 0.1.2
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 +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/popular-recipes +4 -0
- data/bin/setup +8 -0
- data/config/environment.rb +6 -0
- data/lib/cli.rb +98 -0
- data/lib/recipe.rb +42 -0
- data/lib/scraper.rb +56 -0
- data/lib/version.rb +3 -0
- data/popular-recipes.gemspec +39 -0
- data/spec.md +11 -0
- metadata +107 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 63e8ed2cb2bdeb71ef54ce1da992300c6d0bb1744f0f71b5f5d60ce2dc57ff3c
|
|
4
|
+
data.tar.gz: 1f6c6c3327800c873e3c588a5b495f247a21beac78d963d433371293a1b18a32
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 34c903d424e68a144b2789dee2a26fb61b351a6e3abc3c723e2f68155afe43f1a8c9ac1402005e8474bcfd4495f014dae11fdbb3c9acbfa696ac091d35c54aab
|
|
7
|
+
data.tar.gz: a5a3d2a6bd61a36166723b83a14be901364e35cb044edd7cb3464b5dc952bbf265592dbadf44b8a7842bb7e434a92c193ddbea3223772038fab5b186b424f891
|
data/.gitignore
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 'jonhong777@gmail.com'. 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,30 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
popular-recipes (0.1.1)
|
|
5
|
+
nokogiri
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
coderay (1.1.2)
|
|
11
|
+
method_source (0.9.0)
|
|
12
|
+
mini_portile2 (2.3.0)
|
|
13
|
+
nokogiri (1.8.4)
|
|
14
|
+
mini_portile2 (~> 2.3.0)
|
|
15
|
+
pry (0.11.3)
|
|
16
|
+
coderay (~> 1.1.0)
|
|
17
|
+
method_source (~> 0.9.0)
|
|
18
|
+
rake (10.4.2)
|
|
19
|
+
|
|
20
|
+
PLATFORMS
|
|
21
|
+
ruby
|
|
22
|
+
|
|
23
|
+
DEPENDENCIES
|
|
24
|
+
bundler (~> 1.16)
|
|
25
|
+
popular-recipes!
|
|
26
|
+
pry
|
|
27
|
+
rake (~> 10.0)
|
|
28
|
+
|
|
29
|
+
BUNDLED WITH
|
|
30
|
+
1.16.3
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 'Jonathan Hong'
|
|
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/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# PopularRecipes
|
|
2
|
+
A command line interface gem that lists 25 popular recipes from Genius Kitchen. Be able to view each item in list form by name, and see all the details of an individual recipe.
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
Add this line to your application's Gemfile:
|
|
7
|
+
|
|
8
|
+
```ruby
|
|
9
|
+
gem 'popular-recipes'
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
And then execute:
|
|
13
|
+
|
|
14
|
+
$ bundle
|
|
15
|
+
|
|
16
|
+
Or install it yourself as:
|
|
17
|
+
|
|
18
|
+
$ gem install popular-recipes
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Run popular-recipes after installing the gem.
|
|
23
|
+
|
|
24
|
+
## Development
|
|
25
|
+
|
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
27
|
+
|
|
28
|
+
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).
|
|
29
|
+
|
|
30
|
+
## Contributing
|
|
31
|
+
|
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hejeong/popular-recipes-cli-app. 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.
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
37
|
+
|
|
38
|
+
## Code of Conduct
|
|
39
|
+
|
|
40
|
+
Everyone interacting in the PopularRecipes project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hejeong/popular-recipes-cli-app/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 "popular_recipes"
|
|
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/popular-recipes
ADDED
data/bin/setup
ADDED
data/lib/cli.rb
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
class PopularRecipes::CLI
|
|
2
|
+
# calls all necessary methods for CLI to run
|
|
3
|
+
def call
|
|
4
|
+
create_recipes
|
|
5
|
+
welcome
|
|
6
|
+
list_input = gets.strip
|
|
7
|
+
list_recipes(list_input)
|
|
8
|
+
input = nil
|
|
9
|
+
while input != 'exit'
|
|
10
|
+
input = gets.strip
|
|
11
|
+
if input.length > 0 && input.length <= 2 && input.match("[0-9]+")
|
|
12
|
+
get_info(input)
|
|
13
|
+
else
|
|
14
|
+
list_recipes(input)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
# create recipe instances and all necessary attributes
|
|
22
|
+
def create_recipes
|
|
23
|
+
# new scraper instance
|
|
24
|
+
scraper = PopularRecipes::RecipeScraper.new
|
|
25
|
+
# grab name and url attributes
|
|
26
|
+
new_attributes = scraper.scrape_list_page
|
|
27
|
+
# create new instances of recipes and save them
|
|
28
|
+
PopularRecipes::Recipe.create(new_attributes)
|
|
29
|
+
# use the urls of each instance and scrape all the other information and update the attributes
|
|
30
|
+
PopularRecipes::Recipe.all.each do |recipe|
|
|
31
|
+
additional_attr = scraper.scrape_recipe_page(recipe.url)
|
|
32
|
+
recipe.add_attributes(additional_attr)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# display all information about a recipe
|
|
37
|
+
def get_info(number)
|
|
38
|
+
index = number.to_i - 1
|
|
39
|
+
item = PopularRecipes::Recipe.all[index]
|
|
40
|
+
puts "-----------------------------------------------------------------------------------------------------------------------------------------------------"
|
|
41
|
+
puts "[#{item.name}] by #{item.author}"
|
|
42
|
+
puts "Servings: #{item.yield} Total time: #{item.total_time} Rating: #{item.rating}"
|
|
43
|
+
puts "Ingredients:"
|
|
44
|
+
item.ingredients.each do |ingredient|
|
|
45
|
+
puts " ~ #{ingredient}"
|
|
46
|
+
end
|
|
47
|
+
puts "Directions:"
|
|
48
|
+
item.directions.each do |direct|
|
|
49
|
+
puts "~ #{direct}"
|
|
50
|
+
end
|
|
51
|
+
puts "-----------------------------------------------------------------------------------------------------------------------------------------------------"
|
|
52
|
+
puts "If you want to see another list, enter the range (1-5) (6-10) (11-15) (16-20) (21-25) To quit, type exit."
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# output a numbered list of the recipe names
|
|
56
|
+
def list_recipes(list_input)
|
|
57
|
+
puts
|
|
58
|
+
puts
|
|
59
|
+
puts
|
|
60
|
+
recipes = PopularRecipes::Recipe.all
|
|
61
|
+
if list_input.length > 2 && list_input != "exit"
|
|
62
|
+
puts "----------------------Recipes #{list_input}---------------------------"
|
|
63
|
+
case list_input
|
|
64
|
+
when "1-5"
|
|
65
|
+
recipe(0,recipes)
|
|
66
|
+
when "6-10"
|
|
67
|
+
recipe(5,recipes)
|
|
68
|
+
when "11-15"
|
|
69
|
+
recipe(10,recipes)
|
|
70
|
+
when "16-20"
|
|
71
|
+
recipe(15,recipes)
|
|
72
|
+
when "21-25"
|
|
73
|
+
recipe(20,recipes)
|
|
74
|
+
end
|
|
75
|
+
puts "-------------------------------------------------------------"
|
|
76
|
+
puts "If you want to learn more about a recipe, enter the corresponding number."
|
|
77
|
+
puts "Otherwise, if you want to see another list, enter the range (1-5) (6-10) (11-15) (16-20) (21-25)"
|
|
78
|
+
puts "To quit, type exit."
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# prints each recipe by name 5 at a time
|
|
83
|
+
def recipe(start_index, array)
|
|
84
|
+
5.times do
|
|
85
|
+
puts "#{start_index + 1}. #{array[start_index].name}"
|
|
86
|
+
start_index += 1
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# welcome message
|
|
91
|
+
def welcome
|
|
92
|
+
puts
|
|
93
|
+
puts
|
|
94
|
+
puts "Welcome to 25 Popular Recipes!"
|
|
95
|
+
puts "The recipes will be listed 5 at a time, and you'll be given the option to learn more about the recipe."
|
|
96
|
+
puts "Which recipes would you like to see? (1-5) (6-10) (11-15) (16-20) (21-25)"
|
|
97
|
+
end
|
|
98
|
+
end
|
data/lib/recipe.rb
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
class PopularRecipes::Recipe
|
|
2
|
+
# <-- class variable
|
|
3
|
+
@@all = []
|
|
4
|
+
|
|
5
|
+
# attribute accessors
|
|
6
|
+
attr_accessor :name, :url, :total_time, :yield, :author, :rating, :ingredients, :directions
|
|
7
|
+
|
|
8
|
+
# <-- constructors
|
|
9
|
+
def initialize(attribute_hash)
|
|
10
|
+
attribute_hash.each do |attribute, value|
|
|
11
|
+
self.send("#{attribute}=", value)
|
|
12
|
+
end
|
|
13
|
+
self.save
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# attribute_hash is an array of hashes that contain the attributes + values of a recipe
|
|
17
|
+
def self.create(array_of_hashes)
|
|
18
|
+
array_of_hashes.each do |recipe|
|
|
19
|
+
PopularRecipes::Recipe.new(recipe)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# <--instance methods
|
|
25
|
+
|
|
26
|
+
# add any additional attributes to an existing instance
|
|
27
|
+
def add_attributes(attribute_hash)
|
|
28
|
+
attribute_hash.each do |attribute, value|
|
|
29
|
+
self.send("#{attribute}=", value)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# save to class variable
|
|
34
|
+
def save
|
|
35
|
+
@@all << self
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# return array of all instances of this class
|
|
39
|
+
def self.all
|
|
40
|
+
@@all
|
|
41
|
+
end
|
|
42
|
+
end
|
data/lib/scraper.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'pry'
|
|
2
|
+
class PopularRecipes::RecipeScraper
|
|
3
|
+
|
|
4
|
+
# returns HTML in nested nodes
|
|
5
|
+
def get_page(url)
|
|
6
|
+
Nokogiri::HTML(open(url))
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# scrapes from index page
|
|
10
|
+
def scrape_list_page
|
|
11
|
+
doc = get_page("http://www.geniuskitchen.com/ideas/all-time-favorite-recipes-6365?c=24106")
|
|
12
|
+
index_card = doc.css('div.smart-info div.smart-info-wrap')
|
|
13
|
+
recipes = []
|
|
14
|
+
index_card.each do |card|
|
|
15
|
+
recipes << {
|
|
16
|
+
:name => card.css('h2.title a').text.gsub(/#[0-9]*:\s/, ""),
|
|
17
|
+
:url => card.css('h2.title a').attribute('href').value
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
recipes
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# scrapes from recipe page
|
|
24
|
+
def scrape_recipe_page(url)
|
|
25
|
+
doc = get_page(url)
|
|
26
|
+
|
|
27
|
+
# fetch ingredients into proper formatting and add into array
|
|
28
|
+
ingredients = []
|
|
29
|
+
ingredient_wrapper = doc.css('ul.ingredient-list li')
|
|
30
|
+
ingredient_wrapper.each do |element|
|
|
31
|
+
quantity = element.css('span.qty').text
|
|
32
|
+
food = element.css('span.food').text
|
|
33
|
+
text = quantity.ljust(7) + food.strip
|
|
34
|
+
ingredients << text
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# fetch directions and input into directions array
|
|
38
|
+
directions = []
|
|
39
|
+
directions_wrapper = doc.css('div.directions-inner.container-xs ol li')
|
|
40
|
+
directions_wrapper.each do |element|
|
|
41
|
+
directions << element.text
|
|
42
|
+
end
|
|
43
|
+
# last element is just an empty space
|
|
44
|
+
directions.pop
|
|
45
|
+
|
|
46
|
+
# apply all scraped elements into a hash=>key to be used to build a recipe object
|
|
47
|
+
{
|
|
48
|
+
:author => doc.css('div.rating-and-author h6.byline a').first.text,
|
|
49
|
+
:total_time => doc.css('table.recipe-facts.servings_unit tbody tr td.time').text.gsub(/\n/,"").gsub(/\s/,"").gsub(/READYIN:/,""),
|
|
50
|
+
:yield => doc.css('td.servings a span').text,
|
|
51
|
+
:rating => doc.css('div.five-star span.sr-only').text,
|
|
52
|
+
:ingredients => ingredients,
|
|
53
|
+
:directions => directions
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/version.rb
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "popular-recipes"
|
|
8
|
+
spec.version = PopularRecipes::VERSION
|
|
9
|
+
spec.authors = ["'Jonathan Hong'"]
|
|
10
|
+
spec.email = ["'jonhong777@gmail.com'"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{List 25 popular recipes}
|
|
13
|
+
spec.description = %q{25 Most-Saved Recipes scraped from Genius Kitchen. You can view an ordered list of recipes, with the option to read the full recipe.}
|
|
14
|
+
spec.homepage = "https://github.com/hejeong/popular-recipes-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"] = 'https://rubygems.org'
|
|
21
|
+
else
|
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
+
"public gem pushes."
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Specify which files should be added to the gem when it is released.
|
|
27
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
30
|
+
end
|
|
31
|
+
spec.bindir = "bin"
|
|
32
|
+
spec.executables = "popular-recipes"
|
|
33
|
+
spec.require_paths = ["lib","config"]
|
|
34
|
+
|
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
37
|
+
|
|
38
|
+
spec.add_dependency "nokogiri", "~> 1.8"
|
|
39
|
+
end
|
data/spec.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Specifications for the CLI Assessment
|
|
2
|
+
|
|
3
|
+
Specs:
|
|
4
|
+
- [x] Have a CLI for interfacing with the application
|
|
5
|
+
# Welcome message, list view, recipe view, exit
|
|
6
|
+
- [x] Pull data from an external source
|
|
7
|
+
# pulled out recipe names and urls from an index page and the details of the recipe from the recipe page
|
|
8
|
+
# all information scraped from Genius Kitchen
|
|
9
|
+
- [x] Implement both list and detail views
|
|
10
|
+
# ordered list of recipe names
|
|
11
|
+
# individual recipe view (will need to scroll up)
|
metadata
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: popular-recipes
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- "'Jonathan Hong'"
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-08-02 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: nokogiri
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.8'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.8'
|
|
55
|
+
description: 25 Most-Saved Recipes scraped from Genius Kitchen. You can view an ordered
|
|
56
|
+
list of recipes, with the option to read the full recipe.
|
|
57
|
+
email:
|
|
58
|
+
- "'jonhong777@gmail.com'"
|
|
59
|
+
executables:
|
|
60
|
+
- popular-recipes
|
|
61
|
+
extensions: []
|
|
62
|
+
extra_rdoc_files: []
|
|
63
|
+
files:
|
|
64
|
+
- ".gitignore"
|
|
65
|
+
- CODE_OF_CONDUCT.md
|
|
66
|
+
- Gemfile
|
|
67
|
+
- Gemfile.lock
|
|
68
|
+
- LICENSE.txt
|
|
69
|
+
- README.md
|
|
70
|
+
- Rakefile
|
|
71
|
+
- bin/console
|
|
72
|
+
- bin/popular-recipes
|
|
73
|
+
- bin/setup
|
|
74
|
+
- config/environment.rb
|
|
75
|
+
- lib/cli.rb
|
|
76
|
+
- lib/recipe.rb
|
|
77
|
+
- lib/scraper.rb
|
|
78
|
+
- lib/version.rb
|
|
79
|
+
- popular-recipes.gemspec
|
|
80
|
+
- spec.md
|
|
81
|
+
homepage: https://github.com/hejeong/popular-recipes-cli-app
|
|
82
|
+
licenses:
|
|
83
|
+
- MIT
|
|
84
|
+
metadata:
|
|
85
|
+
allowed_push_host: https://rubygems.org
|
|
86
|
+
post_install_message:
|
|
87
|
+
rdoc_options: []
|
|
88
|
+
require_paths:
|
|
89
|
+
- lib
|
|
90
|
+
- config
|
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - ">="
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: '0'
|
|
101
|
+
requirements: []
|
|
102
|
+
rubyforge_project:
|
|
103
|
+
rubygems_version: 2.7.7
|
|
104
|
+
signing_key:
|
|
105
|
+
specification_version: 4
|
|
106
|
+
summary: List 25 popular recipes
|
|
107
|
+
test_files: []
|