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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d29fae0402fa5ff4f3fe0ceeff8ea8743afca9c9af17d3fd14792a387dd83ef
4
- data.tar.gz: 3ad240791ba81f84a51aa71d7ad96d697110ba250046978c2c204a373ec1b90a
3
+ metadata.gz: d68017d3cc4506fb9d54391bdc5aa9bca2be0128c05d5e723e2de5add79f193b
4
+ data.tar.gz: d53007ff89ed7c0f1251dad46144943cefbd87e8300194fe8c9ed3af5c795dc6
5
5
  SHA512:
6
- metadata.gz: 41384fc6353d11ff64f2c1a40da54e628e4aab1b3530a74b1a07b212f8c7a4ae1313bdfc075866d1603cb586bfe80790fce73c7e74c1a1f0a1540224ca9fc2b6
7
- data.tar.gz: e49323399049279db2ea4bb8c13fd66039b05780d1ec468dd37fb80d8e0a20777f61e0c4a082070c6b0fc2e0b56555beda434bca3e72b60f50a6947bb69c095a
6
+ metadata.gz: 1fafc72a06a49340e5c39adea988f5ace68fb07a7ba74729fe96cfac4b1ed05fc4270c1938c2bc952eae7283137c5bc79fee0f3c61f0b024cba1d24eccb201bc
7
+ data.tar.gz: d02a0a6dfd913f06ced94cd4b018082be3aedc381d08197605bea0413811873baf662e9a3b0b4c1b145192e66008be949cc1f96d10b11e6fd0f26a00b9cfc33d
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  |_| |___/
10
10
 
11
11
  ⚡ 轻量级无代理部署工具
12
- 🚀 自信部署,轻松扩展
12
+ 🚀 自动部署,轻松扩展
13
13
  ```
14
14
 
15
15
  一个用 Ruby 编写的轻量级、无代理的部署自动化工具。Kdeploy 使您能够使用 SSH 在多个服务器上部署应用程序、管理配置和执行任务,而无需在目标机器上安装任何代理或守护进程。
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
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Kdeploy module for version management
4
4
  module Kdeploy
5
- VERSION = '1.2.22' unless const_defined?(:VERSION)
5
+ VERSION = '1.2.27' unless const_defined?(:VERSION)
6
6
  end
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.22
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-19 00:00:00.000000000 Z
11
+ date: 2025-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt_pbkdf