env_branch 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/changelog.md +10 -0
- data/lib/env_branch/base.rb +6 -0
- data/lib/env_branch/test_helper.rb +4 -0
- data/lib/env_branch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b6b06eb812e375407cbaaa09916b26f25288975
|
4
|
+
data.tar.gz: dad1c22fdf357ddd1aec203fcae7726685de2e89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 288cf9f2b56f0049464f7eef93ac9a966e1cdd28b182edbb88b1badcb680188cd1ce09126ecc4a14804012a9cfd866c040c5d9546e0b9d50b2f4c15598ac50c7
|
7
|
+
data.tar.gz: 166f559b11e7dc8ec32e9081e3a45d810995f7aefa50436f94326be8ceebaf5a436a57ac124917f54c64263a957f5288617cebbedcf75ab6906856ec41da249d
|
data/README.md
CHANGED
@@ -71,6 +71,9 @@ And more *[details][docs-url]*.
|
|
71
71
|
* GitHub pull request builder plugin (for Jenkins)
|
72
72
|
* `ENV['ghprbSourceBranch']`
|
73
73
|
* [Environment Variables](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin#GitHubpullrequestbuilderplugin-EnvironmentVariables)
|
74
|
+
* Git Plugin (for Jenkins)
|
75
|
+
* `ENV['GIT_BRANCH']`
|
76
|
+
* [Environment variables](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-Environmentvariables)
|
74
77
|
|
75
78
|
|
76
79
|
## Related
|
data/changelog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
<a name="1.2.0"></a>
|
2
|
+
# [1.2.0](https://github.com/packsaddle/ruby-env_branch/compare/v1.1.0...v1.2.0) (2016-05-07)
|
3
|
+
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
* **ci:** support git plugin for jenkins([19eb954](https://github.com/packsaddle/ruby-env_branch/commit/19eb954)), closes [#23](https://github.com/packsaddle/ruby-env_branch/issues/23)
|
8
|
+
|
9
|
+
|
10
|
+
|
1
11
|
<a name="1.1.0"></a>
|
2
12
|
# [1.1.0](https://github.com/packsaddle/ruby-env_branch/compare/v1.0.0...v1.1.0) (2016-05-07)
|
3
13
|
|
data/lib/env_branch/base.rb
CHANGED
@@ -42,6 +42,8 @@ module EnvBranch
|
|
42
42
|
# ENV['CIRCLE_BRANCH']
|
43
43
|
# GitHub pull request builder plugin (for Jenkins):
|
44
44
|
# ENV['ghprbSourceBranch']
|
45
|
+
# Git plugin (for Jenkins):
|
46
|
+
# ENV['GIT_BRANCH']
|
45
47
|
#
|
46
48
|
# @return [String, nil] branch name or nil
|
47
49
|
#
|
@@ -54,6 +56,8 @@ module EnvBranch
|
|
54
56
|
# Environment variables - CircleCI
|
55
57
|
# @see https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin#GitHubpullrequestbuilderplugin-EnvironmentVariables
|
56
58
|
# Environment Variables
|
59
|
+
# @see https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-Environmentvariables
|
60
|
+
# Environment variables
|
57
61
|
def fetch_branch_name
|
58
62
|
if ENV['TRAVIS_BRANCH'] && !ENV['TRAVIS_BRANCH'].empty?
|
59
63
|
ENV['TRAVIS_BRANCH']
|
@@ -61,6 +65,8 @@ module EnvBranch
|
|
61
65
|
ENV['CIRCLE_BRANCH']
|
62
66
|
elsif ENV['ghprbSourceBranch'] && !ENV['ghprbSourceBranch'].empty?
|
63
67
|
ENV['ghprbSourceBranch']
|
68
|
+
elsif ENV['GIT_BRANCH'] && !ENV['GIT_BRANCH'].empty?
|
69
|
+
ENV['GIT_BRANCH']
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
@@ -24,9 +24,11 @@ module EnvBranch
|
|
24
24
|
@original_travis_branch = ENV['TRAVIS_BRANCH']
|
25
25
|
@original_circle_branch = ENV['CIRCLE_BRANCH']
|
26
26
|
@original_github_pull_request_builder_plugin_branch = ENV['ghprbSourceBranch']
|
27
|
+
@original_git_plugin_branch = ENV['GIT_BRANCH']
|
27
28
|
ENV.delete 'TRAVIS_BRANCH'
|
28
29
|
ENV.delete 'CIRCLE_BRANCH'
|
29
30
|
ENV.delete 'ghprbSourceBranch'
|
31
|
+
ENV.delete 'GIT_BRANCH'
|
30
32
|
end
|
31
33
|
|
32
34
|
# Restore original environment variables for branch.
|
@@ -49,9 +51,11 @@ module EnvBranch
|
|
49
51
|
original_travis_branch = (defined?(@original_travis_branch) && @original_travis_branch) || nil
|
50
52
|
original_circle_branch = (defined?(@original_circle_branch) && @original_circle_branch) || nil
|
51
53
|
original_github_pull_request_builder_plugin_branch = (defined?(@original_github_pull_request_builder_plugin_branch) && @original_github_pull_request_builder_plugin_branch) || nil
|
54
|
+
original_git_plugin_branch = (defined?(@original_git_plugin_branch) && @original_git_plugin_branch) || nil
|
52
55
|
ENV['TRAVIS_BRANCH'] = original_travis_branch
|
53
56
|
ENV['CIRCLE_BRANCH'] = original_circle_branch
|
54
57
|
ENV['ghprbSourceBranch'] = original_github_pull_request_builder_plugin_branch
|
58
|
+
ENV['GIT_BRANCH'] = original_git_plugin_branch
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
data/lib/env_branch/version.rb
CHANGED