kontena-cli 1.0.2.pre1 → 1.0.2.rc1

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: 10d95d577cd62d1ef303de2391e5cc943a258492
4
- data.tar.gz: e38f1964bae2e547b28b281f38a49cb661106e5d
3
+ metadata.gz: d958eccc9f62fd73f519d3ef624e62f0ab203c48
4
+ data.tar.gz: 72a3d121bbefee09efd42a69e900dd33cf66d298
5
5
  SHA512:
6
- metadata.gz: 79ee080091fef65600adb307d308599bd7399c151b48f5322cfd39baf0f5d61101234d146bf64cfe6a72636ecdda68820ac5deb08bdbb4c82c96272e373b2fcd
7
- data.tar.gz: 39a0fe44eadac6a14c92ee7b9437b2d9965232d2439d2030163383c6130a2f0b987307d5b79b7eae93b7ed47472f3c010d79839d85d17433efefc119e9900ad0
6
+ metadata.gz: 7ac1410618aaeaba33075e6c90a2b811137cbc7d566cba719eb90672ae12601e4f3a2e28e6f92989ce12d1a3f69980b8ee3ce6dcb7b6014b5ec9b1f9284dee9d
7
+ data.tar.gz: 4a158c1741f8e53c04aa7651f6c8166a179add5f9eda122c46fd28743313bd7bb5cb2cf5aa9f6e8729554c0ae95c1df05e7a94ce05e5f2047b75a3eb45c0892b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2.pre1
1
+ 1.0.2.rc1
data/kontena-cli.gemspec CHANGED
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency "launchy", "~> 2.4.3"
30
30
  spec.add_runtime_dependency "hash_validator", "~> 0.7.0"
31
31
  spec.add_runtime_dependency "retriable", "~> 2.1.0"
32
- spec.add_runtime_dependency "opto", "1.5.2"
32
+ spec.add_runtime_dependency "opto", "~> 1.5.3"
33
33
  spec.add_runtime_dependency "semantic", "~> 1.5"
34
34
  end
@@ -44,7 +44,7 @@ module Kontena::Cli::Stacks
44
44
  return @variables if @variables
45
45
  if yaml && yaml.has_key?('variables')
46
46
  variables_yaml = yaml['variables'].to_yaml
47
- variables_hash = ::YAML.load(replace_dollar_dollars(interpolate(variables_yaml)))
47
+ variables_hash = ::YAML.load(replace_dollar_dollars(interpolate(variables_yaml, use_opto: false)))
48
48
  @variables = Opto::Group.new(variables_hash, defaults: { from: :env, to: :env })
49
49
  else
50
50
  @variables = Opto::Group.new(defaults: { from: :env, to: :env })
@@ -220,19 +220,30 @@ module Kontena::Cli::Stacks
220
220
 
221
221
  ##
222
222
  # @param [String] text - content of YAML file
223
- def interpolate(text)
224
- text.gsub(/(?<!\$)\$(?!\$)\{?\w+\}?/) do |v| # searches $VAR and ${VAR} and not $$VAR
225
- var = v.tr('${}', '')
226
- val = ENV[var]
227
- if val
228
- val
229
- elsif @replace_missing
230
- @replace_missing
223
+ def interpolate(text, use_opto: true)
224
+ text.split(/[\r\n]/).map do |row|
225
+ # skip lines that opto is interpolating
226
+ if row.strip.start_with?('interpolate:') || row.strip.start_with?('evaluate:')
227
+ row
231
228
  else
232
- puts "Value for #{var} is not set. Substituting with an empty string." unless skip_validation?
233
- ''
229
+ row.gsub(/(?<!\$)\$(?!\$)\{?\w+\}?/) do |v| # searches $VAR and ${VAR} and not $$VAR
230
+ var = v.tr('${}', '')
231
+
232
+ if use_opto
233
+ val = variables.value_of(var) || ENV[var]
234
+ else
235
+ val = ENV[var]
236
+ end
237
+
238
+ if val
239
+ val.to_s =~ /[\r\n\"\'\|]/ ? val.inspect : val
240
+ else
241
+ puts "Value for #{var} is not set. Substituting with an empty string." unless skip_validation?
242
+ @replace_missing || ''
243
+ end
244
+ end
234
245
  end
235
- end
246
+ end.join("\n")
236
247
  end
237
248
 
238
249
  ##
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2.pre1
4
+ version: 1.0.2.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc
@@ -140,16 +140,16 @@ dependencies:
140
140
  name: opto
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '='
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.5.2
145
+ version: 1.5.3
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '='
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.5.2
152
+ version: 1.5.3
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: semantic
155
155
  requirement: !ruby/object:Gem::Requirement