herokenv 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +35 -0
- data/Gemfile.lock +18 -1
- data/README.md +11 -4
- data/herokenv.gemspec +2 -0
- data/lib/herokenv.rb +1 -0
- data/lib/herokenv/client.rb +29 -0
- data/lib/herokenv/version.rb +1 -1
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a2b028b0258bf97a75a8ab4f0b7fde7219de445628d1b52974027b9a15c6e8
|
4
|
+
data.tar.gz: b63dc36202b4ed54be0762fc4fa4f50f156e14f1f25ad456dd2426c5b3f815b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e01f77a5da66c9391a29257ccd548f399a2f31f7b3a561b62f555ed70e808491dfe02b350b800fb28fbb08df8e680eef515307e0efb9a429fe478006c07892
|
7
|
+
data.tar.gz: 47c8f8df5348f2533844592465ab6f199900775ef3f3ccbde29dc13d5431b2d4be977aa007e1166aa46a2bec74d710222b16fd55e54eee8ad0552f83693bdf12
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ main ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ main ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
+
# uses: ruby/setup-ruby@v1
|
30
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rake
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
herokenv (
|
4
|
+
herokenv (1.0.0)
|
5
|
+
platform-api
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
@@ -12,9 +13,24 @@ GEM
|
|
12
13
|
rexml
|
13
14
|
diff-lcs (1.4.4)
|
14
15
|
docile (1.4.0)
|
16
|
+
erubis (2.7.0)
|
17
|
+
excon (0.82.0)
|
15
18
|
hashdiff (1.0.1)
|
19
|
+
heroics (0.1.2)
|
20
|
+
erubis (~> 2.0)
|
21
|
+
excon
|
22
|
+
moneta
|
23
|
+
multi_json (>= 1.9.2)
|
24
|
+
webrick
|
25
|
+
moneta (1.0.0)
|
26
|
+
multi_json (1.15.0)
|
27
|
+
platform-api (3.3.0)
|
28
|
+
heroics (~> 0.1.1)
|
29
|
+
moneta (~> 1.0.0)
|
30
|
+
rate_throttle_client (~> 0.1.0)
|
16
31
|
public_suffix (4.0.6)
|
17
32
|
rake (12.3.3)
|
33
|
+
rate_throttle_client (0.1.2)
|
18
34
|
rexml (3.2.5)
|
19
35
|
rspec (3.10.0)
|
20
36
|
rspec-core (~> 3.10.0)
|
@@ -39,6 +55,7 @@ GEM
|
|
39
55
|
addressable (>= 2.3.6)
|
40
56
|
crack (>= 0.3.2)
|
41
57
|
hashdiff (>= 0.4.0, < 2.0.0)
|
58
|
+
webrick (1.7.0)
|
42
59
|
|
43
60
|
PLATFORMS
|
44
61
|
ruby
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Herokenv
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Easily pull Heroku environment variables into non-Heroku environments.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,16 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
Before or during the boot stage of your app you can require `herokenv` and have it populate your ENV
|
24
|
+
based on the values in a Heroku app.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'herokenv'
|
28
|
+
herokenv = Herokenv::Client.new(oauth_token: 'xxx', app: 'stark-citadel-2145')
|
29
|
+
herokenv.populate_env_from_app
|
30
|
+
```
|
31
|
+
|
32
|
+
Now your local process will have access to ENV vars that are set in your heroku app.
|
26
33
|
|
27
34
|
## Development
|
28
35
|
|
data/herokenv.gemspec
CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
+
spec.add_dependency 'platform-api'
|
31
|
+
|
30
32
|
spec.add_development_dependency 'simplecov'
|
31
33
|
spec.add_development_dependency 'webmock'
|
32
34
|
end
|
data/lib/herokenv.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'platform-api'
|
2
|
+
|
3
|
+
module Herokenv
|
4
|
+
class Client
|
5
|
+
attr_accessor :oauth_token
|
6
|
+
attr_accessor :app
|
7
|
+
def initialize(oauth_token:, app:)
|
8
|
+
@oauth_token = oauth_token
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def populate_env_from_app(only: nil, except: nil)
|
13
|
+
configs = heroku.config_var.info_for_app(app)
|
14
|
+
configs.each_pair do |var, value|
|
15
|
+
if except && except.include?(var)
|
16
|
+
next
|
17
|
+
end
|
18
|
+
if only && !only.include?(var)
|
19
|
+
next
|
20
|
+
end
|
21
|
+
ENV[var] = value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def heroku
|
26
|
+
@heroku ||= PlatformAPI.connect_oauth(oauth_token)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/herokenv/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herokenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Green
|
@@ -10,6 +10,20 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2021-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: platform-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: simplecov
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,6 +59,7 @@ executables: []
|
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
62
|
+
- ".github/workflows/ruby.yml"
|
48
63
|
- ".gitignore"
|
49
64
|
- ".rspec"
|
50
65
|
- ".travis.yml"
|
@@ -58,6 +73,7 @@ files:
|
|
58
73
|
- bin/setup
|
59
74
|
- herokenv.gemspec
|
60
75
|
- lib/herokenv.rb
|
76
|
+
- lib/herokenv/client.rb
|
61
77
|
- lib/herokenv/version.rb
|
62
78
|
homepage: https://github.com/Octo-Labs/herokenv
|
63
79
|
licenses:
|