itch_rewards 0.1.2 → 0.1.3
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 +11 -11
- 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: b692518ae6391102d89d5b4fe6f13a378553eba7db5686cfeab7071f7ea5c614
|
|
4
|
+
data.tar.gz: 9b3b5e7dd6bf52733ec24bffcf2590bf1368ab0f2a0737e3656cbe54b493b228
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0cada09e0bdac62f5fe23e9c98daa7e90b9a2d79940667e1425ca507b945fda71dd8d0e3df30bdddaf0158362b155038b89d860df03b16b2855ee4cda734158
|
|
7
|
+
data.tar.gz: e8f02d9624f426c0d78c9f575657b25ad87d766ddf02033233f9920ff570ad735ea90dd148ef05a5e3e6c173f595fba92a0db967e94e64e84ba27b7848e170c0
|
data/Gemfile.lock
CHANGED
data/lib/itch_rewards/cli.rb
CHANGED
|
@@ -97,6 +97,16 @@ module ItchRewards
|
|
|
97
97
|
include AuthOptions
|
|
98
98
|
@options = @options.reject {|opt| [:cookies, :interactive].include? opt.name }
|
|
99
99
|
|
|
100
|
+
def write_config(path, options)
|
|
101
|
+
require 'erb'
|
|
102
|
+
client = authenticated_client!(options)
|
|
103
|
+
|
|
104
|
+
games = client.game_map.map.values
|
|
105
|
+
template = File.read(File.join(__dir__, 'templates/reward_config.yml.erb'))
|
|
106
|
+
|
|
107
|
+
File.write(path, ERB.new(template, trim_mode: '-').result(binding))
|
|
108
|
+
end
|
|
109
|
+
|
|
100
110
|
desc "Save cookies for itch.io and create reward config example file"
|
|
101
111
|
def call(**options)
|
|
102
112
|
options[:cookies] ||= cli.ask("Where would you like to store your login cookies? ", default: ".itch-cookies.yml")
|
|
@@ -114,7 +124,7 @@ module ItchRewards
|
|
|
114
124
|
result = cli.yes?("Config file #{config_path} does not exist, would you like to create it?")
|
|
115
125
|
|
|
116
126
|
if result
|
|
117
|
-
|
|
127
|
+
write_config(config_path, options)
|
|
118
128
|
cli.say "Config file written to #{config_path}"
|
|
119
129
|
end
|
|
120
130
|
else
|
|
@@ -148,16 +158,6 @@ module ItchRewards
|
|
|
148
158
|
cli.say render_table(table)
|
|
149
159
|
end
|
|
150
160
|
|
|
151
|
-
def self.write_config(path, options)
|
|
152
|
-
require 'erb'
|
|
153
|
-
client = authenticated_client!(options)
|
|
154
|
-
|
|
155
|
-
games = client.game_map.map.values
|
|
156
|
-
template = File.read(File.join(__dir__, 'templates/reward_config.yml.erb'))
|
|
157
|
-
|
|
158
|
-
File.write(options[:config], ERB.new(template, trim_mode: '-').result(binding))
|
|
159
|
-
end
|
|
160
|
-
|
|
161
161
|
def self.load_config(path)
|
|
162
162
|
YAML.load_file(path)
|
|
163
163
|
rescue YAML::ParseError => e
|
data/lib/itch_rewards/version.rb
CHANGED