lhj-tools 0.1.45 → 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: fad00b53bac9c95b946a8ef6a87632b0b0f7d2be620b2112332460b891a08a62
4
- data.tar.gz: 8a846f51f4cd67c437e4d8b16f693cd81f68216bae542d97932d1c0440259087
3
+ metadata.gz: 3a3d83868ea1e59da60c81e44b61120054d3896c805f438a9cc72c3a9e70621b
4
+ data.tar.gz: e394c3618917bbd9e0e543bd00fefa181c49f91ebd7d08f0cd7e19ef34e2b9f1
5
5
  SHA512:
6
- metadata.gz: 2ac614b5f510059e17f143cfadf91d7003da0a8178e9e64793ef0ae971d92946a7c1ba05311db3ec917dfac933ed83ce7fcaf46c4d4307ec5dc5e1693709b00a
7
- data.tar.gz: da907ab9b3ee43e9dfcb6fd2013ef9a9967e88e1a2f193ef464e9b918c18c2e2161913715cade5328d1c181a2d0f8d20add0a7005ee873d8df755f388216650a
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
@@ -83,6 +83,7 @@ module Lhj
83
83
  zipped_path = "Life_i_#{rand_key}.zip"
84
84
  zipped_path = "Life_a_#{rand_key}.zip" unless file.end_with?('.ipa')
85
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.45"
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.45
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-06 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