newegg_top_games 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ba63075fe06c7e6fd48f954d5204b90eeeb3328b
4
+ data.tar.gz: a7ea4b49104bf66a0da0a3a1c8bc555235391cb3
5
+ SHA512:
6
+ metadata.gz: '093472c92a6b6ef14ac23072f289f3d74dbdc5cb384728c8b88db47e8c50bf8d9f970e3837846204b473002964c92e4a3474eb168ffe118f59c3884e9318b15a'
7
+ data.tar.gz: d42986c2d313a9d87c816f954b800b3eecbfac8187ea010325eeadf9f9473dec201b8dce1e256b3587edb989d6c667bff6c9589664b8cf2134a8d133b0f44139
@@ -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
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at redcabinny@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in newegg_top_games.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Jon foster
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.
@@ -0,0 +1,41 @@
1
+ Welcome To NewEgg Top Games!
2
+
3
+ Pick a console:
4
+
5
+ 1. Playstation 4
6
+ 2. Xbox One
7
+ 3. Wii
8
+ 4. Nintendo DS
9
+
10
+ Choose a number or type "exit" to exit:
11
+
12
+
13
+ Playstation 4's Twenty Top Selling Items:
14
+
15
+ 1. Attack On Titan (Tecmo)
16
+ 2. Rise of the Tomb Raider (Square Enix)
17
+ 3. Romance of The Three Kingdoms (Tecmo)
18
+ 4. NBA 2K16 (2KSports)
19
+ 5. WWE 2L16 (2KSports)
20
+ etc.....
21
+
22
+
23
+ Which Item would you like to know more about? Type 'list' to re-list items, 'back' to return to consoles, or 'exit' to exit:
24
+
25
+
26
+ WWE 2k16 - Playstation 4
27
+
28
+ Price: $19.99
29
+
30
+ Description:
31
+
32
+ Biggest Roster in WWE Video Game History:The biggest roster in WWE video game history! Play as over 120 unique characters and Raise Some Hell with your favorite WWE and NXT Superstars, Divas, Legends and more.
33
+
34
+ Improved and Refined Gameplay:2K16's core wrestling gameplay is smoother and more responsive than ever, with thousands of new animations, enhancements in chain wrestling, new working holds and reversals to deliver the most fun and authentic WWE experience to date.
35
+
36
+ 2K Showcase:Relive and play through some of the most iconic WWE matches and moments of all-time in 2K16's single player story campaign, 2K Showcase. Complete objectives to unlock legendary characters, gear, match types, and unlockables from WWE history.
37
+ New Creation Suite Features:Utilize 2K's best-in-class Creation Suite to develop your WWE Universe, including options to create, customize and compete with unique Superstars, Divas, Arenas, Championships and more.
38
+
39
+
40
+
41
+ Type 'back' to go back to the list, 'consoles' to go back to the consoles, or 'exit' to exit:
@@ -0,0 +1,39 @@
1
+ # NeweggTopGames
2
+
3
+ 'Newegg Top Games' is a CLI based program which allows you to view the best selling games/accessories of many specific consoles, and then get more information about any of these items.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'newegg_top_games'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install newegg_top_games
20
+
21
+ ## Usage
22
+
23
+ Upon running, you will be presented with a menu to choose a console. You will then see a list of the top selling items for this console, as defined on www.newegg.com. From there, you can choose an item and get more information on it, including the price and description.
24
+
25
+ ## Development
26
+
27
+ 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.
28
+
29
+ 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).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/newegg_top_games. 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.
34
+
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
39
+
@@ -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
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "newegg_top_games"
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
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "newegg_top_games"
5
+
6
+ NewEggTopGames::CLI.new.run
@@ -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,14 @@
1
+ require "newegg_top_games/version"
2
+ require "./lib/newegg_top_games/cli"
3
+ require "./lib/newegg_top_games/console"
4
+ require "./lib/newegg_top_games/console_top_twenty_list"
5
+ require "./lib/newegg_top_games/top_twenty_list_item"
6
+ require "./lib/newegg_top_games/scraper"
7
+ require "./lib/newegg_top_games/game"
8
+ require "nokogiri"
9
+ require "pry"
10
+ require "colorize"
11
+ require "open_uri_redirections"
12
+
13
+
14
+
@@ -0,0 +1,172 @@
1
+ require './lib/newegg_top_games'
2
+
3
+
4
+ class NewEggTopGames::CLI
5
+
6
+ CONSOLE_INFO = {
7
+ :playstation_4 => {name: "Playstation 4", url: "https://www.newegg.com/Product/ProductList.aspx?Submit=ENE&N=100021831&IsNodeId=1&Description=playstation%204&name=PS4%20Video%20Games&Order=BESTSELLING&Pagesize=36&isdeptsrh=1" },
8
+ :playstation_3 => {name: "Playstation 3", url: "https://www.newegg.com/PS3-Video-Games/SubCategory/ID-545?Tid=252383"},
9
+ :playstation_2 => {name: "Playstation 2", url: "https://www.newegg.com/PS2-Games/SubCategory/ID-475?Tid=8097"},
10
+ :xbox_one => {name: "Xbox One", url: "https://www.newegg.com/Xbox-One-Video-Games/SubCategory/ID-3218?Tid=21799&Order=BESTSELLING"},
11
+ :xbox_360 => {name: "Xbox 360", url: "https://www.newegg.com/Xbox-360-Games/SubCategory/ID-516?Tid=252388&Order=BESTSELLING"},
12
+ :wii => {name: "Wii", url: "https://www.newegg.com/Product/ProductList.aspx?Submit=ENE&N=100252378&IsNodeId=1&Description=wii%20games&name=Nintendo%20Wii%20Games&Order=BESTMATCH&isdeptsrh=1"},
13
+ :wii_u => {name: "Wii U", url: "https://www.newegg.com/Nintendo-Wii-U-Games/SubCategory/ID-3005?Tid=19153"},
14
+ :nintendo_ds => {name: "Nintendo DS", url: "https://www.newegg.com/Product/ProductList.aspx?Submit=ENE&N=100008067&IsNodeId=1&Description=nintendo%20ds%20games&name=Nintendo%20DS%20Games&Order=BESTSELLING&Pagesize=36&isdeptsrh=1"},
15
+ :nintendo_switch => {name: "Nintendo Switch", url: "https://www.newegg.com/Nintendo-Switch-Video-Games/SubCategory/ID-3733?Tid=252381"},
16
+ :vr_games => {name: "VR Games", url: "https://www.newegg.com/VR-Games/SubCategory/ID-3722?Tid=245657&Order=BESTSELLING"},
17
+ :pc_games => {name: "PC Games", url: "https://www.newegg.com/Product/ProductList.aspx?Submit=StoreIM&Depa=8&Category=275"},
18
+ :featured_items => {name: "Featured Items", url:"https://www.newegg.com/Product/ProductList.aspx?Submit=StoreIM&Depa=8"}
19
+ }
20
+
21
+ def run
22
+ choose_console
23
+ end
24
+
25
+ def choose_console
26
+ puts ""
27
+ puts "************************************************************".colorize(:color => :yellow).colorize(:background => :light_blue)
28
+ puts " _ _ _____ __ __ ___ __ _ __ _ ".colorize(:color => :white).colorize(:background => :light_blue)
29
+ puts " | ' \\/ -_) V V / / -_) _` / _` | ".colorize(:color => :white).colorize(:background => :light_blue)
30
+ puts " |_||_\\___|\\_/\\_/ \\___\\__, \\__, | top games ".colorize(:color => :white).colorize(:background => :light_blue)
31
+ puts " |___/|___/ ".colorize(:color => :white).colorize(:background => :light_blue)
32
+ puts "************************************************************".colorize(:color => :yellow).colorize(:background => :light_blue)
33
+ input = nil
34
+ puts ""
35
+
36
+ number = 1
37
+ CONSOLE_INFO.each do |key, value|
38
+ spacer = number.to_s.length < 2 ? " " : " "
39
+ puts "#{number.to_s.yellow}.#{spacer}#{CONSOLE_INFO[key][:name]}"
40
+ number +=1
41
+ end
42
+ puts ""
43
+ puts "************************************************************"
44
+ puts ""
45
+ input = nil
46
+
47
+ while input != "EXIT"
48
+ print "Choose a console or type #{'exit'.red} to exit (1-#{CONSOLE_INFO.keys.length}): "
49
+
50
+ input = gets.chomp.upcase
51
+
52
+ case input
53
+ when "1"
54
+ console_menu(CONSOLE_INFO[:playstation_4])
55
+ when "2"
56
+ console_menu(CONSOLE_INFO[:playstation_3])
57
+ when "3"
58
+ console_menu(CONSOLE_INFO[:playstation_2])
59
+ when "4"
60
+ console_menu(CONSOLE_INFO[:xbox_one])
61
+ when "5"
62
+ console_menu(CONSOLE_INFO[:xbox_360])
63
+ when "6"
64
+ console_menu(CONSOLE_INFO[:wii])
65
+ when "7"
66
+ console_menu(CONSOLE_INFO[:wii_u])
67
+ when "8"
68
+ console_menu(CONSOLE_INFO[:nintendo_ds])
69
+ when "9"
70
+ console_menu(CONSOLE_INFO[:nintendo_switch])
71
+ when "10"
72
+ console_menu(CONSOLE_INFO[:vr_games])
73
+ when "11"
74
+ console_menu(CONSOLE_INFO[:pc_games])
75
+ when "12"
76
+ console_menu(CONSOLE_INFO[:featured_items])
77
+ when "EXIT"
78
+ exit_program
79
+ else
80
+ puts "Invalid Entry, try again...".red
81
+ end
82
+ end
83
+ end
84
+
85
+ def console_menu(console_info)
86
+ list = NewEggTopGames::ConsoleTopTwentyList.new(NewEggTopGames::Console.new(console_info))
87
+ print_list(list)
88
+ input = nil
89
+
90
+ while input != "EXIT"
91
+ print "Which Item would you like to know more about? Type 'list' to re-list items, 'consoles' to return to consoles, or #{"'exit'".red} to exit (1-#{list.list.length}): "
92
+ input = gets.chomp.upcase
93
+ if input.to_i > 0 && input.to_i <= list.list.length
94
+ product_page = NewEggTopGames::Scraper.product_page(list.list[input.to_i - 1])
95
+ present_product_page(product_page, console_info)
96
+ end
97
+
98
+ case input
99
+ when "CONSOLES"
100
+ choose_console
101
+ when "LIST"
102
+ console_menu(console_info)
103
+ when "EXIT"
104
+ exit_program
105
+ else
106
+ puts "Invalid Entry, try again...".red
107
+ end
108
+ end
109
+ end
110
+
111
+ def present_product_page(product_page, console_info)
112
+ price = product_page.price.split('.')[1].length == 1 ? product_page.price + "0" : product_page.price
113
+ puts ""
114
+ puts "********************************************************"
115
+ puts "#{product_page.title}"
116
+ puts "********************************************************"
117
+ puts ""
118
+ puts "Price: #{"$".green}#{price.green}"
119
+ puts "Console: #{product_page.console.name.green}"
120
+ puts ""
121
+ puts "Description:".light_blue
122
+ puts "------------------"
123
+ puts ""
124
+ product_page.info_array.each do |item|
125
+ puts item.text.strip
126
+ puts ""
127
+ end
128
+ puts "------------------"
129
+ puts ""
130
+ input = nil
131
+
132
+ while input != "EXIT"
133
+ print "Type 'list' to go back to the #{console_info[:name].green} list, 'consoles' to go back to the consoles, or #{"'exit'".red} to exit: "
134
+ input = gets.strip.upcase
135
+ case input
136
+ when "LIST"
137
+ console_menu(console_info)
138
+ when "CONSOLES"
139
+ choose_console
140
+ when "EXIT"
141
+ exit_program
142
+ else
143
+ puts "Invalid entry, try again...".red
144
+ end
145
+ end
146
+ end
147
+
148
+ def print_list(list)
149
+ list.get_items #populates the list's list_array
150
+ list.list = list.list[0..19] #truncates the array down to 20 items
151
+ puts ""
152
+ puts "NewEgg's top #{list.list.length.to_s.green} selling items for #{list.console.name.green}: "
153
+ puts "-----------------------------------------------"
154
+
155
+ list.list.each_with_index do |list_item, index|
156
+ number = index + 1
157
+ spacer = number.to_s.length < 2 ? " " : " "
158
+ puts "#{number.to_s}.#{spacer}#{list_item.name} (#{list_item.brand}) #{list_item.url == nil ? "No More info".red : ""}"
159
+ end
160
+ puts ""
161
+ end
162
+
163
+ def exit_program
164
+ puts ""
165
+ puts "Thank you, see you next time!"
166
+ puts ""
167
+ exit
168
+ end
169
+ end
170
+
171
+
172
+ ##REFACTOR
@@ -0,0 +1,11 @@
1
+
2
+ class NewEggTopGames::Console
3
+ attr_accessor :name, :url, :top_twenty_lists
4
+
5
+
6
+ def initialize(hash)
7
+ @name = hash[:name]
8
+ @url = hash[:url]
9
+ @top_twenty_lists = []
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ require './lib/newegg_top_games'
2
+
3
+
4
+ class NewEggTopGames::ConsoleTopTwentyList
5
+ attr_accessor :list, :console
6
+
7
+ def initialize(console)
8
+ @console = console
9
+ @list = [] #has many list items
10
+ @console.top_twenty_lists << self
11
+ end
12
+
13
+ def get_items
14
+ NewEggTopGames::Scraper.main_site(self)
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ class NewEggTopGames::Game
2
+ attr_accessor :title, :price, :info_array, :console
3
+
4
+ def initialize(title, price, info_array, console)
5
+ @title = title
6
+ @price = price
7
+ @info_array = info_array
8
+ @console = console
9
+ end
10
+ end
@@ -0,0 +1,38 @@
1
+ require './lib/newegg_top_games'
2
+ require 'open-uri'
3
+ require 'openssl'
4
+
5
+ class NewEggTopGames::Scraper
6
+
7
+ def self.main_site(top_twenty_list)
8
+ url = top_twenty_list.console.url
9
+ doc = Nokogiri::HTML(open(url, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}))
10
+ items = doc.css(".item-container")
11
+ items.each do |item|
12
+ name = item.css('.item-title').text.strip
13
+ begin
14
+ brand = item.css('.item-brand img').attr("title").text
15
+ rescue
16
+ brand = "No brand given"
17
+ end
18
+ begin
19
+ url = "http:#{item.css('.item-info a.item-title').first.attr("href")}"
20
+ rescue
21
+ url = nil
22
+ end
23
+ list_item = NewEggTopGames::TopTwentyListItem.new(name, brand, url)
24
+ list_item.console = top_twenty_list.console
25
+ top_twenty_list.list << list_item
26
+ end
27
+ end
28
+
29
+ def self.product_page(top_twenty_list_item)
30
+ doc = Nokogiri::HTML(open(top_twenty_list_item.url, :allow_redirections => :safe, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE))
31
+ title = doc.css('h1 span').text.strip.split(" - ")[0]
32
+ price = doc.css('div meta').first["content"]
33
+ info_array = doc.css('li.item')
34
+ console = top_twenty_list_item.console
35
+ game = NewEggTopGames::Game.new(title, price, info_array, console)
36
+ game
37
+ end
38
+ end
@@ -0,0 +1,9 @@
1
+ class NewEggTopGames::TopTwentyListItem
2
+ attr_accessor :name, :brand, :url, :console
3
+
4
+ def initialize(name, brand, url)
5
+ @name = name
6
+ @brand = brand
7
+ @url = url
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module NewEggTopGames
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,49 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'newegg_top_games/version'
5
+ require 'uri'
6
+
7
+
8
+
9
+
10
+ Gem::Specification.new do |spec|
11
+ spec.name = "newegg_top_games"
12
+ spec.version = NewEggTopGames::VERSION
13
+ spec.authors = ["Jon foster"]
14
+ spec.email = ["redcabinny@gmail.com"]
15
+
16
+ spec.summary = "A CLI for viewing the top selling games on newegg.com."
17
+ spec.description = "A CLI for viewing the top selling games on newegg.com."
18
+ spec.homepage = 'https://github.com/jonfoster9999/newegg_top_games'
19
+ spec.license = "MIT"
20
+
21
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
22
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
23
+ if spec.respond_to?(:metadata)
24
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
31
+ f.match(%r{^(test|spec|features)/})
32
+ end
33
+ spec.bindir = "exe"
34
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
+ spec.require_paths = ["lib"]
36
+
37
+
38
+
39
+ spec.add_development_dependency "bundler", "~> 1.13"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ spec.add_development_dependency "rspec", "~> 3.0"
42
+ spec.add_development_dependency "pry"
43
+
44
+
45
+ spec.add_dependency "colorize"
46
+ spec.add_dependency "nokogiri"
47
+ spec.add_dependency "open_uri_redirections"
48
+
49
+ end
data/spec.md ADDED
@@ -0,0 +1,12 @@
1
+ # Specifications for the CLI Assessment
2
+
3
+ Specs:
4
+ - [x] Have a CLI for interfacing with the application
5
+ "cli.rb" provides a full working interface which prompts the user for input and delegates that input with conditionals. Menus are provided for each stage of the program.
6
+
7
+ - [x] Pull data from an external source
8
+ The program pulls data from www.newegg.com, scraping data off of both the main pages for best selling games and the individual game pages.
9
+
10
+ - [x] Implement both list and detail views
11
+ The user first chooses a console, and then is presented with a best-sellers list for that console. From there, the user can choose a specific game to get more information on, and at any time return to any menu of the program.
12
+
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newegg_top_games
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jon foster
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-01-20 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
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: colorize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
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: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: open_uri_redirections
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A CLI for viewing the top selling games on newegg.com.
112
+ email:
113
+ - redcabinny@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - CODE_OF_CONDUCT.md
122
+ - Gemfile
123
+ - LICENSE.txt
124
+ - Notes.md
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/newegg_top_games
129
+ - bin/setup
130
+ - lib/newegg_top_games.rb
131
+ - lib/newegg_top_games/cli.rb
132
+ - lib/newegg_top_games/console.rb
133
+ - lib/newegg_top_games/console_top_twenty_list.rb
134
+ - lib/newegg_top_games/game.rb
135
+ - lib/newegg_top_games/scraper.rb
136
+ - lib/newegg_top_games/top_twenty_list_item.rb
137
+ - lib/newegg_top_games/version.rb
138
+ - newegg_top_games.gemspec
139
+ - spec.md
140
+ homepage: https://github.com/jonfoster9999/newegg_top_games
141
+ licenses:
142
+ - MIT
143
+ metadata:
144
+ allowed_push_host: https://rubygems.org
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubyforge_project:
161
+ rubygems_version: 2.5.2
162
+ signing_key:
163
+ specification_version: 4
164
+ summary: A CLI for viewing the top selling games on newegg.com.
165
+ test_files: []