heroku-stage 0.3.0 → 0.4.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
- SHA1:
3
- metadata.gz: 98c73be9fc5d68d62a1e7c86458e407398182cc3
4
- data.tar.gz: f58e7cd677bb741eaab92919fe109cf7f630bd80
2
+ SHA256:
3
+ metadata.gz: f2f7bd67413f3c11bfd4203e0291c05e8a44c510846e5f8f91e05b0b7b9124f4
4
+ data.tar.gz: fe423e33a5e0747e0fc90aee834addf4b1582cd611598989d737d340fc558c57
5
5
  SHA512:
6
- metadata.gz: 5799727161ac6850a4c322b1244190a788ccf795b5df978d1bc2f4605aa90aff57a995ffbb32145fc99c2e8ea2c477b77c350e93af31fb0a66afb7d4cf85cb2c
7
- data.tar.gz: 7cef9b31e6a8ebb8a6c2c5d1cccb5b1a56522f295542ad6272bf22064c9040c25b1c7d38088b38287d11a755d6b2ee43b61957594579b226f3c4ccaae28b9a9c
6
+ metadata.gz: 2c8031836f932cb65172c9a0c1abe18620d9e26dc21b6ab9edaf4574d04e1fee5a0f567d13f09f69fbeb4bba3c7252e07af446c1908fc946749fb914846ad91d
7
+ data.tar.gz: f4153e2ea36f530a87b8bda4aaabfec3083931067fd68bc1ed16d0259e851100242d0e4b286bee9bc1fba6c9dab06dba1b5ba49a14fabfacdeef834458cb2e78
data/README.md CHANGED
@@ -87,6 +87,15 @@ Rails.env.development? # true
87
87
  Heroku.stage # => ''
88
88
  ```
89
89
 
90
+ ### In review apps
91
+
92
+ When in a review app you can get the current pull-request
93
+
94
+ ```ruby
95
+ Heroku.review_app? # true
96
+ Heroku.stage # => pr-43
97
+ ```
98
+
90
99
  ## Testing
91
100
 
92
101
  To run the specs you need to execute, **in the root path of the gem**, the following command:
data/lib/heroku/stage.rb CHANGED
@@ -13,9 +13,15 @@ module Heroku
13
13
  @_stage ||= ActiveSupport::StringInquirer.new(heroku_pipeline_stage)
14
14
  end
15
15
 
16
+ def review_app?
17
+ !ENV['HEROKU_PARENT_APP_NAME'].nil?
18
+ end
19
+
16
20
  private
17
21
 
18
22
  def heroku_pipeline_stage
23
+ return ENV.fetch('HEROKU_APP_NAME')[/pr-(\d*)/] if review_app?
24
+
19
25
  dev_or_test = Rails.env.development? || Rails.env.test?
20
26
  dev_or_test ? '' : ENV.fetch('HEROKU_APP_NAME')[/staging|production/]
21
27
  rescue KeyError
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  module Stage
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-stage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platanus
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-04-04 00:00:00.000000000 Z
12
+ date: 2018-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.4.8
141
+ rubygems_version: 2.7.6
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Read stage name from heroku pipelines