vagrant-docker-hosts-manager 0.3.0 → 0.4.1

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: 66272a00d09743fc1c067456c1680ac75768ca3d3c9534f1ad01eac5bf3b139e
4
- data.tar.gz: 24452535a62c76a094e86d77398697647207528e9cea5315b53b8031822ebfb5
3
+ metadata.gz: 13fa3fbb12ebe7ab3a21ea3333e46b2d15df5b8cd7d77a510402878e22c83d1a
4
+ data.tar.gz: a5c5f2dc4fac3811bf81fc984a0dff6c27664fbaf760c51a50371bb90f57f5a8
5
5
  SHA512:
6
- metadata.gz: 2ba755242cce735714503633ef65d425e9368fc0871bf85a268da447b32c3d7032610db4994707de04cf64df79ff94ab587815ddeb11ad3e3571664b7680b200
7
- data.tar.gz: d2e14700ece77c25e67c59b5a0c033f3daec0b86cea3227ff0438052163b9c577e39e8bb482ec0ef3e8f5e34a3a44471143dff13a45656f9884454f7bcc3f2d7
6
+ metadata.gz: a59cca7baa484a7bf6fb498fd3c2fa5e6f2ddf56c8410615df0369fa4e50bcd22e81f4f6142aeaec0fc11825f8ed5f159f1c4b563457b3041bcf2dbca5bf63ec
7
+ data.tar.gz: e8f76c37f99e9d41f06090c0f0104d89028d973dff0d42c08071c5960379f068d7a6144f96fca149890fa4fcb5c56de8cb276e6a24987933ce0b56b76874a2d2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.1](https://github.com/julienpoirou/vagrant-docker-hosts-manager/compare/v0.4.0...v0.4.1) (2026-07-05)
4
+
5
+
6
+ ### Corrections 🐛
7
+
8
+ * Wire the workflow_dispatch tag input and make Publish release-safe ([53c3beb](https://github.com/julienpoirou/vagrant-docker-hosts-manager/commit/53c3beb47eff1ebbd8d6df5ec45809f2027d627e))
9
+
10
+ ## [0.4.0](https://github.com/julienpoirou/vagrant-docker-hosts-manager/compare/v0.3.0...v0.4.0) (2026-06-30)
11
+
12
+
13
+ ### Fonctionnalités ✨
14
+
15
+ * Improve plugin quality and publish RubyDoc ([47bd507](https://github.com/julienpoirou/vagrant-docker-hosts-manager/commit/47bd5076a2eb0cb9dbf9796ac8fe7ce58f3663dc))
16
+
17
+
18
+ ### Corrections 🐛
19
+
20
+ * Honor VDHM_HOSTS_PATH override on posix, not only windows ([f674f95](https://github.com/julienpoirou/vagrant-docker-hosts-manager/commit/f674f95ccbb70242e6f5e3923c4e606e0d7f8221))
21
+ * Track new util/action modules and specs to fix CI load error ([460fae3](https://github.com/julienpoirou/vagrant-docker-hosts-manager/commit/460fae3ebac8ab4dcfa1069610f7f28f1620d8ac))
22
+
3
23
  ## [0.3.0](https://github.com/julienpoirou/vagrant-docker-hosts-manager/compare/v0.2.0...v0.3.0) (2026-03-11)
4
24
 
5
25
 
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.1
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantDockerHostsManager
4
+ module Action
5
+ class Apply
6
+ def initialize(app, _env) = (@app = app)
7
+
8
+ def call(env)
9
+ Util::I18n.setup!(env)
10
+ cfg = env[:machine].config.docker_hosts
11
+ ENV['VDHM_VERBOSE'] = '1' if cfg.respond_to?(:verbose) && cfg.verbose
12
+ mid = env[:machine].id || 'unknown'
13
+ dry = Util::I18n.env_flag('VDHM_DRY_RUN')
14
+ ui = env[:ui]
15
+ hoster = Util::HostsFile.new(env, owner_id: mid)
16
+
17
+ entries = compute_entries(env, cfg, ui)
18
+ if entries.empty?
19
+ UiHelpers.say(ui, ::I18n.t('vdhm.messages.no_entries'))
20
+ return
21
+ end
22
+
23
+ if dry
24
+ Util::Json.emit(action: 'apply', status: 'dry-run', data: { owner: mid, entries: entries })
25
+ return
26
+ end
27
+
28
+ hoster.apply(entries)
29
+ Util::Json.emit(action: 'apply', status: 'success', data: { owner: mid, entries: entries })
30
+ rescue StandardError => e
31
+ Util::Json.emit(action: 'apply', status: 'error', error: e.message, backtrace: e.backtrace&.first(3))
32
+ UiHelpers.error(ui, "VDHM: #{e.message}")
33
+ ensure
34
+ @app.call(env)
35
+ end
36
+
37
+ private
38
+
39
+ def compute_entries(_env, cfg, ui)
40
+ entries = {}
41
+
42
+ cfg.domains.each do |domain, ip|
43
+ next if domain.to_s.strip.empty?
44
+
45
+ if ip.nil? || ip.to_s.strip.empty?
46
+ UiHelpers.warn(ui, ::I18n.t('vdhm.messages.missing_ip_for', domain: domain))
47
+ next
48
+ end
49
+ entries[domain] = ip
50
+ end
51
+
52
+ if cfg.domain && !cfg.domain.strip.empty?
53
+ ip = cfg.ip || begin
54
+ Util::Docker.ip_for_container(cfg.container_name) if cfg.container_name && !cfg.container_name.strip.empty?
55
+ end
56
+ if ip && !ip.strip.empty?
57
+ UiHelpers.say(ui, ::I18n.t('vdhm.messages.detected_ip', domain: cfg.domain, ip: ip))
58
+ entries[cfg.domain] = ip
59
+ else
60
+ UiHelpers.warn(ui, ::I18n.t('vdhm.messages.no_ip_found', domain: cfg.domain, container: cfg.container_name))
61
+ end
62
+ end
63
+
64
+ entries
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantDockerHostsManager
4
+ module Action
5
+ class Cleanup
6
+ def initialize(app, _env) = (@app = app)
7
+
8
+ def call(env)
9
+ Util::I18n.setup!(env)
10
+ cfg = env[:machine].config.docker_hosts
11
+ ENV['VDHM_VERBOSE'] = '1' if cfg.respond_to?(:verbose) && cfg.verbose
12
+ mid = env[:machine].id || 'unknown'
13
+ dry = Util::I18n.env_flag('VDHM_DRY_RUN')
14
+ purge = Util::I18n.env_flag('VDHM_PURGE_ON_DESTROY')
15
+ ui = env[:ui]
16
+ hoster = Util::HostsFile.new(env, owner_id: mid)
17
+
18
+ if dry
19
+ Util::Json.emit(action: 'cleanup', status: 'dry-run', data: { owner: mid, mode: purge ? 'all' : 'owner' })
20
+ return
21
+ end
22
+
23
+ removed = purge ? hoster.remove_all_managed! : hoster.remove!
24
+ Util::Json.emit(action: 'cleanup', status: 'success',
25
+ data: { owner: mid, removed: removed, mode: purge ? 'all' : 'owner' })
26
+ rescue StandardError => e
27
+ Util::Json.emit(action: 'cleanup', status: 'error', error: e.message)
28
+ UiHelpers.error(ui, "VDHM: #{e.message}")
29
+ ensure
30
+ @app.call(env)
31
+ end
32
+ end
33
+ end
34
+ end