wikihow_tech_topics 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.learn +8 -0
- data/.vscode/database.json +1 -0
- data/.vscode/launch.json +65 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +37 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +45 -0
- data/LICENSE.md +7 -0
- data/LICENSE.txt +21 -0
- data/README copy.md +48 -0
- data/README.md +109 -0
- data/Rakefile +6 -0
- data/Stubs and Notes +65 -0
- data/bin/console +18 -0
- data/bin/setup +8 -0
- data/bin/wikihow_tech_topics +5 -0
- data/config/environment.rb +7 -0
- data/lib/wikihow_tech_topics.rb +4 -0
- data/lib/wikihow_tech_topics/cli.rb +173 -0
- data/lib/wikihow_tech_topics/scraper.rb +131 -0
- data/lib/wikihow_tech_topics/version.rb +3 -0
- data/lib/wikihow_tech_topics/wikihow_tech_topic_model.rb +158 -0
- data/spec.md +7 -0
- data/wikihow_tech_topics.gemspec +39 -0
- metadata +139 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a33657e937e208d7f44e5c31a8b2de5f2bd030e9ea494811d28878e4c296dc33
|
4
|
+
data.tar.gz: 544454e50e4a0b78d3cf1d542be4b4f38788d8426db8d9311a2da51c038a6b24
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 075f1633140a945099899d208ee65c64f2579dab7532be06582a112ad45237350a377dbb289e61545d3cd784e56d5c74f999b127dc54cccd90895c81b78b5f9e
|
7
|
+
data.tar.gz: 026f14b14f2fd309bd3792887b4b7a02c549eab5f7115ac674744c67cfa2773fda4d0a7a476186e22ecde89e19b31ff5935392512605e3e22a080de4d30f5321
|
data/.DS_Store
ADDED
Binary file
|
data/.learn
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
|
8
|
+
{
|
9
|
+
"name": "Debug Local File",
|
10
|
+
"type": "Ruby",
|
11
|
+
"request": "launch",
|
12
|
+
"cwd": "${workspaceRoot}",
|
13
|
+
"program": "${workspaceRoot}/main.rb"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"name": "Listen for rdebug-ide",
|
17
|
+
"type": "Ruby",
|
18
|
+
"request": "attach",
|
19
|
+
"cwd": "${workspaceRoot}",
|
20
|
+
"remoteHost": "127.0.0.1",
|
21
|
+
"remotePort": "1234",
|
22
|
+
"remoteWorkspaceRoot": "${workspaceRoot}"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"name": "Rails server",
|
26
|
+
"type": "Ruby",
|
27
|
+
"request": "launch",
|
28
|
+
"cwd": "${workspaceRoot}",
|
29
|
+
"program": "${workspaceRoot}/bin/rails",
|
30
|
+
"args": [
|
31
|
+
"server"
|
32
|
+
]
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"name": "RSpec - all",
|
36
|
+
"type": "Ruby",
|
37
|
+
"request": "launch",
|
38
|
+
"cwd": "${workspaceRoot}",
|
39
|
+
"program": "${workspaceRoot}/bin/rspec",
|
40
|
+
"args": [
|
41
|
+
"-I",
|
42
|
+
"${workspaceRoot}"
|
43
|
+
]
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"name": "RSpec - active spec file only",
|
47
|
+
"type": "Ruby",
|
48
|
+
"request": "launch",
|
49
|
+
"cwd": "${workspaceRoot}",
|
50
|
+
"program": "${workspaceRoot}/bin/rspec",
|
51
|
+
"args": [
|
52
|
+
"-I",
|
53
|
+
"${workspaceRoot}",
|
54
|
+
"${file}"
|
55
|
+
]
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"name": "Cucumber",
|
59
|
+
"type": "Ruby",
|
60
|
+
"request": "launch",
|
61
|
+
"cwd": "${workspaceRoot}",
|
62
|
+
"program": "${workspaceRoot}/bin/cucumber"
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
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/CONTRIBUTING.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Contributing to Learn.co Curriculum
|
2
|
+
|
3
|
+
We're really exited that you're about to contribute to the [open curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co). If this is your first time contributing, please continue reading to learn how to make the most meaningful and useful impact possible.
|
4
|
+
|
5
|
+
## Raising an Issue to Encourage a Contribution
|
6
|
+
|
7
|
+
If you notice a problem with the curriculum that you believe needs improvement
|
8
|
+
but you're unable to make the change yourself, you should raise a Github issue
|
9
|
+
containing a clear description of the problem. Include relevant snippets of
|
10
|
+
the content and/or screenshots if applicable. Curriculum owners regularly review
|
11
|
+
issue lists and your issue will be prioritized and addressed as appropriate.
|
12
|
+
|
13
|
+
## Submitting a Pull Request to Suggest an Improvement
|
14
|
+
|
15
|
+
If you see an opportunity for improvement and can make the change yourself go
|
16
|
+
ahead and use a typical git workflow to make it happen:
|
17
|
+
|
18
|
+
* Fork this curriculum repository
|
19
|
+
* Make the change on your fork, with descriptive commits in the standard format
|
20
|
+
* Open a Pull Request against this repo
|
21
|
+
|
22
|
+
A curriculum owner will review your change and approve or comment on it in due
|
23
|
+
course.
|
24
|
+
|
25
|
+
# Why Contribute?
|
26
|
+
|
27
|
+
Curriculum on Learn is publicly and freely available under Learn's
|
28
|
+
[Educational Content License](https://learn.co/content-license). By
|
29
|
+
embracing an open-source contribution model, our goal is for the curriculum
|
30
|
+
on Learn to become, in time, the best educational content the world has
|
31
|
+
ever seen.
|
32
|
+
|
33
|
+
We need help from the community of Learners to maintain and improve the
|
34
|
+
educational content. Everything from fixing typos, to correcting
|
35
|
+
out-dated information, to improving exposition, to adding better examples,
|
36
|
+
to fixing tests—all contributions to making the curriculum more effective are
|
37
|
+
welcome.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
wikihow_tech_topics (0.1.0)
|
5
|
+
nokogiri
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.2)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
method_source (0.9.0)
|
13
|
+
mini_portile2 (2.3.0)
|
14
|
+
nokogiri (1.8.1)
|
15
|
+
mini_portile2 (~> 2.3.0)
|
16
|
+
pry (0.11.3)
|
17
|
+
coderay (~> 1.1.0)
|
18
|
+
method_source (~> 0.9.0)
|
19
|
+
rake (10.5.0)
|
20
|
+
rspec (3.7.0)
|
21
|
+
rspec-core (~> 3.7.0)
|
22
|
+
rspec-expectations (~> 3.7.0)
|
23
|
+
rspec-mocks (~> 3.7.0)
|
24
|
+
rspec-core (3.7.1)
|
25
|
+
rspec-support (~> 3.7.0)
|
26
|
+
rspec-expectations (3.7.0)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.7.0)
|
29
|
+
rspec-mocks (3.7.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.7.0)
|
32
|
+
rspec-support (3.7.0)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
bundler (~> 1.16)
|
39
|
+
pry
|
40
|
+
rake (~> 10.0)
|
41
|
+
rspec (~> 3.0)
|
42
|
+
wikihow_tech_topics!
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
1.16.0
|
data/LICENSE.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#Learn.co Educational Content License
|
2
|
+
|
3
|
+
Copyright (c) 2015 Flatiron School, Inc
|
4
|
+
|
5
|
+
The Flatiron School, Inc. owns this Educational Content. However, the Flatiron School supports the development and availability of educational materials in the public domain. Therefore, the Flatiron School grants Users of the Flatiron Educational Content set forth in this repository certain rights to reuse, build upon and share such Educational Content subject to the terms of the Educational Content License set forth [here](http://learn.co/content-license) (http://learn.co/content-license). You must read carefully the terms and conditions contained in the Educational Content License as such terms govern access to and use of the Educational Content.
|
6
|
+
|
7
|
+
Flatiron School is willing to allow you access to and use of the Educational Content only on the condition that you accept all of the terms and conditions contained in the Educational Content License set forth [here](http://learn.co/content-license) (http://learn.co/content-license). By accessing and/or using the Educational Content, you are agreeing to all of the terms and conditions contained in the Educational Content License. If you do not agree to any or all of the terms of the Educational Content License, you are prohibited from accessing, reviewing or using in any way the Educational Content.
|
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/README copy.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
Wikihow Tech Topics
|
2
|
+
|
3
|
+
This gem presents the current articles from the Selecting and Buying a Computer page of the Computers and Technology section of www.wikihow.com in list form in a command line interface (CLI).
|
4
|
+
|
5
|
+
## Instructions
|
6
|
+
|
7
|
+
The user will be presented with a numbered list of article titles to choose from and be able to access the article's basic steps, some in clearly numbered, multiple methods or parts, through typing in the number of the relevant number.
|
8
|
+
|
9
|
+
To execute the progrm once it is loaded, type this into your commnad line or terminal:
|
10
|
+
|
11
|
+
bin/wikihow_tech_topics
|
12
|
+
|
13
|
+
|
14
|
+
The program file Scraper, which is responsible for doing the scraping of information from pages of www.wikihow.com, contains object methods for easy substitution/addition of specific pages at www.wikihow.co to scrape and include in the gem program. Furthermore, future versions of this gem may encompass articles collected from a greater number of tech-related sites and be searchable based on specific topic keywords.
|
15
|
+
|
16
|
+
NOTE: Content for this gem project was scraped directly from the website at https://www.wikihow.com/Category:Selecting-and-Buying-a-Computer as well as from the sites with related article content linked to this website. The gem project complies with Wikihow's Terms of Use, which can be accessed at https://www.wikihow.com/wikiHow:Terms-of-Use.
|
17
|
+
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
ruby gem 'wikihow_tech_topics'
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
$ bundle
|
28
|
+
|
29
|
+
Or install it yourself as:
|
30
|
+
|
31
|
+
$ gem install wikihow_text_topics
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
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.
|
36
|
+
|
37
|
+
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).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dannyd4315/worlds-best-restaurants-cli-gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
42
|
+
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
47
|
+
|
48
|
+
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# Build a CLI Application with External Data
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
In this lesson you're going to build an application that provides a Command Line Interface (CLI) to an external data source. The CLI will be composed of an Object Oriented Ruby application.
|
6
|
+
|
7
|
+
**Please note that while you will be writing code to scrape data from a public website, what we're really looking for is your capacity to effectively write good object oriented ruby code (objects, not hashes, separation of concerns, etc.) - we're less interested in the details of the regex's or selector you're using to parse the web pages that you're scraping.**
|
8
|
+
|
9
|
+
## Requirements
|
10
|
+
|
11
|
+
1. Provide a CLI
|
12
|
+
2. CLI must provide access to data from a web page.
|
13
|
+
3. The data provided must go at least one level deep, generally by showing the user a list of available data and then being able to drill down into a specific item.
|
14
|
+
4. The CLI application can not be a Music CLI application as that is too similiar to the other OO Ruby final project. Also please refrain from using Kickstarter as that was used for the scraping 'code along'. Look at the example domains below for inspiration.
|
15
|
+
5. Use good OO design patterns. You should be creating a collection of objects - not hashes.
|
16
|
+
|
17
|
+
|
18
|
+
*For bonus points, instead of just creating an application, create a gem and for extra bonus points try publishing it to RubyGems.*
|
19
|
+
|
20
|
+
### Example Domains
|
21
|
+
|
22
|
+
- Movies opening soon - Enter your zip code and receive a list of movies and their details.
|
23
|
+
- Libraries near you - Enter your zip code and receive a list of libraries and their details.
|
24
|
+
- Programming meetups near you, list details.
|
25
|
+
- News reader - List articles, read article.
|
26
|
+
|
27
|
+
[now-playing](https://github.com/learn-co-curriculum/now-playing-cli-gem) is an example of a gem that would meet these requirements.
|
28
|
+
[worlds best restaurants](https://github.com/dannyd4315/worlds-best-restaurants-cli-gem) was built by a Learn student and meets these requirements and is well coded.
|
29
|
+
Take the time to clone, run and look through the code for both of these in detail - it'll really help.
|
30
|
+
|
31
|
+
## Instructions
|
32
|
+
|
33
|
+
1. Watch this [video walkthrough](https://www.youtube.com/watch?v=_lDExWIhYKI) of building a CLI Gem called [Daily Deal](https://github.com/learn-co-curriculum/daily_deal) before you begin.
|
34
|
+
2. Create a new repository on GitHub for your application, ie: `name-cli-app`.
|
35
|
+
3. When you create the CLI app for your assessment, add the spec.md file from this repo to the root directory of the project, commit it to Git and push it up to GitHub.
|
36
|
+
4. Build your application. Make sure to commit early and commit often. Commit messages should be meaningful (clearly describe what you're doing in the commit) and accurate (there should be nothing in the commit that doesn't match the description in the commit message). Good rule of thumb is to commit every 3-7 mins of actual coding time. Most of your commits should have under 15 lines of code and a 2 line commit is perfectly acceptable. **This is important and you'll be graded on this**.
|
37
|
+
5. Make sure to create a good README.md with a short description, install instructions, a contributors guide and a link to the license for your code.
|
38
|
+
6. While you're working on it, record a 30 min coding session with your favorite screen capture tool. During the session, either think out loud or not. It's up to you. You don't need to submit the video, but we may ask for it at a later time.
|
39
|
+
7. Make sure to check each box in your spec.md (replace the space between the square braces with an x) and explain next to each one how you've met the requirement *before* you submit your project.
|
40
|
+
8. Prepare a video demo (narration helps!) describing how a user would interact with your working gem.
|
41
|
+
9. Write a blog post about the project and process.
|
42
|
+
10. On Learn, submit links to the GitHub repository for your app, your video demo, and your blog post each to the corresponding textbox in the right rail, and hit "I'm done" to wrap it up.
|
43
|
+
|
44
|
+
|
45
|
+
## If you're a Learn-Verified Premium student:
|
46
|
+
|
47
|
+
Unlike the rest of the curriculum, if you have any questions about your assessment or need help with it, please don’t use the Ask New Question feature. Rather than working with Learn Experts, please reach out to your Learn Instructor responsible for this section instead.
|
48
|
+
|
49
|
+
Watch for an email from Learn with instructions to schedule an assessment. If you don't receive the email within a day or so after submission, get in touch!
|
50
|
+
|
51
|
+
### Be Prepared to:
|
52
|
+
|
53
|
+
1. Explain your code from execution point to exit point. We're making sure you wrote it and understand how it works, nothing else. 10-20 minutes
|
54
|
+
2. Refactor code. 10-20 minutes
|
55
|
+
|
56
|
+
If necessary, after the assessment, be prepared to:
|
57
|
+
|
58
|
+
1. Extend the application with a new feature, more data, a different domain etc. 20-30 minutes
|
59
|
+
2. Submit an improved version.
|
60
|
+
|
61
|
+
### What to expect from the assessment
|
62
|
+
|
63
|
+
Project reviews are focused on preparing you for technical interviews. Treat project reviews as if they were technical interviews, in both attitude and technical presentation.
|
64
|
+
|
65
|
+
#### Be scrappy.
|
66
|
+
- If you make a mistake, correct yourself! We all make mistakes, I promise.
|
67
|
+
- Think on your feet. Feel free to look things up while you're pairing with us. You'll be asked to expand on concepts you implemented and you will be pushed to the edge of your knowledge.
|
68
|
+
- Explain the details. We're curious!
|
69
|
+
- Don’t worry if your code isn’t perfect the first time - focus on getting something working, then refactoring to improve it
|
70
|
+
|
71
|
+
#### Make no little plans.
|
72
|
+
- You're going to learn a ton. We will give pointers and show you ways to improve your code. This isn't telling you that your code is wrong, it's simply us teaching. Whatever you don't quite understand will be explained.
|
73
|
+
- Be proud of your project and your code, and show confidence in it.
|
74
|
+
|
75
|
+
#### Radiate positivity.
|
76
|
+
- Present yourself and your project in the best way possible.
|
77
|
+
- Be open to feedback, both positive and constructive.
|
78
|
+
- Remember, the interviewer is a person too. Be nice to them!
|
79
|
+
|
80
|
+
#### Work Together.
|
81
|
+
- Trust yourself.
|
82
|
+
- Trust us - our goal is to help you be successful in achieving your goals.
|
83
|
+
- We understand that this process can be stressful. We’re here to help you through.
|
84
|
+
|
85
|
+
#### Pursue mastery.
|
86
|
+
- Use the best technical vocabulary you can. We’ll help you with the words you can’t remember, or if you’re unsure about how something is pronounced.
|
87
|
+
- Ask questions! Curiosity and willingness to learn are hugely valued in our industry. If you haven’t heard of something, that’s okay - use this opportunity to learn about it!
|
88
|
+
|
89
|
+
|
90
|
+
### What won't happen:
|
91
|
+
|
92
|
+
- You won't be told you're ever wrong.
|
93
|
+
- You won't be yelled at, belittled, or scolded.
|
94
|
+
- You won't be put on the spot without support.
|
95
|
+
- There's nothing you can do to instantly fail or blow it.
|
96
|
+
|
97
|
+
## Resources
|
98
|
+
|
99
|
+
- [How to build a ruby gem](http://guides.rubygems.org/make-your-own-gem/)
|
100
|
+
- [How to publish your gem](http://guides.rubygems.org/publishing/)
|
101
|
+
- [Environments, Requiring Files, Bundler, and Gems](https://www.youtube.com/watch?v=XBgZLm-sdl8)
|
102
|
+
- [Video- CLI Data Gem Walkthrough](https://www.youtube.com/watch?v=_lDExWIhYKI)
|
103
|
+
- [Video- CLI Data Gem Walkthrough: Creating a CLI Scraper Gem](https://www.youtube.com/watch?v=Y5X6NRQi0bU)
|
104
|
+
- [Video- Common Anti-Patterns in CLI Data Gem](https://www.youtube.com/watch?v=cbMa87oWv08)
|
105
|
+
- [Video- Student Example 1: Refactoring CLI Data Gem](https://www.youtube.com/watch?v=JEL_PXr74qQ)
|
106
|
+
- [Video- Student Example 2: Refactoring CLI Data Gem](https://www.youtube.com/watch?v=Lt0oyHiKWIw)
|
107
|
+
|
108
|
+
|
109
|
+
<p class='util--hide'>View <a href='https://learn.co/lessons/cli-data-gem-assessment'>CLI Data Gem Project</a> on Learn.co and start learning to code for free.</p>
|
data/Rakefile
ADDED
data/Stubs and Notes
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
For current commit message:
|
3
|
+
|
4
|
+
'edited/added to refactoring possibilities/did finaly check of goals and tasks in Stubs and Notes'
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
GOALS to include in ReadMe:
|
9
|
+
|
10
|
+
DONE 1. Make cli user friendly
|
11
|
+
DONE 2. Make model able to store different urls to scrape ... attracessor from Scraper?
|
12
|
+
DONE 3. Make model able to store article titles and content but don't necessarily connect it to specific scraped titles and contents
|
13
|
+
|
14
|
+
Steps for next time:
|
15
|
+
|
16
|
+
DONE 1. Finish parsing cli to make information more user friendly
|
17
|
+
DONE 2. Finish making model workable for instantiating title and content and connect from cli, not scraper?
|
18
|
+
DONE 3. finish main steps below
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Testing out model methods
|
23
|
+
|
24
|
+
1. Checking out any issues with TOS for scraping DONE
|
25
|
+
2. Start Readme DONE
|
26
|
+
|
27
|
+
3. Create CLI to return numbered list of articles DONE
|
28
|
+
|
29
|
+
User will be able to choose from numbered list of article titles to see content
|
30
|
+
|
31
|
+
4. Build out Scraper to scrape this page for attributes DONE
|
32
|
+
5. Build out module DONE
|
33
|
+
6. Make sure CLI works DONE
|
34
|
+
7. Finish/proof Readme DONE
|
35
|
+
8. Finish pushing gem to rubygems FOR AFTER SUBMITTING
|
36
|
+
9. Blog (all along) DONE
|
37
|
+
10. Make sure all steps in lab are finished DONE
|
38
|
+
11. Look over code for points of elegance and clarity such as indenting and descriptive naming DONE
|
39
|
+
12. Submit project DONE
|
40
|
+
|
41
|
+
|
42
|
+
Refactoring possibiilties for after submitting the project:
|
43
|
+
|
44
|
+
find a way to make the retrieval of article content faster
|
45
|
+
|
46
|
+
because the information given to the user often requires more explanation for a step to be useful,
|
47
|
+
scraping the full content associated with steps included in this project
|
48
|
+
|
49
|
+
find a way to intantiate content as well as titles in model
|
50
|
+
|
51
|
+
consider using @@all ||= scraped info as now playing does
|
52
|
+
|
53
|
+
make sure it's easy for any new index page from wikihow to be scraped, not just the one currently scraped in the project
|
54
|
+
|
55
|
+
add heading information not included in this project that follows specific numbered methods and parts for articles organized this way ("Method/Part" was added through code rather than scraping)
|
56
|
+
|
57
|
+
number individual steps for each article and put them in column form
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
For blogging later:
|
63
|
+
|
64
|
+
I found that you need to use both the literal and the abstract. You can "think abstractly" but only to a point. You need to use literal examples, plugging in real instances, objects, and methods, to make sure the abstract works (and not to cause a nervous breakdown on your quest to become the most amazing coder in history in a few months time :) )
|
65
|
+
|
data/bin/console
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "wikihow_tech_topics"
|
5
|
+
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
|
12
|
+
require "pry"
|
13
|
+
Pry.start
|
14
|
+
|
15
|
+
require "irb"
|
16
|
+
IRB.start(__FILE__)
|
17
|
+
|
18
|
+
|
data/bin/setup
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
require_relative "../lib/wikihow_tech_topics/cli"
|
5
|
+
require_relative "../lib/wikihow_tech_topics/version"
|
6
|
+
require_relative "../lib/wikihow_tech_topics/scraper"
|
7
|
+
require_relative "../lib/wikihow_tech_topics/wikihow_tech_topic_model"
|
@@ -0,0 +1,173 @@
|
|
1
|
+
require_relative 'scraper'
|
2
|
+
require_relative 'wikihow_tech_topic_model'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
class WikihowTechTopics::CLI
|
6
|
+
|
7
|
+
def call
|
8
|
+
start
|
9
|
+
end
|
10
|
+
|
11
|
+
def start
|
12
|
+
puts "Welcome to Wikihow Tech Topics!"
|
13
|
+
puts ""
|
14
|
+
puts "Review the list of articles below,\ntype the number of the article\nthat you wish to read, and hit return."
|
15
|
+
puts ""
|
16
|
+
run
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
list_titles
|
21
|
+
get_title_for_user
|
22
|
+
get_content_for_user_multiple_methods
|
23
|
+
get_content_for_user_single_method
|
24
|
+
end
|
25
|
+
|
26
|
+
def list_titles
|
27
|
+
@scraped_titles_array = []
|
28
|
+
WikihowTechTopics::WikihowTechTopicModel.all
|
29
|
+
WikihowTechTopics::WikihowTechTopicModel.all.each.with_index(1) do |title, i|
|
30
|
+
@scraped_titles_array << title.title
|
31
|
+
puts "#{i}. #{title.title}"
|
32
|
+
end
|
33
|
+
puts ""
|
34
|
+
puts ""
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_title_for_user
|
38
|
+
@user_input = gets.to_i
|
39
|
+
@scraped_titles_array.each.with_index(1) do |title, i|
|
40
|
+
case
|
41
|
+
when @user_input == i
|
42
|
+
puts ""
|
43
|
+
puts ""
|
44
|
+
puts title
|
45
|
+
puts ""
|
46
|
+
puts ""
|
47
|
+
puts "Your article ... "
|
48
|
+
puts ""
|
49
|
+
puts ""
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_content_for_user_multiple_methods
|
55
|
+
newly_scraped_for_content = WikihowTechTopics::Scraper.scraped_content_array
|
56
|
+
newly_scraped_for_content.each.with_index(1) do |final_content, i|
|
57
|
+
case
|
58
|
+
when @user_input == i && final_content.size >= 2
|
59
|
+
content_parser_multiple_methods(final_content)
|
60
|
+
option
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_content_for_user_single_method
|
66
|
+
newly_scraped_for_content = WikihowTechTopics::Scraper.scraped_content_array
|
67
|
+
newly_scraped_for_content.each.with_index(1) do |final_content, i|
|
68
|
+
case
|
69
|
+
when @user_input == i && final_content.size == 1
|
70
|
+
puts final_content
|
71
|
+
option
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def content_parser_multiple_methods(content)
|
77
|
+
content.each.with_index(1) do |method, method_num|
|
78
|
+
puts "Method/Part #{method_num}. #{method}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def option
|
83
|
+
|
84
|
+
puts ""
|
85
|
+
puts ""
|
86
|
+
puts "Would you like to read another article? (type y for \"yes\" and n for \"no\")"
|
87
|
+
read_again_input = gets.strip
|
88
|
+
if read_again_input == "y"
|
89
|
+
start
|
90
|
+
else
|
91
|
+
puts ""
|
92
|
+
puts ""
|
93
|
+
puts "Goodbye for now!"
|
94
|
+
puts ""
|
95
|
+
puts ""
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
# elsif final_content.size == 1
|
102
|
+
# final_content
|
103
|
+
|
104
|
+
|
105
|
+
# puts final_content
|
106
|
+
# content_parser_multiple_methods(final_content)
|
107
|
+
# # binding.pry
|
108
|
+
# # final content.each.with_index do |method, num|
|
109
|
+
# # puts "Method #{num}. #{method}" unless num < 2
|
110
|
+
# # parsed_content = content_parser(final_content)
|
111
|
+
# case
|
112
|
+
# when @user_input == i
|
113
|
+
|
114
|
+
# binding.pry
|
115
|
+
|
116
|
+
# end
|
117
|
+
|
118
|
+
# when @user_input == i
|
119
|
+
# if final_content.size == 1
|
120
|
+
# content_parser_single_method(final_content)
|
121
|
+
# end
|
122
|
+
# puts "#{parsed_content[0]}"
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
# WikihowTechTopics::CLI.get_content_for_user
|
128
|
+
|
129
|
+
|
130
|
+
WikihowTechTopics::WikihowTechTopicModel.titles_from_title_array
|
131
|
+
WikihowTechTopics::WikihowTechTopicModel.all
|
132
|
+
# WikihowTechTopics::WikihowTechTopicModel.add_content_from_content_array
|
133
|
+
|
134
|
+
# def content_parser(content)
|
135
|
+
# content.each.with_index(1) do |method, i|
|
136
|
+
# puts "Method #{i}. #{method}"
|
137
|
+
# unless i < 2
|
138
|
+
# end
|
139
|
+
# end
|
140
|
+
# end
|
141
|
+
|
142
|
+
# def
|
143
|
+
# content.each.with_index(1) do |method, i|
|
144
|
+
# method.split(".").each.with_index do |step, step_num|
|
145
|
+
# puts "#{step_num}. #{step}."
|
146
|
+
# end
|
147
|
+
# end
|
148
|
+
# end
|
149
|
+
# end
|
150
|
+
|
151
|
+
# def self.scraped_content
|
152
|
+
# newly_scraped_for_content = WikihowTechTopics::WikihowTechTopicModel.create_from_content_hash
|
153
|
+
# newly_scraped_for_content.each.with_index(1) do |content_steps, i|
|
154
|
+
# puts "#{i}. #{content_steps}"
|
155
|
+
# end
|
156
|
+
# end
|
157
|
+
|
158
|
+
# scraped_content
|
159
|
+
|
160
|
+
# def self.scraped_titles
|
161
|
+
# newly_scraped_for_titles = WikihowTechTopics::WikihowTechTopicModel.create_from_title_hash
|
162
|
+
# newly_scraped_for_titles.each.with_index(1) do |title, i|
|
163
|
+
# unless title == ""
|
164
|
+
# puts "#{i}. #{title}"
|
165
|
+
# end
|
166
|
+
# end
|
167
|
+
# puts ""
|
168
|
+
# puts ""
|
169
|
+
# end
|
170
|
+
# scraped_titles
|
171
|
+
|
172
|
+
|
173
|
+
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
class WikihowTechTopics::Scraper
|
6
|
+
|
7
|
+
attr_accessor :home_page, :title_array, :content_array
|
8
|
+
|
9
|
+
@@all = []
|
10
|
+
|
11
|
+
def initialize(title=nil, content=nil, home_page=nil, title_array = nil, content_array = nil)
|
12
|
+
@title_array = title_array
|
13
|
+
@content_array = content_array
|
14
|
+
@home_page = home_page
|
15
|
+
@@all << self
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.scraped_title_array
|
19
|
+
home_page = Nokogiri::HTML(open("https://www.wikihow.com/Category:Selecting-and-Buying-a-Computer"))
|
20
|
+
title_array = []
|
21
|
+
home_page.css('.text').each do |title_info|
|
22
|
+
info_for_title_array = title_info.css('span').text
|
23
|
+
title_array << info_for_title_array
|
24
|
+
end
|
25
|
+
title_array.pop(5)
|
26
|
+
title_array
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.scraped_content_array
|
30
|
+
url = "https://www.wikihow.com/Category:Selecting-and-Buying-a-Computer"
|
31
|
+
home_page = Nokogiri::HTML(open(url))
|
32
|
+
|
33
|
+
content_urls = home_page.css(".thumbnail").children.css("a").map { |content_link| content_link.attribute("href").text }
|
34
|
+
|
35
|
+
http_added = content_urls.map { |content_url| "https:" + content_url }
|
36
|
+
|
37
|
+
url_array_sidebar_articles_removed = http_added.pop(4)
|
38
|
+
|
39
|
+
http_added.map do |complete_content_url|
|
40
|
+
content_pages_to_scrape = Nokogiri::HTML(open(complete_content_url))
|
41
|
+
|
42
|
+
final_scraped_content = content_pages_to_scrape.css('div.steps').map { |full_content|
|
43
|
+
full_content.css("b").text }
|
44
|
+
|
45
|
+
final_scraped_content
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.all
|
50
|
+
@@all
|
51
|
+
end
|
52
|
+
|
53
|
+
basic_computers_page = WikihowTechTopics::Scraper.new
|
54
|
+
basic_computers_page.home_page = "https://www.wikihow.com/Category:Selecting-and-Buying-a-Computer"
|
55
|
+
basic_computers_page.title_array = self.scraped_title_array
|
56
|
+
basic_computers_page.content_array = self.scraped_content_array
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
# content_urls = home_page.css(".thumbnail").children.css("a").map { |content_link| content_link.attribute("href").text }
|
63
|
+
|
64
|
+
|
65
|
+
# def leaving_out_featured_articles
|
66
|
+
# home_page = Nokogiri::HTML(open("https://www.wikihow.com/Category:Selecting-and-Buying-a-Computer"))
|
67
|
+
# left_out_articles_array = []
|
68
|
+
# div#side-featured-articles
|
69
|
+
|
70
|
+
# end
|
71
|
+
|
72
|
+
|
73
|
+
# Question: Why did a below not need an argument of url but the current way does? (is the differenc each and map)? And was using each the reason I only got one link and a time and not all of the links scraped?)
|
74
|
+
|
75
|
+
# test_array = [{'title' => 'how to text', 'content' => 'just do it'}], {'title' => 'how to email', 'content' => 'just do it, too'}]
|
76
|
+
|
77
|
+
|
78
|
+
# home_page.css(".thumbnail").each do |content_url|
|
79
|
+
# content_url.css("a").attribute("href").text
|
80
|
+
|
81
|
+
# scraped_content_ary = []
|
82
|
+
|
83
|
+
# scraped_content_url = content_url.css("a").attribute("href").text
|
84
|
+
|
85
|
+
# scraped_content_ary << "https:" + scraped_content_url
|
86
|
+
|
87
|
+
# scraped_content_ary.each do |complete_content_url|
|
88
|
+
# content_page = Nokogiri::HTML(open(complete_content_url))
|
89
|
+
|
90
|
+
# content_page.css('div.steps').each do |full_content|
|
91
|
+
# full_content.css("b").text
|
92
|
+
# @content_array << full_content.css("b").text
|
93
|
+
# binding.pry
|
94
|
+
|
95
|
+
# def initialize
|
96
|
+
# @title_hash_array = []
|
97
|
+
# end
|
98
|
+
# @title_array = []
|
99
|
+
|
100
|
+
# students = []
|
101
|
+
# index_page.css("div.roster-cards-container").each do |card|
|
102
|
+
# card.css(".student-card a").each do |student|
|
103
|
+
# student_profile_link = "./fixtures/student-site/#{student.attr('href')}"
|
104
|
+
# student_location = student.css('.student-location').text
|
105
|
+
# student_name = student.css('.student-name').text
|
106
|
+
# students << {name: student_name, location: student_location, profile_url: student_profile_link}
|
107
|
+
# end
|
108
|
+
# end
|
109
|
+
# students
|
110
|
+
# end
|
111
|
+
|
112
|
+
# final_scraped_content.each do |steps|
|
113
|
+
# content_hash[:content] = steps
|
114
|
+
# try = home_page.css('div#bodycontents').each {|title_info| title_info.css('.text').each do |s| x = s.css('span').text x end
|
115
|
+
# binding.pry }
|
116
|
+
|
117
|
+
|
118
|
+
# .each do |t|
|
119
|
+
|
120
|
+
# t.css('span').each do
|
121
|
+
# t.each do |indiv_title|
|
122
|
+
# title_array << {title: indiv_title}
|
123
|
+
|
124
|
+
# home_page.css('.text').each do |title_info|
|
125
|
+
# title_info_for_hash = title_info.css('span').text
|
126
|
+
# title_array << {title: title_info_for_hash}
|
127
|
+
|
128
|
+
# home_page.css('div#bodycontents text').each do |title_info|
|
129
|
+
# binding.pry
|
130
|
+
# title_info_for_hash = title_info.css('span').text
|
131
|
+
# title_array << {title: title_info_for_hash}
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require_relative 'scraper'
|
3
|
+
require_relative 'cli'
|
4
|
+
|
5
|
+
class WikihowTechTopics::WikihowTechTopicModel
|
6
|
+
|
7
|
+
attr_accessor :title, :content
|
8
|
+
attr_reader :home_page, :title_array, :content_array
|
9
|
+
|
10
|
+
@@all = []
|
11
|
+
|
12
|
+
def initialize(title = nil, content = nil)
|
13
|
+
@title = title
|
14
|
+
@content = content
|
15
|
+
@@all << self
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.titles_from_title_array
|
19
|
+
title_array = WikihowTechTopics::Scraper.scraped_title_array
|
20
|
+
title_array.each do |title|
|
21
|
+
self.new(title)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.content_from_content_array
|
26
|
+
content_array = WikihowTechTopics::Scraper.scraped_content_array
|
27
|
+
title_array.each do |title|
|
28
|
+
@title.content = WikihowTechTopics::WikihowTechTopicModel.new
|
29
|
+
binding.pry
|
30
|
+
# self.new(title)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.all
|
35
|
+
@@all
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# WikihowTechTopics::Scraper.scraped_content_array
|
41
|
+
# basic_computers_page = WikihowTechTopics::WikihowTechTopicModel.new
|
42
|
+
# basic_computers_page.title = self.titles_from_title_array.each {|title| title}
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
# def self.create_from_title_array
|
48
|
+
# # title_array.each do |title|
|
49
|
+
# WikihowTechTopics::WikihowTechTopicModel.new(title)
|
50
|
+
# @@all << self
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
|
54
|
+
# def add_content_from_content_array(content_array)
|
55
|
+
# content_array.each do |content|
|
56
|
+
# WikihowTechTopics::WikihowTechTopicModel.new(title_array)
|
57
|
+
# @@all << self
|
58
|
+
# end
|
59
|
+
# end
|
60
|
+
|
61
|
+
|
62
|
+
# def initialize(title=nil, content=nil)
|
63
|
+
# @title = title
|
64
|
+
# @content = content
|
65
|
+
# @@all << self
|
66
|
+
# end
|
67
|
+
|
68
|
+
# def bob
|
69
|
+
# binding.pry
|
70
|
+
|
71
|
+
# bob = WikihowTechTopics::WikihowTechTopicModel.new
|
72
|
+
|
73
|
+
# bob.title = boss
|
74
|
+
# end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
# # def initialize(title=nil, content=nil)
|
80
|
+
# # @title = title
|
81
|
+
# # @content = content
|
82
|
+
# # @@all << self
|
83
|
+
# # end
|
84
|
+
|
85
|
+
# # def self.create_from_title_array
|
86
|
+
# # title = WikihowTechTopics::WikihowTechTopicModel.new
|
87
|
+
# # # new_title_array =
|
88
|
+
# # # WikihowTechTopics::Scraper.scraped_title_array.each do |title_from_array|
|
89
|
+
# # # title = self.new(title_from_array)
|
90
|
+
# # # title_from_array = self.title
|
91
|
+
# # binding.pry
|
92
|
+
|
93
|
+
# # end
|
94
|
+
|
95
|
+
# # def self.create_from_content_array
|
96
|
+
# # new_content_array = WikihowTechTopics::Scraper.scraped_content_array
|
97
|
+
# # new_content_array.each do |content_from_array|
|
98
|
+
# self. content = self.new(content_from_array)
|
99
|
+
# @@all << content
|
100
|
+
# binding.pry
|
101
|
+
|
102
|
+
# end
|
103
|
+
# end
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
# values_in_array = new_title_array.map {|hash| hash[:title]}
|
108
|
+
|
109
|
+
# WikihowTechTopics::Scraper.scraped_content_hash
|
110
|
+
|
111
|
+
|
112
|
+
# new_title_array = [{key1 => value1}, {key2 => value2} ]
|
113
|
+
|
114
|
+
# def self.create_from_collection(students_array)
|
115
|
+
# students_array.each do |student_hash|
|
116
|
+
# Student.new(student_hash)
|
117
|
+
# end
|
118
|
+
# end
|
119
|
+
|
120
|
+
|
121
|
+
# def self.create_from_content_hash
|
122
|
+
# new_content = WikihowTechTopics::Scraper.scraped_content_hash
|
123
|
+
# new_content.each {|key, value| self.send("#{key}=", value)}
|
124
|
+
# @@all << self
|
125
|
+
# end
|
126
|
+
|
127
|
+
|
128
|
+
# WikihowTechTopics::WikihowTechTopicModel.create_from_content_array
|
129
|
+
|
130
|
+
|
131
|
+
# def self.create_from_collection(students_array)
|
132
|
+
# students_array.each do |student_hash|
|
133
|
+
# Student.new(student_hash)
|
134
|
+
# end
|
135
|
+
# end
|
136
|
+
|
137
|
+
# def add_student_attributes(attributes_hash)
|
138
|
+
# attributes_hash.each {|key, value| self.send("#{key}=", value)}
|
139
|
+
# @@all << self
|
140
|
+
# end
|
141
|
+
# def initialize(student_hash)
|
142
|
+
# student_hash.each {|key, value| self.send("#{key}=", value)}
|
143
|
+
# @@all << self
|
144
|
+
# end
|
145
|
+
|
146
|
+
# def self.create_from_collection(students_array)
|
147
|
+
# students_array.each do |student_hash|
|
148
|
+
# Student.new(student_hash)
|
149
|
+
# end
|
150
|
+
# end
|
151
|
+
|
152
|
+
# def add_student_attributes(attributes_hash)
|
153
|
+
# attributes_hash.each {|key, value| self.send("#{key}=", value)}
|
154
|
+
# @@all << self
|
155
|
+
# end
|
156
|
+
|
157
|
+
# def self.all
|
158
|
+
# @@all@@all = []
|
data/spec.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Specifications for the CLI Assessment
|
2
|
+
|
3
|
+
Specs:
|
4
|
+
- [x] Have a CLI for interfacing with the application: The CLI allows user to choose articles from Wikihow
|
5
|
+
- [x] Pull data from an external source: Data is pulled from Wikihow
|
6
|
+
- [x] Implement both list and detail views: User can choose specific articles form a numbered list, which then provides them the article title and content
|
7
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "wikihow_tech_topics/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wikihow_tech_topics"
|
8
|
+
spec.version = WikihowTechTopics::VERSION
|
9
|
+
spec.authors = ["stazman"]
|
10
|
+
spec.email = ["cadistasio@gmail.com"]
|
11
|
+
# spec.executables = ["wikihow_tech_topics"]
|
12
|
+
|
13
|
+
spec.summary = "My first original gem"
|
14
|
+
spec.description = "Provides scraped list of articles from Wikihow.com in a CLI format"
|
15
|
+
spec.homepage = "https://github.com/stazman/wikihow_tech_topics"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
# if spec.respond_to?(:metadata)
|
21
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
# else
|
23
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
# "public gem pushes."
|
25
|
+
# end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "pry"
|
38
|
+
spec.add_dependency "nokogiri"
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wikihow_tech_topics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- stazman
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-08 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: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Provides scraped list of articles from Wikihow.com in a CLI format
|
84
|
+
email:
|
85
|
+
- cadistasio@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".DS_Store"
|
91
|
+
- ".learn"
|
92
|
+
- ".vscode/database.json"
|
93
|
+
- ".vscode/launch.json"
|
94
|
+
- CODE_OF_CONDUCT.md
|
95
|
+
- CONTRIBUTING.md
|
96
|
+
- Gemfile
|
97
|
+
- Gemfile.lock
|
98
|
+
- LICENSE.md
|
99
|
+
- LICENSE.txt
|
100
|
+
- README copy.md
|
101
|
+
- README.md
|
102
|
+
- Rakefile
|
103
|
+
- Stubs and Notes
|
104
|
+
- bin/console
|
105
|
+
- bin/setup
|
106
|
+
- bin/wikihow_tech_topics
|
107
|
+
- config/environment.rb
|
108
|
+
- lib/wikihow_tech_topics.rb
|
109
|
+
- lib/wikihow_tech_topics/cli.rb
|
110
|
+
- lib/wikihow_tech_topics/scraper.rb
|
111
|
+
- lib/wikihow_tech_topics/version.rb
|
112
|
+
- lib/wikihow_tech_topics/wikihow_tech_topic_model.rb
|
113
|
+
- spec.md
|
114
|
+
- wikihow_tech_topics.gemspec
|
115
|
+
homepage: https://github.com/stazman/wikihow_tech_topics
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 2.7.5
|
136
|
+
signing_key:
|
137
|
+
specification_version: 4
|
138
|
+
summary: My first original gem
|
139
|
+
test_files: []
|