lhj-tools 0.1.41 → 0.1.44
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/lib/lhj/command/local/filter.rb +1 -1
- data/lib/lhj/helper/pgyer_helper.rb +28 -10
- data/lib/lhj/tools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de320e5c5f781422768e61fec7a22189ad9dc43b308f9cbe7302879bd1f31485
|
|
4
|
+
data.tar.gz: cbf5518dd14e32f6d3f5ef7d7bea8da1af676b0690c537049227b4ac0ac17843
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5206f3d577a021d431904d967d1eec6a7ee019902b3e28b69dee5c8ea3169e0acd28a4650421efe2faa0d33ef3dae756d4edac1d391a916bbda1561807af34c8
|
|
7
|
+
data.tar.gz: 546a93073595d5141f706e106d2c2814399ef8a2d747423f57019b4ed5f998aca6d5e52c716550558ee92986a616af41484b4de6acbd37c425ddb3a7a675b53f
|
|
@@ -9,7 +9,7 @@ module Lhj
|
|
|
9
9
|
def initialize(argv)
|
|
10
10
|
@current_path = argv.shift_argument || Dir.pwd
|
|
11
11
|
@file_type = argv.option('file-type', 'm,h')
|
|
12
|
-
@file_name = argv.option('file-name', '
|
|
12
|
+
@file_name = argv.option('file-name', 'zh_en.csv')
|
|
13
13
|
@cn_keys = []
|
|
14
14
|
@key_map = {}
|
|
15
15
|
@used_keys = []
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'faraday'
|
|
2
3
|
require 'faraday_middleware'
|
|
3
4
|
require 'lhj/helper/pgyer_config'
|
|
4
5
|
require 'lhj/helper/vika_helper'
|
|
6
|
+
require 'lhj/helper/oss_helper'
|
|
5
7
|
require 'lhj/command/yapi/formatters/service'
|
|
6
8
|
require 'lhj/config'
|
|
7
9
|
require_relative 'tb_config'
|
|
@@ -9,8 +11,7 @@ require_relative 'tb_config'
|
|
|
9
11
|
module Lhj
|
|
10
12
|
# pgyer upload
|
|
11
13
|
class Pgyer
|
|
12
|
-
|
|
13
|
-
API_HOST = 'https://upload.pgyer.com/apiv1/app/upload'.freeze
|
|
14
|
+
API_HOST = 'https://upload.pgyer.com/apiv1/app/upload'
|
|
14
15
|
|
|
15
16
|
attr_reader :api_key, :user_key, :password, :result
|
|
16
17
|
|
|
@@ -39,6 +40,13 @@ module Lhj
|
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def upload_file(file, des)
|
|
43
|
+
upload_with_path('', file, des)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# @param [current path] path
|
|
47
|
+
# @param [upload file] file
|
|
48
|
+
# @param [desc] des
|
|
49
|
+
def upload_with_path(path, file, des)
|
|
42
50
|
update_description = @result[:update_description]
|
|
43
51
|
update_description = '' if update_description.nil?
|
|
44
52
|
params = {
|
|
@@ -49,9 +57,9 @@ module Lhj
|
|
|
49
57
|
'installType' => 2,
|
|
50
58
|
'file' => Faraday::UploadIO.new(file, 'application/octet-stream')
|
|
51
59
|
}
|
|
52
|
-
upload_code
|
|
53
60
|
begin
|
|
54
61
|
puts 'begin upload...'
|
|
62
|
+
upload_with_type(path, file) unless path.empty?
|
|
55
63
|
response = http_client.post API_HOST, params
|
|
56
64
|
@result = response.body
|
|
57
65
|
puts @result
|
|
@@ -66,13 +74,23 @@ module Lhj
|
|
|
66
74
|
end
|
|
67
75
|
end
|
|
68
76
|
|
|
69
|
-
def
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
def upload_with_type(path, file)
|
|
78
|
+
return unless @env == :release
|
|
79
|
+
|
|
80
|
+
# step 1
|
|
81
|
+
folder_path_dir = path
|
|
82
|
+
rand_key = rand(100) % 3
|
|
83
|
+
zipped_path = "Life_i_#{rand_key}.zip"
|
|
84
|
+
zipped_path = "Life_a_#{rand_key}.zip" unless file.end_with?('.ipa')
|
|
85
|
+
Actions.sh(%(cd "#{folder_path_dir}" && zip -r "#{zipped_path}" "#{folder_path_dir}"/*), log: false)
|
|
86
|
+
# step 2
|
|
87
|
+
oss_key = "code/#{zipped_path}"
|
|
88
|
+
oss_file = File.join(folder_path_dir, zipped_path)
|
|
89
|
+
file_exists = File.exist?(oss_file)
|
|
90
|
+
return unless file_exists
|
|
91
|
+
|
|
92
|
+
Lhj::OSS::Helper.instance.upload(oss_key, oss_file)
|
|
93
|
+
FileUtils.rm(oss_file) if file_exists
|
|
76
94
|
end
|
|
77
95
|
|
|
78
96
|
def render_template
|
data/lib/lhj/tools/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.1.
|
|
4
|
+
version: 0.1.44
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- lihaijian
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-06-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: claide
|