hlockey-cli 4 → 5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hlockey-cli/actions.rb +35 -13
- data/lib/hlockey-cli/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b43d6b271156dc226e7171abb4690d03af944d97c3a1896f35898618b7814b65
|
4
|
+
data.tar.gz: 4f6152b2bb108900d0fcb806fb702538e4e2c31f0b26811c6c9f6f84271659ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 321c2ca771842035ccfe138ccff87709c1ae33ed5729947becd34809c6720cbd68b62d0fb14c45eaf77f1226b66df36599c4687265f7c3635be4546367092082
|
7
|
+
data.tar.gz: 74fe7e7ea7746b8cfcd33a327af55931b5142b9ec99ce5f39d408baecd347c695e26071f7196570847cf1e820388e418d04a02addef18dfbb7b8f86b54cb7771
|
data/lib/hlockey-cli/actions.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require("hlockey-cli/user_selection")
|
2
2
|
|
3
3
|
module HlockeyCLI
|
4
|
+
##
|
5
|
+
# Each action the CLI can do
|
4
6
|
module Actions
|
5
7
|
ACTIONS = %i[games standings team_info election information].freeze
|
6
8
|
|
@@ -13,7 +15,13 @@ module HlockeyCLI
|
|
13
15
|
|
14
16
|
chosen_game = HlockeyCLI.user_selection(
|
15
17
|
league.games,
|
16
|
-
str_process: proc
|
18
|
+
str_process: proc do |game|
|
19
|
+
<<~GAME
|
20
|
+
#{game}
|
21
|
+
Weather: #{game.weather}
|
22
|
+
Stadium: #{Hlockey::Message.color(game.stadium)}
|
23
|
+
GAME
|
24
|
+
end
|
17
25
|
)
|
18
26
|
return if chosen_game.nil?
|
19
27
|
|
@@ -49,8 +57,12 @@ module HlockeyCLI
|
|
49
57
|
(chosen_team.nil? ? league.teams : [chosen_team]).each do |team|
|
50
58
|
puts("#{team.emoji} #{team}")
|
51
59
|
puts("\"#{team.motto}\"")
|
52
|
-
|
53
|
-
|
60
|
+
puts(" Stadium:")
|
61
|
+
Hlockey::Utils.hash_display_keys(team.stadium.to_h).each do |key, val|
|
62
|
+
puts(" #{key}: #{val}")
|
63
|
+
end
|
64
|
+
team.roster_display.each do |pos, player|
|
65
|
+
puts(" #{pos}:\n #{player}")
|
54
66
|
put_stats(player)
|
55
67
|
end
|
56
68
|
puts(" Shadows:")
|
@@ -63,14 +75,26 @@ module HlockeyCLI
|
|
63
75
|
end
|
64
76
|
end
|
65
77
|
|
66
|
-
def election(
|
67
|
-
|
68
|
-
puts(
|
69
|
-
|
78
|
+
def election(league)
|
79
|
+
if league.start_time < Time.now
|
80
|
+
puts("Current election options\nGo to the website to vote.")
|
81
|
+
Hlockey::Data.election.each do |category, options|
|
82
|
+
puts(" #{category}")
|
83
|
+
options.each { |name, description| puts(" #{name}\n #{description}") }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
election_results = Hlockey::Data.previous_election_results
|
88
|
+
puts("Previous election results\nvotes cast: #{election_results[:vote_amt]}")
|
89
|
+
election_results[:categories].each do |category, options|
|
90
|
+
puts(" #{category}")
|
91
|
+
options.each do |name, result|
|
92
|
+
puts(" #{name}\n #{result[:winner]}")
|
93
|
+
next if result[:most_votes].nil?
|
94
|
+
|
95
|
+
puts(" team with most votes: #{result[:most_votes]}")
|
96
|
+
end
|
70
97
|
end
|
71
|
-
# TODO: add an actual link to the website,
|
72
|
-
# probably should be from Hlockey lib data
|
73
|
-
puts("Go to the website to vote.")
|
74
98
|
end
|
75
99
|
|
76
100
|
def information(_)
|
@@ -101,9 +125,7 @@ module HlockeyCLI
|
|
101
125
|
|
102
126
|
# @param player [Hlockey::Player]
|
103
127
|
def put_stats(player)
|
104
|
-
player.
|
105
|
-
puts(" #{key}: #{value}")
|
106
|
-
end
|
128
|
+
player.stat_display.each { |key, value| puts(" #{key}: #{value}") }
|
107
129
|
end
|
108
130
|
end
|
109
131
|
end
|
data/lib/hlockey-cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hlockey-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lavender Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hlockey
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: paint
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|