lhj-tools 0.1.21 → 0.1.22
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/tools/version.rb +1 -1
- data/lib/lhj/tools.rb +1 -0
- 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: 5d0b9e563d0ebfe15b800560545a987a274f9787522297f7721b2012ff132594
|
4
|
+
data.tar.gz: 61655a300019b6dc713a71053482ba03c5ac2bee09ccc4be8c3926217a38dada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e56808aae097aa5aaab4204aae1ea2bce2306c0aa8607be0d0ec57046c44c98576aa3d1a4c8313792f0764e37dfa0c7dd6d70f02a084fd7ea4eb3ef79ecd82d
|
7
|
+
data.tar.gz: 88c51758d568b44ad2ea8bcd4bae0572ade581ee87a146100afa9cfce6f53665dd2bd9a864e531f4b50b9d3b8af2c89236d2c406a142ac1dd1935b61339d08fa
|
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
|
|
data/lib/lhj/tools/version.rb
CHANGED
data/lib/lhj/tools.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.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
@@ -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
|