rock_n_roll 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/.gitignore +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +45 -0
- data/LICENSE.txt +21 -0
- data/NOTES.md +23 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/rock-n-roll +6 -0
- data/bin/setup +8 -0
- data/lib/rock_n_roll.rb +13 -0
- data/lib/rock_n_roll/cli.rb +51 -0
- data/lib/rock_n_roll/race.rb +61 -0
- data/lib/rock_n_roll/scraper.rb +14 -0
- data/lib/rock_n_roll/version.rb +3 -0
- data/q +28 -0
- data/rock_n_roll.gemspec +38 -0
- data/spec.md +11 -0
- data/website +88 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d22bbae7144549061bf0af2026c1f00d9dbe83b98d8ccedf0a3c2787d668cbaa
|
4
|
+
data.tar.gz: ab0c5c3474d3a338069a06579142b710fe120eee68ffc8c776a9c574a7d35b2b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39417988c8d751e15fcaaca4c68f77820cd4363992a91d2ead67b6e6aa86d13786e67e6ba592aadf062753b332586cad59cc756e60204520f029581753d8ce21
|
7
|
+
data.tar.gz: d4ebf1074b433c8fa5bf1ab266727a08a7bef99f821c7e21d1b3e4ef24c77a8c7650cf2264070e4e2b5a9dc28811e1d07e9a60ab7ea25e836cc35d6cde6de3fd
|
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 'alyssa.kim@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,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rock_n_roll (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.2)
|
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.4.2)
|
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.1)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
bundler (~> 1.16)
|
39
|
+
pry
|
40
|
+
rake (~> 10.0)
|
41
|
+
rock_n_roll!
|
42
|
+
rspec
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 'Alyssa Kim'
|
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,23 @@
|
|
1
|
+
1. [x] Plan gem, imagine Interface
|
2
|
+
2. [x] Start with project structure
|
3
|
+
3. [x] Start with entry point (file run)
|
4
|
+
4. [x] Force that to build CLI Interface
|
5
|
+
5. [x] Stub out interface
|
6
|
+
6. [ ] Start making things real!
|
7
|
+
7. [ ] Discover objects
|
8
|
+
8. [ ] Code!
|
9
|
+
|
10
|
+
Interface:
|
11
|
+
|
12
|
+
Welcome user with message and list of cities where races are being held.
|
13
|
+
|
14
|
+
Ask user which race they'd like more info about.
|
15
|
+
|
16
|
+
User inputs a number corresponding to the race they'd like to learn more about.
|
17
|
+
|
18
|
+
Provide info:
|
19
|
+
[ ] date(s)
|
20
|
+
[ ] distances
|
21
|
+
[ ] race hashtag
|
22
|
+
[ ] social media links
|
23
|
+
[ ] schedule? (might be complicated...races don't seem to have schedules in same areas)
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# RockNRoll
|
2
|
+
|
3
|
+
This Ruby gem lets users view details of Rock 'n' Roll races held worldwide in the 2018-19 season via a CLI.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rock_n_roll'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rock_n_roll
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Type the text below and follow the on-screen prompts:
|
24
|
+
|
25
|
+
$ rock_n_roll
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
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.
|
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/'alyssa0528'/rock_n_roll. 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 RockNRoll project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/'alyssa0528'/rock_n_roll/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 "rock_n_roll"
|
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/rock-n-roll
ADDED
data/bin/setup
ADDED
data/lib/rock_n_roll.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#environment file
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'pry'
|
5
|
+
|
6
|
+
require_relative "./rock_n_roll/version"
|
7
|
+
require_relative "./rock_n_roll/cli"
|
8
|
+
require_relative "./rock_n_roll/race"
|
9
|
+
require_relative "./rock_n_roll/scraper"
|
10
|
+
|
11
|
+
module RockNRoll
|
12
|
+
# Your code goes here...
|
13
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class RockNRoll::CLI
|
2
|
+
|
3
|
+
def call
|
4
|
+
puts "~~~~~Welcome to the Rock 'n' Roll 2018-19 races!~~~~~"
|
5
|
+
sleep(1)
|
6
|
+
RockNRoll::Scraper.new.create_races
|
7
|
+
show_list
|
8
|
+
menu
|
9
|
+
end
|
10
|
+
|
11
|
+
def show_list
|
12
|
+
@races = RockNRoll::Race.all
|
13
|
+
@races.each.with_index(1) do |race, index|
|
14
|
+
puts "#{index}. #{race.location}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def menu
|
19
|
+
input = nil
|
20
|
+
puts "Enter the number of the race you'd like more information about. Alternatively, type 'list' to see the full list of races, or type 'exit':"
|
21
|
+
while input != "exit"
|
22
|
+
input = gets.strip.downcase
|
23
|
+
if input.to_i > 0 && input.to_i <= RockNRoll::Race.all.length
|
24
|
+
race = RockNRoll::Race.retrieve(input.to_i)
|
25
|
+
show_details(race)
|
26
|
+
puts ""
|
27
|
+
puts "Enter another number to see race details. Type 'list' to see the full list or 'exit':"
|
28
|
+
elsif input == "list"
|
29
|
+
show_list
|
30
|
+
elsif input == "exit"
|
31
|
+
exit_program
|
32
|
+
else
|
33
|
+
puts "Sorry, please enter a valid number or type 'list' or 'exit':"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def show_details(race)
|
39
|
+
puts "~*~*~*~*~*~*~* Details for #{race.location} ~*~*~*~*~*~*~*"
|
40
|
+
puts "Date(s): #{race.date}"
|
41
|
+
puts "Distance(s): #{race.distances}"
|
42
|
+
puts "Description: #{race.description}"
|
43
|
+
puts "Event Hashtag: #{race.hashtag}"
|
44
|
+
puts "Event URL: #{race.url}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def exit_program
|
48
|
+
puts "Thanks for checking, and keep on training!"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class RockNRoll::Race
|
2
|
+
attr_accessor :location, :url, :date, :distances, :description, :hashtag
|
3
|
+
|
4
|
+
@@all = []
|
5
|
+
|
6
|
+
def initialize(location = nil, url = nil)
|
7
|
+
@location = location
|
8
|
+
@url = url
|
9
|
+
@@all << self
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.new_from_list(race)
|
13
|
+
url = race.css("h5 a").attribute("href").text
|
14
|
+
if !url.end_with?("/")
|
15
|
+
url += "/"
|
16
|
+
end
|
17
|
+
self.new(race.css("h5 a").text, url)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.all
|
21
|
+
@@all
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.retrieve(input)
|
25
|
+
self.all[input.to_i - 1]
|
26
|
+
end
|
27
|
+
|
28
|
+
def race_site
|
29
|
+
@race_site ||= Nokogiri::HTML(open(self.url))
|
30
|
+
end
|
31
|
+
|
32
|
+
def date
|
33
|
+
@date = race_site.search("#hero span strong").text.strip
|
34
|
+
end
|
35
|
+
|
36
|
+
def description
|
37
|
+
@description = race_site.search("#features div.column p").first.text
|
38
|
+
if @description == "Leer Más"
|
39
|
+
@description = "Please click on the race's URL for more information."
|
40
|
+
else
|
41
|
+
@description
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def hashtag
|
46
|
+
@hashtag = race_site.search("#ribbon div.hash").text.chomp(' /')
|
47
|
+
end
|
48
|
+
|
49
|
+
def distances
|
50
|
+
@race_distances = []
|
51
|
+
distance_url = self.url + "the-races/distances/"
|
52
|
+
@distance_site = Nokogiri::HTML(open(distance_url))
|
53
|
+
@distance_site.search("div.sidenav").each do |distances|
|
54
|
+
distances.search("a").collect do |distance| #iterate through the XML of distances
|
55
|
+
race_distance = distance.text
|
56
|
+
@race_distances << race_distance
|
57
|
+
end
|
58
|
+
end
|
59
|
+
@distances = @race_distances.join(", ")
|
60
|
+
end
|
61
|
+
end
|
data/q
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
[1mFrom:[0m /home/alyssa0528/cli-data-gem-assessment-v-000/rock_n_roll/lib/rock_n_roll/scraper.rb @ line 40 RockNRoll::Scraper#scrape_race_details:
|
3
|
+
|
4
|
+
[1;34m21[0m: [32mdef[0m [1;34mscrape_race_details[0m
|
5
|
+
[1;34m22[0m: scrape_races
|
6
|
+
[1;34m23[0m: @all_races.collect {|r| r.url}.each [32mdo[0m |website| [1;34m#creates new array of just urls[0m
|
7
|
+
[1;34m24[0m: @doc = [1;34;4mNokogiri[0m::HTML(open(website)) [1;34m#get HTML of each indiv race site[0m
|
8
|
+
[1;34m25[0m:
|
9
|
+
[1;34m26[0m: [1;34m#@doc.search("#hero").each do |header| #loops through the urls, specifically the header section at top of page[0m
|
10
|
+
[1;34m27[0m: [1;34m# binding.pry[0m
|
11
|
+
[1;34m28[0m: [1;34m# @race.date = header.css("span.subhead").attribute("datetime").value[0m
|
12
|
+
[1;34m29[0m: [1;34m#end[0m
|
13
|
+
[1;34m30[0m:
|
14
|
+
[1;34m31[0m: [1;34m#@doc.search("#ribbon").each do |social_media|[0m
|
15
|
+
[1;34m32[0m: [1;34m#binding.pry[0m
|
16
|
+
[1;34m33[0m: [1;34m# @race.hashtag = social_media.css("div.hash").text[0m
|
17
|
+
[1;34m34[0m: [1;34m# @race.twitter = social_media.css("div.twitter a").attribute("href").text[0m
|
18
|
+
[1;34m35[0m: [1;34m# @race.facebook = social_media.css("div.facebook a").attribute("href").text[0m
|
19
|
+
[1;34m36[0m: [1;34m# @race.instagram = social_media.css("div.instagram a").attribute("href").text[0m
|
20
|
+
[1;34m37[0m: [1;34m# end[0m
|
21
|
+
[1;34m38[0m:
|
22
|
+
[1;34m39[0m: @doc.search([31m[1;31m"[0m[31m#races[1;31m"[0m[31m[0m).each [32mdo[0m |distance|
|
23
|
+
=> [1;34m40[0m: binding.pry
|
24
|
+
[1;34m41[0m: [1;34m# @race.distances = distance.css("h3").text[0m
|
25
|
+
[1;34m42[0m: [32mend[0m
|
26
|
+
[1;34m43[0m: [32mend[0m
|
27
|
+
[1;34m44[0m: [32mend[0m
|
28
|
+
|
data/rock_n_roll.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "rock_n_roll/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rock_n_roll"
|
8
|
+
spec.version = RockNRoll::VERSION
|
9
|
+
spec.authors = ["'Alyssa Kim'"]
|
10
|
+
spec.email = ["'alyssa.kim@gmail.com'"]
|
11
|
+
|
12
|
+
spec.summary = %q{This gem returns information about Rock 'n' Roll races around the world.}
|
13
|
+
spec.description = %q{This gem provides information on cities, dates, distances, hashtags, and URLs to Rock 'n' Roll races worldwide.}
|
14
|
+
spec.homepage = "https://github.com/alyssa0528/rock_n_roll"
|
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 si#ngle host or delete this section to allow pushing to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata["allowed_push_host"] = "#TO: Set to '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 = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |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 "pry"
|
36
|
+
spec.add_development_dependency "rspec"
|
37
|
+
spec.add_dependency "nokogiri"
|
38
|
+
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
|
+
My CLI class contains methods (#show_list, #menu, #show_details, #exit_program) that represent the different stages in the CLI. The #show_list and #menu methods are encapsulated in the #call method, while the others are encapsulated in the #menu method.
|
6
|
+
|
7
|
+
- [x] Pull data from an external source
|
8
|
+
My data comes from three pages on the runrocknroll.com site. The cities and URLs for each individual race come from the runrocknroll.com homepage. The date, description, and event hashtag attributes were scraped from each individual race page. The distance information was scraped from a "Distances" page that exist for every race site (i.e., http://www.runrocknroll.com/raleigh/the-races/distances/).
|
9
|
+
|
10
|
+
- [x] Implement both list and detail views
|
11
|
+
Upon starting the CLI, the user is shown a list of scraped cities from runrocknroll.com. The user is prompted to select one of the races (by number) and he/she is then shown details (date, distances, description, the event hashtag, and the race-specific URL).
|
data/website
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
=> [[32m#<RockNRoll::Race:0x00000001520138[0m @location[32m=[0m[1;36mnil[0m, @url[32m=[0m[1;36mnil[0m[32m>[0m,
|
2
|
+
[32m#<RockNRoll::Race:0x00000000c92818[0m
|
3
|
+
@location[32m=[0m[31m[1;31m"[0m[31mGuangzhou[1;31m"[0m[31m[0m,
|
4
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/guangzhou/[1;31m"[0m[31m[0m[32m>[0m,
|
5
|
+
[32m#<RockNRoll::Race:0x00000000c909c8[0m
|
6
|
+
@location[32m=[0m[31m[1;31m"[0m[31mSan Francisco[1;31m"[0m[31m[0m,
|
7
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/san-francisco/[1;31m"[0m[31m[0m[32m>[0m,
|
8
|
+
[32m#<RockNRoll::Race:0x00000000c86540[0m
|
9
|
+
@location[32m=[0m[31m[1;31m"[0m[31mRaleigh[1;31m"[0m[31m[0m,
|
10
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/raleigh/[1;31m"[0m[31m[0m[32m>[0m,
|
11
|
+
[32m#<RockNRoll::Race:0x00000000c7bbb8[0m
|
12
|
+
@location[32m=[0m[31m[1;31m"[0m[31mMadrid[1;31m"[0m[31m[0m,
|
13
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/madrid/[1;31m"[0m[31m[0m[32m>[0m,
|
14
|
+
[32m#<RockNRoll::Race:0x00000000c78030[0m
|
15
|
+
@location[32m=[0m[31m[1;31m"[0m[31mNashville[1;31m"[0m[31m[0m,
|
16
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/nashville/[1;31m"[0m[31m[0m[32m>[0m,
|
17
|
+
[32m#<RockNRoll::Race:0x00000000c65818[0m
|
18
|
+
@location[32m=[0m[31m[1;31m"[0m[31mOaxaca[1;31m"[0m[31m[0m,
|
19
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/oaxaca/[1;31m"[0m[31m[0m[32m>[0m,
|
20
|
+
[32m#<RockNRoll::Race:0x00000000c61128[0m
|
21
|
+
@location[32m=[0m[31m[1;31m"[0m[31mLiverpool[1;31m"[0m[31m[0m,
|
22
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/liverpool/[1;31m"[0m[31m[0m[32m>[0m,
|
23
|
+
[32m#<RockNRoll::Race:0x00000000c55c60[0m
|
24
|
+
@location[32m=[0m[31m[1;31m"[0m[31mSan Diego[1;31m"[0m[31m[0m,
|
25
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/san-diego/[1;31m"[0m[31m[0m[32m>[0m,
|
26
|
+
[32m#<RockNRoll::Race:0x00000000c4a5b8[0m
|
27
|
+
@location[32m=[0m[31m[1;31m"[0m[31mSeattle[1;31m"[0m[31m[0m,
|
28
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/seattle/[1;31m"[0m[31m[0m[32m>[0m,
|
29
|
+
[32m#<RockNRoll::Race:0x00000000c49500[0m
|
30
|
+
@location[32m=[0m[31m[1;31m"[0m[31mMonterrey[1;31m"[0m[31m[0m,
|
31
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/monterrey/[1;31m"[0m[31m[0m[32m>[0m,
|
32
|
+
[32m#<RockNRoll::Race:0x00000000c483d0[0m
|
33
|
+
@location[32m=[0m[31m[1;31m"[0m[31mChicago[1;31m"[0m[31m[0m,
|
34
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/chicago/[1;31m"[0m[31m[0m[32m>[0m,
|
35
|
+
[32m#<RockNRoll::Race:0x00000000c3ded0[0m
|
36
|
+
@location[32m=[0m[31m[1;31m"[0m[31mDublin[1;31m"[0m[31m[0m,
|
37
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/dublin/[1;31m"[0m[31m[0m[32m>[0m,
|
38
|
+
[32m#<RockNRoll::Race:0x00000000c2fb00[0m
|
39
|
+
@location[32m=[0m[31m[1;31m"[0m[31mVirginia Beach[1;31m"[0m[31m[0m,
|
40
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/virginia-beach/[1;31m"[0m[31m[0m[32m>[0m,
|
41
|
+
[32m#<RockNRoll::Race:0x00000000c223d8[0m
|
42
|
+
@location[32m=[0m[31m[1;31m"[0m[31mPhiladelphia[1;31m"[0m[31m[0m,
|
43
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/philadelphia/[1;31m"[0m[31m[0m[32m>[0m,
|
44
|
+
[32m#<RockNRoll::Race:0x00000000c20bf0[0m
|
45
|
+
@location[32m=[0m[31m[1;31m"[0m[31mMontréal[1;31m"[0m[31m[0m,
|
46
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/montreal/[1;31m"[0m[31m[0m[32m>[0m,
|
47
|
+
[32m#<RockNRoll::Race:0x00000000c13338[0m
|
48
|
+
@location[32m=[0m[31m[1;31m"[0m[31mSan Jose[1;31m"[0m[31m[0m,
|
49
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/san-jose/[1;31m"[0m[31m[0m[32m>[0m,
|
50
|
+
[32m#<RockNRoll::Race:0x00000000c063b8[0m
|
51
|
+
@location[32m=[0m[31m[1;31m"[0m[31mDenver[1;31m"[0m[31m[0m,
|
52
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/denver/[1;31m"[0m[31m[0m[32m>[0m,
|
53
|
+
[32m#<RockNRoll::Race:0x00000000bf6670[0m
|
54
|
+
@location[32m=[0m[31m[1;31m"[0m[31mLos Angeles[1;31m"[0m[31m[0m,
|
55
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/los-angeles/[1;31m"[0m[31m[0m[32m>[0m,
|
56
|
+
[32m#<RockNRoll::Race:0x00000000be93f8[0m
|
57
|
+
@location[32m=[0m[31m[1;31m"[0m[31mSavannah[1;31m"[0m[31m[0m,
|
58
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/savannah/[1;31m"[0m[31m[0m[32m>[0m,
|
59
|
+
[32m#<RockNRoll::Race:0x00000000be4bc8[0m
|
60
|
+
@location[32m=[0m[31m[1;31m"[0m[31mMerida[1;31m"[0m[31m[0m,
|
61
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/merida/[1;31m"[0m[31m[0m[32m>[0m,
|
62
|
+
[32m#<RockNRoll::Race:0x00000000be3548[0m
|
63
|
+
@location[32m=[0m[31m[1;31m"[0m[31mLas Vegas[1;31m"[0m[31m[0m,
|
64
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/las-vegas/[1;31m"[0m[31m[0m[32m>[0m,
|
65
|
+
[32m#<RockNRoll::Race:0x00000000be1040[0m
|
66
|
+
@location[32m=[0m[31m[1;31m"[0m[31mSan Antonio[1;31m"[0m[31m[0m,
|
67
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/san-antonio/[1;31m"[0m[31m[0m[32m>[0m,
|
68
|
+
[32m#<RockNRoll::Race:0x00000000bdbb90[0m
|
69
|
+
@location[32m=[0m[31m[1;31m"[0m[31mArizona[1;31m"[0m[31m[0m,
|
70
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/arizona/[1;31m"[0m[31m[0m[32m>[0m,
|
71
|
+
[32m#<RockNRoll::Race:0x00000000bda880[0m
|
72
|
+
@location[32m=[0m[31m[1;31m"[0m[31mNew Orleans[1;31m"[0m[31m[0m,
|
73
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/new-orleans/[1;31m"[0m[31m[0m[32m>[0m,
|
74
|
+
[32m#<RockNRoll::Race:0x00000000bd94a8[0m
|
75
|
+
@location[32m=[0m[31m[1;31m"[0m[31mWashington DC[1;31m"[0m[31m[0m,
|
76
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/dc/[1;31m"[0m[31m[0m[32m>[0m,
|
77
|
+
[32m#<RockNRoll::Race:0x00000000bd8468[0m
|
78
|
+
@location[32m=[0m[31m[1;31m"[0m[31mDallas[1;31m"[0m[31m[0m,
|
79
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/dallas/[1;31m"[0m[31m[0m[32m>[0m,
|
80
|
+
[32m#<RockNRoll::Race:0x00000000bc3ab8[0m
|
81
|
+
@location[32m=[0m[31m[1;31m"[0m[31mCarlsbad 5000[1;31m"[0m[31m[0m,
|
82
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/carlsbad-5000/[1;31m"[0m[31m[0m[32m>[0m,
|
83
|
+
[32m#<RockNRoll::Race:0x00000000baaa68[0m
|
84
|
+
@location[32m=[0m[31m[1;31m"[0m[31mChengdu[1;31m"[0m[31m[0m,
|
85
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/chengdu/[1;31m"[0m[31m[0m[32m>[0m,
|
86
|
+
[32m#<RockNRoll::Race:0x00000000ba8768[0m
|
87
|
+
@location[32m=[0m[31m[1;31m"[0m[31mLuoping[1;31m"[0m[31m[0m,
|
88
|
+
@url[32m=[0m[31m[1;31m"[0m[31mhttp://www.runrocknroll.com/luoping/[1;31m"[0m[31m[0m[32m>[0m]
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rock_n_roll
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "'Alyssa Kim'"
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-05 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: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
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: This gem provides information on cities, dates, distances, hashtags,
|
84
|
+
and URLs to Rock 'n' Roll races worldwide.
|
85
|
+
email:
|
86
|
+
- "'alyssa.kim@gmail.com'"
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- CODE_OF_CONDUCT.md
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- NOTES.md
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/rock-n-roll
|
101
|
+
- bin/setup
|
102
|
+
- lib/rock_n_roll.rb
|
103
|
+
- lib/rock_n_roll/cli.rb
|
104
|
+
- lib/rock_n_roll/race.rb
|
105
|
+
- lib/rock_n_roll/scraper.rb
|
106
|
+
- lib/rock_n_roll/version.rb
|
107
|
+
- q
|
108
|
+
- rock_n_roll.gemspec
|
109
|
+
- spec.md
|
110
|
+
- website
|
111
|
+
homepage: https://github.com/alyssa0528/rock_n_roll
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.7.6
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: This gem returns information about Rock 'n' Roll races around the world.
|
135
|
+
test_files: []
|