kdeploy 1.2.22 → 1.2.27
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/README.md +1 -1
- data/lib/kdeploy/dsl.rb +38 -0
- data/lib/kdeploy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d68017d3cc4506fb9d54391bdc5aa9bca2be0128c05d5e723e2de5add79f193b
|
|
4
|
+
data.tar.gz: d53007ff89ed7c0f1251dad46144943cefbd87e8300194fe8c9ed3af5c795dc6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fafc72a06a49340e5c39adea988f5ace68fb07a7ba74729fe96cfac4b1ed05fc4270c1938c2bc952eae7283137c5bc79fee0f3c61f0b024cba1d24eccb201bc
|
|
7
|
+
data.tar.gz: d02a0a6dfd913f06ced94cd4b018082be3aedc381d08197605bea0413811873baf662e9a3b0b4c1b145192e66008be949cc1f96d10b11e6fd0f26a00b9cfc33d
|
data/README.md
CHANGED
data/lib/kdeploy/dsl.rb
CHANGED
|
@@ -39,6 +39,44 @@ module Kdeploy
|
|
|
39
39
|
}
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
# Assign task to roles or hosts after task definition
|
|
43
|
+
def assign_task(task_name, on: nil, roles: nil)
|
|
44
|
+
task = kdeploy_tasks[task_name.to_sym]
|
|
45
|
+
raise ArgumentError, "Task #{task_name} not found" unless task
|
|
46
|
+
|
|
47
|
+
task[:hosts] = normalize_hosts_option(on) if on
|
|
48
|
+
task[:roles] = normalize_roles_option(roles) if roles
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Include task file and automatically assign all tasks to specified roles or hosts
|
|
52
|
+
def include_tasks(file_path, roles: nil, on: nil)
|
|
53
|
+
# Resolve relative paths based on the caller's file location
|
|
54
|
+
unless File.absolute_path?(file_path)
|
|
55
|
+
caller_file = caller_locations(1, 1).first.path
|
|
56
|
+
base_dir = File.dirname(File.expand_path(caller_file))
|
|
57
|
+
file_path = File.expand_path(file_path, base_dir)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Store tasks before loading
|
|
61
|
+
tasks_before = kdeploy_tasks.keys
|
|
62
|
+
|
|
63
|
+
# Load the task file
|
|
64
|
+
module_eval(File.read(file_path), file_path)
|
|
65
|
+
|
|
66
|
+
# Get newly added tasks
|
|
67
|
+
tasks_after = kdeploy_tasks.keys
|
|
68
|
+
new_tasks = tasks_after - tasks_before
|
|
69
|
+
|
|
70
|
+
# Assign roles/hosts to all new tasks (only if task doesn't already have hosts/roles)
|
|
71
|
+
new_tasks.each do |task_name|
|
|
72
|
+
task = kdeploy_tasks[task_name]
|
|
73
|
+
# Only assign if task doesn't already have hosts or roles defined
|
|
74
|
+
next if task[:hosts] || task[:roles]
|
|
75
|
+
|
|
76
|
+
assign_task(task_name, roles: roles, on: on) if roles || on
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
42
80
|
def normalize_hosts_option(on)
|
|
43
81
|
return on if on.is_a?(Array)
|
|
44
82
|
|
data/lib/kdeploy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kdeploy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.27
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kk
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bcrypt_pbkdf
|