env_branch 1.0.0 → 1.1.0

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
  SHA1:
3
- metadata.gz: 7a62a8a18910d7707ee637cb167e0336333734ca
4
- data.tar.gz: d5b188715beb6af2e449ab703d357b60028eb8cb
3
+ metadata.gz: 4db369b0dd3ed7e7f2e59396a09a498264011507
4
+ data.tar.gz: 3e7b892c565392ff3a7bd44419835b9007a92e70
5
5
  SHA512:
6
- metadata.gz: c486c07dcb4435cf872a316f18eff08663fad4f2c15ab23130b724d0825cc1106cd9dcb0276a35b3aa9b057a767d1c82415ea2112dc8ce95972be69d46078ae3
7
- data.tar.gz: 4a92dea6f182aeac861960e964a43b054f02a6e8c13cfb2f40d2a2effc49f5037653859fbf4150ccd016ba3e1c3a81e07ec342f74fb1dc3f58874e80e7e68712
6
+ metadata.gz: 92971cefe0585a9d5f583a78455b24dc172e09f75dfb7a178688b9c4595eacf5bea62762a25eef87888a5aef4f340a860a8aa0c4b02282a83396e37cdfe2903e
7
+ data.tar.gz: 09b5e98a93682802afd686d1a4ec5c56fc2cecb3bf379f856652aff3447c3a084c968b0e3ee107a9767b9cd9567ac29e5434cc2896947838d8ce500b81a17bd1
data/README.md CHANGED
@@ -68,6 +68,9 @@ And more *[details][docs-url]*.
68
68
  * CircleCI
69
69
  * `ENV['CIRCLE_BRANCH']`
70
70
  * [Environment variables - CircleCI](https://circleci.com/docs/environment-variables#build-details)
71
+ * GitHub pull request builder plugin (for Jenkins)
72
+ * `ENV['ghprbSourceBranch']`
73
+ * [Environment Variables](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin#GitHubpullrequestbuilderplugin-EnvironmentVariables)
71
74
 
72
75
 
73
76
  ## Related
data/changelog.md CHANGED
@@ -1,3 +1,13 @@
1
+ <a name="1.1.0"></a>
2
+ # [1.1.0](https://github.com/packsaddle/ruby-env_branch/compare/v1.0.0...v1.1.0) (2016-05-07)
3
+
4
+
5
+ ### Features
6
+
7
+ * **ci:** support github pull request builder plugin([ca0075c](https://github.com/packsaddle/ruby-env_branch/commit/ca0075c)), closes [#21](https://github.com/packsaddle/ruby-env_branch/issues/21)
8
+
9
+
10
+
1
11
  <a name="1.0.0"></a>
2
12
  # [1.0.0](https://github.com/packsaddle/ruby-env_branch/compare/v0.2.2...v1.0.0) (2016-05-01)
3
13
 
@@ -40,6 +40,8 @@ module EnvBranch
40
40
  # ENV['TRAVIS_BRANCH']
41
41
  # circleci.com:
42
42
  # ENV['CIRCLE_BRANCH']
43
+ # GitHub pull request builder plugin (for Jenkins):
44
+ # ENV['ghprbSourceBranch']
43
45
  #
44
46
  # @return [String, nil] branch name or nil
45
47
  #
@@ -50,11 +52,15 @@ module EnvBranch
50
52
  # Environment Variables - Travis CI
51
53
  # @see https://circleci.com/docs/environment-variables#build-details
52
54
  # Environment variables - CircleCI
55
+ # @see https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin#GitHubpullrequestbuilderplugin-EnvironmentVariables
56
+ # Environment Variables
53
57
  def fetch_branch_name
54
58
  if ENV['TRAVIS_BRANCH'] && !ENV['TRAVIS_BRANCH'].empty?
55
59
  ENV['TRAVIS_BRANCH']
56
60
  elsif ENV['CIRCLE_BRANCH'] && !ENV['CIRCLE_BRANCH'].empty?
57
61
  ENV['CIRCLE_BRANCH']
62
+ elsif ENV['ghprbSourceBranch'] && !ENV['ghprbSourceBranch'].empty?
63
+ ENV['ghprbSourceBranch']
58
64
  end
59
65
  end
60
66
 
@@ -23,8 +23,10 @@ module EnvBranch
23
23
  def stash_env_branch
24
24
  @original_travis_branch = ENV['TRAVIS_BRANCH']
25
25
  @original_circle_branch = ENV['CIRCLE_BRANCH']
26
+ @original_github_pull_request_builder_plugin_branch = ENV['ghprbSourceBranch']
26
27
  ENV.delete 'TRAVIS_BRANCH'
27
28
  ENV.delete 'CIRCLE_BRANCH'
29
+ ENV.delete 'ghprbSourceBranch'
28
30
  end
29
31
 
30
32
  # Restore original environment variables for branch.
@@ -46,8 +48,10 @@ module EnvBranch
46
48
  def restore_env_branch
47
49
  original_travis_branch = (defined?(@original_travis_branch) && @original_travis_branch) || nil
48
50
  original_circle_branch = (defined?(@original_circle_branch) && @original_circle_branch) || nil
51
+ original_github_pull_request_builder_plugin_branch = (defined?(@original_github_pull_request_builder_plugin_branch) && @original_github_pull_request_builder_plugin_branch) || nil
49
52
  ENV['TRAVIS_BRANCH'] = original_travis_branch
50
53
  ENV['CIRCLE_BRANCH'] = original_circle_branch
54
+ ENV['ghprbSourceBranch'] = original_github_pull_request_builder_plugin_branch
51
55
  end
52
56
  end
53
57
  end
@@ -1,3 +1,3 @@
1
1
  module EnvBranch
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-01 00:00:00.000000000 Z
11
+ date: 2016-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler