ky 0.4.2 → 0.4.3
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/examples/.ky.yml +11 -1
- data/lib/ky/cli.rb +2 -0
- data/lib/ky/configuration.rb +3 -1
- data/lib/ky/hash.rb +10 -0
- data/lib/ky/manipulation.rb +1 -1
- data/lib/ky/version.rb +1 -1
- data/spec/ky_bin_spec.rb +17 -0
- data/spec/support/Procfile +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4e1439327b6aed61becdad4564dba6d626bc279
|
4
|
+
data.tar.gz: b9bc624a510108032079a2d5a53766e10e6ecc0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb56300523159011c8af092522a9590ceb4cae1493a63e10f843a17a88ac714815e2fb7c402803a27a0a64db19c4cc8c63cf83ef98787a40472a458b2d43e7e
|
7
|
+
data.tar.gz: eccefe9f0eb273c22ac337e4178bbf0c9941fa25080aa247f7fbc148905ad0919d712ef81dc7259133fe9a5e053fb043ad935e84c6ae602eb868d61883558a2a
|
data/examples/.ky.yml
CHANGED
data/lib/ky/cli.rb
CHANGED
@@ -38,11 +38,13 @@ module KY
|
|
38
38
|
ConfigMap.yml file path may also be specified in configuration as config_path
|
39
39
|
secrets.yml file path may also be specified in configuration as secret_path
|
40
40
|
Output directory may also be specified in configuration as output_dir
|
41
|
+
Ky config (normally loaded from .ky) may be manually specified as ky_config_path
|
41
42
|
DOC
|
42
43
|
method_option :namespace, type: :string, aliases: "-n"
|
43
44
|
method_option :environment, type: :string, aliases: "-e"
|
44
45
|
method_option :image_tag, type: :string, aliases: "-t"
|
45
46
|
method_option :procfile_path, type: :string, aliases: "-p"
|
47
|
+
method_option :ky_config_path, type: :string, aliases: "-k"
|
46
48
|
def compile(config_or_secrets_path=nil, secrets_or_config_path=nil, output_dir=nil)
|
47
49
|
instance = Compilation.new(options.with_indifferent_access)
|
48
50
|
config_or_secrets_path ||= instance.configuration['config_path'] || instance.configuration['secret_path']
|
data/lib/ky/configuration.rb
CHANGED
@@ -17,7 +17,9 @@ module KY
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def build_configuration
|
20
|
-
config = if
|
20
|
+
config = if ky_config_path = opts[:ky_config_path]
|
21
|
+
YAML.load(File.read(ky_config_path)).with_indifferent_access
|
22
|
+
elsif config_file_location
|
21
23
|
YAML.load(File.read(config_file_location)).with_indifferent_access
|
22
24
|
else
|
23
25
|
DEFAULT_CONFIG
|
data/lib/ky/hash.rb
CHANGED
@@ -14,4 +14,14 @@ class Hash # specifically for HashWithIndifferentAccess < Hash, instead of plain
|
|
14
14
|
end
|
15
15
|
result
|
16
16
|
end
|
17
|
+
|
18
|
+
def compact_blank(opts={})
|
19
|
+
inject({}) do |new_hash, (k,v)|
|
20
|
+
if !v.blank?
|
21
|
+
new_hash[k] = opts[:recurse] && v.class == Hash ? v.compact_blank(opts) : v
|
22
|
+
end
|
23
|
+
new_hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
17
27
|
end
|
data/lib/ky/manipulation.rb
CHANGED
@@ -26,7 +26,7 @@ module KY
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def merge_hash(hsh1, hsh2)
|
29
|
-
hsh1.deeper_merge!(hsh2, merge_hash_arrays: true, extend_existing_arrays: true)
|
29
|
+
hsh1.deeper_merge!(hsh2, merge_hash_arrays: true, extend_existing_arrays: true, knockout_prefix: "--").compact_blank(recurse: true)
|
30
30
|
end
|
31
31
|
|
32
32
|
def code_yaml(yaml_source, direction)
|
data/lib/ky/version.rb
CHANGED
data/spec/ky_bin_spec.rb
CHANGED
@@ -179,6 +179,23 @@ describe "ky cli" do
|
|
179
179
|
|
180
180
|
end
|
181
181
|
|
182
|
+
describe "allows knocking out depoyment elements in merge" do
|
183
|
+
|
184
|
+
before do
|
185
|
+
instance = KY::Cli.new
|
186
|
+
instance.options = {namespace: fake_namespace, procfile_path: 'spec/support/Procfile', ky_config_path: 'examples/.ky.yml'}
|
187
|
+
instance.compile('spec/support/config.yml', 'spec/support/decoded.yml', tmpdir)
|
188
|
+
end
|
189
|
+
|
190
|
+
|
191
|
+
it "generated files (currently named as deployments indiscriminately)" do
|
192
|
+
expect(File.exists?("#{tmpdir}/migration.deployment.yml")).to be true
|
193
|
+
expect(YAML.load(File.read("#{tmpdir}/migration.deployment.yml"))['spec']['replicas']).to be_nil
|
194
|
+
expect(YAML.load(File.read("#{tmpdir}/migration.deployment.yml"))['kind']).to match("Job")
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
182
199
|
end
|
183
200
|
end
|
184
201
|
|
data/spec/support/Procfile
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Glusman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|