sharks_ahead 0.1.6 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 799ed924ab9bdaf5017dd61b0d2e8269b6d97f51
4
- data.tar.gz: 580e4bc937f664fc6f6f475bdc24e215eb33f9bc
3
+ metadata.gz: 677949237ec9525dcba486700690d2e37e9d06d2
4
+ data.tar.gz: 50964e5576720b0f7c19cb722c822e348f244c43
5
5
  SHA512:
6
- metadata.gz: 6666011882fc3d10d8d6662c6f0c764918fb0a8065a2dc18919191a175d667fd51633fb8edd46da55d8095950a6b57238b68e05f32b3349c19f7c46898a0c3a3
7
- data.tar.gz: fd1ec5eeba9af90bc558d8a6348d19dd12ab2f55cb4e76d86f45043878c8170e213468778d1e194112976f9d3d5f88f4df3da6511fab5885b311fb026d8bece3
6
+ metadata.gz: a84d6b2756f34aa30f96b7e81b7d33a072546530a3b81b35c90206ddc7b90585357f573264491da7d70a037bfb455216b21415919b8e2e701614a55bb3346986
7
+ data.tar.gz: 47638a493767ea28fb9fd399856d76769b49a6ecc68aa72d070e02d9601876f28e56c356e85503ce9b3c5f7595958c2423160d5cde30dca60458ca94ac601184
data/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ Version 0.2.0 - fixed broken links in shark-extinct, added word wrap, changed version
data/README.md CHANGED
@@ -1,43 +1,43 @@
1
- # SharksAhead
2
-
3
-
4
- [![Gem Version](https://badge.fury.io/rb/sharks_ahead.svg)](https://badge.fury.io/rb/sharks_ahead)
5
-
6
- SharksAhead cli gem was built to scrape and display information about living and extinct shark species.
7
-
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
11
-
12
- ```ruby
13
- gem 'sharks_ahead'
14
- ```
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself as:
21
-
22
- $ gem install sharks_ahead
23
-
24
- ## Usage
25
-
26
- ![Thar be sharks ahead! screenshot](https://cloud.githubusercontent.com/assets/18357112/16693613/f4115a9c-4503-11e6-81a9-6b41a4ccb3be.jpg)
27
-
28
- With a pirate theme, this gem is intended to be educational and amusing for all ages. After installing gem, execute with command "sharks-ahead".
29
-
30
- ## Development
31
-
32
- 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.
33
-
34
- 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).
35
-
36
- ## Contributing
37
-
38
- Bug reports and pull requests are welcome on GitHub at https://github.com/becky000/sharks_ahead. 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.
39
-
40
-
41
- ## License
42
-
43
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
1
+ # SharksAhead
2
+
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/sharks_ahead.svg)](https://badge.fury.io/rb/sharks_ahead)
5
+
6
+ SharksAhead cli gem was built to scrape and display information about living and extinct shark species.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'sharks_ahead'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install sharks_ahead
23
+
24
+ ## Usage
25
+
26
+ ![Thar be sharks ahead! screenshot](https://cloud.githubusercontent.com/assets/18357112/17081473/01747f36-5128-11e6-9885-723f210cf288.JPG)
27
+
28
+ With a pirate theme, this gem is intended to be educational and amusing for all ages. After installing gem, execute with command "sharks-ahead".
29
+
30
+ ## Development
31
+
32
+ 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.
33
+
34
+ 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).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/becky000/sharks_ahead. 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.
39
+
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/bin/sharks-ahead CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../lib/sharks_ahead'
4
-
5
- SharksAhead::CLI.new.call
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/sharks_ahead'
4
+
5
+ SharksAhead::CLI.new.call
@@ -1,168 +1,183 @@
1
- class SharksAhead::CLI
2
-
3
- def call
4
- welcome
5
- end
6
-
7
- def welcome
8
- puts "\e[H\e[2J"
9
- # text art generator at http://fsymbols.com/generators/carty/
10
- puts <<-DOC
11
- ╔═══╗ ╔╗ ╔╗ ╔═══╗ ╔═══╗ ╔╗╔═╗ ╔╗
12
- ║╔═╗║ ║║ ║║ ║╔═╗║ ║╔═╗║ ║║║╔╝ ║║
13
- ║╚══╗ ║╚═╝║ ║║ ║║ ║╚═╝║ ║╚╝╝ ║║
14
- ╚══╗║ ║╔═╗║ ║╚═╝║ ║╔╗╔╝ ║╔╗║ ╚╝
15
- ║╚═╝║ ║║ ║║ ║╔═╗║ ║║║╚╗ ║║║╚╗ ╔╗
16
- ╚═══╝ ╚╝ ╚╝ ╚╝ ╚╝ ╚╝╚═╝ ╚╝╚═╝ ╚╝
17
- DOC
18
-
19
- # ascii ship art from http://chris.com/ascii/index.php?art=transportation/nautical
20
- puts " _~"
21
- puts " _~ )_)_~ "
22
- puts " )_))_))_) Thar be sharks ahead! "
23
- puts " _!__!__!_"
24
- puts " ~ ~ \\______t/"
25
- puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\\~~~~~~~|\\~~~~~~~~~~~~~~~~"
26
- print "\nAre ye prepared to look fer 'em? Tell me! Yes or no? "
27
-
28
- answer_look = nil
29
- while answer_look != "exit"
30
- answer_look = gets.chomp
31
- case answer_look
32
- when /^(y|yes)$/i then answer_yes
33
- when /^(n|no)$/i then goodbye1
34
- else belay_that
35
- end
36
- end
37
- end
38
-
39
- def answer_yes
40
- puts "\e[H\e[2J"
41
- # ascii shark art from http://www.ascii-art.de/ascii/s/sharks.txt
42
- puts " , "
43
- puts " .'; "
44
- puts " .-'` .' "
45
- puts " ,`.-'-.`\ "
46
- puts " ; / '-'"
47
- puts " | \ ,-,"
48
- puts " \ '-.__ )_`'._ "
49
- puts " '. ``` ``'--._ "
50
- puts " .-' , `'-. Are ye lookin' fer dead sharks"
51
- puts " '-'`-._ (( o ) or livin'? Tell me!"
52
- puts " `'--....(`- ,__..--' "
53
- print " '-'` Dead or alive? "
54
-
55
- answer_dead_or_alive = nil
56
- while answer_dead_or_alive != "exit"
57
- answer_dead_or_alive = gets.chomp
58
- case answer_dead_or_alive
59
- when /^(d|dead)$/i then list_extinct
60
- when /^(a|alive)$/i then list_living
61
- when /^(e|exit)$/i then goodbye2
62
- else belay_that
63
- end
64
- end
65
- end
66
-
67
- def list_extinct
68
- puts "\nWe'll be lookin' fer extinct ones. Here y'arr:\n\n"
69
-
70
- @shark_extinct = SharksAhead::SharkExtinct.get_extinct_sharks
71
- @shark_extinct.each.with_index(1) do |shark, i|
72
- printf "%3s - %-50s\n", i, shark[:name]
73
- end
74
- description_extinct
75
- end
76
-
77
- def description_extinct
78
- extinct_input = nil
79
- while extinct_input != "exit"
80
- give_choices
81
-
82
- extinct_input = gets.chomp
83
- the_shark = @shark_extinct[extinct_input.to_i-1]
84
-
85
- case extinct_input
86
- when /([1-7])/ then puts "\n#{the_shark[:description]}\n\n"
87
- when /^(l|list)$/i then list_extinct
88
- when /^(e|exit)$/i then goodbye2
89
- when /^(s|start)$/i then welcome
90
- else belay_that
91
- end
92
- end
93
- end
94
-
95
- def list_living
96
- puts "\nLet's find thee a livin' one!\n\n"
97
-
98
- @shark_living = SharksAhead::SharkLiving.get_living_sharks
99
- @shark_living.each.with_index(1) do |shark, i|
100
- printf "%3s - %-50s\n", i, shark[:name]
101
- end
102
- description_living
103
- end
104
-
105
- def description_living
106
- living_input = nil
107
- while living_input != "exit"
108
- give_choices
109
-
110
- living_input = gets.chomp
111
- the_shark = @shark_living[living_input.to_i-1]
112
-
113
- case living_input
114
- when /([1-7])/ then puts "\n#{the_shark[:description]}\n\n"
115
- when /^(l|list)$/i then list_living
116
- when /^(e|exit)$/i then goodbye2
117
- when /^(s|start)$/i then welcome
118
- else belay_that
119
- end
120
- end
121
- end
122
-
123
- def give_choices
124
- puts "\nWhat's yer lucky number? Else ye may abandon ship by typin' exit."
125
- puts "If ye cannot recall the list, type list."
126
- print "If ye wish to start again, ye may type start. "
127
- end
128
-
129
- def goodbye1
130
- puts "\nWell then, ye must be a wee babe. I'll sing ye a lullaby instead.\n\n"
131
-
132
- # Seal Lullaby from The Jungle Book by Rudyard Kipling
133
- # http://www.poetryloverspage.com/poets/kipling/seal_lullaby.html
134
- puts <<-DOC
135
- Oh! hush thee, my baby, the night is behind us,
136
- And black are the waters that sparkled so green.
137
- The moon, o'er the combers, looks downward to find us
138
- At rest in the hollows that rustle between.
139
- Where billow meets billow, there soft be thy pillow;
140
- Ah, weary wee flipperling, curl at thy ease!
141
- The storm shall not wake thee, nor shark overtake thee,
142
- Asleep in the arms of the slow-swinging seas.
143
- DOC
144
-
145
- puts "\nCome back to see me when ye get yer mettle up."
146
- ship_end
147
- exit
148
- end
149
-
150
- def goodbye2
151
- puts "\nFare thee well me matey. Ye may join me crew again anytime!\n\n"
152
- ship_end
153
- exit
154
- end
155
-
156
- def belay_that
157
- print "\nBelay that! Ye must make a proper choice. "
158
- end
159
-
160
- def ship_end
161
- puts " . _~ *"
162
- puts " . * _~ )_)_~"
163
- puts " * )_))_))_)"
164
- puts " * . * . _!__!__!_ ."
165
- puts " \\______t/"
166
- puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
167
- end
168
- end
1
+ class SharksAhead::CLI
2
+
3
+ def call
4
+ welcome
5
+ end
6
+
7
+ def welcome
8
+ puts "\e[H\e[2J"
9
+ # text art generator at http://fsymbols.com/generators/carty/
10
+ puts <<-DOC
11
+ ╔═══╗ ╔╗ ╔╗ ╔═══╗ ╔═══╗ ╔╗╔═╗ ╔╗
12
+ ║╔═╗║ ║║ ║║ ║╔═╗║ ║╔═╗║ ║║║╔╝ ║║
13
+ ║╚══╗ ║╚═╝║ ║║ ║║ ║╚═╝║ ║╚╝╝ ║║
14
+ ╚══╗║ ║╔═╗║ ║╚═╝║ ║╔╗╔╝ ║╔╗║ ╚╝
15
+ ║╚═╝║ ║║ ║║ ║╔═╗║ ║║║╚╗ ║║║╚╗ ╔╗
16
+ ╚═══╝ ╚╝ ╚╝ ╚╝ ╚╝ ╚╝╚═╝ ╚╝╚═╝ ╚╝
17
+ DOC
18
+
19
+ # ascii ship art from http://chris.com/ascii/index.php?art=transportation/nautical
20
+ puts " _~"
21
+ puts " _~ )_)_~ "
22
+ puts " )_))_))_) Thar be sharks ahead! "
23
+ puts " _!__!__!_"
24
+ puts " ~ ~ \\______t/"
25
+ puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\\~~~~~~~|\\~~~~~~~~~~~~~~~~"
26
+ print "\nAre ye prepared to look fer 'em? Tell me! Yes or no? "
27
+
28
+ answer_look
29
+ end
30
+
31
+ def answer_look
32
+ answer = nil
33
+ while answer != "exit"
34
+ answer = gets.chomp
35
+ case answer
36
+ when /^(y|yes)$/i then answer_yes
37
+ when /^(n|no)$/i then goodbye1
38
+ else belay_that
39
+ end
40
+ end
41
+ end
42
+
43
+ def answer_yes
44
+ puts "\e[H\e[2J"
45
+ # ascii shark art from http://www.ascii-art.de/ascii/s/sharks.txt
46
+ puts " , "
47
+ puts " .'; "
48
+ puts " .-'` .' "
49
+ puts " ,`.-'-.`\ "
50
+ puts " ; / '-'"
51
+ puts " | \ ,-,"
52
+ puts " \ '-.__ )_`'._ "
53
+ puts " '. ``` ``'--._ "
54
+ puts " .-' , `'-. Are ye lookin' fer dead sharks"
55
+ puts " '-'`-._ (( o ) or livin'? Tell me!"
56
+ puts " `'--....(`- ,__..--' "
57
+ print " '-'` Dead or alive? "
58
+
59
+ answer_dead_or_alive
60
+ end
61
+
62
+ def answer_dead_or_alive
63
+ answer = nil
64
+ while answer != "exit"
65
+ answer = gets.chomp
66
+ case answer
67
+ when /^(d|dead)$/i then list_extinct
68
+ when /^(a|alive)$/i then list_living
69
+ when /^(e|exit)$/i then goodbye2
70
+ else belay_that
71
+ end
72
+ end
73
+ end
74
+
75
+ def list_extinct
76
+ puts "\nWe'll be lookin' fer extinct ones. Here y'arr:\n\n"
77
+
78
+ @shark_extinct = SharksAhead::SharkExtinct.get_extinct_sharks
79
+ @shark_extinct.each.with_index(1) do |shark, i|
80
+ printf "%3s - %-50s\n", i, shark[:name]
81
+ end
82
+ description_extinct
83
+ end
84
+
85
+ def description_extinct
86
+ extinct_input = nil
87
+ while extinct_input != "exit"
88
+ give_choices
89
+
90
+ extinct_input = gets.chomp
91
+ the_shark = @shark_extinct[extinct_input.to_i-1]
92
+
93
+ case extinct_input
94
+ when /([1-7])/ then puts word_wrap("\n#{the_shark[:description]}\n\n", 75)
95
+ when /^(l|list)$/i then list_extinct
96
+ when /^(e|exit)$/i then goodbye2
97
+ when /^(s|start)$/i then welcome
98
+ else belay_that
99
+ end
100
+ end
101
+ end
102
+
103
+ def list_living
104
+ puts "\nLet's find thee a livin' one!\n\n"
105
+
106
+ @shark_living = SharksAhead::SharkLiving.get_living_sharks
107
+ @shark_living.each.with_index(1) do |shark, i|
108
+ printf "%3s - %-50s\n", i, shark[:name]
109
+ end
110
+ description_living
111
+ end
112
+
113
+ def description_living
114
+ living_input = nil
115
+ while living_input != "exit"
116
+ give_choices
117
+
118
+ living_input = gets.chomp
119
+ the_shark = @shark_living[living_input.to_i-1]
120
+
121
+ case living_input
122
+ when /([1-7])/ then puts word_wrap("\n#{the_shark[:description]}\n\n", 75)
123
+ when /^(l|list)$/i then list_living
124
+ when /^(e|exit)$/i then goodbye2
125
+ when /^(s|start)$/i then welcome
126
+ else belay_that
127
+ end
128
+ end
129
+ end
130
+
131
+ def give_choices
132
+ puts "\nWhat's yer lucky number? Else ye may abandon ship by typin' exit."
133
+ puts "If ye cannot recall the list, type list."
134
+ print "If ye wish to start again, ye may type start. "
135
+ end
136
+
137
+ # Word wrap from Ruby Cookbook
138
+ def word_wrap(text, width = 70)
139
+ text.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
140
+ end
141
+
142
+ def goodbye1
143
+ puts "\nWell then, ye must be a wee babe. I'll sing ye a lullaby instead.\n\n"
144
+ lullaby
145
+ puts "\nCome back to see me when ye get yer mettle up."
146
+ ship_end
147
+ exit
148
+ end
149
+
150
+ def goodbye2
151
+ puts "\nFare thee well me matey. Ye may join me crew again anytime!\n\n"
152
+ ship_end
153
+ exit
154
+ end
155
+
156
+ def belay_that
157
+ print "\nBelay that! Ye must make a proper choice. "
158
+ end
159
+
160
+ def lullaby
161
+ # Seal Lullaby from The Jungle Book by Rudyard Kipling
162
+ # http://www.poetryloverspage.com/poets/kipling/seal_lullaby.html
163
+ puts <<-DOC
164
+ Oh! hush thee, my baby, the night is behind us,
165
+ And black are the waters that sparkled so green.
166
+ The moon, o'er the combers, looks downward to find us
167
+ At rest in the hollows that rustle between.
168
+ Where billow meets billow, there soft be thy pillow;
169
+ Ah, weary wee flipperling, curl at thy ease!
170
+ The storm shall not wake thee, nor shark overtake thee,
171
+ Asleep in the arms of the slow-swinging seas.
172
+ DOC
173
+ end
174
+
175
+ def ship_end
176
+ puts " . _~ *"
177
+ puts " . * _~ )_)_~"
178
+ puts " * )_))_))_)"
179
+ puts " * . * . _!__!__!_ ."
180
+ puts " \\______t/"
181
+ puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
182
+ end
183
+ end
@@ -1,22 +1,26 @@
1
- class SharksAhead::SharkExtinct
2
-
3
- def self.get_extinct_sharks
4
- extinct_sharks = []
5
- url = [
6
- 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/cladoselache.htm',
7
- 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/Diablodontus.htm',
8
- 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/falcatus.htm',
9
- 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/helicoprion.htm',
10
- 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/otodus.htm',
11
- 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/squalicorax.htm',
12
- 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/stethacanthus.htm',
13
- ]
14
- url.each do |u|
15
- doc = Nokogiri::HTML(open(u))
16
- name = doc.search('h1').text
17
- description = doc.search('div.col-push-2.col-push-tablet-1.content-responsive p').text.tr("\n", " ")
18
- extinct_sharks << {name: name, description: description}
19
- end
20
- extinct_sharks
21
- end
22
- end
1
+ class SharksAhead::SharkExtinct
2
+
3
+ def self.get_extinct_sharks
4
+ extinct_sharks = []
5
+ url = [
6
+ 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/cladoselache.htm',
7
+ 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/cretoxyrhina.htm',
8
+ 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/Edestus.htm',
9
+ 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/helicoprion.htm',
10
+ 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/otodus.htm',
11
+ 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/squalicorax.htm',
12
+ 'http://dinosaurs.about.com/od/tetrapodsandamphibians/p/stethacanthus.htm',
13
+
14
+ ]
15
+ url.each do |u|
16
+ doc = Nokogiri::HTML(open(u))
17
+ name = doc.search('h1').text
18
+ description = doc.search('div.col-push-2.col-push-tablet-1.content-responsive p').text.tr("\n", " ")
19
+ extinct_sharks << {name: name, description: description}
20
+ end
21
+ extinct_sharks
22
+ end
23
+ end
24
+
25
+ # [19] pry(main)> link = doc.search('a[href]').text
26
+ # => "\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\nAbout.comAutosCareersDating & RelationshipsEducationen EspañolEntertainmentFoodHealthHomeMoneyNews & IssuesParentingReligion & SpiritualitySportsStyleTechTravel\t\t\t\t1\n\t\t\t\t 400 Million Years of Shark Evolution\n\n\t\t\t\t\t2\n\t\t\t\t\t 500 Million Years of Fish Evolution\n\n\t\t\t\t\t3\n\t\t\t\t\t The Devonian Period (416-360 Million Years Ago)\n\n\t\t\t\t\t4\n\t\t\t\t\t Ichthyosaurs - The \"Fish Lizards\"\n\n\t\t\t\t\t5\n\t\t\t\t\t Helicoprion\n\n\t\t\t\tAbout.com\n\t\t\t\t\tAbout Education\n\t\t\t\t\tDinosaurs\n\t\t\t\t\t\tPrehistoric Animals\nBy Bob Strauss\t\t \tDinosaurs Expert\n \n\n\n\n\n\n\n\n\n\n\nShare\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\nPin\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\nTweet\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\nSubmit\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\nStumble\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\nPost\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\nShare\n\n\n\n\n\n\n\n\n\n\n\n\n\nBob StraussOrdovicianpliosaursmosasaursGreat White Sharkgallery of prehistoric shark pictureswhy there are no giant sharks alive todayfossilized teethtetrapodsCladoselacheStethacanthusOrthacanthusXenacanthusMesozoic EraichthyosaursHybodusCretaceousCretoxyrhinaSqualicoraxPtychodusMioceneOtodusMegalodonclimate changeCladoselacheCretoxyrhinaDiablodontusEdestusFalcatusHelicoprionHybodusIschyrhizaMegalodonOrthacanthusOtodusPtychodusSqualicoraxStethacanthusXenacanthus\t\t\n\t\t\tShow Full Article\n\t\t\t\n\t\t\nHybodus FactsThese Sharks Were the Terror of the Mesozoic and Cenozoic ErasStethacanthus FactsSqualicorax FactsDinosaurs Dinosaur Basics\n Types of Dinosaurs - Carnivorous and Herbivorous Dinosaurs and Other Prehistoric Reptiles\n Dinosaur Evolution\n The Daily Life of a Dinosaur\n Dinosaurs and Birds\n Prehistoric Animals\n Dinosaur Extinction\n Dinosaur Controversies\n Dinosaur Discovery\n Dinosaur Fun!\nAbout Education\n\n\n\nOur StoryAdvertise With UsSite MapHelpWrite for AboutCareers at AboutTerms of Use & PoliciesVerywellThe Balance"
@@ -1,22 +1,22 @@
1
- class SharksAhead::SharkLiving
2
-
3
- def self.get_living_sharks
4
- living_sharks = []
5
- url = [
6
- 'http://marinelife.about.com/od/vertebrates/p/baskingshark.htm',
7
- 'http://marinelife.about.com/od/Sharks/p/Blue-Shark.htm',
8
- 'http://marinelife.about.com/od/fish/p/Greatwhiteshark.htm',
9
- 'http://marinelife.about.com/od/Sharks/p/Hammerhead-Sharks.htm',
10
- 'http://marinelife.about.com/od/vertebrates/p/shortfinmako.htm',
11
- 'http://marinelife.about.com/od/Sharks/p/Tiger-Shark-Galeocerdo-Cuvier.htm',
12
- 'http://marinelife.about.com/od/fish/p/whaleshark.htm',
13
- ]
14
- url.each do |u|
15
- doc = Nokogiri::HTML(open(u))
16
- name = doc.search('h1').text
17
- description = doc.search('article.content.widget.widget-alt.expert-content.expert-content-text p').text
18
- living_sharks << {name: name, description: description}
19
- end
20
- living_sharks
21
- end
22
- end
1
+ class SharksAhead::SharkLiving
2
+
3
+ def self.get_living_sharks
4
+ living_sharks = []
5
+ url = [
6
+ 'http://marinelife.about.com/od/vertebrates/p/baskingshark.htm',
7
+ 'http://marinelife.about.com/od/Sharks/p/Blue-Shark.htm',
8
+ 'http://marinelife.about.com/od/fish/p/Greatwhiteshark.htm',
9
+ 'http://marinelife.about.com/od/Sharks/p/Hammerhead-Sharks.htm',
10
+ 'http://marinelife.about.com/od/vertebrates/p/shortfinmako.htm',
11
+ 'http://marinelife.about.com/od/Sharks/p/Tiger-Shark-Galeocerdo-Cuvier.htm',
12
+ 'http://marinelife.about.com/od/fish/p/whaleshark.htm',
13
+ ]
14
+ url.each do |u|
15
+ doc = Nokogiri::HTML(open(u))
16
+ name = doc.search('h1').text
17
+ description = doc.search('article.content.widget.widget-alt.expert-content.expert-content-text p').text
18
+ living_sharks << {name: name, description: description}
19
+ end
20
+ living_sharks
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module SharksAhead
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
data/sharks_ahead.gemspec CHANGED
@@ -20,5 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.12"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_dependency "nokogiri"
23
+ spec.add_dependency "nokogiri", "~> 1.6.8"
24
24
  end
data/spec.md CHANGED
@@ -1,20 +1,20 @@
1
- # Specifications for the CLI Assessment
2
-
3
- ## Specs:
4
- - [x] Have a CLI for interfacing with the application
5
-
6
- After installation, the CLI is called from the command line with `sharks-ahead`.
7
- The user makes choices by entering from menus of commands.
8
-
9
-
10
- - [x] Pull data from an external source
11
-
12
- The gem pulls data from two main external sources:
13
-
14
- http://marinelife.about.com/od/fish/tp/Types-Of-Sharks.htm
15
- http://dinosaurs.about.com/od/otherprehistoriclife/a/prehistoric-sharks.htm
16
-
17
- - [x] Implement both list and detail views
18
-
19
- The user is presented with a list of choices after choosing from two options.
20
- When choosing from the list, a detail view is given specific to that choice.
1
+ # Specifications for the CLI Assessment
2
+
3
+ ## Specs:
4
+ - [x] Have a CLI for interfacing with the application
5
+
6
+ After installation, the CLI is called from the command line with `sharks-ahead`.
7
+ The user makes choices by entering from menus of commands.
8
+
9
+
10
+ - [x] Pull data from an external source
11
+
12
+ The gem pulls data from two main external sources:
13
+
14
+ http://marinelife.about.com/od/fish/tp/Types-Of-Sharks.htm
15
+ http://dinosaurs.about.com/od/otherprehistoriclife/a/prehistoric-sharks.htm
16
+
17
+ - [x] Implement both list and detail views
18
+
19
+ The user is presented with a list of choices after choosing from two options.
20
+ When choosing from the list, a detail view is given specific to that choice.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharks_ahead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Sherman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-24 00:00:00.000000000 Z
11
+ date: 2016-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 1.6.8
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 1.6.8
55
55
  description: With a pirate theme, this gem is intended to be educational and amusing
56
56
  for all ages.
57
57
  email:
@@ -62,6 +62,7 @@ extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
64
  - ".gitignore"
65
+ - CHANGELOG.md
65
66
  - CODE_OF_CONDUCT.md
66
67
  - Gemfile
67
68
  - LICENSE.txt
@@ -97,9 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
98
  version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.6.6
101
+ rubygems_version: 2.4.8
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Scrapes and displays information via CLI about living and extinct shark species.
104
105
  test_files: []
105
- has_rdoc: