populate-env 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -1
- data/bin/console +1 -1
- data/lib/populate_env/cli/heroku_options.rb +5 -0
- data/lib/populate_env/cli/runner.rb +8 -8
- data/lib/populate_env/formatters/env_shell_section.rb +8 -3
- data/lib/populate_env/heroku/attribute_compilation.rb +1 -1
- data/lib/populate_env/heroku/compilation.rb +1 -1
- data/lib/populate_env/heroku/manifest.rb +5 -1
- data/lib/populate_env/heroku/options.rb +2 -1
- data/lib/populate_env/version.rb +1 -1
- data/populate-env.gemspec +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c52ba2e454dad8b543ac962ed672561bae13c48f2565cde305813af01cd1b567
|
4
|
+
data.tar.gz: c3d316ed975b6ab0a28f1b5bc8035e3ce1d5b2418d47d1dd8bd4d8ade3fca757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 804912c25cd36c104f9ebf0922aebb2488bf8c0f88dfc2d22bb05da2193c803fbffdad5af02d1f607dca52120fd3ce8a6c0707b328be868717ef8c3ae3773bdb
|
7
|
+
data.tar.gz: dde38e0bca6d7b6a343849409a6b2b0c92a5280eb70db211aaf5656c460f3a2cc203de30dff1b0eec7c25072267da7747359d8ee8426c7f1de72eb5cb0ddcfd4
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# populate-env
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/Aupajo/populate-env.svg?branch=master)](https://travis-ci.org/Aupajo/populate-env)
|
4
4
|
|
5
|
+
A command-line tool for populating environment variables.
|
5
6
|
|
6
7
|
## Installation
|
7
8
|
|
data/bin/console
CHANGED
@@ -57,6 +57,11 @@ module PopulateEnv
|
|
57
57
|
options.prompt_missing = value
|
58
58
|
end
|
59
59
|
|
60
|
+
description = "Prefix variable declarations in output with export (defaults to #{options.skip_local_env})"
|
61
|
+
parser.on("--[no-]export", description) do |value|
|
62
|
+
options.export = value
|
63
|
+
end
|
64
|
+
|
60
65
|
parser.parse!(argv)
|
61
66
|
|
62
67
|
options
|
@@ -28,14 +28,14 @@ module PopulateEnv
|
|
28
28
|
|
29
29
|
def option_parser
|
30
30
|
@option_parser ||= OptionParser.new do |parser|
|
31
|
-
parser.banner =
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
parser.banner = <<-BANNER
|
32
|
+
Usage:
|
33
|
+
#{executable} COMMAND [options]
|
34
|
+
|
35
|
+
Commands:
|
36
|
+
heroku
|
37
|
+
|
38
|
+
Options:
|
39
39
|
BANNER
|
40
40
|
|
41
41
|
description = 'Show the help (combine with a command for full options)'
|
@@ -1,10 +1,15 @@
|
|
1
1
|
module PopulateEnv
|
2
2
|
module Formatters
|
3
3
|
class EnvShellSection
|
4
|
-
attr_reader :attribute
|
4
|
+
attr_reader :attribute, :export
|
5
5
|
|
6
|
-
def initialize(attribute)
|
6
|
+
def initialize(attribute, export: false)
|
7
7
|
@attribute = attribute
|
8
|
+
@export = export
|
9
|
+
end
|
10
|
+
|
11
|
+
def prefix
|
12
|
+
export ? "export " : ""
|
8
13
|
end
|
9
14
|
|
10
15
|
def to_s
|
@@ -20,7 +25,7 @@ module PopulateEnv
|
|
20
25
|
output << "# "
|
21
26
|
end
|
22
27
|
|
23
|
-
output << "#{attribute.name}=#{attribute.value}\n"
|
28
|
+
output << "#{prefix}#{attribute.name}=#{attribute.value}\n"
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -22,7 +22,7 @@ module PopulateEnv
|
|
22
22
|
def sections
|
23
23
|
attribute_definitions.map do |definition|
|
24
24
|
attribute = AttributeCompilation.new(definition, options, remote_config).perform
|
25
|
-
Formatters::EnvShellSection.new(attribute) if attribute
|
25
|
+
Formatters::EnvShellSection.new(attribute, export: options.export) if attribute
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -11,7 +11,11 @@ module PopulateEnv
|
|
11
11
|
begin
|
12
12
|
data = JSON.parse(@path.read, symbolize_names: true)
|
13
13
|
env_vars = data.fetch(:env, {})
|
14
|
-
env_vars.merge!(
|
14
|
+
env_vars.merge!(
|
15
|
+
data.fetch(:environments, {})
|
16
|
+
.fetch(environment.to_sym, {})
|
17
|
+
.fetch(:env, {})
|
18
|
+
)
|
15
19
|
|
16
20
|
env_vars.map do |key, value|
|
17
21
|
if value.is_a?(Hash)
|
data/lib/populate_env/version.rb
CHANGED
data/populate-env.gemspec
CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
+
spec.required_ruby_version = '~> 2.3'
|
24
|
+
|
23
25
|
spec.add_development_dependency "bundler", "~> 1.15"
|
24
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: populate-env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Nicholls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,9 +98,9 @@ require_paths:
|
|
98
98
|
- lib
|
99
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '2.3'
|
104
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - ">="
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.6
|
111
|
+
rubygems_version: 2.7.6
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: A command-line tool for populating environment variables
|