video_game_reviews 0.1.7

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 74e1df0df3f316372e2b302d8e80aeeaac870f59
4
+ data.tar.gz: 0da8457acaa2920042aa95fb7dc553b52211a3a4
5
+ SHA512:
6
+ metadata.gz: 625fa9de05a9c1d5d162e96cf877a859016040a4431227f28846b52c684f8af744f5f9b519913ac8c11eeac02030335dde4ec25c0228eba77ed4d900b88600f9
7
+ data.tar.gz: 229532686d07f02c59e4b3290b572e5e9263b3375ef1d811f06bebff583419a75453e59fb5d7998bba107dd075597c7dd414933da8648d975f7a0d7bc03dcdd4
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.11.2
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at jchu4483@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in video_game_reviews.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 jchu4483
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/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # VideoGameReviews
2
+
3
+ Welcome to Video Game Reviews CLI Gem!
4
+
5
+ This gem uses Nokogiri to scrape a list of recent video game reviews from http://www.ign.com/games/reviews? It returns the 25 most recent reviews from the site. It returns the title of the review, the author, the date of the review, the first paragraph of the full written review and, if the author has given a score, it will return the numeric score as well. If you'd like to read more about a specific review, the program can open the full review directly in your browser.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'video_game_reviews'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install video_game_reviews
22
+
23
+ ## Usage
24
+
25
+ The instructions are explained when you run the user interface. At each point, you will be prompted for confirmation and acceptable inputs will be described to you.
26
+ If you'd like to read more about a specific game review, just type the corresponding number in the list that is shown to you. Once you are in an individual review, you can type "yes" or "no" to read the full review in your web browser. To exit out of the program, just type "exit".
27
+
28
+ ## Development
29
+
30
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
+
32
+ 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).
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/video_game_reviews. 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.
37
+
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "video_game_reviews"
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
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'video_game_reviews'
4
+
5
+ VideoGameReviews::CLI.new.call
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'video_game_reviews'
4
+
5
+ VideoGameReviews::CLI.new.call
@@ -0,0 +1,8 @@
1
+ require_relative "./video_game_reviews/version"
2
+ require_relative './video_game_reviews/cli'
3
+ require_relative './video_game_reviews/review'
4
+ require_relative './video_game_reviews/scraper'
5
+
6
+ require 'nokogiri'
7
+ require 'pry'
8
+ require 'open-uri'
@@ -0,0 +1,66 @@
1
+ class VideoGameReviews::CLI
2
+
3
+ def call
4
+ VideoGameReviews::Scraper.scrape_titles
5
+ puts "Welcome to Video Games Review CLI! "
6
+ list_reviews
7
+ end
8
+
9
+ def main_menu
10
+ puts "-------------------------------------------------------------------------"
11
+ puts ""
12
+ puts "Type '1' to get a list of reviews or type 'exit' to exit the program:"
13
+ puts "1. List Reviews"
14
+ puts "2. Exit"
15
+
16
+ input = nil
17
+ input = gets.strip
18
+ case input
19
+ when "1"
20
+ list_reviews
21
+ when "exit"
22
+ exit
23
+ else
24
+ puts "Invalid input, please try again:"
25
+ main_menu
26
+ end
27
+ end
28
+
29
+ def list_reviews
30
+ puts "-------------------------------------------------------------------------"
31
+ puts "Here's a list of reviews:"
32
+ puts ""
33
+ VideoGameReviews::Review.all.each.with_index(1) do |review, i|
34
+ puts "#{i}. #{review.name} - Review Date: #{review.date}"
35
+ end
36
+ get_review
37
+ end
38
+
39
+ def get_review
40
+ puts "-------------------------------------------------------------------------"
41
+ puts ""
42
+ puts "Enter a number of the review to read the review:"
43
+ answer = gets.strip
44
+ if answer.to_i-1 <= VideoGameReviews::Review.all.size
45
+ review = VideoGameReviews::Review.all[answer.to_i-1]
46
+ puts "#{review.name} Genre: #{review.genre} Score: #{review.score} #{review.author} Date: #{review.date}"
47
+ puts "--------------------------------------------------------------------------------------------------"
48
+ puts review.full_review
49
+ puts "--------------------------------------------------------------------------------------------------"
50
+
51
+ puts "Would you like to read the full review in your browser? Type yes or no to get back to the main menu:"
52
+ input = gets.strip
53
+ if ["Y", "YES"].include?(input.upcase)
54
+ review.open_in_browser
55
+ main_menu
56
+ else ["N", "NO"].include?(input.upcase)
57
+ main_menu
58
+ end
59
+ end
60
+ end
61
+
62
+ def exit
63
+ puts "Goodbye!"
64
+ end
65
+
66
+ end
@@ -0,0 +1,17 @@
1
+ class VideoGameReviews::Review
2
+ attr_accessor :name, :score, :review_url, :genre, :full_review, :author, :date
3
+ @@reviews = []
4
+
5
+ def self.all
6
+ @@reviews
7
+ end
8
+
9
+ def save
10
+ @@reviews << self
11
+ end
12
+
13
+ def open_in_browser
14
+ system("open '#{review_url}'")
15
+ end
16
+
17
+ end
@@ -0,0 +1,20 @@
1
+ class VideoGameReviews::Scraper
2
+
3
+ def self.scrape_titles
4
+ @doc = Nokogiri::HTML(open("http://www.ign.com/games/reviews?"))
5
+
6
+ @doc.search("#item-list div.itemList div.itemList-item").each do |review|
7
+ new_review = VideoGameReviews::Review.new
8
+ new_review.name = review.search("h3 a").text.split("\n").collect {|info| info.strip!}.delete_if {|info| info == nil}.join("")
9
+ new_review.score = review.search(".scoreBox-score").text
10
+ new_review.genre = review.search(".item-details span.item-genre").text.strip!
11
+ new_review.review_url = review.search("div.up-com.grid_7 > ul > li > a").attr("href").value
12
+ review_details = Nokogiri::HTML(open(new_review.review_url))
13
+ new_review.date = review_details.search("span.article-publish-date").text.gsub("\n","").strip
14
+ new_review.full_review = review_details.search("div.article-content > p:nth-child(-n+4)").text
15
+ new_review.author = review_details.search("span > span").text.split("\n").collect {|info| info.strip!}[1]
16
+ new_review.save
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,3 @@
1
+ module VideoGameReviews
2
+ VERSION = "0.1.7"
3
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'video_game_reviews/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "video_game_reviews"
8
+ spec.version = VideoGameReviews::VERSION
9
+ spec.authors = ["jchu4483"]
10
+ spec.email = ["jchu4483@gmail.com"]
11
+
12
+ spec.summary = %q{Uses Nokogiri to return a list of video game reviews from ign.com/games/reviews}
13
+ spec.description = %q{}
14
+
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency "pry"
26
+ spec.add_development_dependency "nokogiri"
27
+ spec.add_development_dependency "require_all", "~> 1.3", ">= 1.3.3"
28
+ end
29
+
30
+
31
+
32
+ #["lib/video_game_reviews/cli.rb", "lib/video_game_reviews/review.rb", "lib/video_game_reviews/scraper.rb", "lib/video_game_reviews/version.rb", "lib/video_game_reviews.rb"]
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: video_game_reviews
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
+ platform: ruby
6
+ authors:
7
+ - jchu4483
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-16 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.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
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: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: require_all
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 1.3.3
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '1.3'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 1.3.3
103
+ description: ''
104
+ email:
105
+ - jchu4483@gmail.com
106
+ executables:
107
+ - video_game_reviews
108
+ extensions: []
109
+ extra_rdoc_files: []
110
+ files:
111
+ - ".gitignore"
112
+ - ".rspec"
113
+ - ".travis.yml"
114
+ - CODE_OF_CONDUCT.md
115
+ - Gemfile
116
+ - LICENSE.txt
117
+ - README.md
118
+ - Rakefile
119
+ - bin/console
120
+ - bin/setup
121
+ - bin/video_game_reviews
122
+ - exe/video_game_reviews
123
+ - lib/video_game_reviews.rb
124
+ - lib/video_game_reviews/cli.rb
125
+ - lib/video_game_reviews/review.rb
126
+ - lib/video_game_reviews/scraper.rb
127
+ - lib/video_game_reviews/version.rb
128
+ - video_game_reviews.gemspec
129
+ homepage:
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.4.5.1
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Uses Nokogiri to return a list of video game reviews from ign.com/games/reviews
153
+ test_files: []