itch_rewards 0.1.3 → 0.1.4
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/Gemfile.lock +1 -1
- data/lib/itch_rewards/cli.rb +17 -19
- data/lib/itch_rewards/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28124fd296c0c6919d5a5bf9aa01fe4b0165f310f61bcb78133126fbc6becc9c
|
4
|
+
data.tar.gz: c865c1beff954f19277914f9ad33413eb29a02509a38fd37187fde48ff284f64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77fe5877e20855f24b4b1dc2a3a0e6ba8bca40dbd1d0bdcab7574c115821e4c09f11c3e8be2f9af4796af8c1d1744d4e34ee869e547451b1f4a913e2f95f45e
|
7
|
+
data.tar.gz: 29db46393f880c338ab51c1bcaffbd2e4327e315a306564709ffa1a3efd291b0a9f26e3e9144980aa27fd59d15aee9665c0be2b898e17b84b286910239693176
|
data/Gemfile.lock
CHANGED
data/lib/itch_rewards/cli.rb
CHANGED
@@ -77,6 +77,12 @@ module ItchRewards
|
|
77
77
|
|
78
78
|
table.render(:unicode, multiline: true, padding: [0,1], resize: false, border: { style: :green })
|
79
79
|
end
|
80
|
+
|
81
|
+
def show_rewards(game)
|
82
|
+
cli.say "Rewards for #{game.name} (id: #{game.id})"
|
83
|
+
table = objects_to_table(game.rewards.list)
|
84
|
+
cli.say render_table(table)
|
85
|
+
end
|
80
86
|
end
|
81
87
|
|
82
88
|
module Commands
|
@@ -150,21 +156,6 @@ module ItchRewards
|
|
150
156
|
end
|
151
157
|
|
152
158
|
module Rewards
|
153
|
-
extend self
|
154
|
-
include Helper
|
155
|
-
def self.show_rewards(game)
|
156
|
-
cli.say "Rewards for #{game.name} (id: #{game.id})"
|
157
|
-
table = objects_to_table(game.rewards.list)
|
158
|
-
cli.say render_table(table)
|
159
|
-
end
|
160
|
-
|
161
|
-
def self.load_config(path)
|
162
|
-
YAML.load_file(path)
|
163
|
-
rescue YAML::ParseError => e
|
164
|
-
cli.error("Config file (#{path}) is not valid yaml")
|
165
|
-
exit 1
|
166
|
-
end
|
167
|
-
|
168
159
|
class List < Dry::CLI::Command
|
169
160
|
include AuthOptions
|
170
161
|
include Helper
|
@@ -187,7 +178,7 @@ module ItchRewards
|
|
187
178
|
client = authenticated_client!(options)
|
188
179
|
game = options[:id] ? client.game(options[:id]) : client.game(name: options[:name])
|
189
180
|
|
190
|
-
|
181
|
+
show_rewards(game)
|
191
182
|
end
|
192
183
|
end
|
193
184
|
|
@@ -238,7 +229,7 @@ module ItchRewards
|
|
238
229
|
|
239
230
|
rewards.save reward_list
|
240
231
|
|
241
|
-
|
232
|
+
show_rewards(game)
|
242
233
|
end
|
243
234
|
end
|
244
235
|
|
@@ -246,11 +237,18 @@ module ItchRewards
|
|
246
237
|
include Helper
|
247
238
|
include AuthOptions
|
248
239
|
|
240
|
+
def load_config(path)
|
241
|
+
YAML.load_file(path)
|
242
|
+
rescue YAML::ParseError => e
|
243
|
+
cli.error("Config file (#{path}) is not valid yaml")
|
244
|
+
exit 1
|
245
|
+
end
|
246
|
+
|
249
247
|
desc "Update reward quantity and description from configuration file"
|
250
248
|
|
251
249
|
option :config, required: true, desc: "Path to config file", default: "itch-reward-config.yml"
|
252
250
|
option :save, type: :boolean, desc: "Saves changes when enabled. Otherwise, dry-run and show result", default: false
|
253
|
-
|
251
|
+
|
254
252
|
def call(**options)
|
255
253
|
client = authenticated_client!(options)
|
256
254
|
|
@@ -259,7 +257,7 @@ module ItchRewards
|
|
259
257
|
exit 1
|
260
258
|
end
|
261
259
|
|
262
|
-
config =
|
260
|
+
config = load_config(options[:config])
|
263
261
|
unless config["games"].is_a? Hash
|
264
262
|
cli.error("No games configured for rewards updates in config file")
|
265
263
|
exit 1
|
data/lib/itch_rewards/version.rb
CHANGED