pokemoves-cli 1.0.4 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +2 -7
- data/README.md +5 -2
- data/bin/pokemoves +2 -2
- data/lib/move.rb +14 -2
- data/lib/pokemon.rb +3 -3
- data/lib/pokemoves.rb +78 -66
- data/lib/pokemoves/cli/version.rb +1 -1
- data/lib/scraper.rb +0 -1
- data/pokemoves-cli.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 239ff9f15288592cb8c55da88f16519de762bb58d617a23ca509f8192fe47971
|
4
|
+
data.tar.gz: '0961d2218db011607223d91db4c59436086533d9983d2c6b9539569b62cc433b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 256aaef1df8f5a1be89cb88ac582910c13d51d7daf67f449a7e0e353dacdcfbd9e80e68e81c28c0ce281905cf72a61ecd68bb5a2a62cdadc48ab6a527a68cf44
|
7
|
+
data.tar.gz: 4ec41649d6d3a5c0d317b19193e890a81f3ddd493d1261f174a90a30ed88006ab14d155d698bc14441867f1e9d1a4161c30de097b0bcdf58957703b71fd18f5f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,23 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pokemoves-cli (1.0.
|
4
|
+
pokemoves-cli (1.0.9)
|
5
|
+
httparty
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
9
|
-
coderay (1.1.3)
|
10
10
|
httparty (0.18.1)
|
11
11
|
mime-types (~> 3.0)
|
12
12
|
multi_xml (>= 0.5.2)
|
13
|
-
method_source (1.0.0)
|
14
13
|
mime-types (3.3.1)
|
15
14
|
mime-types-data (~> 3.2015)
|
16
15
|
mime-types-data (3.2020.0512)
|
17
16
|
multi_xml (0.6.0)
|
18
|
-
pry (0.13.1)
|
19
|
-
coderay (~> 1.1)
|
20
|
-
method_source (~> 1.0)
|
21
17
|
rake (12.3.3)
|
22
18
|
|
23
19
|
PLATFORMS
|
@@ -27,7 +23,6 @@ DEPENDENCIES
|
|
27
23
|
bundler (~> 2.0)
|
28
24
|
httparty
|
29
25
|
pokemoves-cli!
|
30
|
-
pry
|
31
26
|
rake (~> 12.3.3)
|
32
27
|
|
33
28
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
<<<<<<< HEAD
|
2
1
|
# Pokemoves-cli
|
3
2
|
|
4
3
|
Pokemoves allows you to easily check which moves pokemon can learn, as well as which pokemon can learn a specific move. You can also check a move's given type.
|
@@ -21,7 +20,11 @@ Or install it yourself as:
|
|
21
20
|
|
22
21
|
## Usage
|
23
22
|
|
24
|
-
|
23
|
+
Simply enter the command:
|
24
|
+
|
25
|
+
$ pokemoves
|
26
|
+
|
27
|
+
Into the terminal to start up the CLI. From there, instructions are provided by the CLI itself.
|
25
28
|
|
26
29
|
## Development
|
27
30
|
|
data/bin/pokemoves
CHANGED
data/lib/move.rb
CHANGED
@@ -2,15 +2,23 @@ require_relative "scraper.rb"
|
|
2
2
|
require_relative "pokemon.rb"
|
3
3
|
|
4
4
|
class Move
|
5
|
-
attr_reader :name, :
|
5
|
+
attr_reader :name, :pretty_name
|
6
6
|
@@all = []
|
7
7
|
|
8
8
|
def initialize(name)
|
9
9
|
@name = name
|
10
|
-
@
|
10
|
+
@pretty_name = name.split("-").collect{|word| word.capitalize}.join(" ")
|
11
|
+
|
11
12
|
@@all << self
|
12
13
|
end
|
13
14
|
|
15
|
+
def type
|
16
|
+
if @type == nil
|
17
|
+
@type = Scraper.get_move_by_name(name)["type"]["name"]
|
18
|
+
end
|
19
|
+
@type
|
20
|
+
end
|
21
|
+
|
14
22
|
def self.all
|
15
23
|
@@all
|
16
24
|
end
|
@@ -22,4 +30,8 @@ class Move
|
|
22
30
|
end
|
23
31
|
return nil
|
24
32
|
end
|
33
|
+
|
34
|
+
def self.find_or_create_by_pretty_name(pretty_name)
|
35
|
+
self.find_or_create_by_name(pretty_name.split(" ").collect{|word| word.downcase}.join("-"))
|
36
|
+
end
|
25
37
|
end
|
data/lib/pokemon.rb
CHANGED
@@ -11,11 +11,11 @@ class Pokemon
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def get_moves
|
14
|
-
|
14
|
+
Scraper.get_pokemon_by_name(@name)["moves"].collect{|move_hash| Move.new(move_hash["move"]["name"])}
|
15
15
|
end
|
16
16
|
|
17
|
-
def can_learn_move?(
|
18
|
-
self.get_moves.include?(
|
17
|
+
def can_learn_move?(move)
|
18
|
+
self.get_moves.collect{|m| m.name}.include?(move.name)
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.all
|
data/lib/pokemoves.rb
CHANGED
@@ -1,85 +1,97 @@
|
|
1
1
|
require_relative "pokemon.rb"
|
2
2
|
require_relative "move.rb"
|
3
|
-
require "pokemoves/cli/version"
|
3
|
+
#require "pokemoves/cli/version"
|
4
4
|
|
5
5
|
module Pokemoves
|
6
6
|
class CLI
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
|
8
|
+
def run
|
9
|
+
puts "Welcome to Pokemoves!"
|
10
|
+
input = 0
|
11
|
+
until input == 3
|
12
|
+
puts "Enter 1 to see a list of a pokemon's given moves."
|
13
|
+
puts "Enter 2 to see if a certain move is learnable by a pokemon."
|
14
|
+
puts "Enter 3 to exit."
|
15
|
+
input = gets.to_i
|
16
|
+
if input == 1
|
17
|
+
get_pokemon_move_list
|
18
|
+
|
19
|
+
elsif input == 2
|
20
|
+
check_learnability_of_move
|
21
|
+
else
|
22
|
+
puts "That isn't a vailid choice." unless input == 3
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_pokemon_move_list
|
30
|
+
puts "Enter the name of a pokemon."
|
31
|
+
pokemon_name = gets.chomp
|
32
|
+
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil
|
33
|
+
puts "It doesn't look like we have that pokemon stored."
|
34
|
+
puts "Try a different one."
|
16
35
|
pokemon_name = gets.chomp
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
36
|
+
end
|
37
|
+
current_pokemon = Pokemon.find_or_create_by_name(pokemon_name.downcase)
|
38
|
+
puts "Press enter to see a list of #{pokemon_name.capitalize}'s moves."
|
39
|
+
gets
|
40
|
+
counter = 1
|
41
|
+
current_pokemon.get_moves.each{|move|
|
42
|
+
puts "#{counter}. #{move.pretty_name}"
|
43
|
+
counter += 1
|
44
|
+
}
|
45
|
+
puts "Enter the number of the move you'd like to know the type of."
|
46
|
+
puts "To continue to the main menu, enter -1"
|
47
|
+
num = gets.to_i
|
48
|
+
until num <= 0
|
49
|
+
if(num <= current_pokemon.get_moves.size)
|
50
|
+
current_move = Move.find_or_create_by_name(current_pokemon.get_moves[num - 1].name)
|
51
|
+
puts "The move #{current_move.pretty_name} is a #{current_move.type} type move."
|
52
|
+
else
|
53
|
+
puts "That number is not in the list of moves."
|
21
54
|
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
55
|
puts "Enter the number of the move you'd like to know the type of."
|
31
|
-
puts "
|
56
|
+
puts "Enter -1 to continue to the main menu."
|
32
57
|
num = gets.to_i
|
33
|
-
|
34
|
-
|
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
|
58
|
+
end
|
59
|
+
end
|
44
60
|
|
45
|
-
|
46
|
-
|
61
|
+
def check_learnability_of_move
|
62
|
+
puts "Enter the name of a move!"
|
63
|
+
move_name = gets.chomp
|
64
|
+
until Move.find_or_create_by_pretty_name(move_name) != nil
|
65
|
+
puts "It doesn't look like we have that move stored."
|
66
|
+
puts "Try a different one."
|
47
67
|
move_name = gets.chomp
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
68
|
+
end
|
69
|
+
current_move = Move.find_or_create_by_pretty_name(move_name)
|
70
|
+
puts "Enter the name of a pokemon to see if they can learn #{current_move.pretty_name}"
|
71
|
+
pokemon_name = gets.chomp
|
72
|
+
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil
|
73
|
+
puts "It doesn't look like we have that pokemon stored."
|
74
|
+
puts "Try a different one."
|
75
|
+
pokemon_name = gets.chomp
|
76
|
+
end
|
77
|
+
until pokemon_name == "exit"
|
78
|
+
current_pokemon = Pokemon.find_or_create_by_name(pokemon_name.downcase)
|
79
|
+
if current_pokemon.can_learn_move?(current_move)
|
80
|
+
puts "It looks like #{current_pokemon.name.capitalize} can learn #{current_move.pretty_name}."
|
81
|
+
else
|
82
|
+
puts "It looks like #{current_pokemon.name.capitalize} can't learn #{current_move.pretty_name}."
|
52
83
|
end
|
53
|
-
|
54
|
-
puts "Enter
|
84
|
+
puts "Enter the name of another pokemon to see if they can learn #{current_move.pretty_name}."
|
85
|
+
puts "Enter \"exit\" to continue to the main menu."
|
55
86
|
pokemon_name = gets.chomp
|
56
|
-
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil
|
87
|
+
until Pokemon.find_or_create_by_name(pokemon_name.downcase) != nil || pokemon_name == "exit"
|
57
88
|
puts "It doesn't look like we have that pokemon stored."
|
58
|
-
puts "Try a different one."
|
89
|
+
puts "Try a different one, or enter \"exit\" to exit."
|
59
90
|
pokemon_name = gets.chomp
|
60
91
|
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
92
|
end
|
80
|
-
|
81
93
|
end
|
82
|
-
|
83
|
-
|
94
|
+
|
95
|
+
end
|
84
96
|
|
85
|
-
end
|
97
|
+
end
|
data/lib/scraper.rb
CHANGED
data/pokemoves-cli.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Andrew Ribas'"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 12.3.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: httparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: '"Pokemoves allows you to easily check which moves pokemon can learn,
|
42
56
|
as well as which pokemon can learn a specific move. You can also check a move''s
|
43
57
|
given type."'
|