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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3e2cbbf671a3e7fd09fb7eac2e4b209cc2eccc5
4
- data.tar.gz: aea2bbb6db0bde006fea255fdbbcc53bb502b79f
3
+ metadata.gz: b4e1439327b6aed61becdad4564dba6d626bc279
4
+ data.tar.gz: b9bc624a510108032079a2d5a53766e10e6ecc0a
5
5
  SHA512:
6
- metadata.gz: a486fa1c392976cd44a83a5498728fb60f6ebd222432725537bc2b82609a6f035956a6a24fd1feaa583ed715168fa9af38a3b7e10787019eb409c22afb93f5dc
7
- data.tar.gz: 0def538f73dcbbe5a574363911feff3b94e58f92646b8370074b375bdcfb3288b66424ca67f64eb87279934e7c7bd0356e121d927dce37db3d5cf77d236357ff
6
+ metadata.gz: 2fb56300523159011c8af092522a9590ceb4cae1493a63e10f843a17a88ac714815e2fb7c402803a27a0a64db19c4cc8c63cf83ef98787a40472a458b2d43e7e
7
+ data.tar.gz: eccefe9f0eb273c22ac337e4178bbf0c9941fa25080aa247f7fbc148905ad0919d712ef81dc7259133fe9a5e053fb043ad935e84c6ae602eb868d61883558a2a
@@ -20,4 +20,14 @@ merge:
20
20
  spec:
21
21
  containers:
22
22
  - ports:
23
- - containerPort: 3000
23
+ - containerPort: 3000
24
+ migration: &job
25
+ apiVersion: batch/v1
26
+ kind: Job
27
+ spec:
28
+ replicas: --
29
+ template:
30
+ spec:
31
+ restartPolicy: Never
32
+ console:
33
+ <<: *job
@@ -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']
@@ -17,7 +17,9 @@ module KY
17
17
  end
18
18
 
19
19
  def build_configuration
20
- config = if config_file_location
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
@@ -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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module KY
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -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
 
@@ -1,3 +1,5 @@
1
1
  web: bundle exec puma -C ./config/puma.rb
2
2
  jobs: bundle exec rake jobs:work
3
3
  worker: bundle exec toiler --rails -C config/toiler.yml
4
+ migration: bundle exec rake db:migrate
5
+ console: bundle exec
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.2
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-01 00:00:00.000000000 Z
11
+ date: 2016-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec