pokemoves-cli 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/pokemoves +6 -0
- data/lib/pokemoves/cli/version.rb +1 -1
- data/lib/pokemoves.rb +85 -0
- data/pokemoves-cli.gemspec +2 -2
- metadata +6 -5
- data/bin/pokemoves-cli +0 -16
- data/lib/cli.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c14c3e3b3d4cb10f712588c038e64eb8af0693412c651a87885fb10c5ac5bd4
|
4
|
+
data.tar.gz: 07f67a2b3dea25672c5934c3b1c7e06319006df5ed6315b583d764e219de365b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc6b737b3ce69e2a6ed8c5ae6711df15d2028563c5814b75946b422990f3a74e9fb98b8f3d7301cb040848462afe177ae5943f25ac4f743e2eafb57001491747
|
7
|
+
data.tar.gz: f795ce047298109524186e97ef2ed445001debc202583c5d78f93aecb3977078418a751573f416f0d85fb7903d54dff276b700c96e5628c49abbaebbe9994097
|
data/Gemfile.lock
CHANGED
data/bin/pokemoves
ADDED
data/lib/pokemoves.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require_relative "pokemon.rb"
|
2
|
+
require_relative "move.rb"
|
3
|
+
require "pokemoves/cli/version"
|
4
|
+
|
5
|
+
module Pokemoves
|
6
|
+
class CLI
|
7
|
+
puts "Welcome to Pokemoves!"
|
8
|
+
input = 0
|
9
|
+
until input == 3
|
10
|
+
puts "Enter 1 to see a list of a pokemon's given moves."
|
11
|
+
puts "Enter 2 to see if a certain move is learnable by a pokemon."
|
12
|
+
puts "Enter 3 to exit."
|
13
|
+
input = gets.to_i
|
14
|
+
if input == 1
|
15
|
+
puts "Enter the name of a pokemon."
|
16
|
+
pokemon_name = gets.chomp
|
17
|
+
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil
|
18
|
+
puts "It doesn't look like we have that pokemon stored."
|
19
|
+
puts "Try a different one."
|
20
|
+
pokemon_name = gets.chomp
|
21
|
+
end
|
22
|
+
current_pokemon = Pokemon.find_or_create_by_name(pokemon_name.downcase)
|
23
|
+
puts "Press enter to see a list of #{pokemon_name.capitalize}'s moves."
|
24
|
+
gets
|
25
|
+
counter = 1
|
26
|
+
current_pokemon.get_moves.each{|move|
|
27
|
+
puts "#{counter}. #{move.split("-").collect{|word| word.capitalize}.join(" ")}"
|
28
|
+
counter += 1
|
29
|
+
}
|
30
|
+
puts "Enter the number of the move you'd like to know the type of."
|
31
|
+
puts "To continue to the main menu, enter -1"
|
32
|
+
num = gets.to_i
|
33
|
+
until num <= 0
|
34
|
+
if(num <= current_pokemon.get_moves.size)
|
35
|
+
current_move = Move.find_or_create_by_name(current_pokemon.get_moves[num - 1])
|
36
|
+
puts "The move #{current_move.name.capitalize} is a #{current_move.type} type move."
|
37
|
+
else
|
38
|
+
puts "That number is not in the list of moves."
|
39
|
+
end
|
40
|
+
puts "Enter the number of the move you'd like to know the type of."
|
41
|
+
puts "Enter -1 to continue to the main menu."
|
42
|
+
num = gets.to_i
|
43
|
+
end
|
44
|
+
|
45
|
+
elsif input == 2
|
46
|
+
puts "Enter the name of a move!"
|
47
|
+
move_name = gets.chomp
|
48
|
+
until Move.find_or_create_by_name(move_name.split(" ").collect{|word| word.downcase}.join("-")) != nil
|
49
|
+
puts "It doesn't look like we have that move stored."
|
50
|
+
puts "Try a different one."
|
51
|
+
move_name = gets.chomp
|
52
|
+
end
|
53
|
+
current_move = Move.find_or_create_by_name(move_name.split(" ").collect{|word| word.downcase}.join("-"))
|
54
|
+
puts "Enter the name of a pokemon to see if they can learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}"
|
55
|
+
pokemon_name = gets.chomp
|
56
|
+
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil
|
57
|
+
puts "It doesn't look like we have that pokemon stored."
|
58
|
+
puts "Try a different one."
|
59
|
+
pokemon_name = gets.chomp
|
60
|
+
end
|
61
|
+
until pokemon_name == "exit"
|
62
|
+
current_pokemon = Pokemon.find_or_create_by_name(pokemon_name.downcase)
|
63
|
+
if current_pokemon.can_learn_move?(current_move.name)
|
64
|
+
puts "It looks like #{current_pokemon.name.capitalize} can learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}."
|
65
|
+
else
|
66
|
+
puts "It looks like #{current_pokemon.name.capitalize} can't learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}."
|
67
|
+
end
|
68
|
+
puts "Enter the name of another pokemon to see if they can learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}."
|
69
|
+
puts "Enter \"exit\" to continue to the main menu."
|
70
|
+
pokemon_name = gets.chomp
|
71
|
+
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil || pokemon_name == "exit"
|
72
|
+
puts "It doesn't look like we have that pokemon stored."
|
73
|
+
puts "Try a different one, or enter \"exit\" to exit."
|
74
|
+
pokemon_name = gets.chomp
|
75
|
+
end
|
76
|
+
end
|
77
|
+
else
|
78
|
+
puts "That isn't a vailid choice." unless input == 3
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
data/pokemoves-cli.gemspec
CHANGED
@@ -32,8 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
33
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
34
|
end
|
35
|
-
spec.bindir = "exe"
|
36
|
-
spec.executables =
|
35
|
+
#spec.bindir = "exe"
|
36
|
+
spec.executables = ["pokemoves"]
|
37
37
|
spec.require_paths = ["lib"]
|
38
38
|
|
39
39
|
spec.add_development_dependency "bundler", "~> 2.0"
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pokemoves-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Andrew Ribas'"
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -43,7 +43,8 @@ description: '"Pokemoves allows you to easily check which moves pokemon can lear
|
|
43
43
|
given type."'
|
44
44
|
email:
|
45
45
|
- "'andrew.j.ribas@gmail.com'"
|
46
|
-
executables:
|
46
|
+
executables:
|
47
|
+
- pokemoves
|
47
48
|
extensions: []
|
48
49
|
extra_rdoc_files: []
|
49
50
|
files:
|
@@ -54,11 +55,11 @@ files:
|
|
54
55
|
- LICENSE.txt
|
55
56
|
- README.md
|
56
57
|
- Rakefile
|
57
|
-
- bin/pokemoves
|
58
|
+
- bin/pokemoves
|
58
59
|
- bin/setup
|
59
|
-
- lib/cli.rb
|
60
60
|
- lib/move.rb
|
61
61
|
- lib/pokemon.rb
|
62
|
+
- lib/pokemoves.rb
|
62
63
|
- lib/pokemoves/cli/version.rb
|
63
64
|
- lib/scraper.rb
|
64
65
|
- pokemoves-cli.gemspec
|
data/bin/pokemoves-cli
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
|
5
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
6
|
-
# with your gem easier. You can also use a different console, if you like.
|
7
|
-
|
8
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
9
|
-
# require "pry"
|
10
|
-
# Pry.start
|
11
|
-
|
12
|
-
require "irb"
|
13
|
-
require "./lib/cli.rb"
|
14
|
-
|
15
|
-
cli = CLI.new
|
16
|
-
|
data/lib/cli.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require_relative "pokemon.rb"
|
2
|
-
require_relative "move.rb"
|
3
|
-
|
4
|
-
class CLI
|
5
|
-
puts "Welcome to Pokemoves!"
|
6
|
-
input = 0
|
7
|
-
until input == 3
|
8
|
-
puts "Enter 1 to see a list of a pokemon's given moves."
|
9
|
-
puts "Enter 2 to see if a certain move is learnable by a pokemon."
|
10
|
-
puts "Enter 3 to exit."
|
11
|
-
input = gets.to_i
|
12
|
-
if input == 1
|
13
|
-
puts "Enter the name of a pokemon."
|
14
|
-
pokemon_name = gets.chomp
|
15
|
-
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil
|
16
|
-
puts "It doesn't look like we have that pokemon stored."
|
17
|
-
puts "Try a different one."
|
18
|
-
pokemon_name = gets.chomp
|
19
|
-
end
|
20
|
-
current_pokemon = Pokemon.find_or_create_by_name(pokemon_name.downcase)
|
21
|
-
puts "Press enter to see a list of #{pokemon_name.capitalize}'s moves."
|
22
|
-
gets
|
23
|
-
counter = 1
|
24
|
-
current_pokemon.get_moves.each{|move|
|
25
|
-
puts "#{counter}. #{move.split("-").collect{|word| word.capitalize}.join(" ")}"
|
26
|
-
counter += 1
|
27
|
-
}
|
28
|
-
puts "Enter the number of the move you'd like to know the type of."
|
29
|
-
puts "To continue to the main menu, enter -1"
|
30
|
-
num = gets.to_i
|
31
|
-
until num <= 0
|
32
|
-
if(num <= current_pokemon.get_moves.size)
|
33
|
-
current_move = Move.find_or_create_by_name(current_pokemon.get_moves[num - 1])
|
34
|
-
puts "The move #{current_move.name.capitalize} is a #{current_move.type} type move."
|
35
|
-
else
|
36
|
-
puts "That number is not in the list of moves."
|
37
|
-
end
|
38
|
-
puts "Enter the number of the move you'd like to know the type of."
|
39
|
-
puts "Enter -1 to continue to the main menu."
|
40
|
-
num = gets.to_i
|
41
|
-
end
|
42
|
-
|
43
|
-
elsif input == 2
|
44
|
-
puts "Enter the name of a move!"
|
45
|
-
move_name = gets.chomp
|
46
|
-
until Move.find_or_create_by_name(move_name.split(" ").collect{|word| word.downcase}.join("-")) != nil
|
47
|
-
puts "It doesn't look like we have that move stored."
|
48
|
-
puts "Try a different one."
|
49
|
-
move_name = gets.chomp
|
50
|
-
end
|
51
|
-
current_move = Move.find_or_create_by_name(move_name.split(" ").collect{|word| word.downcase}.join("-"))
|
52
|
-
puts "Enter the name of a pokemon to see if they can learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}"
|
53
|
-
pokemon_name = gets.chomp
|
54
|
-
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil
|
55
|
-
puts "It doesn't look like we have that pokemon stored."
|
56
|
-
puts "Try a different one."
|
57
|
-
pokemon_name = gets.chomp
|
58
|
-
end
|
59
|
-
until pokemon_name == "exit"
|
60
|
-
current_pokemon = Pokemon.find_or_create_by_name(pokemon_name.downcase)
|
61
|
-
if current_pokemon.can_learn_move?(current_move.name)
|
62
|
-
puts "It looks like #{current_pokemon.name.capitalize} can learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}."
|
63
|
-
else
|
64
|
-
puts "It looks like #{current_pokemon.name.capitalize} can't learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}."
|
65
|
-
end
|
66
|
-
puts "Enter the name of another pokemon to see if they can learn #{current_move.name.split("-").collect{|word| word.capitalize}.join(" ")}."
|
67
|
-
puts "Enter \"exit\" to continue to the main menu."
|
68
|
-
pokemon_name = gets.chomp
|
69
|
-
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil || pokemon_name == "exit"
|
70
|
-
puts "It doesn't look like we have that pokemon stored."
|
71
|
-
puts "Try a different one, or enter \"exit\" to exit."
|
72
|
-
pokemon_name = gets.chomp
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
else
|
77
|
-
puts "That isn't a vailid choice." unless input == 3
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|