kscript 1.0.7 → 1.0.9
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/kscript/base.rb +1 -1
- data/lib/{completions → kscript/completions}/kscript.bash +1 -1
- data/lib/kscript/completions/kscript.zsh +27 -0
- data/lib/kscript/plugins/kk_apnic_ip_utils.rb +17 -12
- data/lib/kscript/plugins/kk_aws_s3_utils.rb +2 -2
- data/lib/kscript/plugins/kk_cursor_rules_utils.rb +113 -0
- data/lib/kscript/plugins/kk_elastic_cert_finger_utils.rb +2 -2
- data/lib/kscript/plugins/kk_ffmpeg_install_utils.rb +2 -2
- data/lib/kscript/plugins/kk_file_rename_utils.rb +2 -2
- data/lib/kscript/plugins/kk_ip_lookup_utils.rb +2 -2
- data/lib/kscript/plugins/kk_jenkins_manage_utils.rb +2 -2
- data/lib/kscript/plugins/kk_kibana_manage_utils.rb +2 -2
- data/lib/kscript/plugins/kk_lvm_manage_utils.rb +2 -2
- data/lib/kscript/plugins/kk_mac_optimize_utils.rb +2 -2
- data/lib/kscript/plugins/kk_mac_status_utils.rb +2 -2
- data/lib/kscript/plugins/kk_port_scan_utils.rb +9 -14
- data/lib/kscript/plugins/kk_project_scan_utils.rb +4 -3
- data/lib/kscript/plugins/kk_shell_helper_utils.rb +3 -3
- data/lib/kscript/plugins/kk_usd_rate_utils.rb +1 -3
- data/lib/kscript/plugins/kk_vcs_cleaner_utils.rb +3 -3
- data/lib/kscript/plugins/kk_wg_acl_utils.rb +2 -2
- data/lib/kscript/plugins/kk_wg_pass_utils.rb +2 -2
- data/lib/kscript/version.rb +1 -1
- data/lib/kscript.rb +5 -6
- metadata +5 -5
- data/lib/completions/kscript.zsh +0 -29
- data/lib/kscript/utils.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587c4a1f08230cd5085bace44a9fbb4035f52a62a4f1fdb35e00fb5ef4e52567
|
4
|
+
data.tar.gz: efb3539204a0b0dddb0a8a375a6d58574d668b96bdef01dacd0d1e394f309542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54c44443112073b48dda6b9d4c7f9707ab99b94b8fb5e4a04c1320cdcd1becaacd34c81c452d21bd84bc20be797900e05fed004d07e5423c7081e49a96379b66
|
7
|
+
data.tar.gz: c155b0a6eb3c047c73e5b90c0c6353aaff99e47eab12acdab905cfa287090475ff35c681d95674a92b85268f886ad4351e0ce58209d0b00f727e696d3ff4ffe3
|
data/README.md
CHANGED
data/lib/kscript/base.rb
CHANGED
@@ -8,7 +8,7 @@ _kscript_completions() {
|
|
8
8
|
|
9
9
|
# Main command list as array
|
10
10
|
local opts=(
|
11
|
-
|
11
|
+
apnic_ip aws_s3 cursor_rules elastic_cert_finger ffmpeg_install file_rename ip_lookup jenkins_manage kibana_manage lvm_manage mac_optimize mac_status port_scan project_scan shell_helper usd_rate vcs_cleaner wg_acl wg_pass
|
12
12
|
)
|
13
13
|
|
14
14
|
if [[ ${COMP_CWORD} == 1 ]]; then
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#compdef kscript
|
2
|
+
_kscript() {
|
3
|
+
local -a commands
|
4
|
+
commands=(
|
5
|
+
'apnic_ip:kscript command'
|
6
|
+
'aws_s3:kscript command'
|
7
|
+
'cursor_rules:kscript command'
|
8
|
+
'elastic_cert_finger:kscript command'
|
9
|
+
'ffmpeg_install:kscript command'
|
10
|
+
'file_rename:kscript command'
|
11
|
+
'ip_lookup:kscript command'
|
12
|
+
'jenkins_manage:kscript command'
|
13
|
+
'kibana_manage:kscript command'
|
14
|
+
'lvm_manage:kscript command'
|
15
|
+
'mac_optimize:kscript command'
|
16
|
+
'mac_status:kscript command'
|
17
|
+
'port_scan:kscript command'
|
18
|
+
'project_scan:kscript command'
|
19
|
+
'shell_helper:kscript command'
|
20
|
+
'usd_rate:kscript command'
|
21
|
+
'vcs_cleaner:kscript command'
|
22
|
+
'wg_acl:kscript command'
|
23
|
+
'wg_pass:kscript command'
|
24
|
+
)
|
25
|
+
_describe 'command' commands
|
26
|
+
}
|
27
|
+
compdef _kscript kscript
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript' # 移除此行
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkApnicIpUtils < Base
|
11
|
+
class KkApnicIpUtils < Kscript::Base
|
12
12
|
attr_reader :country_sn, :cache_file
|
13
13
|
|
14
14
|
# Initialize class instance, set country code and cache file path
|
@@ -21,16 +21,20 @@ module Kscript
|
|
21
21
|
# Download data from APNIC or read from cache
|
22
22
|
def download_data
|
23
23
|
if File.exist?(cache_file) && File.size?(cache_file)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
File.write(cache_file, response.body.to_s)
|
32
|
-
logger.kinfo("Data downloaded and saved to #{cache_file}")
|
24
|
+
mtime = File.mtime(cache_file)
|
25
|
+
if Time.now - mtime < 86_400
|
26
|
+
logger.kinfo("Using cached data from #{cache_file} (updated #{mtime})")
|
27
|
+
return
|
28
|
+
else
|
29
|
+
logger.kinfo("Cache expired (last updated #{mtime}), downloading new data...")
|
30
|
+
end
|
33
31
|
end
|
32
|
+
url = 'https://ftp.apnic.net/stats/apnic/delegated-apnic-latest'
|
33
|
+
response = HTTP.get(url)
|
34
|
+
raise "Failed to download the APNIC data. HTTP Status: #{response.status}" unless response.status.success?
|
35
|
+
|
36
|
+
File.write(cache_file, response.body.to_s)
|
37
|
+
logger.kinfo("Data downloaded and saved to #{cache_file}")
|
34
38
|
end
|
35
39
|
|
36
40
|
# Parse data and return IPv4 address ranges (CIDR format) for specified country
|
@@ -58,8 +62,9 @@ module Kscript
|
|
58
62
|
32 - Math.log2(hosts).to_i
|
59
63
|
end
|
60
64
|
|
61
|
-
def run
|
65
|
+
def run(*args, **_opts)
|
62
66
|
with_error_handling do
|
67
|
+
@country_sn = args[0] if args[0]
|
63
68
|
parse_ip_ranges
|
64
69
|
end
|
65
70
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
# AWS S3 文件上传测试工具
|
11
11
|
# 用法示例:
|
@@ -14,7 +14,7 @@ require 'kscript'
|
|
14
14
|
# 依赖:aws-sdk-s3(已在主入口 require)
|
15
15
|
|
16
16
|
module Kscript
|
17
|
-
class KkAwsS3Utils < Base
|
17
|
+
class KkAwsS3Utils < Kscript::Base
|
18
18
|
# 初始化,支持所有参数通过 CLI 传递
|
19
19
|
def initialize(*args, **opts)
|
20
20
|
super
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2025 kk
|
4
|
+
#
|
5
|
+
# This software is released under the MIT License.
|
6
|
+
# https://opensource.org/licenses/MIT
|
7
|
+
|
8
|
+
# require 'kscript'
|
9
|
+
|
10
|
+
module Kscript
|
11
|
+
class KkCursorRulesUtils < Kscript::Base
|
12
|
+
def initialize(*_args, **opts)
|
13
|
+
super(**opts.merge(service: 'kk_cursor_rules'))
|
14
|
+
end
|
15
|
+
|
16
|
+
def run(*args, **_opts)
|
17
|
+
with_error_handling do
|
18
|
+
if args[0].to_s == 'deploy'
|
19
|
+
deploy
|
20
|
+
else
|
21
|
+
logger.kwarn("Usage: #{self.class.usage}")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def deploy
|
27
|
+
logger.kinfo('======= 🚀 Cursor Rules Deploy =======')
|
28
|
+
logger.kinfo("📅 Date Time: #{Time.now}")
|
29
|
+
logger.kinfo('')
|
30
|
+
|
31
|
+
# Remove .cursor if exists
|
32
|
+
if Dir.exist?('.cursor')
|
33
|
+
logger.kinfo('Removing existing .cursor directory...')
|
34
|
+
FileUtils.rm_rf('.cursor')
|
35
|
+
end
|
36
|
+
|
37
|
+
# Clone .cursor repo
|
38
|
+
logger.kinfo('Cloning .cursor repo from github...')
|
39
|
+
system_or_raise('git clone git@github.com:kevin197011/cursor.git .cursor')
|
40
|
+
|
41
|
+
# Move Rakefile if not exists, else remove .cursor/Rakefile
|
42
|
+
if !File.exist?('Rakefile') && File.exist?('.cursor/Rakefile')
|
43
|
+
logger.kinfo('Moving .cursor/Rakefile to project root...')
|
44
|
+
FileUtils.mv('.cursor/Rakefile', 'Rakefile')
|
45
|
+
elsif File.exist?('.cursor/Rakefile')
|
46
|
+
logger.kinfo('Removing .cursor/Rakefile (already present in root)...')
|
47
|
+
FileUtils.rm_rf('.cursor/Rakefile')
|
48
|
+
end
|
49
|
+
|
50
|
+
# Move push.rb
|
51
|
+
if File.exist?('.cursor/push.rb')
|
52
|
+
logger.kinfo('Moving .cursor/push.rb to project root...')
|
53
|
+
FileUtils.mv('.cursor/push.rb', 'push.rb')
|
54
|
+
end
|
55
|
+
|
56
|
+
# Move .rubocop.yml
|
57
|
+
if File.exist?('.cursor/.rubocop.yml')
|
58
|
+
logger.kinfo('Moving .cursor/.rubocop.yml to project root...')
|
59
|
+
FileUtils.mv('.cursor/.rubocop.yml', '.rubocop.yml')
|
60
|
+
end
|
61
|
+
|
62
|
+
# Remove .cursor/.git if exists
|
63
|
+
if File.exist?('.cursor/.git')
|
64
|
+
logger.kinfo('Removing .cursor/.git directory...')
|
65
|
+
FileUtils.rm_rf('.cursor/.git')
|
66
|
+
end
|
67
|
+
|
68
|
+
# Ensure .gitignore contains .cursor
|
69
|
+
if File.exist?('.gitignore') && File.readlines('.gitignore').none? { |l| l.strip == '.cursor' }
|
70
|
+
logger.kinfo('Adding .cursor to .gitignore...')
|
71
|
+
File.open('.gitignore', 'a') { |f| f.puts '\n.cursor' }
|
72
|
+
end
|
73
|
+
|
74
|
+
logger.kinfo("\n✅ Cursor rules deploy completed!")
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def system_or_raise(cmd)
|
80
|
+
logger.kinfo("Running: #{cmd}")
|
81
|
+
success = system(cmd)
|
82
|
+
raise "Command failed: #{cmd}" unless success
|
83
|
+
end
|
84
|
+
|
85
|
+
def with_error_handling
|
86
|
+
yield
|
87
|
+
rescue StandardError => e
|
88
|
+
logger.kerror("[ERROR] #{e.class}: #{e.message}")
|
89
|
+
exit(1)
|
90
|
+
end
|
91
|
+
|
92
|
+
# ==== CLI/Plugin Metadata ====
|
93
|
+
def self.description
|
94
|
+
'Cursor rules deploy helper: syncs .cursor repo and project rules.'
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.arguments
|
98
|
+
'[deploy]'
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.usage
|
102
|
+
'kscript cursor_rules deploy'
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.group
|
106
|
+
'devops'
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.author
|
110
|
+
'kk'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkElasticCertFingerUtils < Base
|
11
|
+
class KkElasticCertFingerUtils < Kscript::Base
|
12
12
|
DEFAULT_CERT_PATH = 'elasticsearch.crt'
|
13
13
|
|
14
14
|
attr_reader :cert_path
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkFfmpegInstallUtils < Base
|
11
|
+
class KkFfmpegInstallUtils < Kscript::Base
|
12
12
|
def initialize(*args, **opts)
|
13
13
|
super
|
14
14
|
end
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkFileRenameUtils < Base
|
11
|
+
class KkFileRenameUtils < Kscript::Base
|
12
12
|
attr_reader :source_pattern, :target_pattern, :directory
|
13
13
|
|
14
14
|
def initialize(*args, **opts)
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkIpLookupUtils < Base
|
11
|
+
class KkIpLookupUtils < Kscript::Base
|
12
12
|
IP_API_BASE_URL = 'http://ip-api.com/json'
|
13
13
|
IP_CHECK_URL = 'https://api.ipify.org?format=json'
|
14
14
|
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkJenkinsManageUtils < Base
|
11
|
+
class KkJenkinsManageUtils < Kscript::Base
|
12
12
|
def initialize(*args, **opts)
|
13
13
|
super
|
14
14
|
jenkins_url, user, password = args
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkKibanaManageUtils < Base
|
11
|
+
class KkKibanaManageUtils < Kscript::Base
|
12
12
|
def initialize(*args, **opts)
|
13
13
|
super
|
14
14
|
project_name, project_env, base_url, username, password = args
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkLvmManageUtils < Base
|
11
|
+
class KkLvmManageUtils < Kscript::Base
|
12
12
|
DEFAULT_CONFIG = {
|
13
13
|
device: '/dev/sdb',
|
14
14
|
volume_group: 'vg_data',
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkMacOptimizeUtils < Base
|
11
|
+
class KkMacOptimizeUtils < Kscript::Base
|
12
12
|
def initialize(*args, **opts)
|
13
13
|
super
|
14
14
|
end
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkMacStatusUtils < Base
|
11
|
+
class KkMacStatusUtils < Kscript::Base
|
12
12
|
def initialize(*_args, **opts)
|
13
13
|
super(**opts.merge(service: 'kk_mac_status'))
|
14
14
|
end
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkPortScanUtils < Base
|
11
|
+
class KkPortScanUtils < Kscript::Base
|
12
12
|
attr_reader :host, :ports, :thread_count
|
13
13
|
|
14
14
|
# Initialize the scanner with target host and port range
|
@@ -22,8 +22,12 @@ module Kscript
|
|
22
22
|
@thread_count = (opts[:thread_count] || 50).to_i
|
23
23
|
end
|
24
24
|
|
25
|
-
def run
|
25
|
+
def run(*args, **_opts)
|
26
26
|
with_error_handling do
|
27
|
+
# 支持命令行参数覆盖
|
28
|
+
@target = args[0] if args[0]
|
29
|
+
@ports = parse_ports(args[1]) if args[1]
|
30
|
+
@thread_count = args[2].to_i if args[2]
|
27
31
|
scan
|
28
32
|
end
|
29
33
|
end
|
@@ -31,11 +35,7 @@ module Kscript
|
|
31
35
|
# Execute port scanning using multiple threads
|
32
36
|
def scan
|
33
37
|
msg = "Scanning #{@target} ports #{@ports} with concurrency=#{@thread_count}"
|
34
|
-
|
35
|
-
puts msg
|
36
|
-
else
|
37
|
-
logger.kinfo(msg)
|
38
|
-
end
|
38
|
+
logger.kinfo(msg)
|
39
39
|
queue = Queue.new
|
40
40
|
@ports.each { |port| queue << port }
|
41
41
|
threads = []
|
@@ -50,12 +50,7 @@ module Kscript
|
|
50
50
|
end
|
51
51
|
begin
|
52
52
|
Socket.tcp(@target, port, connect_timeout: 0.5) do |_sock|
|
53
|
-
|
54
|
-
puts "Port #{port} is open"
|
55
|
-
else
|
56
|
-
logger.kinfo('Port open', port: port)
|
57
|
-
logger.kinfo("Port #{port} is open")
|
58
|
-
end
|
53
|
+
logger.kinfo('Port open', port: port)
|
59
54
|
end
|
60
55
|
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, SocketError
|
61
56
|
# closed or filtered
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkProjectScanUtils < Base
|
11
|
+
class KkProjectScanUtils < Kscript::Base
|
12
12
|
def initialize(*args, **opts)
|
13
13
|
super
|
14
14
|
end
|
@@ -58,7 +58,8 @@ module Kscript
|
|
58
58
|
projects = []
|
59
59
|
Dir.glob(File.join(@src_path, '*')).each do |path|
|
60
60
|
next unless File.directory?(path)
|
61
|
-
|
61
|
+
|
62
|
+
# next unless git_project?(path)
|
62
63
|
|
63
64
|
project_name = File.basename(path)
|
64
65
|
projects << create_project_entry(project_name, path)
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkShellHelperUtils < Base
|
11
|
+
class KkShellHelperUtils < Kscript::Base
|
12
12
|
CHT_SH_URL = 'https://cht.sh'
|
13
13
|
|
14
14
|
attr_reader :command
|
@@ -44,7 +44,7 @@ module Kscript
|
|
44
44
|
def fetch_help(command)
|
45
45
|
response = make_request(command)
|
46
46
|
response = response.first if response.is_a?(Array)
|
47
|
-
|
47
|
+
logger.kinfo(response.body)
|
48
48
|
rescue StandardError => e
|
49
49
|
display_error(e)
|
50
50
|
end
|
@@ -5,13 +5,11 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
9
|
-
|
10
8
|
require 'net/http'
|
11
9
|
require 'json'
|
12
10
|
|
13
11
|
module Kscript
|
14
|
-
class KkUsdRateUtils < Base
|
12
|
+
class KkUsdRateUtils < Kscript::Base
|
15
13
|
API_URL = 'https://api.exchangerate-api.com/v4/latest/USD'
|
16
14
|
|
17
15
|
def initialize(currency_code = 'CNY', *args, **opts)
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkVcsCleanerUtils < Base
|
11
|
+
class KkVcsCleanerUtils < Kscript::Base
|
12
12
|
DEFAULT_RETAIN_VERSIONS = 10
|
13
13
|
|
14
14
|
attr_reader :source_path, :retain_count
|
@@ -64,7 +64,7 @@ module Kscript
|
|
64
64
|
version_count = versions.length
|
65
65
|
return if version_count <= @retain_count
|
66
66
|
|
67
|
-
logger.
|
67
|
+
logger.kinfo("Processing #{app_path}", version_count: version_count, retain: @retain_count)
|
68
68
|
cleanup_old_versions(versions, version_count)
|
69
69
|
end
|
70
70
|
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkWgAclUtils < Base
|
11
|
+
class KkWgAclUtils < Kscript::Base
|
12
12
|
WIREGUARD_PORT = 51_821
|
13
13
|
ALLOWED_IPS = %w[127.0.0.1].freeze
|
14
14
|
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# This software is released under the MIT License.
|
6
6
|
# https://opensource.org/licenses/MIT
|
7
7
|
|
8
|
-
require 'kscript'
|
8
|
+
# require 'kscript'
|
9
9
|
|
10
10
|
module Kscript
|
11
|
-
class KkWgPassUtils < Base
|
11
|
+
class KkWgPassUtils < Kscript::Base
|
12
12
|
def initialize(*args, **opts)
|
13
13
|
super
|
14
14
|
end
|
data/lib/kscript/version.rb
CHANGED
data/lib/kscript.rb
CHANGED
@@ -27,12 +27,11 @@ require 'thor'
|
|
27
27
|
require 'aws-sdk-s3'
|
28
28
|
require 'dotenv'
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
require 'kscript/version'
|
30
|
+
require_relative 'kscript/config'
|
31
|
+
require_relative 'kscript/base'
|
32
|
+
require_relative 'kscript/plugins'
|
33
|
+
require_relative 'kscript/logger'
|
34
|
+
require_relative 'kscript/version'
|
36
35
|
|
37
36
|
module Kscript
|
38
37
|
# fluentd 风格插件注册机制
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -147,17 +147,18 @@ files:
|
|
147
147
|
- README.md
|
148
148
|
- exe/kscript
|
149
149
|
- ext/mkrf_conf.rb
|
150
|
-
- lib/completions/kscript.bash
|
151
|
-
- lib/completions/kscript.zsh
|
152
150
|
- lib/kscript.rb
|
153
151
|
- lib/kscript/banner.rb
|
154
152
|
- lib/kscript/base.rb
|
155
153
|
- lib/kscript/cli.rb
|
154
|
+
- lib/kscript/completions/kscript.bash
|
155
|
+
- lib/kscript/completions/kscript.zsh
|
156
156
|
- lib/kscript/config.rb
|
157
157
|
- lib/kscript/logger.rb
|
158
158
|
- lib/kscript/plugins.rb
|
159
159
|
- lib/kscript/plugins/kk_apnic_ip_utils.rb
|
160
160
|
- lib/kscript/plugins/kk_aws_s3_utils.rb
|
161
|
+
- lib/kscript/plugins/kk_cursor_rules_utils.rb
|
161
162
|
- lib/kscript/plugins/kk_elastic_cert_finger_utils.rb
|
162
163
|
- lib/kscript/plugins/kk_ffmpeg_install_utils.rb
|
163
164
|
- lib/kscript/plugins/kk_file_rename_utils.rb
|
@@ -175,7 +176,6 @@ files:
|
|
175
176
|
- lib/kscript/plugins/kk_wg_acl_utils.rb
|
176
177
|
- lib/kscript/plugins/kk_wg_pass_utils.rb
|
177
178
|
- lib/kscript/post_install.rb
|
178
|
-
- lib/kscript/utils.rb
|
179
179
|
- lib/kscript/version.rb
|
180
180
|
homepage: https://github.com/kevin197011/kscript
|
181
181
|
licenses:
|
data/lib/completions/kscript.zsh
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#compdef kscript
|
2
|
-
_kscript() {
|
3
|
-
local -a commands
|
4
|
-
commands=(
|
5
|
-
'version:kscript command'
|
6
|
-
'help:kscript command'
|
7
|
-
'list:kscript command'
|
8
|
-
'apnic:kscript command'
|
9
|
-
'cleaner:kscript command'
|
10
|
-
'es_fingerprint:kscript command'
|
11
|
-
'ffmpeg:kscript command'
|
12
|
-
'ip:kscript command'
|
13
|
-
'jenkins:kscript command'
|
14
|
-
'kibana:kscript command'
|
15
|
-
'lvm:kscript command'
|
16
|
-
'optimize:kscript command'
|
17
|
-
'portscan:kscript command'
|
18
|
-
'projscan:kscript command'
|
19
|
-
'rename:kscript command'
|
20
|
-
'sh:kscript command'
|
21
|
-
'syscheck:kscript command'
|
22
|
-
'top:kscript command'
|
23
|
-
'usd:kscript command'
|
24
|
-
'wg_acl:kscript command'
|
25
|
-
'wg_pass:kscript command'
|
26
|
-
)
|
27
|
-
_describe 'command' commands
|
28
|
-
}
|
29
|
-
compdef _kscript kscript
|
data/lib/kscript/utils.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|