Class: Pindo::Command::Dev::Debug

Inherits:
Pindo::Command::Dev show all
Includes:
Appselect, XcodeCertHelper
Defined in:
lib/pindo/command/dev/debug.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from XcodeCertHelper

#config_infoplist_cert, #config_project_cert, #create_provisioning_info_array, #create_upload_cert_info, #create_upload_provisioning_info, #get_target_name_map, #modify_entitlements_plist, #modify_info_plist_icloud

Methods included from Appselect

#all_dev_bundleid, #all_itc_bundleid, #all_release_bundleid, #all_tool_bundleid, #deploy_build_setting_json, #dev_build_setting_json, #get_deploy_repo_with_modul_name, #get_deploy_setting_repo, #get_dev_setting_repo, #get_selected_deploy_bundleid, #get_selected_dev_bundleid, #get_setting_bundleid_withdir, #load_setting, #select_main_app

Constructor Details

#initialize(argv) ⇒ Debug

Returns a new instance of Debug.



54
55
56
57
58
59
# File 'lib/pindo/command/dev/debug.rb', line 54

def initialize(argv)
  @args_adhoc_flag = argv.flag?('adhoc', false)
  @args_deploy_flag = argv.flag?('deploy', false)
  @args_macos_flag = argv.flag?('macos', false)
  super 
end

Class Method Details

.optionsObject

命令的选项列表



46
47
48
49
50
51
52
# File 'lib/pindo/command/dev/debug.rb', line 46

def self.options
  [
    ['--deploy', '使用发布bundle id(默认使用开发bundle id)'],
    ['--adhoc',  '使用adhoc证书(默认使用dev证书)'],
    ['--macos',  '使用macOS平台证书'],
  ].concat(super)
end

Instance Method Details

#runObject



62
63
64
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/pindo/command/dev/debug.rb', line 62

def run

  mainapp_bundleid= nil
  if @args_deploy_flag
    mainapp_bundleid = get_selected_deploy_bundleid()
  else
    mainapp_bundleid = get_selected_dev_bundleid()
  end

  args_temp = []
  args_temp << mainapp_bundleid
  Pindo::Command::Deploy::Pullconfig::run(args_temp)


  project_dir = Dir.pwd
  Dir.chdir(project_dir)
  config_json_file = File.join(project_dir,"config.json")
  # 处理entitlements配置
  Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: project_dir, config_file: config_json_file)

  args_temp = []
  if @args_adhoc_flag
      args_temp << "--adhoc"
  else
      args_temp << "--dev"
  end



  project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
  if !project_fullname.nil?
      project_obj = Xcodeproj::Project.open(project_fullname)
      project_build_platform = project_obj.root_object.build_configuration_list.get_setting("SDKROOT")["Release"]
      if !project_build_platform.nil? && project_build_platform.eql?("macosx")
        @args_macos_flag = true
      end
  end

  if @args_macos_flag
    args_temp << "--macos"
  end
  
  Pindo::Command::Deploy::Cert::run(args_temp)

end