horoscopes 0.1.1
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 +9 -0
- data/Gemfile +5 -0
- data/NOTES.md +35 -0
- data/README.md +27 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/horoscopes +5 -0
- data/bin/setup +8 -0
- data/horoscopes.gemspec +37 -0
- data/ign +10426 -0
- data/igns +17 -0
- data/lib/horoscopes/cli.rb +48 -0
- data/lib/horoscopes/scraper.rb +28 -0
- data/lib/horoscopes/version.rb +3 -0
- data/lib/horoscopes/zodiacs.rb +16 -0
- data/lib/horoscopes.rb +9 -0
- data/spec.md +6 -0
- metadata +116 -0
data/igns
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
=> [[32m#<Horoscopes::Zodiacs:0x00000002db90c8[0m
|
|
2
|
+
@name[32m=[0m[31m[1;31m"[0m[31mAries[1;31m"[0m[31m[0m,
|
|
3
|
+
@number[32m=[0m[1;34m1[0m,
|
|
4
|
+
@reading[32m=[0m
|
|
5
|
+
[31m[1;31m"[0m[31mJul 18, 2017 - Today is a great day to move forward, Aries. Your emotions are stable, leaving your heart free to take off to the clouds. Daydream. Now might be a good time to make plans with a romantic partner. Solidify your relationship and confirm your commitment to one another. If you're single, this is a good time to set a plan in motion that will put you one step closer to your greatest fantasy.[1;35m\n[0m[31mWhat's in your future? Ask a psychic nowWhat's in your future? Ask a psychic nowGet your daily horoscopes straight to your inbox!The Wheel of Fortune symbolizes the ever-changing cycle of life, wins and losses, ups and downs, unexpected luck, advancements and setbacks, success and failure [1;35m\u[0m[31m2013 the duality of things. Representing...What specific type of Aquarius are you?How to clear through the clutter of your cosmetics...Cancers should invest in this for biggest payoffs...To manage your subscriptions, please type in your email below.[1;31m"[0m[31m[0m[32m>[0m,
|
|
6
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db90a0[0m @name[32m=[0m[31m[1;31m"[0m[31mTaurus[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m2[0m[32m>[0m,
|
|
7
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db9078[0m @name[32m=[0m[31m[1;31m"[0m[31mGemini[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m3[0m[32m>[0m,
|
|
8
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db9028[0m @name[32m=[0m[31m[1;31m"[0m[31mCancer[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m4[0m[32m>[0m,
|
|
9
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db9000[0m @name[32m=[0m[31m[1;31m"[0m[31mLeo[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m5[0m[32m>[0m,
|
|
10
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db8fb0[0m @name[32m=[0m[31m[1;31m"[0m[31mVirgo[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m6[0m[32m>[0m,
|
|
11
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db8f88[0m @name[32m=[0m[31m[1;31m"[0m[31mLibra[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m7[0m[32m>[0m,
|
|
12
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db8f38[0m @name[32m=[0m[31m[1;31m"[0m[31mScorpio[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m8[0m[32m>[0m,
|
|
13
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db8f10[0m @name[32m=[0m[31m[1;31m"[0m[31mSagittarius[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m9[0m[32m>[0m,
|
|
14
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db8ee8[0m @name[32m=[0m[31m[1;31m"[0m[31mCapricorn[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m10[0m[32m>[0m,
|
|
15
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db8ec0[0m @name[32m=[0m[31m[1;31m"[0m[31mAquarius[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m11[0m[32m>[0m,
|
|
16
|
+
[32m#<Horoscopes::Zodiacs:0x00000002db8e98[0m @name[32m=[0m[31m[1;31m"[0m[31mPisces[1;31m"[0m[31m[0m, @number[32m=[0m[1;34m12[0m[32m>[0m,
|
|
17
|
+
[31m[1;31m"[0m[31mJul 18, 2017 - Today is a great day to move forward, Aries. Your emotions are stable, leaving your heart free to take off to the clouds. Daydream. Now might be a good time to make plans with a romantic partner. Solidify your relationship and confirm your commitment to one another. If you're single, this is a good time to set a plan in motion that will put you one step closer to your greatest fantasy.[1;35m\n[0m[31mWhat's in your future? Ask a psychic nowWhat's in your future? Ask a psychic nowGet your daily horoscopes straight to your inbox!The Wheel of Fortune symbolizes the ever-changing cycle of life, wins and losses, ups and downs, unexpected luck, advancements and setbacks, success and failure [1;35m\u[0m[31m2013 the duality of things. Representing...What specific type of Aquarius are you?How to clear through the clutter of your cosmetics...Cancers should invest in this for biggest payoffs...To manage your subscriptions, please type in your email below.[1;31m"[0m[31m[0m]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#CLI Controller
|
|
2
|
+
class Horoscopes::CLI
|
|
3
|
+
|
|
4
|
+
def call
|
|
5
|
+
puts "Welcome to daily horoscopes!"
|
|
6
|
+
Horoscopes::Scraper.new.signs
|
|
7
|
+
list_zodiac
|
|
8
|
+
main_menu
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def list_zodiac
|
|
12
|
+
Horoscopes::Zodiacs.all.each.with_index(1) do |sign, index|
|
|
13
|
+
puts "#{index}. #{sign.name}: #{sign.birthday}"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def main_menu
|
|
18
|
+
puts "Please enter the number of your zodiac sign from the list above:"
|
|
19
|
+
input = gets.strip.to_i
|
|
20
|
+
if input.between?(1, Horoscopes::Zodiacs.all.size)
|
|
21
|
+
puts "Today's Reading:"
|
|
22
|
+
puts Horoscopes::Scraper.new.reading[input - 1].reading
|
|
23
|
+
horoscope_reading
|
|
24
|
+
else
|
|
25
|
+
puts "Looks like that doesn't exist in the stars..."
|
|
26
|
+
main_menu
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def horoscope_reading
|
|
31
|
+
puts "Please type menu for list of zodiac signs or exit to leave:"
|
|
32
|
+
answer = gets.strip.downcase
|
|
33
|
+
case answer
|
|
34
|
+
when "exit"
|
|
35
|
+
goodbye
|
|
36
|
+
when "menu"
|
|
37
|
+
list_zodiac
|
|
38
|
+
main_menu
|
|
39
|
+
else
|
|
40
|
+
horoscope_reading
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def goodbye
|
|
45
|
+
puts "Come back later for tomorrow's horoscopes! <3"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class Horoscopes::Scraper
|
|
2
|
+
|
|
3
|
+
def signs
|
|
4
|
+
@doc = Nokogiri::HTML(open("https://www.horoscope.com/us/index.aspx"))
|
|
5
|
+
@doc.css("div.span-2.span-sm-3.span-xs-4.col").each do |signs|
|
|
6
|
+
sign = Horoscopes::Zodiacs.new
|
|
7
|
+
|
|
8
|
+
sign.name = signs.css("h3").text
|
|
9
|
+
sign.number = signs.css("a").attribute('href').value.split("=")[1]
|
|
10
|
+
sign.birthday = signs.css("p").text
|
|
11
|
+
|
|
12
|
+
sign.save
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def reading
|
|
17
|
+
@list = []
|
|
18
|
+
Horoscopes::Zodiacs.all.each do |sign|
|
|
19
|
+
number = sign.number
|
|
20
|
+
doc = Nokogiri::HTML(open("https://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign=#{number}"))
|
|
21
|
+
sign_reading = doc.css("div.horoscope-content p:first-child").text.strip
|
|
22
|
+
sign.reading = sign_reading
|
|
23
|
+
@list << sign
|
|
24
|
+
end
|
|
25
|
+
@list
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
data/lib/horoscopes.rb
ADDED
data/spec.md
ADDED
metadata
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: horoscopes
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Sohee Cho
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-11-06 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.14'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.14'
|
|
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: nokogiri
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description: CLI Ruby gem that lets you check your daily horoscope readings.
|
|
70
|
+
email:
|
|
71
|
+
- soheecho94@gmail.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- ".gitignore"
|
|
77
|
+
- Gemfile
|
|
78
|
+
- NOTES.md
|
|
79
|
+
- README.md
|
|
80
|
+
- Rakefile
|
|
81
|
+
- bin/console
|
|
82
|
+
- bin/horoscopes
|
|
83
|
+
- bin/setup
|
|
84
|
+
- horoscopes.gemspec
|
|
85
|
+
- ign
|
|
86
|
+
- igns
|
|
87
|
+
- lib/horoscopes.rb
|
|
88
|
+
- lib/horoscopes/cli.rb
|
|
89
|
+
- lib/horoscopes/scraper.rb
|
|
90
|
+
- lib/horoscopes/version.rb
|
|
91
|
+
- lib/horoscopes/zodiacs.rb
|
|
92
|
+
- spec.md
|
|
93
|
+
homepage: https://github.com/soheecho94/horoscopes-cli-app
|
|
94
|
+
licenses: []
|
|
95
|
+
metadata: {}
|
|
96
|
+
post_install_message:
|
|
97
|
+
rdoc_options: []
|
|
98
|
+
require_paths:
|
|
99
|
+
- lib
|
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ">="
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '0'
|
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
requirements: []
|
|
111
|
+
rubyforge_project:
|
|
112
|
+
rubygems_version: 2.6.12
|
|
113
|
+
signing_key:
|
|
114
|
+
specification_version: 4
|
|
115
|
+
summary: Check your daily horoscopes here!
|
|
116
|
+
test_files: []
|