invader_zim 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9d360cffd3bf5d8ddcff1d73984b44a8e4a712513425b6fe7ed5b973d6beb0d9
4
+ data.tar.gz: 8cf113322b30cf7a72946ff07f1dbdafc89df06fa3317102e59e983c25039e80
5
+ SHA512:
6
+ metadata.gz: 6ebd41bbef88a0488c93abd81cb1868b2be5521a22fd3668e2300022892a82a5cf2828e254e61678b5124cdf36d282e07325e81d1899fa5b9fc5d398d84f8298
7
+ data.tar.gz: f0d090bb0074f52c3b4926400713d8ad939da7225f76404acc676184df746cdc5258302df34e7ea848c95e5d1d13a6d97fca404aed6dd987dfac6112a446f92e
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -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 'matandersonlv@hotmail.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,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in invader_zim.gemspec
4
+ gemspec
5
+
6
+
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ invader_zim (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ catpix_mini (0.1.1)
10
+ docopt (~> 0.5, >= 0.5.0)
11
+ mini_magick (~> 4.7.0, >= 4.7.0)
12
+ ruby-terminfo (~> 0.1, >= 0.1.1)
13
+ tco (~> 0.1, >= 0.1.8)
14
+ cli-colorize (2.0.0)
15
+ coderay (1.1.2)
16
+ docopt (0.6.1)
17
+ method_source (0.9.2)
18
+ mini_magick (4.7.2)
19
+ mini_portile2 (2.4.0)
20
+ nokogiri (1.10.2)
21
+ mini_portile2 (~> 2.4.0)
22
+ pry (0.12.2)
23
+ coderay (~> 1.1.0)
24
+ method_source (~> 0.9.0)
25
+ rake (10.5.0)
26
+ ruby-terminfo (0.1.1)
27
+ tco (0.1.8)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (~> 2.0)
34
+ catpix_mini (~> 0.1.1)
35
+ cli-colorize (~> 2.0)
36
+ invader_zim!
37
+ mini_magick (~> 4.7)
38
+ nokogiri
39
+ pry
40
+ rake (~> 10.0)
41
+ tco (~> 0.1.8)
42
+
43
+ BUNDLED WITH
44
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 'David Anderson'
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,51 @@
1
+ # Invader Zim
2
+
3
+ This Ruby Gem provides an interactive CLI experience to learn about different Invader Zim Characters as per the Invader Zim Wiki website.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'invader_zim'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install invader_zim
20
+
21
+ ## Linux Installation
22
+
23
+ Put these in your terminal:
24
+
25
+ sudo apt-get install libmagickwand-dev
26
+
27
+ sudo apt-get install imagemagick
28
+
29
+ ## Usage
30
+
31
+ Type the below and follow the on screen prompts.
32
+
33
+ $ ./bin/invader_zim
34
+
35
+ ## Development
36
+
37
+ 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.
38
+
39
+ 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).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/'mat0829'/invader_zim. 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.
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
48
+
49
+ ## Code of Conduct
50
+
51
+ Everyone interacting in the InvaderZim project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/'mat0829'/invader_zim/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
Binary file
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "invader_zim"
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(__FILE__)
data/bin/invader_zim ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/environment"
4
+
5
+ InvaderZim::CLI.new.call
6
+
7
+
8
+
9
+
10
+
11
+
12
+
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
data/gir_red.gif ADDED
Binary file
Binary file
data/girdisguise.gif ADDED
Binary file
@@ -0,0 +1,33 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "invader_zim/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "invader_zim"
8
+ spec.version = InvaderZim::VERSION
9
+ spec.authors = ["'David Mathew Anderson'"]
10
+ spec.email = ["'matandersonlv@hotmail.com'"]
11
+ spec.date = "2019-04-20"
12
+
13
+ spec.summary = "Invader Zim Cli Experience"
14
+ spec.description = "Provides an interactive CLI experience to learn about different Invader Zim Characters"
15
+ spec.homepage = "https://github.com/mat0829/invader_zim"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "bundler", "~> 2.0"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "nokogiri", "~> 1.10.2"
28
+ spec.add_development_dependency "pry", "~> 0.12.2"
29
+ spec.add_development_dependency "cli-colorize", "~> 2.0"
30
+ spec.add_development_dependency "mini_magick", "~> 4.7"
31
+ spec.add_development_dependency "catpix_mini", "~> 0.1.1"
32
+ spec.add_development_dependency "tco", "~> 0.1.8"
33
+ end
@@ -0,0 +1,16 @@
1
+ require_relative "invader_zim/version"
2
+ require_relative "invader_zim/cli"
3
+ require_relative "invader_zim/character"
4
+ require_relative "invader_zim/scraper"
5
+ require_relative "invader_zim/human"
6
+
7
+
8
+ require 'pry'
9
+ require 'open-uri'
10
+ require 'nokogiri'
11
+ require 'cli-colorize'
12
+ require 'mini_magick'
13
+ require 'catpix_mini'
14
+ require 'tco'
15
+
16
+
@@ -0,0 +1,37 @@
1
+ class InvaderZim::Character
2
+ attr_accessor :name, :homeworld, :gender, :affliation, :debut, :profile_url, :introduction, :appearance, :facts_of_doom
3
+
4
+ @@all = []
5
+
6
+ def initialize(character_hash)
7
+ character_hash.each {|k, v| self.send("#{k}=", v)}
8
+ @@all << self
9
+ end
10
+
11
+ def self.make_characters
12
+ characters_array = InvaderZim::Scraper.scrape_index_page('index.html')
13
+ self.create_from_collection(characters_array)
14
+ end
15
+
16
+ def self.create_from_collection(characters_array)
17
+ characters_array.each {|character| InvaderZim::Character.new(character)}
18
+ end
19
+
20
+ def add_character_attributes(attributes_hash)
21
+ attributes_hash.each {|k, v| self.send("#{k}=", v)}
22
+ end
23
+
24
+ def add_attributes_to_characters(character)
25
+ attributes = InvaderZim::Scraper.scrape_profile_page(character)
26
+ character.add_character_attributes(attributes)
27
+ end
28
+
29
+ def self.find(id)
30
+ self.all[id-1]
31
+ end
32
+
33
+ def self.all
34
+ @@all
35
+ end
36
+
37
+ end
@@ -0,0 +1,259 @@
1
+ class InvaderZim::CLI
2
+
3
+ def call
4
+ system "clear"
5
+ InvaderZim::Character.make_characters
6
+ introduction
7
+ menu
8
+ end
9
+
10
+ def introduction
11
+ print_image("zim.gif")
12
+ sleep(2)
13
+ puts CLIColorize.colorize("Greetings human! It is I, ZIM!\n", :green).strip
14
+ sleep(3)
15
+
16
+ puts CLIColorize.colorize("Type in your name so I can check if you are WORTHY of being friends with ZIM.\n" , :green).strip
17
+
18
+ input = gets.strip
19
+ @human = InvaderZim::Human.new(input)
20
+
21
+ puts CLIColorize.colorize("\nIf you would like to skip the introduction type 'skip' and hit Enter or type any key and Enter to continue.\n" , :white).strip
22
+
23
+ input = gets.strip.downcase
24
+
25
+ if input == "skip"
26
+ system "clear"
27
+ print_image("zim.gif")
28
+ sleep(2)
29
+ puts CLIColorize.colorize("\nOh, it's you #{@human.name}! I didn't recognize you my most worthy friend! Head down to the secret lair to some rain DOOM upon the DOOMED heads of our DOOMED enemies!" , :green)
30
+ sleep(5)
31
+ menu
32
+ else
33
+ system "clear"
34
+ print_image("zim.gif")
35
+ sleep(2)
36
+ puts CLIColorize.colorize("\nComputer, give me all the information you have on #{@human.name}.\n", :green).strip
37
+ sleep(3)
38
+
39
+ puts CLIColorize.colorize("#{@human.name} is a disgruntled human.\n", :red).strip
40
+ sleep(3)
41
+
42
+ puts CLIColorize.colorize("Continue.\n", :green).strip
43
+ sleep(3)
44
+
45
+ puts CLIColorize.colorize("Insufficient data.\n", :red).strip
46
+ sleep(3)
47
+
48
+ puts CLIColorize.colorize("Insufficient data? Can't you just make an educated guess?\n", :green).strip
49
+ sleep(3)
50
+
51
+ puts CLIColorize.colorize("O... kay... Um, #{@human.name} was born in a year between 1940 and.....now to, uh... demons, and trained to... uh, I dunno, fight... ninjas and rain DOOM?\n", :red).strip
52
+ sleep(5)
53
+
54
+ puts CLIColorize.colorize("I KNEW IT!\n", :green).strip
55
+ sleep(3)
56
+
57
+ puts CLIColorize.colorize("Congratulations #{@human.name}. I have checked your AMAZINGNESS and found you to be WORTHY, SO VERY WORTHY, to be friends with ZIM! Praise you! PRAISE YOU!!!\n", :green)
58
+ sleep(5)
59
+
60
+ puts CLIColorize.colorize("Follow us to the secret lair #{@human.name}.\n", :green)
61
+ sleep(4)
62
+ system "clear"
63
+ print_image("zim_and_gir.gif")
64
+ puts CLIColorize.colorize("*You stand on the platform and start descending*\n" , :white)
65
+ sleep(6)
66
+
67
+ system "clear"
68
+ puts CLIColorize.colorize("#{@human.name}, would you like to learn more about the amazingness that is me, ZIM, or a different, far less superior character?" , :green)
69
+ sleep(5)
70
+ end
71
+ end
72
+
73
+ def menu
74
+ system "clear"
75
+ show_characters_list
76
+ puts CLIColorize.colorize("\n#{@human.name}, choose a character's number from the list and hit enter.", :red)
77
+
78
+ input = gets.strip.to_i
79
+
80
+ if input.between?(1,14)
81
+ character = InvaderZim::Character.find(input.to_i)
82
+ if character.homeworld == nil
83
+ character.add_attributes_to_characters(character)
84
+ show_character(character)
85
+ else
86
+ show_character(character)
87
+ end
88
+ else
89
+ system "clear"
90
+ print_image("almighty_tallest.gif")
91
+ sleep(3)
92
+ puts CLIColorize.colorize("Almighty Tallest Purple: 'What are you doing?'\n" , :magenta)
93
+ sleep(4)
94
+ puts CLIColorize.colorize("Almighty Tallest Red: 'I am running a diagnostic to find the problem! YOU! Save the doughnuts!'\n" , :red)
95
+ sleep(4)
96
+ puts CLIColorize.colorize("Almighty Tallest Red: 'I found the problem. #{@human.name} put in something other then 1 to 14.'\n" , :red)
97
+ sleep(4)
98
+ puts CLIColorize.colorize("Almighty Tallest Purple: '#{@human.name}, You should have tried harder!'\n" , :magenta)
99
+ sleep(4)
100
+ menu
101
+ end
102
+ end
103
+
104
+ def show_character(character)
105
+ system "clear"
106
+ print CLIColorize.colorize("Name:", :red).strip
107
+ puts CLIColorize.colorize(" #{character.name}\n", :cyan).strip
108
+
109
+ if character.name == "Professor Membrane" || character.name == "Ms. Bitters" || character.name == "Recap Kid"
110
+ print CLIColorize.colorize("Homeworld:", :red).strip
111
+ puts CLIColorize.colorize(" Earth", :cyan).strip
112
+ elsif character.name == "GIR" || character.name == "Minimoose" || character.name == "Roboparents"
113
+ print CLIColorize.colorize("Homeworld:", :red).strip
114
+ puts CLIColorize.colorize(" Irk", :cyan).strip
115
+ else
116
+ print CLIColorize.colorize("Homeworld:", :red).strip
117
+ puts CLIColorize.colorize(" #{character.homeworld}", :cyan).strip
118
+ end
119
+
120
+ print CLIColorize.colorize("\nGender:", :red).strip
121
+ puts CLIColorize.colorize(" #{character.gender}\n", :cyan).strip
122
+
123
+ if character.affliation == ""
124
+ print CLIColorize.colorize("Affliation:", :red).strip
125
+ puts CLIColorize.colorize(" None\n", :cyan).strip
126
+ else
127
+ print CLIColorize.colorize("Affliation:", :red).strip
128
+ puts CLIColorize.colorize(" #{character.affliation}\n", :cyan).strip
129
+ end
130
+
131
+ print CLIColorize.colorize("Debut:", :red).strip
132
+ puts CLIColorize.colorize(" #{character.debut}\n", :cyan).strip
133
+
134
+ puts CLIColorize.colorize("Introduction:", :red).strip
135
+ puts CLIColorize.colorize(" #{character.introduction}\n", :cyan).strip
136
+
137
+ puts CLIColorize.colorize("Appearance:", :red).strip
138
+ puts CLIColorize.colorize(" #{character.appearance}\n", :cyan).strip
139
+ sleep(3)
140
+
141
+ puts CLIColorize.colorize("#{@human.name}, would you like to know some Facts of Doom!? Enter Y or N", :red).strip
142
+
143
+ input = gets.strip.downcase
144
+
145
+ if input == "y"
146
+ system "clear"
147
+ print_image("girdisguise.gif")
148
+ puts CLIColorize.colorize("Yay! I'm gunna sing The Doom Song now!\n", :yellow).strip
149
+ sleep(3)
150
+ puts CLIColorize.colorize("Doom doom doom doom doom, doom doom do DOOM, DOOOM doom do-doom, DOOM do-doom doom doooom, doom doom dooom, do-do-DOOOM!\n", :yellow).strip
151
+ sleep(5)
152
+ puts CLIColorize.colorize("(6 months later...)\n", :white).strip
153
+ sleep(3)
154
+ puts CLIColorize.colorize("Doom doom doo doom doom, DOOMY-DOOMY-DOOM, doom do do DOOM, Do do DOOM, doomy-doomy-doomy, Doom doom doom THE END." , :yellow).strip
155
+ sleep(6)
156
+ system "clear"
157
+
158
+ if character.facts_of_doom == ""
159
+ puts CLIColorize.colorize("Sorry #{@human.name}, this character has no Facts of Doom.", :red).strip
160
+ sleep(3)
161
+ else
162
+ puts CLIColorize.colorize("Facts of Doom:", :red).strip
163
+ puts CLIColorize.colorize(" #{character.facts_of_doom}\n", :cyan).strip
164
+ sleep(3)
165
+ end
166
+
167
+ puts CLIColorize.colorize("#{@human.name}, would you like to gain knowledge about a different character? Enter Y or N", :red).strip
168
+
169
+ input = gets.strip.downcase
170
+
171
+ if input == "y"
172
+ system "clear"
173
+ print_image("gir_red.gif")
174
+ puts CLIColorize.colorize("\nThe knowledge, it fills me. It is neat.", :yellow).strip
175
+ sleep(5)
176
+ menu
177
+ elsif input == "n" || input == "exit"
178
+ system "clear"
179
+ print_image("zim2.gif")
180
+ puts CLIColorize.colorize("Nooooo! You lie! YOU LIIIIIIIIIEEEEEEEEEE!!!!!\n", :green).strip
181
+ puts CLIColorize.colorize("*makes wild scratching motions with his arms*\n", :white).strip
182
+ sleep(5)
183
+ exit
184
+ else
185
+ system "clear"
186
+ print_image("gir_transformation.gif")
187
+ sleep(3)
188
+ puts CLIColorize.colorize("Leprechauns!", :yellow).strip
189
+ sleep(5)
190
+ menu
191
+ end
192
+
193
+ elsif input == "n"
194
+ system "clear"
195
+ print_image("ms_bitters.gif")
196
+ puts CLIColorize.colorize("\n#{@human.name}, your performance was miserable! Your parents will get a phone call instructing them to love you less.\n", :magenta).strip
197
+ sleep(5)
198
+ system "clear"
199
+ puts CLIColorize.colorize("#{@human.name}, would you like to learn about a different character? Enter Y or N", :red).strip
200
+
201
+ input = gets.strip.downcase
202
+
203
+ if input == "y"
204
+ print_image("recap_kid.gif")
205
+ puts CLIColorize.colorize("Previously at Invader Zim's Secret Lair...", :white).strip
206
+ sleep(4)
207
+ menu
208
+ elsif input == "n" || input == "exit"
209
+ system "clear"
210
+ print_image("sad_gir.gif")
211
+ puts CLIColorize.colorize("\nWhy!? Why!? I loveded you! I loveded you!\n", :white).strip
212
+ sleep(5)
213
+ exit
214
+ else
215
+ system "clear"
216
+ print_image("professor.gif")
217
+ puts CLIColorize.colorize("[transmitting from his lab on a floating monitor]\n", :white).strip
218
+ sleep(3)
219
+ puts CLIColorize.colorize("I'm sorry, but I'm very busy right now.\n", :red).strip
220
+ sleep(3)
221
+ puts CLIColorize.colorize("We're testing some highly unstable- \n", :red).strip
222
+ sleep(3)
223
+ puts CLIColorize.colorize("[gasps, alerts going off]\n", :white).strip
224
+ sleep(3)
225
+ puts CLIColorize.colorize("OH NO!! YOU PRESSED AN INCORRECT KEY!!\n", :red).strip
226
+ sleep(3)
227
+ puts CLIColorize.colorize("[A large explosion occurs across town and the screen plays elevator music with 'Please Stand By' appearing]\n", :white).strip
228
+ sleep(4)
229
+ menu
230
+ end
231
+ else
232
+ system "clear"
233
+ print_image("mini_moose.gif")
234
+ puts CLIColorize.colorize("You have entered an incorrect key. Minimoose judges you. The Shame....", :white).strip
235
+ sleep(6)
236
+ menu
237
+ end
238
+
239
+ end
240
+
241
+ def show_characters_list
242
+ characters = InvaderZim::Character.all
243
+ characters.each.with_index(1) do |character, index|
244
+ puts CLIColorize.colorize("#{index}. #{character.name}", :cyan)
245
+ end
246
+ end
247
+
248
+ def print_image(img)
249
+ CatpixMini::print_image img,
250
+ :limit_x => 1,
251
+ :limit_y => 0,
252
+ :center_x => false,
253
+ :center_y => false,
254
+ :bg => "white",
255
+ :bg_fill => false,
256
+ :resolution => "high"
257
+ end
258
+
259
+ end
@@ -0,0 +1,12 @@
1
+ class InvaderZim::Human
2
+ attr_accessor :name
3
+
4
+ def initialize(name)
5
+ @name = name
6
+ end
7
+
8
+ def name
9
+ @name
10
+ end
11
+
12
+ end
@@ -0,0 +1,112 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+
5
+ class InvaderZim::Scraper
6
+
7
+ def self.scrape_index_page(index_url)
8
+ index_url = "https://zim.fandom.com/wiki/Characters"
9
+
10
+ doc = Nokogiri::HTML(open(index_url))
11
+ character_info = doc.css(".wikia-gallery-item")
12
+ characters = []
13
+
14
+ character_info.each do |character|
15
+ characters << {
16
+ :name => character.css(".lightbox-caption center b a[href]").text,
17
+ :debut => character.css("[href]")[2].text,
18
+ :profile_url => "https://zim.fandom.com" + character.css("b a").first["href"]
19
+ }
20
+ end
21
+ characters
22
+ end
23
+
24
+ def self.scrape_profile_page(character)
25
+ html = open(character.profile_url)
26
+ doc = Nokogiri::HTML(html)
27
+
28
+ character_table = doc.css(".WikiaArticle")
29
+ character_page_traits = {}
30
+
31
+ character_table.each do |table|
32
+
33
+ case character.name
34
+ when "GIR", "Professor Membrane", "Ms. Bitters", "Recap Kid", "Minimoose", "Roboparents"
35
+ character_page_traits[:homeworld] ||= table.css("td")[1].text.strip.gsub(/[\n]/, '')
36
+ else
37
+ character_page_traits[:homeworld] ||= table.css("td")[3].text.strip.gsub(/[\n]/, '')
38
+ end
39
+
40
+ case character.name
41
+ when "Dib Membrane", "Gaz Membrane", "Keef", "Roboparents"
42
+ character_page_traits[:gender] ||= table.css("td")[5].text.strip.gsub(/[\n]/, '')
43
+ when "Zim", "Invader Skoodge"
44
+ character_page_traits[:gender] ||= table.css("td")[9].text.strip.gsub(/[\n]/, '')
45
+ else
46
+ character_page_traits[:gender] ||= table.css("td")[7].text.strip.gsub(/[\n]/, '')
47
+ end
48
+
49
+ case character.name
50
+ when "Roboparents"
51
+ character_page_traits[:affliation] ||= table.css("td")[9].text.strip.gsub(/[\n]/, '')
52
+ when "Gir", "Minimoose"
53
+ character_page_traits[:affliation] ||= table.css("td")[9].text[13..15].strip.gsub(/[\n]/, '')
54
+ when "Dib Membrane", "Gaz Membrane", "Keef"
55
+ character_page_traits[:affliation] ||= table.css("td")[11].text.strip.gsub(/[\n]/, '')
56
+ when "Almighty Tallest Red", "Almighty Tallest Purple", "Tak"
57
+ character_page_traits[:affliation] ||= table.css("td")[13].text.strip.gsub(/[\n]/, '')
58
+ when "Zim", "Invader Skoodge"
59
+ character_page_traits[:affliation] ||= table.css("td")[17].text.strip.gsub(/[\n]/, '')
60
+ else
61
+ character_page_traits[:affliation] ||= table.css("td")[1].text.strip.gsub(/[\n]/, '')
62
+ end
63
+
64
+ case character.name
65
+ when "Roboparents", "Recap Kid", "Ms. Bitters"
66
+ character_page_traits[:introduction] ||= table.css("p")[0].text.strip.gsub(/[\n]/, ' ')
67
+ when "Invader Skoodge"
68
+ character_page_traits[:introduction] ||= table.css("p")[1].text.strip.gsub(/[\n]/, ' ').delete("\"")
69
+ when "Keef"
70
+ character_page_traits[:introduction] ||= table.css("p")[7].text.strip.gsub(/[\n]/, ' ').delete("\"")
71
+ when "Gaz Membrane"
72
+ character_page_traits[:introduction] ||= table.css("p")[7..9].text.strip.gsub(/[\n]/, ' ').delete("\"").delete("\u2019")
73
+ else
74
+ character_page_traits[:introduction] ||= table.css("p")[2].text.strip.gsub(/[\n]/, ' ').gsub(/[\u00A0\u00E1\u2019]/, ' ').delete("\"")
75
+ end
76
+
77
+ case character.name
78
+ when "Keef"
79
+ character_page_traits[:appearance] ||= table.css("p")[2].text.gsub(/[\"\n]/, '')
80
+ when "Dib Membrane", "Invader Skoodge", "Minimoose"
81
+ character_page_traits[:appearance] ||= table.css("p")[3].text.gsub(/[\"\n]/, '')
82
+ when "Gaz Membrane", "Tak"
83
+ character_page_traits[:appearance] ||= table.css("p")[5].text.gsub(/[\"\n]/, '')
84
+ when "Recap Kid"
85
+ character_page_traits[:appearance] ||= table.css("p")[3].text.gsub(/[\"\n]/, '').delete("[1]")
86
+ else
87
+ character_page_traits[:appearance] ||= table.css("p")[4].text.gsub(/[\"\n]/, '').delete("\u00A0").delete("\u00E4").delete("\u00ED")
88
+ end
89
+
90
+ case character.name
91
+ when "Minimoose"
92
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[0..5].text.strip.gsub(/[\"\n\t]/, '')
93
+ when "Zim"
94
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[5..10].text.strip.gsub(/[\"\n\t]/, '')
95
+ when "Dib Membrane"
96
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[26..30].text.strip.gsub(/[\"\n\t]/, '')
97
+ when "Gaz Membrane"
98
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[4..8].text.strip.gsub(/[\"\n]/, '').delete("\t")
99
+ when "Ms. Bitters", "Almighty Tallest Purple", "Keef"
100
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[0..6].text.strip.gsub(/[\"\n]/, '').delete("[1]").delete("[2]").delete("[3]")
101
+ when "Recap Kid"
102
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[42..45].text.strip.gsub(/[\"\n]/, '').delete("[2]")
103
+ when "Tak"
104
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[17..19].text.strip.gsub(/[\"\n]/, '').delete("\"")
105
+ else
106
+ character_page_traits[:facts_of_doom] ||= table.css(".mw-content-text ul li")[0..8].text.strip.gsub(/[\"\n\t]/, '')
107
+ end
108
+ end
109
+ character_page_traits
110
+ end
111
+
112
+ end
@@ -0,0 +1,3 @@
1
+ module InvaderZim
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "invader_zim/version"
2
+
3
+ module InvaderZim
4
+ end
5
+
6
+
data/mini_moose.gif ADDED
Binary file
data/ms_bitters.gif ADDED
Binary file
data/professor.gif ADDED
Binary file
data/recap_kid.gif ADDED
Binary file
data/sad_gir.gif ADDED
Binary file
data/zim.gif ADDED
Binary file
data/zim2.gif ADDED
Binary file
data/zim_and_gir.gif ADDED
Binary file
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: invader_zim
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - "'David Mathew Anderson'"
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-04-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: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
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: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.10.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.10.2
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.12.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.12.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: cli-colorize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mini_magick
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: catpix_mini
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.1.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.1.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: tco
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.1.8
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.1.8
125
+ description: Provides an interactive CLI experience to learn about different Invader
126
+ Zim Characters
127
+ email:
128
+ - "'matandersonlv@hotmail.com'"
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - CODE_OF_CONDUCT.md
135
+ - Gemfile
136
+ - Gemfile.lock
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - almighty_tallest.gif
141
+ - bin/console
142
+ - bin/invader_zim
143
+ - bin/setup
144
+ - gir_red.gif
145
+ - gir_transformation.gif
146
+ - girdisguise.gif
147
+ - invader_zim.gemspec
148
+ - lib/environment.rb
149
+ - lib/invader_zim.rb
150
+ - lib/invader_zim/character.rb
151
+ - lib/invader_zim/cli.rb
152
+ - lib/invader_zim/human.rb
153
+ - lib/invader_zim/scraper.rb
154
+ - lib/invader_zim/version.rb
155
+ - mini_moose.gif
156
+ - ms_bitters.gif
157
+ - professor.gif
158
+ - recap_kid.gif
159
+ - sad_gir.gif
160
+ - zim.gif
161
+ - zim2.gif
162
+ - zim_and_gir.gif
163
+ homepage: https://github.com/mat0829/invader_zim
164
+ licenses:
165
+ - MIT
166
+ metadata: {}
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubygems_version: 3.0.3
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Invader Zim Cli Experience
186
+ test_files: []