Class: Pindo::Command::Dev::Autobuild

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

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ Autobuild

Returns a new instance of Autobuild.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/pindo/command/dev/autobuild.rb', line 62

def initialize(argv)

    @args_deploy_flag = argv.flag?('deploy', false)
    @args_adhoc_flag = argv.flag?('adhoc', false)  
    @args_upload_flag = argv.flag?('upload', false)  
    @args_send_flag = argv.flag?('send', false)  
    @args_proj_name = argv.option('proj')

    if @args_send_flag
        @args_upload_flag = true
    end

    super
    @additional_args = argv.remainder!
end

Class Method Details

.optionsObject

命令的选项列表



52
53
54
55
56
57
58
59
60
# File 'lib/pindo/command/dev/autobuild.rb', line 52

def self.options
    [
        ['--deploy',  '默认用开发的bundle id,用法:pindo dev autobuild --deploy'],
        ['--adhoc',   '默认用dev证书,使用--adhoc设置使用adhoc证书编译'],
        ['--proj',    '指定上传到pgyer对应的项目名称(大小写空格忽略)'],
        ['--upload',  '是否上传编译后的ipa'],
        ['--send',    '上传到之后是否发送测试信息'],
    ].concat(super)
end

Instance Method Details

#runObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/pindo/command/dev/autobuild.rb', line 83

def run
    
    pindo_unity_project_dir = Dir.pwd
    build_helper = Pindo::BuildHelper.share_instance
    pindo_unity_project_dir = Dir.pwd


    build_helper = Pindo::BuildHelper.share_instance
    project_type = build_helper.project_type(pindo_unity_project_dir)

    args_temp = []
    args_temp << "--proj=#{@args_proj_name}" if @args_proj_name
    args_temp << "--upload" if @args_upload_flag
    args_temp << "--send" if @args_send_flag
    args_temp << "--adhoc" if @args_adhoc_flag
    args_temp << "--deploy" if @args_deploy_flag    

    case project_type
    when :ios
        puts "iOS工程, 请使用 pindo ios autobuild"
        Pindo::Command::Ios::Autobuild::run(args_temp)
    when :android
        puts "Android工程, 请使用 pindo android autobuild"
    when :unity
        raise Informative, "Unity工程, 请使用 pindo unity ipa 或者pindo unity apk"
    else
        raise Informative, "当前目录不是工程目录,不能编译"
    end

end

#validate!Object



78
79
80
81
# File 'lib/pindo/command/dev/autobuild.rb', line 78

def validate!
    
    super
end