lhj-tools 0.1.23 → 0.1.24
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/helper/log_helper.rb +25 -9
- data/lib/lhj/helper/pgyer_config.rb +27 -6
- data/lib/lhj/helper/pgyer_helper.rb +5 -5
- data/lib/lhj/helper/team_member_config.rb +20 -0
- data/lib/lhj/tools/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a3955d41955a54ce3ca861519c4333245dacd4c4b14477f73fc7061707c1f3
|
4
|
+
data.tar.gz: 630fc37529847a893022bd49226e2bd1bd44794f71618458d7e7620d3ad3f265
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e3c30af417e17bd237c0bc114ed48d8e9fd46e39263085ef1743398e702c510ee9bd5212eaa2e06446a659a33d47089fbdc865dfcf284307538b9b6edb5abc4
|
7
|
+
data.tar.gz: e0d7853fb9f18c5785fa570c3e23c212f29e5aa935fcf437224f0f9db24c03221e3ff88efa91c8a63eb6eac8057cba5bc4ef4a0d3c798057754482c50a2e6642
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'lhj/helper/team_member_config'
|
2
|
+
|
1
3
|
module Lhj
|
2
4
|
# log helper
|
3
5
|
class LogHelper
|
@@ -16,7 +18,8 @@ module Lhj
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def fetch_branch
|
19
|
-
Lhj::Actions.git_branch || ''
|
21
|
+
name = Lhj::Actions.git_branch || ''
|
22
|
+
name.split('/').last
|
20
23
|
end
|
21
24
|
|
22
25
|
def fetch_env(env)
|
@@ -33,12 +36,25 @@ module Lhj
|
|
33
36
|
def fetch_log
|
34
37
|
from = last_commit_hash
|
35
38
|
to = 'HEAD'
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
message = Lhj::Actions.git_log_between(' %an %ar - %s;', from, to, :exclude_merges, 'short', false)
|
40
|
+
handle_message(message)
|
41
|
+
end
|
42
|
+
|
43
|
+
def handle_message(m)
|
44
|
+
message = m
|
45
|
+
if !message.nil? && !message.empty?
|
46
|
+
message = message.gsub('seconds ', '秒')
|
47
|
+
message = message.gsub('minutes ', '分钟')
|
48
|
+
message = message.gsub('hours ', '小时')
|
49
|
+
message = message.gsub('days ', '天')
|
50
|
+
message = message.gsub('ago ', '前')
|
51
|
+
Lhj::TeamMemberConfig.config.each do |key, value|
|
52
|
+
message = message.gsub(key, value) if message =~ /#{key}/
|
53
|
+
end
|
54
|
+
else
|
55
|
+
message = '此次打包没代码更新'
|
56
|
+
end
|
57
|
+
message
|
42
58
|
end
|
43
59
|
|
44
60
|
def save_last_commit_hash
|
@@ -56,8 +72,8 @@ module Lhj
|
|
56
72
|
end
|
57
73
|
|
58
74
|
def last_commit_file
|
59
|
-
|
60
|
-
File.join(Lhj::Config.instance.home_dir, ".#{
|
75
|
+
branch_name = @branch.gsub(%r{/}, '')
|
76
|
+
File.join(Lhj::Config.instance.home_dir, ".#{@env}_#{branch_name}_last_commit")
|
61
77
|
end
|
62
78
|
|
63
79
|
def render_template
|
@@ -16,16 +16,37 @@ module Lhj
|
|
16
16
|
@yaml ||= YAML.load_file(config_file)
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.api_key
|
20
|
-
|
19
|
+
def self.api_key(env = :uat)
|
20
|
+
case env
|
21
|
+
when :release
|
22
|
+
'release.....'
|
23
|
+
when :gray
|
24
|
+
'gray.....'
|
25
|
+
else
|
26
|
+
config['api_key']
|
27
|
+
end
|
21
28
|
end
|
22
29
|
|
23
|
-
def self.user_key
|
24
|
-
|
30
|
+
def self.user_key(env = :uat)
|
31
|
+
case env
|
32
|
+
when :release
|
33
|
+
config['user_key']
|
34
|
+
when :gray
|
35
|
+
config['user_key']
|
36
|
+
else
|
37
|
+
config['user_key']
|
38
|
+
end
|
25
39
|
end
|
26
40
|
|
27
|
-
def self.password
|
28
|
-
|
41
|
+
def self.password(env = :uat)
|
42
|
+
case env
|
43
|
+
when :release
|
44
|
+
config['password']
|
45
|
+
when :gray
|
46
|
+
config['password']
|
47
|
+
else
|
48
|
+
config['password']
|
49
|
+
end
|
29
50
|
end
|
30
51
|
end
|
31
52
|
end
|
@@ -13,10 +13,10 @@ module Lhj
|
|
13
13
|
|
14
14
|
attr_reader :api_key, :user_key, :password, :result
|
15
15
|
|
16
|
-
def initialize
|
17
|
-
@api_key = Lhj::PgyerConfig.api_key
|
18
|
-
@user_key = Lhj::PgyerConfig.user_key
|
19
|
-
@password = Lhj::PgyerConfig.password
|
16
|
+
def initialize(env = :uat)
|
17
|
+
@api_key = Lhj::PgyerConfig.api_key(env)
|
18
|
+
@user_key = Lhj::PgyerConfig.user_key(env)
|
19
|
+
@password = Lhj::PgyerConfig.password(env)
|
20
20
|
@result = { 'data' => {} }
|
21
21
|
end
|
22
22
|
|
@@ -39,7 +39,7 @@ module Lhj
|
|
39
39
|
def upload_file(file, des)
|
40
40
|
|
41
41
|
update_description = @result[:update_description]
|
42
|
-
update_description =
|
42
|
+
update_description = '' if update_description.nil?
|
43
43
|
params = {
|
44
44
|
'_api_key' => @api_key,
|
45
45
|
'uKey' => @user_key,
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'yaml'
|
3
|
+
require 'lhj/config'
|
4
|
+
|
5
|
+
module Lhj
|
6
|
+
# team member config
|
7
|
+
class TeamMemberConfig
|
8
|
+
|
9
|
+
CONFIG_NAME = 'team_member.yml'
|
10
|
+
|
11
|
+
def self.config_file
|
12
|
+
File.join(Lhj::Config.instance.home_dir, CONFIG_NAME)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.config
|
16
|
+
@yaml ||= YAML.load_file(config_file)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/lhj/tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
@@ -338,6 +338,7 @@ files:
|
|
338
338
|
- lib/lhj/helper/pgyer_helper.rb
|
339
339
|
- lib/lhj/helper/tb_config.rb
|
340
340
|
- lib/lhj/helper/tb_helper.rb
|
341
|
+
- lib/lhj/helper/team_member_config.rb
|
341
342
|
- lib/lhj/helper/trans_helper.rb
|
342
343
|
- lib/lhj/tools.rb
|
343
344
|
- lib/lhj/tools/version.rb
|