kuber_kit 0.5.6 → 0.5.7

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
  SHA256:
3
- metadata.gz: 185201d6f305a1e69b2d5ec982288234454404bb9b87501130f159fb58a3b97a
4
- data.tar.gz: e411255031c65afe38e7b0faa20e9b578b2d3eca93a3bb9dc013766a59c7d2b1
3
+ metadata.gz: 9193e2d8c2f37a0ab10c3784fc353b2a7db990852aed41c12370624a4604eee3
4
+ data.tar.gz: e8effb3c080cdf273076f60998ef90fe70c0be31f36537edc06c1f6871b54541
5
5
  SHA512:
6
- metadata.gz: 936fd6032488908db1fffe95f736dd05042c499f2995be2bc28566b2f65d9d5b35150acc0cf08de50442c16408d56d623292bb8e051215bfc15b8aba804266cc
7
- data.tar.gz: c81b1a227cf5690d675b0b8d269382f0bb6d13ed71cfc3442679e1bd7471b995e02e7177b6c93bfb6955792bd591708c0ea017f9ea52291992bbbd0e5b33c0e2
6
+ metadata.gz: 2f9322e5dee8ef3385e4ceba437257bb7a549e0aba7804420fe44c7bb42731f9d22419a83e584a121226f1ea80192e1b9041b343756a947177e89f7be62f488c
7
+ data.tar.gz: 053c5fcbffe7c9246ede5e166abd17d7a62a20d0e63a5c5d10a21b63cf5ea9c02eacaee6f54ecab01c7c90f6f9d89b0300a9f9da38d213d7c512302cf5c4303c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ **0.5.7**
2
+ - Look for kuber_kit root path in parent folders, so kit command will work in sub-folders
3
+
1
4
  **0.5.6**
2
5
  - Pre-process env file if it has .erb extension
3
6
  - Allow attaching env file from configuration to docker container
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.5.6)
4
+ kuber_kit (0.5.7)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
data/lib/kuber_kit.rb CHANGED
@@ -82,6 +82,7 @@ module KuberKit
82
82
  autoload :FilePresenceChecker, 'tools/file_presence_checker'
83
83
  autoload :LoggerFactory, 'tools/logger_factory'
84
84
  autoload :ProcessCleaner, 'tools/process_cleaner'
85
+ autoload :WorkdirDetector, 'tools/workdir_detector'
85
86
  end
86
87
 
87
88
  module Shell
@@ -4,6 +4,7 @@ class KuberKit::Actions::ConfigurationLoader
4
4
  "core.image_store",
5
5
  "core.service_store",
6
6
  "core.configuration_store",
7
+ "tools.workdir_detector",
7
8
  "artifacts_sync.artifacts_updater",
8
9
  "shell.local_shell",
9
10
  "ui",
@@ -12,7 +13,7 @@ class KuberKit::Actions::ConfigurationLoader
12
13
 
13
14
  Contract Hash => Any
14
15
  def call(options)
15
- root_path = options[:path] || File.join(Dir.pwd, configs.kuber_kit_dirname)
16
+ root_path = workdir_detector.call(options)
16
17
  images_path = options[:images_path] || File.join(root_path, configs.images_dirname)
17
18
  services_path = options[:services_path] || File.join(root_path, configs.services_dirname)
18
19
  infra_path = options[:infra_path] || File.join(root_path, configs.infra_dirname)
data/lib/kuber_kit/cli.rb CHANGED
@@ -179,7 +179,7 @@ class KuberKit::CLI < Thor
179
179
  end
180
180
 
181
181
  # We should load config before loading any bean, to make sure that bean won't be built with default config
182
- root_path = options[:path] || File.join(Dir.pwd, KuberKit::Container['configs'].kuber_kit_dirname)
182
+ root_path = KuberKit::Container['tools.workdir_detector'].call(options)
183
183
  config_file_path = File.join(root_path, APP_CONFIG_FILENAME)
184
184
  if File.exists?(config_file_path)
185
185
  require config_file_path
@@ -137,6 +137,10 @@ class KuberKit::Container
137
137
  KuberKit::Tools::ProcessCleaner.new
138
138
  end
139
139
 
140
+ register "tools.workdir_detector" do
141
+ KuberKit::Tools::WorkdirDetector.new
142
+ end
143
+
140
144
  register "shell.bash_commands" do
141
145
  KuberKit::Shell::Commands::BashCommands.new
142
146
  end
@@ -0,0 +1,33 @@
1
+ class KuberKit::Tools::WorkdirDetector
2
+ include KuberKit::Import[
3
+ "configs",
4
+ "tools.file_presence_checker"
5
+ ]
6
+
7
+ def call(options, current_dir: nil)
8
+ current_dir ||= Dir.pwd
9
+ default_dir = File.join(current_dir, configs.kuber_kit_dirname)
10
+ workdir_path = options[:path] || ENV['KUBER_KIT_PATH'] || default_dir
11
+
12
+ unless file_presence_checker.dir_exists?(workdir_path)
13
+ workdir_in_ancestors = find_workdir_in_ancestors(current_dir)
14
+ workdir_path = workdir_in_ancestors if workdir_in_ancestors
15
+ end
16
+
17
+ workdir_path
18
+ end
19
+
20
+ private
21
+ def find_workdir_in_ancestors(dir)
22
+ if dir == "/"
23
+ return nil
24
+ end
25
+
26
+ workdir_path = File.join(dir, configs.kuber_kit_dirname)
27
+ if file_presence_checker.dir_exists?(workdir_path)
28
+ return workdir_path
29
+ end
30
+
31
+ find_workdir_in_ancestors(File.dirname(dir))
32
+ end
33
+ end
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuber_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2021-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts-lite
@@ -316,6 +316,7 @@ files:
316
316
  - lib/kuber_kit/tools/file_presence_checker.rb
317
317
  - lib/kuber_kit/tools/logger_factory.rb
318
318
  - lib/kuber_kit/tools/process_cleaner.rb
319
+ - lib/kuber_kit/tools/workdir_detector.rb
319
320
  - lib/kuber_kit/ui.rb
320
321
  - lib/kuber_kit/ui/api.rb
321
322
  - lib/kuber_kit/ui/debug.rb