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 +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/lib/kuber_kit.rb +1 -0
- data/lib/kuber_kit/actions/configuration_loader.rb +2 -1
- data/lib/kuber_kit/cli.rb +1 -1
- data/lib/kuber_kit/container.rb +4 -0
- data/lib/kuber_kit/tools/workdir_detector.rb +33 -0
- data/lib/kuber_kit/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9193e2d8c2f37a0ab10c3784fc353b2a7db990852aed41c12370624a4604eee3
         | 
| 4 | 
            +
              data.tar.gz: e8effb3c080cdf273076f60998ef90fe70c0be31f36537edc06c1f6871b54541
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2f9322e5dee8ef3385e4ceba437257bb7a549e0aba7804420fe44c7bb42731f9d22419a83e584a121226f1ea80192e1b9041b343756a947177e89f7be62f488c
         | 
| 7 | 
            +
              data.tar.gz: 053c5fcbffe7c9246ede5e166abd17d7a62a20d0e63a5c5d10a21b63cf5ea9c02eacaee6f54ecab01c7c90f6f9d89b0300a9f9da38d213d7c512302cf5c4303c
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        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     =  | 
| 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 | 
| 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
         | 
    
        data/lib/kuber_kit/container.rb
    CHANGED
    
    | @@ -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
         | 
    
        data/lib/kuber_kit/version.rb
    CHANGED
    
    
    
        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. | 
| 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 | 
            +
            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
         |