Sha256: 7da3a97a63a93f583d63f17825aab33c46a16769e97a6988920dbc6d85bd0c23

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module YkIosCmd
  class YkConfig < Thor
    include Thor::Actions
    no_commands do
      def initialize(config_path)
        @at_path = config_path

        # 调试代码,在开发阶段,由于需要改动
        # config_dir = File.join(@at_path, '/configruation-files')
        # return unless File.exist?(config_dir) == false

        FileUtils.remove_dir("#{@at_path + '/configruation-files'}", true)
        hostA = 'yeah'
        hostB = 'ka'
        config_repo_url =
          "http://gitlab.#{hostA}#{hostB}.com/App/iOS/YKComponents/com-manage-platform-resources/configruation-files.git"
        cmd =
          "git clone #{config_repo_url} #{@at_path + '/configruation-files'}"
        puts("execute command: #{cmd}")
        system(cmd)
        FileUtils.remove_dir("#{@at_path + '/configruation-files/.git'}", true)
      end

      def read_config(file_name)
        config_file_path = "#{@at_path + '/configruation-files/' + file_name}"
        File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ykioscmd-0.6.7 lib/yk_command/config/yk_config.rb
ykioscmd-0.6.6 lib/yk_command/config/yk_config.rb