aromancer 0.0.6 → 0.0.8

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.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  =begin
2
4
 
3
5
  storage.rb
@@ -12,18 +14,116 @@ module Aromancer
12
14
  class Storage
13
15
  include Singleton
14
16
 
15
- DEFAULT_SERVER = "http://aromancer.com"
17
+ VALID_KEYS = [
18
+ :arena,
19
+ :last_error,
20
+ :legends,
21
+ :player,
22
+ :preference_debug,
23
+ :preference_force_ssl,
24
+ :preference_hide_sentences,
25
+ :preference_hide_stream,
26
+ :server_url_host,
27
+ :server_url_port,
28
+ :server_url_scheme,
29
+ :signed_out_flag,
30
+ :stream,
31
+ :websocket_path,
32
+ :websocket_scheme
33
+ ]
34
+
35
+ PERSISTED_KEYS = [
36
+ :last_error,
37
+ :player,
38
+ :preference_debug,
39
+ :preference_force_ssl,
40
+ :preference_hide_sentences,
41
+ :preference_hide_stream,
42
+ :server_url_host,
43
+ :server_url_port,
44
+ :server_url_scheme,
45
+ :websocket_path,
46
+ :websocket_scheme
47
+ ]
16
48
 
17
- attr_accessor :storage_open, :cache
49
+ URI_KEYS = [
50
+ :scheme,
51
+ :host,
52
+ :port
53
+ ]
54
+
55
+ DEFAULT_SERVER = "http://127.0.0.1"
56
+
57
+ DEFAULT_PREFERENCES = {
58
+ preference_debug: false,
59
+ preference_force_ssl: false,
60
+ preference_hide_sentences: true,
61
+ preference_hide_stream: true,
62
+ }
63
+
64
+ attr_accessor :storage_open, :cache, :clear_flag, :parser_error
18
65
 
19
66
  def initialize
67
+ reload!
68
+ ensure_default_preferences_exist
69
+ end
70
+
71
+ def ensure_default_preferences_exist
72
+ DEFAULT_PREFERENCES.keys.each{|d_key|
73
+ current_value = get_key(d_key)
74
+ if current_value.nil? || ![TrueClass, FalseClass].include?(current_value.class)
75
+ set_key(d_key.to_s, DEFAULT_PREFERENCES[d_key])
76
+ end
77
+ }
78
+ end
79
+
80
+ def reload!
81
+ @storage_open = false
82
+ @clear_flag = false
83
+ @parser_error = nil
20
84
  clear_cache!
21
85
  FileUtils.mkdir_p(Aromancer.home_directory)
22
86
  end
23
87
 
24
88
  def clear_cache!
89
+ if @storage_open
90
+ @clear_flag = true
91
+ return
92
+ end
93
+ @clear_flag = false
25
94
  @storage_open = false
26
- @cache = {}
95
+
96
+ @cache = {} # clear'd
97
+ end
98
+
99
+ def self.snapshot_config
100
+ current_config = {}
101
+
102
+ PERSISTED_KEYS.each{|p_key|
103
+ current_config[p_key] = Aromancer::Storage.instance.get_key(p_key)
104
+ }
105
+
106
+ current_config
107
+ end
108
+
109
+ def self.valid_config?(config)
110
+ return false unless config.kind_of?(Hash)
111
+
112
+ config.keys.all?{|k| PERSISTED_KEYS.include?(k.to_sym)}
113
+ end
114
+
115
+ def self.restore_config(config)
116
+ return nil unless valid_config?(config)
117
+ PERSISTED_KEYS.each{|p_key|
118
+ Aromancer::Storage.instance.set_key(p_key, config[p_key])
119
+ }
120
+ end
121
+
122
+ def self.recreate!
123
+ current_config = snapshot_config
124
+ FileUtils.rm_rf(storage_filepath)
125
+ Aromancer::Storage.instance.reload!
126
+ restore_config(current_config)
27
127
  end
28
128
 
29
129
  def self.storage_filepath
@@ -48,34 +148,35 @@ module Aromancer
48
148
  return Time.now.to_i
49
149
  end
50
150
 
51
- def self.get_preference(preference, default: :default)
151
+ def self.get_preference(preference, default: nil)
52
152
  p_key = "preference_#{preference}"
53
- p = instance.get_key(p_key)
54
- if p.nil?
55
- instance.set_key(p_key, default)
56
- return instance.get_key(p_key)
153
+ pref = Aromancer::Storage.instance.get_key(p_key)
154
+ if pref.nil? && !default.nil?
155
+ Aromancer::Storage.instance.set_key(p_key, default)
156
+ pref = Aromancer::Storage.instance.get_key(p_key)
57
157
  end
58
- p
158
+ pref
59
159
  end
60
160
 
61
161
  def self.set_preference(preference, value)
62
162
  p_key = "preference_#{preference}"
63
- instance.set_key(p_key, value)
163
+ Aromancer::Storage.instance.set_key(p_key, value)
64
164
  end
65
165
 
66
166
  def self.toggle_preference(key)
67
- set_preference(key, !get_preference(key))
167
+ v = get_preference(key, default: DEFAULT_PREFERENCES["preference_#{key}"])
168
+ set_preference(key, !v)
68
169
  end
69
170
 
70
171
  def self.toggle_force_ssl
71
172
  toggle_preference(:force_ssl)
72
173
  v = get_preference(:force_ssl)
73
- self.instance.set_key(:server_url_scheme, "http#{v ? :s : ""}")
74
- self.instance.set_key(:websocket_scheme, "ws#{v ? :s : ""}")
174
+ Aromancer::Storage.set_key(:server_url_scheme, "http#{v ? :s : ""}")
175
+ Aromancer::Storage.set_key(:websocket_scheme, "ws#{v ? :s : ""}")
75
176
  end
76
177
 
77
178
  def self.set_signed_out_flag(flag)
78
- Aromancer::Storage.instance.set_key(:signed_out_flag, flag)
179
+ instance.set_key(:signed_out_flag, flag)
79
180
  end
80
181
 
81
182
  def self.get_signed_out_flag
@@ -83,7 +184,7 @@ module Aromancer
83
184
  end
84
185
 
85
186
  def self.set_player(player_hash)
86
- Aromancer::Storage.instance.set_key(:player, player_hash)
187
+ instance.set_key(:player, player_hash)
87
188
  end
88
189
 
89
190
  def self.get_player
@@ -91,7 +192,7 @@ module Aromancer
91
192
  end
92
193
 
93
194
  def self.set_legends(legends_array)
94
- Aromancer::Storage.instance.set_key(:legends, legends_array)
195
+ instance.set_key(:legends, legends_array)
95
196
  end
96
197
 
97
198
  def self.get_legends
@@ -99,7 +200,7 @@ module Aromancer
99
200
  end
100
201
 
101
202
  def self.set_arena(arena_hash)
102
- Aromancer::Storage.instance.set_key(:arena, arena_hash)
203
+ instance.set_key(:arena, arena_hash)
103
204
  end
104
205
 
105
206
  def self.get_arena
@@ -107,7 +208,7 @@ module Aromancer
107
208
  end
108
209
 
109
210
  def self.set_stream(stream_array)
110
- Aromancer::Storage.instance.set_key(:stream, stream_array)
211
+ instance.set_key(:stream, stream_array)
111
212
  end
112
213
 
113
214
  def self.get_stream
@@ -115,25 +216,18 @@ module Aromancer
115
216
  end
116
217
 
117
218
  def self.set_last_error(error_hash)
118
- Aromancer::Storage.instance.set_key(:last_error, error_hash)
219
+ instance.set_key(:last_error, error_hash)
119
220
  end
120
221
 
121
222
  def self.get_last_error
122
223
  Aromancer::Storage.instance.get_key(:last_error)
123
224
  end
124
225
 
125
- URI_KEYS = [
126
- :scheme,
127
- :host,
128
- :port
129
- ]
130
-
131
226
  def self.set_server_url(server_url)
132
227
  uri = URI.parse(server_url)
133
- if uri.kind_of?(URI::HTTP) or uri.kind_of?(URI::HTTPS)
228
+ if uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
134
229
  URI_KEYS.each{|k|
135
- uri.kind_of?(URI::HTTP) && get_preference(:force_ssl) ? toggle_force_ssl : nil
136
- Aromancer::Storage.instance.set_key("server_url_#{k}", uri.select(k).first)
230
+ instance.set_key("server_url_#{k}", uri.select(k).first)
137
231
  }
138
232
  elsif get_server_url.nil?
139
233
  set_server_url(DEFAULT_SERVER)
@@ -158,12 +252,12 @@ module Aromancer
158
252
  def self.get_websocket_url
159
253
  # default scheme is ws
160
254
  w_scheme = Aromancer::Storage.instance.get_key(:websocket_scheme)
161
- Aromancer::Storage.instance.set_key(:websocket_scheme, :ws) if w_scheme.nil?
255
+ instance.set_key(:websocket_scheme, :ws) if w_scheme.nil?
162
256
  w_scheme = Aromancer::Storage.instance.get_key(:websocket_scheme)
163
257
 
164
258
  # default path is broadcast
165
259
  w_path = Aromancer::Storage.instance.get_key(:websocket_path)
166
- Aromancer::Storage.instance.set_key(:websocket_path, :broadcast) if w_path.nil?
260
+ instance.set_key(:websocket_path, :broadcast) if w_path.nil?
167
261
  w_path = Aromancer::Storage.instance.get_key(:websocket_path)
168
262
 
169
263
  # asserts host and port not nil
@@ -179,7 +273,9 @@ module Aromancer
179
273
 
180
274
  # ensure default for key exists
181
275
  @cache[key] = {value: nil, persisted: false} unless @cache.keys.include?(key)
182
-
276
+ if false && (@cache[:preference_debug.to_s] || {value: DEFAULT_PREFERENCES[:preference_debug]})[:value]
277
+ Aromancer::Prompt.say("#{__method__} > @cache[#{key}]=#{@cache[key]}")
278
+ end
183
279
  # return cache value if storage open or the cache value is persisted
184
280
  return @cache[key][:value] if @storage_open || @cache[key][:persisted]
185
281
 
@@ -187,12 +283,17 @@ module Aromancer
187
283
  @storage_open = true
188
284
  storage_contents = {}
189
285
  begin
286
+ @parser_error = nil
190
287
  # read storage
191
- storage_contents = JSON.parse(File.read(Aromancer::Storage.storage_filepath))
288
+ storage_contents = JSON.parse(File.read(Aromancer::Storage.storage_filepath, encoding: "UTF-8"))
192
289
  rescue StandardError => e
193
290
  @storage_open = false
194
- FileUtils.rm(Aromancer::Storage.storage_filepath)
195
- return
291
+ if @parser_error.nil?
292
+ @parser_error = e
293
+ return get_key(key)
294
+ else
295
+ raise @parser_error
296
+ end
196
297
  end
197
298
 
198
299
  # only update the cache value if present in storage
@@ -202,20 +303,26 @@ module Aromancer
202
303
  @cache[key][:persisted] = false
203
304
  end
204
305
 
306
+ value = @cache[key][:value]
205
307
  @storage_open = false
206
- @cache[key][:value]
308
+ clear_cache! if @clear_flag
309
+ return value
207
310
  end
208
311
 
209
312
  def set_key(key, value)
210
313
  key = key.to_s
211
314
 
212
315
  # ensure default for key exists
213
- @cache[key] = {value: nil, persisted: false} unless @cache.keys.include?(key)
316
+ @cache[key] = {value: value, persisted: false} unless @cache.keys.include?(key)
214
317
 
215
318
  # assign new cache value and set persisted to false
216
319
  @cache[key][:value] = value
217
320
  @cache[key][:persisted] = false
218
321
 
322
+ if @storage_open && (@cache[:preference_debug.to_s] || {value: DEFAULT_PREFERENCES[:preference_debug]})[:value]
323
+ puts Thread.current.backtrace
324
+ Aromancer::Prompt.say("#{__method__} > @cache[#{key}]=#{@cache[key]}")
325
+ end
219
326
  # return if storage open
220
327
  # non-persisted cache values update next cycle
221
328
  return if @storage_open
@@ -224,12 +331,17 @@ module Aromancer
224
331
  @storage_open = true
225
332
  storage_contents = {}
226
333
  begin
334
+ @parser_error = nil
227
335
  # read storage
228
- storage_contents = JSON.parse(File.read(Aromancer::Storage.storage_filepath))
336
+ storage_contents = JSON.parse(File.read(Aromancer::Storage.storage_filepath, encoding: "UTF-8"))
229
337
  rescue StandardError => e
230
338
  @storage_open = false
231
- FileUtils.rm(Aromancer::Storage.storage_filepath)
232
- return
339
+ if @parser_error.nil?
340
+ @parser_error = e
341
+ return get_key(key)
342
+ else
343
+ raise @parser_error
344
+ end
233
345
  end
234
346
 
235
347
  # update storage and cache
@@ -245,8 +357,13 @@ module Aromancer
245
357
  f.write(storage_contents.to_json)
246
358
  end
247
359
 
360
+ if (@cache[:preference_debug.to_s] || {value: DEFAULT_PREFERENCES[:preference_debug]})[:value]
361
+ Aromancer::Prompt.say("#{__method__} > @cache[#{key}]=#{@cache[key]}")
362
+ end
363
+
248
364
  # close storage
249
365
  @storage_open = false
366
+ clear_cache! if @clear_flag
250
367
  end
251
368
  end
252
369
  end
@@ -11,5 +11,5 @@
11
11
  =end
12
12
 
13
13
  module Aromancer
14
- VERSION = "0.0.6"
14
+ VERSION = "0.0.8"
15
15
  end
@@ -22,9 +22,18 @@ module Aromancer
22
22
 
23
23
  attr_accessor :socket
24
24
 
25
+ def self.channel_identifier
26
+ {identifier: {channel: :PlayerChannel.to_s, id: Aromancer::Storage.get_player["id"]}.to_json}
27
+ end
28
+
25
29
  def connect
26
- return unless self.socket.nil?
27
- return if Aromancer::Storage.get_player["api_key"].nil?
30
+ if !self.socket.nil? && self.socket.closed?
31
+ disconnect
32
+ end
33
+
34
+ return if !self.socket.nil? ||
35
+ Aromancer::Storage.get_player["api_key"].nil? ||
36
+ Aromancer::Storage.get_player["active_legend_id"].nil?
28
37
 
29
38
  begin
30
39
  self.socket = WebSocket::Client::Simple.connect(Aromancer::Storage.get_websocket_url, {headers: Aromancer::Server.auth_header})
@@ -45,8 +54,10 @@ module Aromancer
45
54
  legend_id = payload["message"]["id"]
46
55
  lid = Aromancer::Storage.get_player&.symbolize_keys[:active_legend_id]
47
56
  if !lid.nil? && lid == legend_id.to_i
57
+ Aromancer::Storage.instance.clear_cache!
58
+ Aromancer::Api.get_legends
48
59
  Aromancer::Api.load_arena
49
- sleep(0.5)
60
+ sleep(1)
50
61
  Aromancer::Cli.instance.start_ui_thread
51
62
  end
52
63
  when :legends
@@ -57,10 +68,7 @@ module Aromancer
57
68
  end
58
69
 
59
70
  self.socket.on :open do
60
- r = {
61
- command: "subscribe",
62
- identifier: {channel: "PlayerChannel"}.to_json
63
- }.to_json
71
+ r = {"command": :subscribe.to_s}.merge(Aromancer::Websocket.channel_identifier).to_json
64
72
  Aromancer::Websocket.instance.socket.send(r)
65
73
  end
66
74
 
@@ -69,7 +77,10 @@ module Aromancer
69
77
  end
70
78
 
71
79
  self.socket.on :error do |e|
72
- puts e.inspect
80
+ if Aromancer::Storage.get_preference(:debug)
81
+ Aromancer::Prompt.say("#{self.class.name} socket.on :error")
82
+ Aromancer::Prompt.say(e.inspect)
83
+ end
73
84
  Aromancer::Websocket.instance.disconnect
74
85
  end
75
86
  end
@@ -78,5 +89,15 @@ module Aromancer
78
89
  self.socket&.close
79
90
  self.socket = nil
80
91
  end
92
+
93
+ # todo: websockets only in-game
94
+ # https://docs.anycable.io/misc/action_cable_protocol#perform-actions
95
+ # def self.set_active_legend_id(id)
96
+ # return if self.instance.socket.nil?
97
+ # r = {"command": :message.to_s}.merge(Aromancer::Websocket.channel_identifier).merge({
98
+ # data: {action: :player.to_s, active_legend_id: id}.to_json
99
+ # }).to_json
100
+ # self.instance.socket.send(r)
101
+ # end
81
102
  end
82
103
  end
data/lib/aromancer.rb CHANGED
@@ -14,126 +14,38 @@ require_relative :reiquire.to_s
14
14
  Reiquire::aromancer
15
15
 
16
16
  module Aromancer
17
- THROTTLE_MS = 0.2
17
+ ERROR_EXPIRATION = 11.11.to_f
18
18
  FONT = TTY::Font.new(:standard)
19
+ DATE_FORMAT = "%A %d %b %Y %I:%M:%S %p"
20
+ TIME_FORMAT = "%I:%M:%S %p"
19
21
 
20
22
  UNICODE = {
21
23
  close: "\u2A2F",
22
24
  check: "\u2713"
23
25
  }
24
26
 
25
- # instance runs on main thread
26
- class Cli
27
- include Singleton
28
-
29
- attr_accessor :ui_thread, :ws_thread, :busy, :last_render
30
-
31
- # user entry point
32
- def self.run
33
- # ensure preferences exist
34
- Aromancer::Storage.get_preference(:debug, default: false)
35
- Aromancer::Storage.get_preference(:force_ssl, default: true)
36
- Aromancer::Storage.get_preference(:hide_sentences, default: true)
37
-
38
- self.instance.last_render = 0
39
-
40
- # load player on-start
41
- Aromancer::Api.set_active_legend_id(nil) unless Aromancer::Storage.get_player.nil?
42
-
43
- Thread.main[:route] = :authentication
44
- Thread.main[:menu_options] = {}
45
- Aromancer::Prompt.say(I18n.t("shared.welcome", version: Aromancer::VERSION))
46
- Aromancer::Prompt.say(I18n.t("shared.server_url", url: Aromancer::Storage::get_server_url))
47
- self.instance.start_ui_thread
48
- self.instance.start_ws_thread
49
- loop do
50
- begin
51
- self.instance.ui_thread.join
52
- rescue NoMethodError => e
53
- if Aromancer::Storage.get_preference(:debug)
54
- Aromancer::Prompt.say(I18n.t("shared.last_error"))
55
- Aromancer::Prompt.say(e.inspect)
56
- sleep(5)
57
- end
58
- self.instance.start_ui_thread
59
- self.instance.start_ws_thread
60
- sleep(1)
61
- rescue Interrupt => e
62
- exit
63
- end
64
- end
65
- end
66
-
67
- def get_view(view_key)
68
- Thread.main[:menu_options][view_key.to_sym]
69
- end
70
-
71
- def start_ui_thread(force = false)
72
- return if (@busy || Time.now - @last_render < 2) && !force
73
-
74
- @busy = true
75
- self.ui_thread&.exit
76
- self.ui_thread&.kill
77
- Thread.main[:menu_runners] = {}
78
- Aromancer::Prompt.instance.reload!
79
- self.ui_thread = Thread.new do
80
- loop do
81
- menu_options = Thread.main[:menu_options][Thread.main[:route]]
82
- menu_runners = Thread.main[:menu_runners][Thread.main[:route]]
83
- unless menu_options.nil? || menu_runners.nil?
84
- Aromancer::Routes.resume
85
- sleep(THROTTLE_MS)
86
- Aromancer.print_hud
87
- v = Aromancer::Prompt.p.select("", menu_options, show_help: :always, cycle: true, per_page: 11)
88
- runners = menu_runners.select{|r| r[:value] == v}
89
- runners = menu_runners.select{|r| r[:value].nil?} if runners.empty?
90
-
91
- if runners.any?
92
- r = runners.first
93
- r[:proc].call(v)
94
- else
95
- exit
96
- end
97
- else
98
- Aromancer::Routes.resume
99
- end
100
- Aromancer::Cli.instance.busy = false
101
- Aromancer::Cli.instance.last_render = Time.now
102
- # sleep(THROTTLE_MS)
103
- end
104
- end
105
- end
106
-
107
- def start_ws_thread
108
- self.ws_thread.kill unless self.ws_thread.nil?
109
- self.ws_thread = Thread.new do
110
- Aromancer::Websocket.instance.disconnect
111
- loop do
112
- player = Aromancer::Storage.get_player
113
- if player.nil?
114
- Aromancer::Websocket.instance.disconnect
115
- elsif !player["api_key"].nil?
116
- # attempt websocket connection
117
- Aromancer::Websocket.instance.connect
118
- end
119
-
120
- sleep(4)
121
- end
122
- end
123
- end
27
+ def self.print_large_text(text = Aromancer.to_s.downcase, letter_spacing = 1)
28
+ Aromancer::Prompt.say(Aromancer::FONT.write(text, letter_spacing: letter_spacing))
29
+ end
124
30
 
31
+ def self.home_directory
32
+ "#{`echo $HOME`.strip}/.aromancer"
125
33
  end
126
34
 
127
- def self.get_font(text = :aromancer.to_s, letter_spacing = 1)
128
- Aromancer::FONT.write(text, letter_spacing: letter_spacing).split("\n")
35
+ def self.date_display(raw)
36
+ DateTime.parse(raw)&.strftime(Aromancer::DATE_FORMAT).downcase.gsub(" ", "_")
129
37
  end
130
38
 
131
- def self.home_directory
132
- "#{`echo $HOME`.strip}/.aromancer"
39
+ def self.time_display(raw)
40
+ DateTime.parse(raw)&.strftime(Aromancer::TIME_FORMAT).downcase.gsub(" ", "_")
133
41
  end
134
42
 
135
43
  def self.print_hud
136
- websocket_status = "#{Aromancer::Storage.instance.get_key(:websocket_scheme)}: #{Aromancer::Websocket.instance.socket.nil? ? UNICODE[:close] : UNICODE[:check] }"
44
+ print_last_error
45
+ ws_status_symbol = (
46
+ Aromancer::Websocket.instance.socket.nil? || Aromancer::Websocket.instance.socket.closed?
47
+ ) ? UNICODE[:close] : UNICODE[:check]
48
+ websocket_status = "#{Aromancer::Storage.instance.get_key(:websocket_scheme)}: #{ws_status_symbol}"
137
49
  player_status = if Aromancer::Storage.get_player.nil?
138
50
  I18n.t("routes.main_menu.not_signed_in")
139
51
  else
@@ -141,22 +53,36 @@ module Aromancer
141
53
  end
142
54
 
143
55
  Aromancer::Prompt.say(
144
- [nil, player_status, websocket_status, nil].join(" | ")
56
+ [nil, :v.to_s + Aromancer::VERSION, player_status, websocket_status, nil,].join(" | ")
145
57
  )
146
58
  end
147
59
 
148
60
  def self.print_last_error(i18n_key = nil)
149
- last_error = Aromancer::Storage.get_last_error
61
+ if Time.now.to_f - Aromancer::Cli.instance.error_timeout.to_f >= Aromancer::ERROR_EXPIRATION
62
+ Aromancer::Cli.instance.error_timeout = Time.now.to_i
63
+ Aromancer::Storage.set_last_error(nil)
64
+ return
65
+ end
66
+
67
+ last_error = Aromancer::Storage.get_last_error&.symbolize_keys
68
+
150
69
  return if last_error.nil?
151
- last_error = last_error.symbolize_keys
152
70
  message = last_error[:body]
153
71
  begin
154
72
  message = JSON.parse(message).symbolize_keys
155
73
  message = message[:error_message] if message.keys.include?(:error_message)
74
+ rescue TypeError => e
75
+ message = last_error[:body]
156
76
  rescue JSON::ParserError => e
157
77
  message = last_error[:body]
158
78
  end
159
- Aromancer::Prompt.say(I18n.t(i18n_key || "shared.last_error", status: last_error[:status], error: message))
160
- Aromancer::Storage.set_last_error(nil)
79
+
80
+ if message.kind_of?(Hash)
81
+ message = JSON.pretty_generate(message)
82
+ elsif message.kind_of?(String)
83
+ message = message[0..777]
84
+ end
85
+
86
+ Aromancer::Prompt.say(I18n.t(i18n_key || "shared.last_error", status: last_error[:status], error: message), rjust: true)
161
87
  end
162
88
  end
data/lib/reiquire.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  =begin
2
4
 
3
5
  reiquire.rb
data/listen.rb CHANGED
@@ -1,10 +1,6 @@
1
1
  require :listen.to_s
2
2
 
3
3
  listener = Listen.to(*[:lib.to_s, :bin.to_s, :spec.to_s, :locale.to_s], only: /[\.rb\.yml]/) {|modified, added, removed|
4
- # puts modified
5
- # puts added
6
- # puts removed
7
- # system("exec rake make")
8
4
  system("exec rake install")
9
5
  }
10
6
  listener.start
data/locale/en.yml CHANGED
@@ -13,6 +13,7 @@ en:
13
13
  update_confirm: "confirm update [%{new_value}] (enter y): "
14
14
  signed_in_as: "authenticated as %{as}"
15
15
  last_error: "error (%{status}). %{error}"
16
+ waiting: "waiting..."
16
17
  back: "back"
17
18
  exit: "exit"
18
19
  routes:
@@ -29,6 +30,7 @@ en:
29
30
  new_game: "new game"
30
31
  load_game: "load game"
31
32
  find_game: "find game"
33
+ rules: "rules"
32
34
  player_count: "enter player count (1-2): "
33
35
  sign_out: "sign out"
34
36
  not_signed_in: "signed out"
@@ -43,14 +45,15 @@ en:
43
45
  debug: "debug (%{stored})"
44
46
  debug_toggle: "debug preference toggled to %{value}"
45
47
  new_game:
46
- player_count: "number of players"
47
- story_count: "number of stories"
48
+ player_count: "players"
49
+ story_count: "stories"
48
50
  starting: "starting new game..."
49
51
  status: "status"
50
52
  cancelled: "cancelled. game not created."
51
53
  legend:
52
54
  title: "legend"
53
55
  subtitle: "%{subtitle}"
56
+ alchemy_for: "alchemy_for_%{name}:"
54
57
  arena_failed: "arena failed to load (%{status}). %{error}"
55
58
  scroll: "scroll"
56
59
  spoken_words: "scroll words"
@@ -66,6 +69,8 @@ en:
66
69
  place_on_scroll: "place %{word} on the scroll."
67
70
  options_for_word: "available options for the %{word} word."
68
71
  last_error: "last error"
72
+ returning_to_: "returning to %{route}..."
73
+ your_alchemy: "alchemy"
69
74
  legends:
70
75
  help: ""
71
76
  legend_menu:
@@ -74,5 +79,5 @@ en:
74
79
  help: ""
75
80
  stream:
76
81
  title: "stream"
77
-
78
-
82
+ end: "eos"
83
+ hide_title: "hide stream"
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ echo "pre-commit hook"
4
+ echo "rake build:checksum && git add checksums/"
5
+ rake build:checksum && git add checksums/
data/tasks/make.rake CHANGED
@@ -1,4 +1,4 @@
1
- desc "bundle graph && rake install && rspec --backtrace"
1
+ desc "rake install"
2
2
  task :make do
3
- exec "bundle graph && rake install && rspec --backtrace"
3
+ exec "rake install"
4
4
  end