Class: Pindo::Command::Appstore::Quswark

Inherits:
Pindo::Command::Appstore show all
Defined in:
lib/pindo/command/appstore/quswark.rb

Constant Summary

Constants inherited from Pindo::Command

DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS

Instance Attribute Summary

Attributes inherited from Pindo::Command

#args_help_flag

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pindo::Command

command_name, #initialize_options, run, use_cache?, #validate!

Methods included from Funlog::Mixin

#pindo_log_instance

Methods included from Pindoconfig::Mixin

#pindo_single_config

Constructor Details

#initialize(argv) ⇒ Quswark

Returns a new instance of Quswark.



37
38
39
40
# File 'lib/pindo/command/appstore/quswark.rb', line 37

def initialize(argv)
    super
    @additional_args = argv.remainder!
end

Class Method Details

.optionsObject



31
32
33
34
35
# File 'lib/pindo/command/appstore/quswark.rb', line 31

def self.options
    [

    ].concat(super)
end

Instance Method Details

#runObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/pindo/command/appstore/quswark.rb', line 42

def run


    project_dir = Dir.pwd
    config_file = File.join(project_dir, "config.json")

    # 加载配置
    config_parser = Pindo::IosConfigParser.instance
    config_parser.load_config(config_file: config_file)
    config_json = config_parser.config_json

    if config_json.nil? || config_json.empty?
        raise Informative, "配置未加载,请检查配置文件: #{config_file}"
    end

    # 始终使用 release 模式
    build_type = 'release'

    # 根据配置决定使用 Quark 还是 Swark
    if config_json['project_info']['xcode_build_type'] && config_json["project_info"]["xcode_build_type"].include?("quark")
        success = Pindo::XcodeSwarkHelper.quark_run(
            project_dir: project_dir,
            config_json: config_json,
            build_type: build_type
        )
        unless success
            raise Informative, "Quark 配置失败,请检查日志"
        end
    else
        # 默认使用 Swark
        success = Pindo::XcodeSwarkHelper.swark_run(
            project_dir: project_dir,
            config_json: config_json,
            build_type: build_type
        )
        unless success
            raise Informative, "Swark 配置失败,请检查日志"
        end
    end
end