top_ten_islands_cli_gem 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/README.md +5 -18
- data/bin/console +3 -5
- data/bin/top_ten_islands_cli_gem +3 -2
- data/lib/top_ten_islands_cli_gem.rb +8 -1
- data/lib/top_ten_islands_cli_gem/cli.rb +6 -12
- data/lib/top_ten_islands_cli_gem/island.rb +1 -16
- data/lib/top_ten_islands_cli_gem/scraper.rb +3 -7
- data/lib/top_ten_islands_cli_gem/version.rb +1 -1
- data/top_ten_islands_cli_gem.gemspec +8 -6
- metadata +61 -6
- data/config/environment.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aee43619489c51bc309f4ce511832eefa5bcba5c
|
4
|
+
data.tar.gz: 50ed887df39698f5715a3b69b7bd41bae339cc67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2006a544c9d992faee57f848d98ded0aa1b1919e5afa56626b6282247896baceca0f63750ec08aee4b33f160c0375138afed480cda8fe933190bb666b4caa9a
|
7
|
+
data.tar.gz: c64543958b550d47270f3d1e033fd48dbfeb7aa76caf293a71dd52f33751bae42fb4ee63154c0097f0e1b7f4074cf04798b45d7a9a468e68e09b818a859e2d5b
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,28 +1,16 @@
|
|
1
|
-
|
1
|
+
## TopTenIslands
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/top_ten_islands`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
5
|
TODO: Delete this and the text above, and describe your gem
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'top_ten_islands_cli_gem'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install top_ten_islands_cli_gem
|
9
|
+
You can install this gem via `gem install top_ten_islands_cli_gem`. The `top_ten_islands_cli_gem` CLI will be installed and you can run `top_ten_islands_cli_gem` to get a list of islands to travel to in your command line.
|
22
10
|
|
23
11
|
## Usage
|
24
12
|
|
25
|
-
|
13
|
+
Run top_ten_islands_cli_gem after installing the gem.
|
26
14
|
|
27
15
|
## Development
|
28
16
|
|
@@ -32,10 +20,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
20
|
|
33
21
|
## Contributing
|
34
22
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/
|
23
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/top_ten_islands.
|
36
24
|
|
37
25
|
|
38
26
|
## License
|
39
27
|
|
40
28
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require "bundler/setup"
|
4
|
+
require "top_ten_islands_cli_gem"
|
5
|
+
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
@@ -10,7 +10,5 @@ require_relative '../config/environment.rb'
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
TopTenIslandsCliGem::Cli.new.start
|
14
|
-
|
15
13
|
require "irb"
|
16
14
|
IRB.start
|
data/bin/top_ten_islands_cli_gem
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
require "
|
1
|
+
require "open-uri"
|
2
|
+
require "pry"
|
3
|
+
require "nokogiri"
|
4
|
+
|
5
|
+
require_relative "top_ten_islands_cli_gem/version"
|
6
|
+
require_relative "top_ten_islands_cli_gem/scraper.rb"
|
7
|
+
require_relative "top_ten_islands_cli_gem/island.rb"
|
8
|
+
require_relative "top_ten_islands_cli_gem/cli.rb"
|
2
9
|
|
3
10
|
module TopTenIslandsCliGem
|
4
11
|
end
|
@@ -14,18 +14,18 @@ class TopTenIslandsCliGem::Cli
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def discription
|
17
|
-
input = 0
|
17
|
+
@input = 0
|
18
18
|
#binding.pry
|
19
|
-
until input.between?(1,10)
|
19
|
+
until @input.between?(1,10)
|
20
20
|
puts " "
|
21
21
|
puts "What number island would you like to read about?"
|
22
|
-
input = gets.chomp.to_i
|
22
|
+
@input = gets.chomp.to_i
|
23
23
|
end
|
24
24
|
#binding.pry
|
25
25
|
puts ""
|
26
|
-
puts "--------#{TopTenIslandsCliGem::Island.all[input-1].name}--------"
|
26
|
+
puts "--------#{TopTenIslandsCliGem::Island.all[@input-1].name}--------"
|
27
27
|
puts ""
|
28
|
-
puts TopTenIslandsCliGem::Island.all[input-1].get_discription
|
28
|
+
puts TopTenIslandsCliGem::Island.all[@input-1].get_discription
|
29
29
|
puts ""
|
30
30
|
ending
|
31
31
|
end
|
@@ -40,15 +40,9 @@ class TopTenIslandsCliGem::Cli
|
|
40
40
|
when "y"
|
41
41
|
discription
|
42
42
|
when "n"
|
43
|
-
puts "
|
44
|
-
exit
|
43
|
+
puts "Hope to see you at #{TopTenIslandsCliGem::Island.all[@input-1].name} soon!!"
|
45
44
|
end
|
46
45
|
|
47
46
|
end
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
48
|
end
|
@@ -11,27 +11,12 @@ class TopTenIslandsCliGem::Island
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def get_discription
|
14
|
-
@discription ||=
|
14
|
+
@discription ||= TopTenIslandsCliGem::Scraper.get_island_discription(@url)
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.all
|
18
18
|
ALL
|
19
19
|
end
|
20
20
|
|
21
|
-
def discription
|
22
|
-
input = ""
|
23
|
-
until input > 0
|
24
|
-
puts "What island would you like more information about, by number?"
|
25
|
-
input = gets.chomp
|
26
|
-
end
|
27
|
-
TopTenIslandsCliGem::Island.all[input-1].get_discription
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
21
|
|
37
22
|
end
|
@@ -2,20 +2,16 @@ class TopTenIslandsCliGem::Scraper
|
|
2
2
|
|
3
3
|
def self.get_page
|
4
4
|
Nokogiri::HTML(open("https://www.tripadvisor.com/TravelersChoice-Islands"))
|
5
|
-
#binding.pry
|
6
5
|
end
|
7
6
|
|
8
7
|
def self.create_islands
|
9
|
-
#binding.pry
|
10
8
|
island_array = get_page.css(" .mainName").map do |island|
|
11
9
|
i = TopTenIslandsCliGem::Island.new(island.text.strip,"https://www.tripadvisor.com#{island.css("a").attribute("href").text}")
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
def self.get_island_discription(url=nil)
|
14
|
+
Nokogiri::HTML(open(url)).css(" .ermb_text").css(" .content").text.strip
|
15
|
+
end
|
20
16
|
|
21
17
|
end
|
@@ -1,27 +1,29 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'top_ten_islands/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "top_ten_islands_cli_gem"
|
8
|
-
spec.version =
|
8
|
+
spec.version = TopTenIslands::VERSION
|
9
9
|
spec.authors = ["Sholom Steinmetz"]
|
10
10
|
spec.email = ["sholomsteinmetz@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = "
|
13
|
-
|
12
|
+
spec.summary = "Shows a list of the worlds top ten islands to visit"
|
13
|
+
spec.description = "Shows a list of the worlds top ten islands to go to for a vacation after a long day of coding"
|
14
14
|
spec.homepage = "https://github.com/peacestone/top-ten-islands-cli-gem"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
19
|
spec.bindir = "bin"
|
20
|
-
spec.executables =
|
20
|
+
spec.executables = ["top_ten_islands_cli_gem"]
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.12"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
|
25
|
+
spec.add_development_dependency "nokogiri", "~> 1.6", ">= 0"
|
26
|
+
spec.add_development_dependency "pry", "~> 0.10.3"
|
27
|
+
spec.add_development_dependency "rubysl-open-uri", "~> 2.0", ">= 2.0"
|
26
28
|
|
27
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: top_ten_islands_cli_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sholom Steinmetz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,10 +38,66 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '1.6'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: pry
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.10.3
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.10.3
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rubysl-open-uri
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.0'
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '2.0'
|
85
|
+
type: :development
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '2.0'
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '2.0'
|
95
|
+
description: Shows a list of the worlds top ten islands to go to for a vacation after
|
96
|
+
a long day of coding
|
42
97
|
email:
|
43
98
|
- sholomsteinmetz@gmail.com
|
44
|
-
executables:
|
99
|
+
executables:
|
100
|
+
- top_ten_islands_cli_gem
|
45
101
|
extensions: []
|
46
102
|
extra_rdoc_files: []
|
47
103
|
files:
|
@@ -53,7 +109,6 @@ files:
|
|
53
109
|
- bin/console
|
54
110
|
- bin/setup
|
55
111
|
- bin/top_ten_islands_cli_gem
|
56
|
-
- config/environment.rb
|
57
112
|
- lib/top_ten_islands_cli_gem.rb
|
58
113
|
- lib/top_ten_islands_cli_gem/cli.rb
|
59
114
|
- lib/top_ten_islands_cli_gem/island.rb
|
@@ -84,5 +139,5 @@ rubyforge_project:
|
|
84
139
|
rubygems_version: 2.6.4
|
85
140
|
signing_key:
|
86
141
|
specification_version: 4
|
87
|
-
summary:
|
142
|
+
summary: Shows a list of the worlds top ten islands to visit
|
88
143
|
test_files: []
|
data/config/environment.rb
DELETED