lhj-tools 0.2.12 → 0.2.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 052fc9182b82f2f6595458752a58cbf368d4ecad37c40300e6b837b5d257aa8d
4
- data.tar.gz: 5e5110997bc75ab7612047d54d3828e6190cbfc666f700bf2c399c0f2ecb4819
3
+ metadata.gz: e98ba9e3b82c4ba4d49cef41166bdd1f8c32a36376f9987712a48e674af350ca
4
+ data.tar.gz: 68e482442564ebfb85ce6ed64be267c83c92f4c7aa40db1b60db7a58ad1a292d
5
5
  SHA512:
6
- metadata.gz: 52b51878b4c58abbc55c3a8a991d1a8b75c42e92b49ef3af3828c03478b890e9fac6a102421b9fc2b8bdb694fb1bb788070147c774be376e670eb9c0a39acfb9
7
- data.tar.gz: d92a4ff5ce3f8eb74c9fdf79da7faa43f5c7a3f0ccae11d93032eb69efdf0338aabf44768457afc25c599466f704fa9170c9c1a99dbaac834739ab7dac75f2e1
6
+ metadata.gz: c0295568b128c55159b956c306005ffdf895dfe90174c49bae6698fdb965bd6478976cbaf6ead1ae0f9222b242422eaefbeb81183b73aab1eb2fcbaff95c1fd1
7
+ data.tar.gz: 10632f0e6ed6aadc73d7e7a4d87a0eb0677c77cfc3ab18b91404e42ef3bd6cedfbd3f5f8315c167b64805a2416880ce67d8fb7cef5d2e7e8ff5498a6628451cc
@@ -1,3 +1,4 @@
1
+ require 'jenkins_api_client'
1
2
 
2
3
  module Lhj
3
4
  class Command
@@ -29,8 +30,11 @@ module Lhj
29
30
  end
30
31
 
31
32
  def handle
32
- client = Lhj::JenkinsApi::Client.new(:server_url => @server_url)
33
- client.job.build(@job)
33
+ client = JenkinsApi::Client.new(server_ip: '47.97.61.232', server_port: 8080, username: 'aomi', password: '11e5ddb4c71a61abf66ed0ab4c08090794')
34
+ # puts client.user.get('aomi')
35
+ # puts client.job.list_all
36
+ # client.job.build('aomi_uat')
37
+ puts client.job.get_console_output('aomi_uat', 253)
34
38
  end
35
39
  end
36
40
  end
data/lib/lhj/command.rb CHANGED
@@ -34,7 +34,7 @@ module Lhj
34
34
  require 'lhj/command/sync_pod_code'
35
35
  require 'lhj/command/pgyer_upload'
36
36
  require 'lhj/command/duplicate_imageset'
37
- require 'lhj/command/jenkins_build'
37
+ require 'lhj/command/jenkins/jenkins_build'
38
38
 
39
39
  self.abstract_command = true
40
40
  self.command = 'lhj'
@@ -3,7 +3,7 @@ module Lhj
3
3
  # bugly helper
4
4
  class BuglyHelper
5
5
 
6
- BUGLY_JAR = 'buglyqq-upload-symbol.jar'
6
+ BUGLY_JAR = 'buglyqq-upload-symbol.jar'.freeze
7
7
 
8
8
  def self.upload_sym(app_id, app_key, bundle_id, version, input_symbol)
9
9
  file = File.join(Lhj::Config.instance.home_dir, BUGLY_JAR)
@@ -11,6 +11,8 @@ module Lhj
11
11
 
12
12
  # zip_path = Dir['*.app.dSYM.zip'].first
13
13
  # Action.sh("unzip -qo '#{zip_path}' -d dsym") if zip_path
14
+ sym_path = input_symbol
15
+ sym_path = input_symbol.shellescape if %r{[^A-Za-z0-9_\-.,:+/@\n]} =~ input_symbol
14
16
 
15
17
  command = %w[java -jar]
16
18
  command << "#{Lhj::Config.instance.home_dir}/#{BUGLY_JAR}"
@@ -19,7 +21,7 @@ module Lhj
19
21
  command << "-bundleid #{bundle_id}"
20
22
  command << "-version #{version}"
21
23
  command << '-platform IOS'
22
- command << "-inputSymbol #{input_symbol}"
24
+ command << "-inputSymbol #{sym_path}"
23
25
  # puts command.join(' ')
24
26
  Actions.sh(command.join(' '), log: true)
25
27
  end
@@ -0,0 +1,61 @@
1
+ module Lhj
2
+ class TraditionalCheckHelper
3
+ def self.check(path, ignore_path, type = 'm,h,pch,xib')
4
+ ignore_file = File.join(ignore_path, '.checkignore')
5
+ ignore_list = []
6
+ ignore_list = File.readlines(ignore_file) if File.exist?(ignore_file)
7
+ check_ignore(path, type: type, ignore: ignore_list)
8
+ end
9
+
10
+ def self.check_ignore(path, type: 'm,h,pch,xib', ignore: [])
11
+ result = {}
12
+ all_files = Dir.glob("#{path}/**/*.{#{type}}").reject do |p|
13
+ p =~ /Pods/ || ignore.include?(File.basename(p))
14
+ end
15
+ all_files.each do |f|
16
+ infos = handle_file(f)
17
+ next unless infos.length.positive?
18
+
19
+ result[File.basename(f)] = infos
20
+ end
21
+ notify(result) if result.keys.length.positive?
22
+ end
23
+
24
+ def self.show_result(result)
25
+ result.each do |k, v|
26
+ puts k
27
+ v.each do |o|
28
+ puts "第#{o[:idx]}行:"
29
+ puts o[:cn]
30
+ puts o[:hk]
31
+ end
32
+ end
33
+ end
34
+
35
+ def self.handle_file(file)
36
+ result = []
37
+ File.open(file, 'r') do |f|
38
+ f.readlines.each_with_index do |line, idx|
39
+ next if line =~ %r{//}
40
+ next unless line =~ /[\u4e00-\u9fa5]/
41
+ next unless Lhj::Trans::Helper.instance.contain_zh_hk(line)
42
+
43
+ result << { idx: idx, cn: line.strip, hk: Lhj::Trans::Helper.instance.trans_zh_hk_str(line).strip }
44
+ end
45
+ end
46
+ result
47
+ end
48
+
49
+ def self.robot_url
50
+ 'https://oapi.dingtalk.com/robot/send?access_token=fe879fd3e7a3b5e59d5719b2384845b7884901919be5a78fe443cbf777869807'
51
+ end
52
+
53
+ def self.notify(result)
54
+ temp = Lhj::ErbTemplateHelper.load('traditional_code_notify')
55
+ temp_result = Lhj::ErbTemplateHelper.render(temp, { result: result })
56
+ puts temp_result
57
+ Lhj::Dingtalk.post_message_robot(robot_url, 'check code', temp_result)
58
+ end
59
+
60
+ end
61
+ end
@@ -32,6 +32,15 @@ module Lhj
32
32
  end
33
33
  end
34
34
 
35
+ # contain hk char
36
+ def contain_zh_hk(input)
37
+ @trans_map ||= load_trans_map
38
+ input.each_char do |c|
39
+ return true if @trans_map[c]
40
+ end
41
+ false
42
+ end
43
+
35
44
  def trans_zh_cn_str(input)
36
45
  @trans_map_invert ||= load_trans_map.invert
37
46
  out = []
data/lib/lhj/lhj.rb CHANGED
@@ -4,17 +4,13 @@ require 'colored'
4
4
  require 'xcodeproj'
5
5
 
6
6
  module Lhj
7
- require 'lhj/jenkins/urihelper'
8
- require 'lhj/jenkins/exceptions'
9
- require 'lhj/jenkins/client'
10
- require 'lhj/jenkins/job'
11
-
12
7
  require 'lhj/env'
13
8
  require 'lhj/ui/ui'
14
9
  require 'lhj/config'
15
10
  require 'lhj/helper/pod_repo_config'
16
11
  require 'lhj/helper/git_branch_feature_config'
17
12
  require 'lhj/helper/erb_template_helper'
13
+ require 'lhj/helper/trans_helper'
18
14
  require 'lhj/helper/pgyer_helper'
19
15
  require 'lhj/helper/pgyer_shortcut_helper'
20
16
  require 'lhj/helper/dingtalk_helper'
@@ -25,6 +21,7 @@ module Lhj
25
21
  require 'lhj/helper/vika_helper'
26
22
  require 'lhj/helper/app_version_info'
27
23
  require 'lhj/helper/bugly_helper'
24
+ require 'lhj/helper/traditional_check_helper'
28
25
 
29
26
  class Error < StandardError; end
30
27
 
data/lib/lhj/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lhj
4
- VERSION = '0.2.12'
4
+ VERSION = '0.2.14'
5
5
  end
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.12
4
+ version: 0.2.14
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-03 00:00:00.000000000 Z
11
+ date: 2023-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -330,6 +330,20 @@ dependencies:
330
330
  - - ">="
331
331
  - !ruby/object:Gem::Version
332
332
  version: 5.0.6
333
+ - !ruby/object:Gem::Dependency
334
+ name: jenkins_api_client
335
+ requirement: !ruby/object:Gem::Requirement
336
+ requirements:
337
+ - - '='
338
+ - !ruby/object:Gem::Version
339
+ version: 1.5.3
340
+ type: :runtime
341
+ prerelease: false
342
+ version_requirements: !ruby/object:Gem::Requirement
343
+ requirements:
344
+ - - '='
345
+ - !ruby/object:Gem::Version
346
+ version: 1.5.3
333
347
  description: lhj tools.
334
348
  email:
335
349
  - sanan.li@qq.com
@@ -353,7 +367,7 @@ files:
353
367
  - lib/lhj/command/head_import.rb
354
368
  - lib/lhj/command/http.rb
355
369
  - lib/lhj/command/init.rb
356
- - lib/lhj/command/jenkins_build.rb
370
+ - lib/lhj/command/jenkins/jenkins_build.rb
357
371
  - lib/lhj/command/local/fetch.rb
358
372
  - lib/lhj/command/local/filter.rb
359
373
  - lib/lhj/command/local/local.rb
@@ -398,13 +412,10 @@ files:
398
412
  - lib/lhj/helper/tb_config.rb
399
413
  - lib/lhj/helper/tb_helper.rb
400
414
  - lib/lhj/helper/team_member_config.rb
415
+ - lib/lhj/helper/traditional_check_helper.rb
401
416
  - lib/lhj/helper/trans_helper.rb
402
417
  - lib/lhj/helper/vika_config.rb
403
418
  - lib/lhj/helper/vika_helper.rb
404
- - lib/lhj/jenkins/client.rb
405
- - lib/lhj/jenkins/exceptions.rb
406
- - lib/lhj/jenkins/job.rb
407
- - lib/lhj/jenkins/urihelper.rb
408
419
  - lib/lhj/lhj.rb
409
420
  - lib/lhj/tree/directory_renderer.rb
410
421
  - lib/lhj/tree/hash_walker.rb