module Pod class Command class JxedtCommand < Command class Binary < JxedtCommand class SourceProject < Binary self.summary = '生成源码Pods工程' self.description = <<-DESC 生成源码Pods工程\n 默认我们是不保留源码工程,如果需要查看组件源码时,可重新生成对应的源码工程,打开查看 DESC self.command = 'sourceProject' self.arguments = [ ] def self.options [] end def initialize(argv) super end def validate! super end def run podfile = Pod::Config.instance.podfile lockfile = Pod::Config.instance.lockfile sandbox = Pod::Config.instance.sandbox help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil? # 修改config配置 options = { :keep_source_project => true, # 保留源码工程 } Jxedt.config.dsl_config.merge!(options) require 'cocoapods-jxedt/binary/helper/target_definition' require 'cocoapods-jxedt/binary/helper/prebuild_sandbox' require 'cocoapods-jxedt/binary/helper/podfile_post_install_hook' require 'cocoapods-jxedt/binary/helper/prebuild_installer' # 获取原始的installer对象,必须先获取对象 prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(sandbox) source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, podfile, lockfile) # 执行install source_installer.install! end end end end end end