Class: Pod::Command::JxedtCommand::Options

Inherits:
Pod::Command::JxedtCommand show all
Defined in:
lib/cocoapods-jxedt/command/options/options.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Options

Returns a new instance of Options.



18
19
20
21
22
# File 'lib/cocoapods-jxedt/command/options/options.rb', line 18

def initialize(argv)
    @config = argv.flag?('config', false)
    @more_config = argv.flag?('more-config', false)
    super
end

Class Method Details

.optionsObject



12
13
14
15
16
17
# File 'lib/cocoapods-jxedt/command/options/options.rb', line 12

def self.options
    [
        ['--config', '获取cocoapods-jxedt插件的基础配置'],
        ['--more-config', '获取cocoapods-jxedt插件的完整配置']
    ]
end

Instance Method Details

#log_section(message) ⇒ Object



108
109
110
111
112
# File 'lib/cocoapods-jxedt/command/options/options.rb', line 108

def log_section(message)
    Pod::UI.puts "-----------------------------------------"
    Pod::UI.puts message
    Pod::UI.puts "-----------------------------------------"
end


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cocoapods-jxedt/command/options/options.rb', line 45

def print_base_options_config
    config = "use_frameworks! :linkage => :static\n# use_modular_headers!\n\nplugin 'cocoapods-jxedt'\noptions = {\n    'all_binary': true, # \u6240\u6709\u7EC4\u4EF6\u5F00\u542Fbinary\n    'keep_source_project': true, # \u4FDD\u7559\u6E90\u7801pod\u5DE5\u7A0B\uFF0C\u6240\u5728\u76EE\u5F55`Pods-Source`\n    'excluded_pods': [], # \u6392\u9664binary\u7684\u7EC4\u4EF6\u540D\u79F0\n    'framework_header_search_enabled': true, # \u517C\u5BB9\u5934\u6587\u4EF6\u5F15\u7528`#import \"xxx.h\"`\n    'configurations': ['Release'], # \u652F\u6301\u7684configurations ['Release', 'Debug']\n    'device_build_enabled': true, # \u771F\u673A\n    'simulator_build_enabled': false # \u6A21\u62DF\u5668\n}\ncocoapods_jxedt_config(options)\n"
    Pod::UI.puts config
end


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/cocoapods-jxedt/command/options/options.rb', line 65

def print_options_config
    dsl_config = Jxedt::Config::APPLICABLE_DSL_CONFIG
    git_config = Jxedt::Config::GIT_CACHE_CONFIG

    config = "use_frameworks! :linkage => :static # \u63D2\u4EF6\u662F\u652F\u6301\u4F7F\u7528library\u7684\uFF0C\u63D2\u4EF6\u4F1A\u628A\u7F16\u8BD1\u540E\u7684.a\u751F\u6210framework\u3002\u5982\u679C\u4F60\u7684\u5DE5\u7A0B\u4E0D\u652F\u6301module\uFF0C\u53EF\u4EE5\u5220\u6389\u6216\u8005\u6CE8\u91CA\u6389\u8FD9\u4E00\u884C\u3002\u4E0D\u5F71\u54CD\u4F7F\u7528\n# use_modular_headers!\n\nplugin 'cocoapods-jxedt'\n\n# \u8FD9\u91CC\u9ED8\u8BA4\u914D\u7F6E\u4E86\u5927\u90E8\u5206\u5E38\u7528\u7684\u914D\u7F6E\u53C2\u6570\uFF0C\u53EA\u9700\u8981\u7B80\u5355\u4FEE\u6539\u5C31\u53EF\u4EE5\u4F7F\u7528\u4E86\noptions = {\n    'all_binary': true, # \#{dsl_config[:all_binary]}\n    'binary_dir': '../_Prebuild', # \#{dsl_config[:binary_dir]}\n    'binary_switch': true, # \#{dsl_config[:binary_switch]}\n    'prebuild_job': true, # \#{dsl_config[:prebuild_job]}\n    'keep_source_project': false, # \#{dsl_config[:keep_source_project]}\n    'excluded_pods': [], # \#{dsl_config[:excluded_pods]}\n    'framework_header_search_enabled': false, # \#{dsl_config[:framework_header_search_enabled]}\n    'configurations': ['Release'], # \#{dsl_config[:configurations]}\n    'xcframework': false, # \#{dsl_config[:xcframework]}\n    'clean_build': true, # \#{dsl_config[:clean_build]}\n    'device_build_enabled': true, # \#{dsl_config[:device_build_enabled]}\n    'simulator_build_enabled': false, # \#{dsl_config[:simulator_build_enabled]}\n    'disable_resource_compilable_pods': false, # \#{dsl_config[:disable_resource_compilable_pods]}\n    'build_args': { # \u4E0B\u9762\u662F\u9ED8\u8BA4\u7684\u914D\u7F6E\uFF0C\u5982\u679C\u6CA1\u6709\u6539\u52A8\u53EF\u5220\u9664\u8282\u70B9\n        'default': [\"ONLY_ACTIVE_ARCH=NO\", \"BUILD_LIBRARY_FOR_DISTRIBUTION=YES\"],\n        'device': [\"ARCHS='arm64'\"],\n        'simulator': [\"ARCHS='x86_64'\"]\n    },\n    'git_cache': { # \u5982\u679C\u4E0D\u9700\u8981git\u7F13\u5B58\uFF0C\u76F4\u63A5\u5220\u6389\u8FD9\u4E2A\u8282\u70B9\u5373\u53EF\n        'repo': '', # \#{git_config[:repo]}\n        'branch': 'develop', # \#{git_config[:branch]}\n        'auto_fetch': true, # \#{git_config[:auto_fetch]}\n        'auto_push': false # \#{git_config[:auto_push]}\n    }\n}\ncocoapods_jxedt_config(options)\n"

    Pod::UI.puts config
end

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cocoapods-jxedt/command/options/options.rb', line 28

def run
    require 'cocoapods-jxedt/binary/config'

    return print_options_config if @more_config
    return print_base_options_config if @config

    require 'json'
    
    log_section "🌹 APPLICABLE_DSL_CONFIG"
    dsl_config = Jxedt::Config::APPLICABLE_DSL_CONFIG
    Pod::UI.puts JSON.pretty_generate(dsl_config)

    log_section "🌹 GIT_CACHE_CONFIG"
    git_config = Jxedt::Config::GIT_CACHE_CONFIG
    Pod::UI.puts JSON.pretty_generate(git_config)
end

#validate!Object



24
25
26
# File 'lib/cocoapods-jxedt/command/options/options.rb', line 24

def validate!
    super
end