k_builder 0.0.68 → 0.0.69

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bd3ddd77fda6cfa2a887a20fb924aa5a5181244a91d910540a32a7383074191
4
- data.tar.gz: e942f11959736361d19c0b09f39a4ed6500b89373dcfa3e7e8763d79ff803559
3
+ metadata.gz: 344376d8ceaffc96fb8ebc4c0add3456bc6a1ff97f7d1b017286a6f4ea523c09
4
+ data.tar.gz: 51eb8ddb6f7e3b578442423f0dfd9c08759012caa33003d1ecec0849d435b342
5
5
  SHA512:
6
- metadata.gz: 8ad7eec17221b5e64b59cea284bbfd7dc20af852c113462a90ae17637307f36945e4c7535c35d3a75a138a8fb662da86c8254dc2a244e2e5f3bc2c781ca2dff7
7
- data.tar.gz: a8ca584e3c0ff1feae5d8cbf4b8c32fc0bea751cec6d23980092de814fea9f10c7f1dec936852a698edf6fdc70bfe913c26b86a6d5014f5a81ee0fe930c89a8f
6
+ metadata.gz: 0dde58c5926b4ecdf4952ee40b4babc4111cf8e9578ee2bacb29f6f6a14915e954631b4ef1c09d4148002357640f7323879325ac61cc7da9c8e5d40bb0168971
7
+ data.tar.gz: 1a6b81315dd4a09c7bd48e83e5f3fb3b35a2b179a3fdd4a79d1d6e87e9645d86ae054ecc1332eed8a5e24e4628117b53c30b445264975ad93dc03e8f9d6daf8e
@@ -121,9 +121,10 @@ module KBuilder
121
121
  # Extra options will be used as data for templates, e.g
122
122
  # @option opts [String] :to Recipient email
123
123
  # @option opts [String] :body The email's body
124
- def add_file_command(file, **opts)
124
+ def add_file_action(file, **opts)
125
125
  {
126
126
  action: :add_file,
127
+ played: false,
127
128
  file: file,
128
129
  opts: opts
129
130
  }
@@ -156,24 +157,39 @@ module KBuilder
156
157
  end
157
158
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
158
159
 
159
- def replay_commands(commands)
160
- commands.each do |command|
161
- case command[:action]
162
- when :add_file
163
- add_file(command[:file], command[:opts])
164
- when :delete_file
165
- delete_file(command[:file], command[:opts])
166
- else
167
- log.error "Unknown command: #{command[:action]}"
168
- end
160
+ def play_actions(actions)
161
+ actions.reject { |action| action[:played] }.each do |action|
162
+ play_action(action)
169
163
  end
170
164
  end
171
165
 
166
+ def play_action(action)
167
+ case action[:action]
168
+ when :add_file
169
+ add_file(action[:file], action[:opts])
170
+ when :delete_file
171
+ delete_file(action[:file], action[:opts])
172
+ when :vscode
173
+ vscode(action[:file_parts], action[:opts])
174
+ when :browse
175
+ browse(action[:file_parts], action[:opts])
176
+ when :set_current_folder
177
+ set_current_folder(action[:folder_key])
178
+ when :run_command
179
+ run_command(action[:command])
180
+ else
181
+ log.error "Unknown action: #{action[:action]}"
182
+ end
183
+
184
+ action[:played] = true
185
+ end
186
+
172
187
  alias touch add_file # it is expected that you would not supply any options, just a file name
173
188
 
174
- def delete_file_command(file, **opts)
189
+ def delete_file_action(file, **opts)
175
190
  {
176
191
  action: :delete_file,
192
+ played: false,
177
193
  file: file,
178
194
  opts: opts
179
195
  }
@@ -241,9 +257,10 @@ module KBuilder
241
257
  end
242
258
  alias clipboard_copy add_clipboard
243
259
 
244
- def vscode_command(*file_parts, folder_key: current_folder_key, file: nil)
260
+ def vscode_action(*file_parts, folder_key: current_folder_key, file: nil)
245
261
  {
246
262
  action: :vscode,
263
+ played: false,
247
264
  file_parts: file_parts,
248
265
  opts: { folder_key: folder_key, file: file }
249
266
  }
@@ -258,9 +275,10 @@ module KBuilder
258
275
  self
259
276
  end
260
277
 
261
- def browse_command(*file_parts, folder_key: current_folder_key, file: nil)
278
+ def browse_action(*file_parts, folder_key: current_folder_key, file: nil)
262
279
  {
263
280
  action: :browse,
281
+ played: false,
264
282
  file_parts: file_parts,
265
283
  opts: { folder_key: folder_key, file: file }
266
284
  }
@@ -330,6 +348,14 @@ module KBuilder
330
348
  # Target folders and files
331
349
  # ----------------------------------------------------------------------
332
350
 
351
+ def set_current_folder_action(folder_key)
352
+ {
353
+ action: :set_current_folder,
354
+ played: false,
355
+ folder_key: folder_key
356
+ }
357
+ end
358
+
333
359
  def set_current_folder(folder_key)
334
360
  target_folders.current = folder_key
335
361
 
@@ -506,6 +532,14 @@ module KBuilder
506
532
  end
507
533
  alias rc run_command
508
534
 
535
+ def run_command_action(command)
536
+ {
537
+ action: :run_command,
538
+ played: false,
539
+ command: command
540
+ }
541
+ end
542
+
509
543
  def file_write(file, content, on_exist: :skip)
510
544
  self.last_output_file = file # if file not found, we still want to record this as the last_output_file
511
545
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KBuilder
4
- VERSION = '0.0.68'
4
+ VERSION = '0.0.69'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.68
4
+ version: 0.0.69
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: handlebars-helpers