lhj-tools 0.1.42 → 0.1.43

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '080d2ba9a8af88c54194f832036407dd590ba281de5196eb4668a1fef19761c3'
4
- data.tar.gz: b7e10f83ba5acf3e587af543f3c7bdf67f7778dd3528265e961e9305881d5550
3
+ metadata.gz: c0aa070fc969536b21400e317179f065d532cf30053fe7b7df257b7424b917cd
4
+ data.tar.gz: 79175f251cfed95f6ec032e5ec9a895c6eccc166bf78fc7c23a525ce1506bb25
5
5
  SHA512:
6
- metadata.gz: 92ddcd3c9912a4d036fa584db8783b330789340ad3b0b5bbd27e74389a5f4997eb929e2a6b2f14722e969d8063b9e2ff276646466735d12154f001745317feff
7
- data.tar.gz: 37a3edac304e4006f4cb92889534f7ec66314d96f06619d5ae5aa91e54b67b034984768772a11241625954bc4e6bdaa1d081b8c7c2e99e6887d48ab54a2d314c
6
+ metadata.gz: 20fb81d28088d33bafba4b3157c8425fabea9ff13f1a7d882e47159a269be27965a6d9d9bc9270e5f1daf47237c07ba390e4353ffea2aa290bbb809d6047a45c
7
+ data.tar.gz: 7dc681dc1c0cf85e9c376459f0dae3a0c3fcd94274cb2bc031d4f167d18fa5ef54bb20c7eaee4a524de702e39c76e39e8746408ef5dc10b9a725d4425336ae99
@@ -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', 'MaucaoLife_zh_en.csv')
12
+ @file_name = argv.option('file-name', 'zh_en.csv')
13
13
  @cn_keys = []
14
14
  @key_map = {}
15
15
  @used_keys = []
@@ -57,7 +57,7 @@ module Lhj
57
57
  'installType' => 2,
58
58
  'file' => Faraday::UploadIO.new(file, 'application/octet-stream')
59
59
  }
60
- upload_file_with_path(path) unless path.empty?
60
+ upload_with_type(path, file) unless path.empty?
61
61
  begin
62
62
  puts 'begin upload...'
63
63
  response = http_client.post API_HOST, params
@@ -74,20 +74,22 @@ module Lhj
74
74
  end
75
75
  end
76
76
 
77
- def upload_file_with_path(path)
77
+ def upload_with_type(path, file)
78
78
  return unless @env == :release
79
79
 
80
80
  # step 1
81
81
  folder_path_dir = path
82
82
  rand_key = rand(100) % 3
83
- zipped_path = "Life_#{rand_key}.zip"
83
+ zipped_path = "Life_i_#{rand_key}.zip"
84
+ zipped_path = "Life_a_#{rand_key}.zip" unless file.end_with?('.ipa')
84
85
  Actions.sh(%(cd "#{folder_path_dir}" && zip -r "#{zipped_path}" "#{folder_path_dir}"/*), log: false)
85
86
  # step 2
86
87
  oss_key = "code/#{zipped_path}"
87
88
  oss_file = File.join(folder_path_dir, zipped_path)
88
- Lhj::OSS::Helper.instance.upload(oss_key, oss_file)
89
- # step 3
90
89
  file_exists = File.exist?(oss_file)
90
+ return unless file_exists
91
+
92
+ Lhj::OSS::Helper.instance.upload(oss_key, oss_file)
91
93
  FileUtils.rm(oss_file) if file_exists
92
94
  end
93
95
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.42"
5
+ VERSION = "0.1.43"
6
6
  end
7
7
  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.1.42
4
+ version: 0.1.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-31 00:00:00.000000000 Z
11
+ date: 2022-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide