pokemoves-cli 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb8cb7108327718cdb80a49954b547282c2590b999398e33d22767a76aab9956
4
- data.tar.gz: 03077af2c10f6cb231417002d5d9c9dc514f35327cc66b7878893e06351bc28b
3
+ metadata.gz: 239ff9f15288592cb8c55da88f16519de762bb58d617a23ca509f8192fe47971
4
+ data.tar.gz: '0961d2218db011607223d91db4c59436086533d9983d2c6b9539569b62cc433b'
5
5
  SHA512:
6
- metadata.gz: 83475f7b57df6097d9616451b67d44a9a019c1306ffa804a62a0ca56282eb10dcd7c16e4ddfc51481f9348dfd5a8915f335bc764e9e83b21b806db634ec878d3
7
- data.tar.gz: 44624204c1f2c53f05f812d97790949175f0a3456cb97e4aa5a90a5c68c02520b98a69ad8bbd45bc21d4f24ea3d2006cde46c56012b0f624c8a1250d851dd3a7
6
+ metadata.gz: 256aaef1df8f5a1be89cb88ac582910c13d51d7daf67f449a7e0e353dacdcfbd9e80e68e81c28c0ce281905cf72a61ecd68bb5a2a62cdadc48ab6a527a68cf44
7
+ data.tar.gz: 4ec41649d6d3a5c0d317b19193e890a81f3ddd493d1261f174a90a30ed88006ab14d155d698bc14441867f1e9d1a4161c30de097b0bcdf58957703b71fd18f5f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pokemoves-cli (1.0.8)
4
+ pokemoves-cli (1.0.9)
5
5
  httparty
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -20,7 +20,11 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
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.
24
28
 
25
29
  ## Development
26
30
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "pokemoves"
3
+ require_relative "../lib/pokemoves.rb"
4
4
 
5
- cli = Pokemoves::CLI.new
5
+ Pokemoves::CLI.new.run
6
6
 
@@ -11,7 +11,7 @@ class Pokemon
11
11
  end
12
12
 
13
13
  def get_moves
14
- moves = Scraper.get_pokemon_by_name(@name)["moves"].collect{|move_hash| Move.new(move_hash["move"]["name"])}
14
+ Scraper.get_pokemon_by_name(@name)["moves"].collect{|move_hash| Move.new(move_hash["move"]["name"])}
15
15
  end
16
16
 
17
17
  def can_learn_move?(move)
@@ -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
- 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."
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
- 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
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.pretty_name}"
28
- counter += 1
29
- }
30
55
  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"
56
+ puts "Enter -1 to continue to the main menu."
32
57
  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].name)
36
- puts "The move #{current_move.pretty_name} 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
- elsif input == 2
46
- puts "Enter the name of a move!"
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
- until Move.find_or_create_by_pretty_name(move_name) != nil
49
- puts "It doesn't look like we have that move stored."
50
- puts "Try a different one."
51
- move_name = gets.chomp
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
- current_move = Move.find_or_create_by_pretty_name(move_name)
54
- puts "Enter the name of a pokemon to see if they can learn #{current_move.pretty_name}"
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)
64
- puts "It looks like #{current_pokemon.name.capitalize} can learn #{current_move.pretty_name}."
65
- else
66
- puts "It looks like #{current_pokemon.name.capitalize} can't learn #{current_move.pretty_name}."
67
- end
68
- puts "Enter the name of another pokemon to see if they can learn #{current_move.pretty_name}."
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
- end
94
+
95
+ end
84
96
 
85
- end
97
+ end
@@ -1,5 +1,5 @@
1
1
  module Pokemoves
2
2
  module Cli
3
- VERSION = "1.0.8"
3
+ VERSION = "1.0.9"
4
4
  end
5
5
  end
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.8
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-08-01 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler