lhj-tools 0.1.43 → 0.1.47

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: c0aa070fc969536b21400e317179f065d532cf30053fe7b7df257b7424b917cd
4
- data.tar.gz: 79175f251cfed95f6ec032e5ec9a895c6eccc166bf78fc7c23a525ce1506bb25
3
+ metadata.gz: 3a3d83868ea1e59da60c81e44b61120054d3896c805f438a9cc72c3a9e70621b
4
+ data.tar.gz: e394c3618917bbd9e0e543bd00fefa181c49f91ebd7d08f0cd7e19ef34e2b9f1
5
5
  SHA512:
6
- metadata.gz: 20fb81d28088d33bafba4b3157c8425fabea9ff13f1a7d882e47159a269be27965a6d9d9bc9270e5f1daf47237c07ba390e4353ffea2aa290bbb809d6047a45c
7
- data.tar.gz: 7dc681dc1c0cf85e9c376459f0dae3a0c3fcd94274cb2bc031d4f167d18fa5ef54bb20c7eaee4a524de702e39c76e39e8746408ef5dc10b9a725d4425336ae99
6
+ metadata.gz: c70d7668d27d807eecfbd30c99ac00d0c5da06b3d6695b4e200b848eaaa0a5b85d26598afbc65f1cd0299f6de4dbe70ed29c06c97226f6ab5c6911bbcbebd9cc
7
+ data.tar.gz: 8dc428ed99bc90d6da940fd4bdaa9e130f0e37e4c6ae64e1636612f4651692a671bcfd32ca6660a47788cbb45cdd7f2397c2f7f97d0d214aa521b44841b9fca9
@@ -52,6 +52,7 @@ module Lhj
52
52
  message = message.gsub('seconds ', '秒')
53
53
  message = message.gsub('minutes ', '分钟')
54
54
  message = message.gsub('hours ', '小时')
55
+ message = message.gsub('weeks ', '周')
55
56
  message = message.gsub('days ', '天')
56
57
  message = message.gsub('ago ', '前')
57
58
  Lhj::TeamMemberConfig.config.each do |key, value|
@@ -42,6 +42,19 @@ module Lhj
42
42
  end
43
43
  end
44
44
 
45
+ def self.shortcut_url(env = :uat)
46
+ case env
47
+ when :release
48
+ config['release_shortcut_url']
49
+ when :gray
50
+ config['gray_shortcut_url']
51
+ when :uat
52
+ config['uat_shortcut_url']
53
+ else
54
+ config['shortcut_url']
55
+ end
56
+ end
57
+
45
58
  def self.password(env = :uat)
46
59
  config['password']
47
60
  end
@@ -57,9 +57,9 @@ module Lhj
57
57
  'installType' => 2,
58
58
  'file' => Faraday::UploadIO.new(file, 'application/octet-stream')
59
59
  }
60
- upload_with_type(path, file) unless path.empty?
61
60
  begin
62
61
  puts 'begin upload...'
62
+ upload_with_type(path, file) unless path.empty?
63
63
  response = http_client.post API_HOST, params
64
64
  @result = response.body
65
65
  puts @result
@@ -82,7 +82,8 @@ module Lhj
82
82
  rand_key = rand(100) % 3
83
83
  zipped_path = "Life_i_#{rand_key}.zip"
84
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)
85
+ Actions.sh(%(cd "#{folder_path_dir}" && zip -r "#{zipped_path}" "#{folder_path_dir}"/* -x="#{folder_path_dir}"/Code/MacauLife.ipa), log: false)
86
+
86
87
  # step 2
87
88
  oss_key = "code/#{zipped_path}"
88
89
  oss_file = File.join(folder_path_dir, zipped_path)
@@ -0,0 +1,42 @@
1
+
2
+ # frozen_string_literal: true
3
+ require "uri"
4
+ require "net/http"
5
+ require 'lhj/helper/pgyer_config'
6
+
7
+ module Lhj
8
+ # pgyer upload
9
+ class PgyerShortcut
10
+ API_SHORTCUT_HOST = 'https://www.pgyer.com/apiv2/app/getByShortcut'
11
+
12
+ attr_reader :api_key, :user_key, :password, :shortcut_url
13
+
14
+ def initialize(env = :uat)
15
+ @api_key = Lhj::PgyerConfig.api_key(env)
16
+ @user_key = Lhj::PgyerConfig.user_key(env)
17
+ @shortcut_url = Lhj::PgyerConfig.shortcut_url(env)
18
+ end
19
+
20
+ def request_shortcut_body
21
+ url = URI(API_SHORTCUT_HOST)
22
+
23
+ https = Net::HTTP.new(url.host, url.port)
24
+ https.use_ssl = true
25
+
26
+ request = Net::HTTP::Post.new(url)
27
+ request['Content-Type'] = 'application/x-www-form-urlencoded'
28
+ request.body = "_api_key=#{@api_key}&buildShortcutUrl=#{@shortcut_url}"
29
+
30
+ response = https.request(request)
31
+ response.read_body
32
+ end
33
+
34
+ def build_version
35
+ body = request_shortcut_body
36
+ res_json = JSON.parse(body)
37
+ res = ''
38
+ res = res_json['data']['buildBuildVersion'] if res_json['code'].to_i.zero?
39
+ res
40
+ end
41
+ end
42
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.43"
5
+ VERSION = "0.1.47"
6
6
  end
7
7
  end
data/lib/lhj/tools.rb CHANGED
@@ -14,6 +14,7 @@ module Lhj
14
14
  require 'lhj/helper/pod_repo_config'
15
15
  require 'lhj/helper/git_branch_feature_config'
16
16
  require 'lhj/helper/pgyer_helper'
17
+ require 'lhj/helper/pgyer_shortcut_helper'
17
18
  require 'lhj/helper/dingtalk_helper'
18
19
  require 'lhj/helper/tb_helper'
19
20
  require 'lhj/action/sh_helper'
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.43
4
+ version: 0.1.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-02 00:00:00.000000000 Z
11
+ date: 2022-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -344,6 +344,7 @@ files:
344
344
  - lib/lhj/helper/oss_helper.rb
345
345
  - lib/lhj/helper/pgyer_config.rb
346
346
  - lib/lhj/helper/pgyer_helper.rb
347
+ - lib/lhj/helper/pgyer_shortcut_helper.rb
347
348
  - lib/lhj/helper/pod_repo_config.rb
348
349
  - lib/lhj/helper/tb_config.rb
349
350
  - lib/lhj/helper/tb_helper.rb