legionio 1.6.38 → 1.6.40

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: f8485f443a4edd6f1e0edde6a5fd0f505117345dc094ba7c530cae364bf81ba4
4
- data.tar.gz: 316d0d1f81411b61704e7e554d157a70fdaa8b152eb8a70c5b696bfae7294224
3
+ metadata.gz: a330f40be9fc2224253f20449a723f990292ba92e7de86a98fd4d1c65c9e2e32
4
+ data.tar.gz: 3c0f0d1b70ec90418b7084888cc2e9c4f5574f925f6b194f8d60d3291e9ac78a
5
5
  SHA512:
6
- metadata.gz: 6b3937eed89a7d2378c6767483502029677b084f2178927b3e468b2c9e3b695e78063c089a8cb09ea199ed7209b1b91dac94cbe28bb25d0de1d469efaf7ebfa0
7
- data.tar.gz: b5285e4f906bd6af480077d793834d866a4d83ae4f53b826701c1073e23a839838b34ee2383e9e9d2d3389f0c3231a08f3637417aee3dced2b678ff12cd9398f
6
+ metadata.gz: 8f4ade19e0409428016b6f622f4125f88f3b46634367ba051dcdf303ba8c25a9c92938761731382c749513fafb8b17189645fdd0d578de43c13437c1cea3c4ee
7
+ data.tar.gz: '05807dccd9c9d7e7ff490dd8fab8096ead9dfa6af1de59c4d7c05d2c9f563bd5112736d4e515b4ce80461181e96666d7bbf5635ddbbd6641de216ff65dca88dc'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.6.40] - 2026-03-30
6
+
7
+ ### Fixed
8
+ - `Helpers::Lex` now includes Cache, Transport, Task, and Data helpers so all actors, runners, absorbers, and hooks automatically get `cache_connected?`, `transport_connected?`, `data_connected?`, `generate_task_id`, and related methods
9
+ - `Absorbers::Base` now includes `Helpers::Lex` (previously included zero helpers, causing `NoMethodError` for `log`, `cache_connected?`, etc.)
10
+
11
+ ## [1.6.39] - 2026-03-30
12
+
13
+ ### Added
14
+ - `legionio config reset` subcommand to wipe all JSON config files from settings directory (#88)
15
+ - `legionio bootstrap --clean` flag to clear settings before import (#88)
16
+
17
+ ### Changed
18
+ - `legionio bootstrap` no longer runs `ConfigScaffold` when a source is provided — scaffolded empty files were conflicting with imported config (#88)
19
+
5
20
  ## [1.6.38] - 2026-03-30
6
21
 
7
22
  ### Removed
@@ -21,6 +21,7 @@ module Legion
21
21
  class_option :skip_packs, type: :boolean, default: false, desc: 'Skip gem pack installation (config only)'
22
22
  class_option :start, type: :boolean, default: false, desc: 'Start redis + legionio via brew services after bootstrap'
23
23
  class_option :force, type: :boolean, default: false, desc: 'Overwrite existing config files'
24
+ class_option :clean, type: :boolean, default: false, desc: 'Remove all existing config files before import'
24
25
 
25
26
  desc 'SOURCE', 'Bootstrap Legion from a URL or local config file (fetch config, scaffold, install packs)'
26
27
  long_desc <<~DESC
@@ -53,16 +54,19 @@ module Legion
53
54
  print_step(out, 'Pre-flight checks')
54
55
  results[:preflight] = run_preflight_checks(out, warns)
55
56
 
56
- # 2. Fetch + parse config
57
+ # 2. Clean existing config (--clean)
58
+ results[:cleaned] = clean_settings(out) if options[:clean]
59
+
60
+ # 3. Fetch + parse config
57
61
  print_step(out, "Fetching config from #{source}")
58
62
  body = ConfigImport.fetch_source(source)
59
63
  config = ConfigImport.parse_payload(body)
60
64
 
61
- # 3. Extract packs before writing (bootstrap-only directive)
65
+ # 4. Extract packs before writing (bootstrap-only directive)
62
66
  pack_names = Array(config.delete(:packs)).map(&:to_s).reject(&:empty?)
63
67
  results[:packs_requested] = pack_names
64
68
 
65
- # 4. Write config
69
+ # 5. Write config
66
70
  paths = ConfigImport.write_config(config, force: options[:force])
67
71
  results[:config_written] = paths
68
72
  unless options[:json]
@@ -73,18 +77,18 @@ module Legion
73
77
  end
74
78
  end
75
79
 
76
- # 5. Scaffold missing subsystem files
77
- results[:scaffold] = run_scaffold(out)
80
+ # 6. Scaffold missing subsystem files (skipped when source provided)
81
+ results[:scaffold] = :skipped
78
82
 
79
- # 6. Install packs (unless --skip-packs)
83
+ # 7. Install packs (unless --skip-packs)
80
84
  results[:packs_installed] = install_packs_step(pack_names, out)
81
85
 
82
- # 7. Post-bootstrap summary
86
+ # 8. Post-bootstrap summary
83
87
  summary = build_summary(config, results, warns)
84
88
  results[:summary] = summary
85
89
  print_summary(out, summary)
86
90
 
87
- # 8. Optional --start
91
+ # 9. Optional --start
88
92
  if options[:start]
89
93
  print_step(out, 'Starting services')
90
94
  results[:services_started] = start_services(out)
@@ -207,6 +211,24 @@ module Legion
207
211
  end
208
212
  end
209
213
 
214
+ # -----------------------------------------------------------------------
215
+ # Clean settings (--clean)
216
+ # -----------------------------------------------------------------------
217
+
218
+ def clean_settings(out)
219
+ dir = ConfigImport::SETTINGS_DIR
220
+ files = Dir.glob(File.join(dir, '*.json'))
221
+ if files.empty?
222
+ out.warn("No existing config files to clean in #{dir}") unless options[:json]
223
+ return []
224
+ end
225
+
226
+ print_step(out, "Cleaning #{files.size} config file(s) from #{dir}")
227
+ files.each { |f| FileUtils.rm_f(f) }
228
+ files.each { |f| out.success("Removed: #{File.basename(f)}") } unless options[:json]
229
+ files
230
+ end
231
+
210
232
  # -----------------------------------------------------------------------
211
233
  # Scaffold options
212
234
  # -----------------------------------------------------------------------
@@ -184,6 +184,43 @@ module Legion
184
184
  raise SystemExit, exit_code if exit_code != 0
185
185
  end
186
186
 
187
+ desc 'reset', 'Remove all JSON config files from the settings directory'
188
+ long_desc <<~DESC
189
+ Removes all *.json files from the settings directory (~/.legionio/settings/).
190
+ Prompts for confirmation unless --force is passed.
191
+ DESC
192
+ option :force, type: :boolean, default: false, desc: 'Skip confirmation prompt'
193
+ def reset
194
+ require_relative 'config_import'
195
+ out = formatter
196
+ dir = options[:config_dir] || ConfigImport::SETTINGS_DIR
197
+
198
+ files = Dir.glob(File.join(dir, '*.json'))
199
+ if files.empty?
200
+ out.warn("No JSON files found in #{dir}")
201
+ return
202
+ end
203
+
204
+ unless options[:force]
205
+ out.warn("This will remove #{files.size} JSON file(s) from #{dir}:")
206
+ files.each { |f| puts " #{File.basename(f)}" }
207
+ print ' Continue? [y/N] '
208
+ answer = $stdin.gets&.strip
209
+ unless answer&.match?(/\Ay(es)?\z/i)
210
+ out.warn('Aborted.')
211
+ return
212
+ end
213
+ end
214
+
215
+ files.each { |f| FileUtils.rm_f(f) }
216
+
217
+ if options[:json]
218
+ out.json(removed: files, directory: dir)
219
+ else
220
+ out.success("Removed #{files.size} JSON file(s) from #{dir}")
221
+ end
222
+ end
223
+
187
224
  desc 'import SOURCE', 'Import configuration from a URL or local file'
188
225
  option :force, type: :boolean, default: false, desc: 'Overwrite existing imported config'
189
226
  def import(source)
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../definitions'
4
+ require_relative '../helpers/lex'
4
5
 
5
6
  module Legion
6
7
  module Extensions
7
8
  module Absorbers
8
9
  class Base
9
10
  extend Legion::Extensions::Definitions
11
+ include Legion::Extensions::Helpers::Lex
10
12
 
11
13
  class TokenRevocationError < StandardError
12
14
  end
@@ -1,7 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'legion/json/helper'
4
+ require_relative 'core'
5
+ require_relative 'logger'
4
6
  require_relative 'secret'
7
+ require_relative 'cache'
8
+ require_relative 'transport'
9
+ require_relative 'task'
10
+
11
+ begin
12
+ require_relative 'data'
13
+ rescue LoadError
14
+ nil
15
+ end
5
16
 
6
17
  module Legion
7
18
  module Extensions
@@ -11,6 +22,10 @@ module Legion
11
22
  include Legion::Extensions::Helpers::Logger
12
23
  include Legion::JSON::Helper
13
24
  include Legion::Extensions::Helpers::Secret
25
+ include Legion::Extensions::Helpers::Cache
26
+ include Legion::Extensions::Helpers::Transport
27
+ include Legion::Extensions::Helpers::Task
28
+ include Legion::Extensions::Helpers::Data if defined?(Legion::Extensions::Helpers::Data)
14
29
 
15
30
  def runner_desc(desc)
16
31
  settings[:runners] = {} if settings[:runners].nil?
@@ -19,8 +34,12 @@ module Legion
19
34
  end
20
35
 
21
36
  def self.included(base)
22
- base.send :extend, Legion::Extensions::Helpers::Core if base.instance_of?(Class)
23
- base.send :extend, Legion::Extensions::Helpers::Logger if base.instance_of?(Class)
37
+ if base.instance_of?(Class)
38
+ base.send :extend, Legion::Extensions::Helpers::Core
39
+ base.send :extend, Legion::Extensions::Helpers::Logger
40
+ base.send :extend, Legion::Extensions::Helpers::Cache
41
+ base.send :extend, Legion::Extensions::Helpers::Transport
42
+ end
24
43
  base.extend base if base.instance_of?(Module)
25
44
  end
26
45
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Legion
4
- VERSION = '1.6.38'
4
+ VERSION = '1.6.40'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legionio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.38
4
+ version: 1.6.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity