rock_n_roll 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rock_n_roll/cli.rb +11 -7
- data/lib/rock_n_roll/race.rb +15 -9
- data/lib/rock_n_roll/scraper.rb +2 -2
- data/lib/rock_n_roll/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3eaa3a47503a0da3cf6f05a5bddf96eb9d62da029279ff8a7fa152cfb435f1d
|
4
|
+
data.tar.gz: e38a3a7cd70f3aa0168744a89250c511dfd47a911a1d4b3d084e3eb0a468b597
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3746f2947e560b4f18ee65056c4913fc19c17a4781cc167edca55d7ec57ea1d1a4306ee3a6739e3eb1509beb84f29fabbb281f1259b93f1ca9036ec28b14f7c2
|
7
|
+
data.tar.gz: 313a32473adb84e94aae7ec63f69f3c92d83c3bcffd527f19d991fd5133ac1cfa8047ec1a15458ce3e205778485bc32c138c25d093ffb38c29044fe56eb7cfef
|
data/lib/rock_n_roll/cli.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class RockNRoll::CLI
|
2
2
|
|
3
3
|
def call
|
4
|
-
puts "~~~~~Welcome to the Rock 'n' Roll
|
4
|
+
puts "~~~~~Welcome to the Rock 'n' Roll 2019-20 races!~~~~~"
|
5
5
|
sleep(1)
|
6
6
|
RockNRoll::Scraper.new.create_races
|
7
7
|
show_list
|
@@ -36,12 +36,16 @@ class RockNRoll::CLI
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def show_details(race)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
if race.location != "TBD"
|
40
|
+
puts "~*~*~*~*~*~*~* Details for #{race.location} ~*~*~*~*~*~*~*"
|
41
|
+
puts "Date(s): #{race.date}"
|
42
|
+
puts "Distance(s): #{race.distances}"
|
43
|
+
puts "Description: #{race.description}"
|
44
|
+
puts "Event Hashtag: #{race.hashtag}"
|
45
|
+
puts "Event URL: #{race.url}"
|
46
|
+
else
|
47
|
+
puts "Check back again soon for more details for this race!"
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
def exit_program
|
data/lib/rock_n_roll/race.rb
CHANGED
@@ -10,11 +10,17 @@ class RockNRoll::Race
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.new_from_list(race)
|
13
|
-
|
13
|
+
location = race.css("h3 a").text
|
14
|
+
if location == ""
|
15
|
+
location = "TBD"
|
16
|
+
end
|
17
|
+
url = "https://www.runrocknroll.com" + race.css("h3 a").attribute("href").text
|
14
18
|
if !url.end_with?("/")
|
15
19
|
url += "/"
|
20
|
+
elsif url == ""
|
21
|
+
url = "TBD"
|
16
22
|
end
|
17
|
-
self.new(
|
23
|
+
self.new(location, url)
|
18
24
|
end
|
19
25
|
|
20
26
|
def self.all
|
@@ -30,12 +36,12 @@ class RockNRoll::Race
|
|
30
36
|
end
|
31
37
|
|
32
38
|
def date
|
33
|
-
@date = race_site.search("
|
39
|
+
@date = race_site.search("h3 time").text.strip
|
34
40
|
end
|
35
41
|
|
36
42
|
def description
|
37
|
-
@description = race_site.search("
|
38
|
-
if @description == "Leer Más"
|
43
|
+
@description = race_site.search(".caption p").first.text.strip
|
44
|
+
if @description == "Leer Más" || @description == ""
|
39
45
|
@description = "Please click on the race's URL for more information."
|
40
46
|
else
|
41
47
|
@description
|
@@ -43,16 +49,16 @@ class RockNRoll::Race
|
|
43
49
|
end
|
44
50
|
|
45
51
|
def hashtag
|
46
|
-
|
52
|
+
@hashtag = race_site.search(".twitter-handle").text.chomp(' /').strip
|
47
53
|
end
|
48
54
|
|
49
55
|
def distances
|
50
56
|
@race_distances = []
|
51
|
-
distance_url = self.url + "the-races/
|
57
|
+
distance_url = self.url + "the-races/courses/"
|
52
58
|
@distance_site = Nokogiri::HTML(open(distance_url))
|
53
|
-
@distance_site.search("div.
|
59
|
+
@distance_site.search("div ul.nav-justified li").each do |distances|
|
54
60
|
distances.search("a").collect do |distance| #iterate through the XML of distances
|
55
|
-
race_distance = distance.text
|
61
|
+
race_distance = distance.text.strip
|
56
62
|
@race_distances << race_distance
|
57
63
|
end
|
58
64
|
end
|
data/lib/rock_n_roll/scraper.rb
CHANGED
data/lib/rock_n_roll/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock_n_roll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Alyssa Kim'"
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.7.
|
131
|
+
rubygems_version: 2.7.7
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: This gem returns information about Rock 'n' Roll races around the world.
|