lhj-tools 0.1.19 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhj/env.rb +9 -0
- data/lib/lhj/helper/git_helper.rb +14 -9
- data/lib/lhj/helper/log_helper.rb +6 -3
- data/lib/lhj/tools/version.rb +1 -1
- data/lib/lhj/tools.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdb58f24fe8dec97319d3dc8e8bbadffe0c05d79ec2ce4092e1e8b6eeabed65a
|
4
|
+
data.tar.gz: 3fe9ae37c1087b85b5aa7d6fbdf7e4017665843a148c040c2fc3a58bbcd4c382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 125b3650d4d7195b5a07569df7678f976094591292c4d9e5d961e4ccef588f29c6f62e4f7ddaebcdafb558d2f287b00170a0606f72b34b0fedfa0dd2979996e5
|
7
|
+
data.tar.gz: 95cf649f1f6cf458822bc7d7a9143be7bcc8b24f4da4dfdcc7a10e291d58d4e85d24bfff6e3a84f1178e68e547e04fca744d45480cf02da43a1e54c3b0237292
|
data/lib/lhj/env.rb
ADDED
@@ -60,11 +60,11 @@ module Lhj
|
|
60
60
|
return nil if last_git_commit_formatted_with('%an').nil?
|
61
61
|
|
62
62
|
{
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
author: last_git_commit_formatted_with('%an'),
|
64
|
+
author_email: last_git_commit_formatted_with('%ae'),
|
65
|
+
message: last_git_commit_formatted_with('%B'),
|
66
|
+
commit_hash: last_git_commit_formatted_with('%H'),
|
67
|
+
abbreviated_commit_hash: last_git_commit_formatted_with('%h')
|
68
68
|
}
|
69
69
|
end
|
70
70
|
|
@@ -118,10 +118,15 @@ module Lhj
|
|
118
118
|
# Returns the current git branch, or "HEAD" if it's not checked out to any branch
|
119
119
|
# Can be replaced using the environment variable `GIT_BRANCH`
|
120
120
|
def self.git_branch
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
121
|
+
env_name = SharedValues::GIT_BRANCH_ENV_VARS.find { |env_var| Lhj::Env.truthy?(env_var) }
|
122
|
+
ENV.fetch(env_name.to_s) do
|
123
|
+
# Rescues if not a git repo or no commits in a git repo
|
124
|
+
begin
|
125
|
+
Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp
|
126
|
+
rescue => err
|
127
|
+
UI.verbose("Error getting git branch: #{err.message}")
|
128
|
+
nil
|
129
|
+
end
|
125
130
|
end
|
126
131
|
end
|
127
132
|
|
@@ -24,7 +24,7 @@ module Lhj
|
|
24
24
|
when :release
|
25
25
|
'release'
|
26
26
|
when :gray
|
27
|
-
'
|
27
|
+
'gray'
|
28
28
|
else
|
29
29
|
'uat'
|
30
30
|
end
|
@@ -36,7 +36,9 @@ module Lhj
|
|
36
36
|
changelog = Lhj::Actions.git_log_between(' %an, %ar - %s;', from, to, :exclude_merges, 'short', false)
|
37
37
|
changelog ||= ''
|
38
38
|
changelog&.gsub("\n\n", "\n")
|
39
|
-
changelog.gsub('seconds ', '秒').gsub('minutes ', '分钟').gsub('hours ', '小时').gsub('days ', '天').gsub('ago ', '前')
|
39
|
+
changelog = changelog.gsub('seconds ', '秒').gsub('minutes ', '分钟').gsub('hours ', '小时').gsub('days ', '天').gsub('ago ', '前')
|
40
|
+
changelog = '此次打包没代码更新' if changelog.empty?
|
41
|
+
changelog
|
40
42
|
end
|
41
43
|
|
42
44
|
def save_last_commit_hash
|
@@ -54,7 +56,8 @@ module Lhj
|
|
54
56
|
end
|
55
57
|
|
56
58
|
def last_commit_file
|
57
|
-
|
59
|
+
file_name = @branch.gsub(%r{/}, '')
|
60
|
+
File.join(Lhj::Config.instance.home_dir, ".#{file_name}_last_commit")
|
58
61
|
end
|
59
62
|
|
60
63
|
def render_template
|
data/lib/lhj/tools/version.rb
CHANGED
data/lib/lhj/tools.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.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|
@@ -326,6 +326,7 @@ files:
|
|
326
326
|
- lib/lhj/command/yapi/formatters/template/pgyer.erb
|
327
327
|
- lib/lhj/command/yapi/formatters/template/yapi.erb
|
328
328
|
- lib/lhj/config.rb
|
329
|
+
- lib/lhj/env.rb
|
329
330
|
- lib/lhj/helper/dingtalk_config.rb
|
330
331
|
- lib/lhj/helper/dingtalk_helper.rb
|
331
332
|
- lib/lhj/helper/git_helper.rb
|