lhj-tools 0.2.18 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhj/helper/jenkins_config.rb +35 -0
- data/lib/lhj/helper/todo_check_helper.rb +38 -0
- data/lib/lhj/helper/traditional_check_helper.rb +1 -1
- data/lib/lhj/lhj.rb +2 -0
- data/lib/lhj/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69527af7e6d31836627134b3476c1edb79e592cc1563618470fc9555c2a9278a
|
4
|
+
data.tar.gz: bb04571a3ea807688bc5c740eac5ff7002fb8482e62a1aab26a4bdecb9a2996a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca7a1305f8c7409180e51b9d844e64f082fc798ce9cec6dc4e751dae395699da10e2e6024ea284819fe98e356ebc1046dbfd73b3a24e729dc678a966b3423ff
|
7
|
+
data.tar.gz: 25e245b12c8ab42bf98e317cb5c61c6842729cbef8460386c2e6543f54c2f160e88cb7dcf0da237b12da245cd427148e0ed7a3913996804287bacab33c36ddea
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'yaml'
|
3
|
+
require 'lhj/config'
|
4
|
+
|
5
|
+
module Lhj
|
6
|
+
# Jenkins Config
|
7
|
+
class JenkinsConfig
|
8
|
+
|
9
|
+
CONFIG_NAME = 'jenkins_config.yml'
|
10
|
+
|
11
|
+
def self.config_file
|
12
|
+
File.join(Lhj::Config.instance.home_dir, CONFIG_NAME)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.config
|
16
|
+
@yaml ||= YAML.load_file(config_file)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.server_ip
|
20
|
+
config['server_ip']
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.server_port
|
24
|
+
config['server_port']
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.username
|
28
|
+
config['username']
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.password
|
32
|
+
config['password']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Lhj
|
2
|
+
class TodoCheckHelper
|
3
|
+
def self.check(path, type = 'm,h')
|
4
|
+
all_files = Dir.glob("#{path}/**/*.{#{type}}").reject do |p|
|
5
|
+
p =~ /Pods/
|
6
|
+
end
|
7
|
+
result = []
|
8
|
+
all_files.each do |f|
|
9
|
+
result << handle_file(f)
|
10
|
+
end
|
11
|
+
notify(result.flatten) if result.length.positive?
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.handle_file(file)
|
15
|
+
result = []
|
16
|
+
File.open(file, 'r') do |f|
|
17
|
+
f.readlines.each_with_index do |line, idx|
|
18
|
+
next unless line =~ %r{//} && line =~ /todo|TOdo|Todo|TODO/
|
19
|
+
|
20
|
+
result << { file: File.basename(file), idx: idx + 1, todo: line.strip }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
result
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.robot_url
|
27
|
+
'https://oapi.dingtalk.com/robot/send?access_token=fe879fd3e7a3b5e59d5719b2384845b7884901919be5a78fe443cbf777869807'
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.notify(result)
|
31
|
+
temp = Lhj::ErbTemplateHelper.load('todo_code_notify')
|
32
|
+
temp_result = Lhj::ErbTemplateHelper.render(temp, { result: result }, '-')
|
33
|
+
puts temp_result
|
34
|
+
Lhj::Dingtalk.post_message_robot(robot_url, 'check code', temp_result)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -43,7 +43,7 @@ module Lhj
|
|
43
43
|
next unless line =~ /[\u4e00-\u9fa5]/
|
44
44
|
next unless Lhj::Trans::Helper.instance.contain_zh_hk(line)
|
45
45
|
|
46
|
-
result << { idx: idx, cn: line.strip, hk: Lhj::Trans::Helper.instance.trans_zh_hk_str(line).strip }
|
46
|
+
result << { idx: idx + 1, cn: line.strip, hk: Lhj::Trans::Helper.instance.trans_zh_hk_str(line).strip }
|
47
47
|
end
|
48
48
|
end
|
49
49
|
result
|
data/lib/lhj/lhj.rb
CHANGED
@@ -7,6 +7,7 @@ module Lhj
|
|
7
7
|
require 'lhj/env'
|
8
8
|
require 'lhj/ui/ui'
|
9
9
|
require 'lhj/config'
|
10
|
+
require 'lhj/helper/jenkins_config'
|
10
11
|
require 'lhj/helper/pod_repo_config'
|
11
12
|
require 'lhj/helper/git_branch_feature_config'
|
12
13
|
require 'lhj/helper/erb_template_helper'
|
@@ -22,6 +23,7 @@ module Lhj
|
|
22
23
|
require 'lhj/helper/app_version_info'
|
23
24
|
require 'lhj/helper/bugly_helper'
|
24
25
|
require 'lhj/helper/traditional_check_helper'
|
26
|
+
require 'lhj/helper/todo_check_helper'
|
25
27
|
|
26
28
|
class Error < StandardError; end
|
27
29
|
|
data/lib/lhj/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhj-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|
@@ -387,6 +387,7 @@ files:
|
|
387
387
|
- lib/lhj/helper/erb_template_helper.rb
|
388
388
|
- lib/lhj/helper/git_branch_feature_config.rb
|
389
389
|
- lib/lhj/helper/git_helper.rb
|
390
|
+
- lib/lhj/helper/jenkins_config.rb
|
390
391
|
- lib/lhj/helper/local_config.rb
|
391
392
|
- lib/lhj/helper/log_helper.rb
|
392
393
|
- lib/lhj/helper/oss_config.rb
|
@@ -398,6 +399,7 @@ files:
|
|
398
399
|
- lib/lhj/helper/tb_config.rb
|
399
400
|
- lib/lhj/helper/tb_helper.rb
|
400
401
|
- lib/lhj/helper/team_member_config.rb
|
402
|
+
- lib/lhj/helper/todo_check_helper.rb
|
401
403
|
- lib/lhj/helper/traditional_check_helper.rb
|
402
404
|
- lib/lhj/helper/trans_helper.rb
|
403
405
|
- lib/lhj/helper/vika_config.rb
|