kdeploy 0.2.0 → 0.4.0
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 +122 -318
- data/exe/kdeploy +6 -0
- data/k.md +149 -0
- data/lib/kdeploy/banner.rb +44 -14
- data/lib/kdeploy/cli.rb +179 -1395
- data/lib/kdeploy/dsl.rb +62 -530
- data/lib/kdeploy/executor.rb +73 -0
- data/lib/kdeploy/initializer.rb +229 -0
- data/lib/kdeploy/runner.rb +40 -180
- data/lib/kdeploy/template.rb +19 -161
- data/lib/kdeploy/version.rb +1 -2
- data/lib/kdeploy.rb +9 -100
- metadata +74 -52
- data/.editorconfig +0 -12
- data/.rspec +0 -3
- data/.rubocop.yml +0 -100
- data/LICENSE +0 -21
- data/README_CN.md +0 -1030
- data/Rakefile +0 -46
- data/bin/kdeploy +0 -7
- data/kdeploy.gemspec +0 -49
- data/lib/kdeploy/command.rb +0 -182
- data/lib/kdeploy/configuration.rb +0 -83
- data/lib/kdeploy/host.rb +0 -85
- data/lib/kdeploy/inventory.rb +0 -243
- data/lib/kdeploy/logger.rb +0 -100
- data/lib/kdeploy/pipeline.rb +0 -249
- data/lib/kdeploy/ssh_connection.rb +0 -187
- data/lib/kdeploy/statistics.rb +0 -439
- data/lib/kdeploy/task.rb +0 -240
- data/scripts/common_tasks.rb +0 -218
- data/scripts/deploy.rb +0 -50
data/lib/kdeploy.rb
CHANGED
@@ -1,106 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require 'tty-prompt'
|
12
|
-
require 'erb'
|
13
|
-
require 'fileutils'
|
14
|
-
require 'json'
|
3
|
+
require_relative 'kdeploy/version'
|
4
|
+
require_relative 'kdeploy/banner'
|
5
|
+
require_relative 'kdeploy/dsl'
|
6
|
+
require_relative 'kdeploy/executor'
|
7
|
+
require_relative 'kdeploy/runner'
|
8
|
+
require_relative 'kdeploy/initializer'
|
9
|
+
require_relative 'kdeploy/template'
|
10
|
+
require_relative 'kdeploy/cli'
|
15
11
|
|
16
|
-
# Internal dependencies - ordered by dependency chain
|
17
12
|
module Kdeploy
|
18
|
-
# Load all components
|
19
|
-
autoload :VERSION, 'kdeploy/version'
|
20
|
-
autoload :Configuration, 'kdeploy/configuration'
|
21
|
-
autoload :Logger, 'kdeploy/logger'
|
22
|
-
autoload :Host, 'kdeploy/host'
|
23
|
-
autoload :Inventory, 'kdeploy/inventory'
|
24
|
-
autoload :Template, 'kdeploy/template'
|
25
|
-
autoload :SSHConnection, 'kdeploy/ssh_connection'
|
26
|
-
autoload :Command, 'kdeploy/command'
|
27
|
-
autoload :Task, 'kdeploy/task'
|
28
|
-
autoload :Pipeline, 'kdeploy/pipeline'
|
29
|
-
autoload :DSL, 'kdeploy/dsl'
|
30
|
-
autoload :Runner, 'kdeploy/runner'
|
31
|
-
autoload :Statistics, 'kdeploy/statistics'
|
32
|
-
autoload :Banner, 'kdeploy/banner'
|
33
|
-
autoload :CLI, 'kdeploy/cli'
|
34
|
-
|
35
|
-
# Base error class for Kdeploy
|
36
13
|
class Error < StandardError; end
|
37
|
-
|
38
|
-
# Error raised when connection fails
|
39
|
-
class ConnectionError < Error; end
|
40
|
-
|
41
|
-
# Error raised when command execution fails
|
42
|
-
class CommandError < Error; end
|
43
|
-
|
44
|
-
# Error raised when configuration is invalid
|
45
|
-
class ConfigurationError < Error; end
|
46
|
-
|
47
|
-
class << self
|
48
|
-
attr_accessor :configuration
|
49
|
-
attr_reader :statistics
|
50
|
-
|
51
|
-
# Initialize statistics
|
52
|
-
# @return [Statistics] Statistics instance
|
53
|
-
def statistics
|
54
|
-
@statistics ||= Statistics.new
|
55
|
-
end
|
56
|
-
|
57
|
-
# Configure kdeploy
|
58
|
-
# @yield [Configuration] Configuration instance
|
59
|
-
# @return [Configuration] Configuration instance
|
60
|
-
def configure
|
61
|
-
self.configuration ||= Configuration.new
|
62
|
-
yield(configuration) if block_given?
|
63
|
-
configuration
|
64
|
-
end
|
65
|
-
|
66
|
-
# Load and execute deployment script
|
67
|
-
# @param script_file [String] Path to deployment script
|
68
|
-
# @return [Pipeline] Loaded pipeline
|
69
|
-
# @raise [ConfigurationError] If script file not found
|
70
|
-
def load_script(script_file)
|
71
|
-
validate_script_file(script_file)
|
72
|
-
script_dir = File.dirname(File.expand_path(script_file))
|
73
|
-
create_pipeline(script_file, script_dir)
|
74
|
-
end
|
75
|
-
|
76
|
-
# Execute deployment pipeline
|
77
|
-
# @param pipeline [Pipeline] Pipeline to execute
|
78
|
-
# @return [Hash] Execution results
|
79
|
-
def execute(pipeline)
|
80
|
-
runner = Runner.new(pipeline)
|
81
|
-
runner.execute
|
82
|
-
end
|
83
|
-
|
84
|
-
# Convenient method to load and execute script
|
85
|
-
# @param script_file [String] Path to deployment script
|
86
|
-
# @return [Hash] Execution results
|
87
|
-
def run(script_file)
|
88
|
-
pipeline = load_script(script_file)
|
89
|
-
execute(pipeline)
|
90
|
-
end
|
91
|
-
|
92
|
-
private
|
93
|
-
|
94
|
-
def validate_script_file(script_file)
|
95
|
-
return if File.exist?(script_file)
|
96
|
-
|
97
|
-
raise ConfigurationError, "Script file not found: #{script_file}"
|
98
|
-
end
|
99
|
-
|
100
|
-
def create_pipeline(script_file, script_dir)
|
101
|
-
dsl = DSL.new(script_dir)
|
102
|
-
dsl.instance_eval(File.read(script_file), script_file)
|
103
|
-
dsl.pipeline
|
104
|
-
end
|
105
|
-
end
|
14
|
+
# Your code goes here...
|
106
15
|
end
|
metadata
CHANGED
@@ -1,118 +1,157 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kdeploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Norton
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2025-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: concurrent-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: net-scp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: net-
|
42
|
+
name: net-ssh
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '7.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '7.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: pastel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0.8'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: thor
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.2'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: tty-
|
84
|
+
name: tty-box
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.7'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.7'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: tty-table
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
103
|
+
version: '0.12'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0.
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
110
|
+
version: '0.12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '13.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '13.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.21'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.21'
|
153
|
+
description: Kdeploy is a Ruby-based deployment automation tool that provides agentless
|
154
|
+
remote deployment solutions with an elegant DSL
|
116
155
|
email:
|
117
156
|
- kevin197011@outlook.com
|
118
157
|
executables:
|
@@ -120,40 +159,24 @@ executables:
|
|
120
159
|
extensions: []
|
121
160
|
extra_rdoc_files: []
|
122
161
|
files:
|
123
|
-
- ".editorconfig"
|
124
|
-
- ".rspec"
|
125
|
-
- ".rubocop.yml"
|
126
|
-
- LICENSE
|
127
162
|
- README.md
|
128
|
-
-
|
129
|
-
-
|
130
|
-
- bin/kdeploy
|
131
|
-
- kdeploy.gemspec
|
163
|
+
- exe/kdeploy
|
164
|
+
- k.md
|
132
165
|
- lib/kdeploy.rb
|
133
166
|
- lib/kdeploy/banner.rb
|
134
167
|
- lib/kdeploy/cli.rb
|
135
|
-
- lib/kdeploy/command.rb
|
136
|
-
- lib/kdeploy/configuration.rb
|
137
168
|
- lib/kdeploy/dsl.rb
|
138
|
-
- lib/kdeploy/
|
139
|
-
- lib/kdeploy/
|
140
|
-
- lib/kdeploy/logger.rb
|
141
|
-
- lib/kdeploy/pipeline.rb
|
169
|
+
- lib/kdeploy/executor.rb
|
170
|
+
- lib/kdeploy/initializer.rb
|
142
171
|
- lib/kdeploy/runner.rb
|
143
|
-
- lib/kdeploy/ssh_connection.rb
|
144
|
-
- lib/kdeploy/statistics.rb
|
145
|
-
- lib/kdeploy/task.rb
|
146
172
|
- lib/kdeploy/template.rb
|
147
173
|
- lib/kdeploy/version.rb
|
148
|
-
- scripts/common_tasks.rb
|
149
|
-
- scripts/deploy.rb
|
150
174
|
homepage: https://github.com/kevin197011/kdeploy
|
151
175
|
licenses:
|
152
176
|
- MIT
|
153
177
|
metadata:
|
154
|
-
allowed_push_host: https://rubygems.org
|
155
178
|
homepage_uri: https://github.com/kevin197011/kdeploy
|
156
|
-
source_code_uri: https://github.com/kevin197011/kdeploy
|
179
|
+
source_code_uri: https://github.com/kevin197011/kdeploy.git
|
157
180
|
changelog_uri: https://github.com/kevin197011/kdeploy/blob/main/CHANGELOG.md
|
158
181
|
rubygems_mfa_required: 'true'
|
159
182
|
post_install_message:
|
@@ -164,7 +187,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
187
|
requirements:
|
165
188
|
- - ">="
|
166
189
|
- !ruby/object:Gem::Version
|
167
|
-
version: 3.
|
190
|
+
version: 3.2.0
|
168
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
192
|
requirements:
|
170
193
|
- - ">="
|
@@ -174,6 +197,5 @@ requirements: []
|
|
174
197
|
rubygems_version: 3.4.19
|
175
198
|
signing_key:
|
176
199
|
specification_version: 4
|
177
|
-
summary:
|
178
|
-
support
|
200
|
+
summary: A lightweight agentless deployment tool
|
179
201
|
test_files: []
|
data/.editorconfig
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
# require:
|
2
|
-
# - rubocop-rspec
|
3
|
-
|
4
|
-
AllCops:
|
5
|
-
TargetRubyVersion: 3.2.2
|
6
|
-
NewCops: enable
|
7
|
-
Exclude:
|
8
|
-
- 'vendor/**/*'
|
9
|
-
- 'tmp/**/*'
|
10
|
-
- 'bin/**/*'
|
11
|
-
SuggestExtensions: false
|
12
|
-
|
13
|
-
# Style
|
14
|
-
Style/Documentation:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Style/FrozenStringLiteralComment:
|
18
|
-
Enabled: true
|
19
|
-
|
20
|
-
Style/StringLiterals:
|
21
|
-
EnforcedStyle: single_quotes
|
22
|
-
|
23
|
-
Style/StringLiteralsInInterpolation:
|
24
|
-
EnforcedStyle: single_quotes
|
25
|
-
|
26
|
-
# Layout
|
27
|
-
Layout/LineLength:
|
28
|
-
Max: 150
|
29
|
-
AllowedPatterns: ['\A#']
|
30
|
-
|
31
|
-
Layout/MultilineMethodCallIndentation:
|
32
|
-
EnforcedStyle: indented
|
33
|
-
|
34
|
-
# Metrics
|
35
|
-
Metrics/ClassLength:
|
36
|
-
Max: 400
|
37
|
-
Exclude:
|
38
|
-
- 'lib/kdeploy/cli.rb' # CLI class is naturally large
|
39
|
-
|
40
|
-
Metrics/MethodLength:
|
41
|
-
Max: 40
|
42
|
-
Exclude:
|
43
|
-
- 'spec/**/*'
|
44
|
-
- 'lib/kdeploy/cli.rb' # CLI methods can be longer
|
45
|
-
|
46
|
-
Metrics/BlockLength:
|
47
|
-
Exclude:
|
48
|
-
- 'spec/**/*'
|
49
|
-
- '*.gemspec'
|
50
|
-
|
51
|
-
Metrics/AbcSize:
|
52
|
-
Max: 35
|
53
|
-
Exclude:
|
54
|
-
- 'lib/kdeploy/inventory.rb' # Inventory parsing is complex
|
55
|
-
|
56
|
-
Metrics/CyclomaticComplexity:
|
57
|
-
Max: 15
|
58
|
-
Exclude:
|
59
|
-
- 'lib/kdeploy/inventory.rb' # Inventory parsing is complex
|
60
|
-
|
61
|
-
Metrics/PerceivedComplexity:
|
62
|
-
Max: 15
|
63
|
-
Exclude:
|
64
|
-
- 'lib/kdeploy/inventory.rb' # Inventory parsing is complex
|
65
|
-
|
66
|
-
Metrics/ParameterLists:
|
67
|
-
Max: 8 # Some methods need more parameters
|
68
|
-
|
69
|
-
# Naming
|
70
|
-
Naming/PredicatePrefix:
|
71
|
-
ForbiddenPrefixes:
|
72
|
-
- 'is_'
|
73
|
-
|
74
|
-
Naming/PredicateMethod:
|
75
|
-
Exclude:
|
76
|
-
- 'spec/**/*' # Mock methods don't need to follow naming conventions
|
77
|
-
- 'lib/kdeploy/dsl.rb' # DSL methods may have various naming patterns
|
78
|
-
|
79
|
-
# Lint
|
80
|
-
Lint/DuplicateBranch:
|
81
|
-
Exclude:
|
82
|
-
- 'lib/kdeploy/logger.rb' # Logger level mapping has duplicate branches
|
83
|
-
|
84
|
-
Lint/UnusedMethodArgument:
|
85
|
-
Exclude:
|
86
|
-
- 'spec/**/*' # Mock methods may have unused arguments
|
87
|
-
|
88
|
-
Lint/UselessAssignment:
|
89
|
-
Exclude:
|
90
|
-
- 'lib/kdeploy/ssh_connection.rb' # Some assignments are for clarity
|
91
|
-
|
92
|
-
# RSpec (disabled - requires rubocop-rspec gem)
|
93
|
-
# RSpec/ExampleLength:
|
94
|
-
# Max: 10
|
95
|
-
#
|
96
|
-
# RSpec/MultipleExpectations:
|
97
|
-
# Max: 5
|
98
|
-
#
|
99
|
-
# RSpec/NestedGroups:
|
100
|
-
# Max: 4
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2024 Kdeploy Team
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|