Class: Pindo::Command::Dev::Build

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

Constant Summary

Constants inherited from Pindo::Command

Pindo::Command::DEFAULT_OPTIONS, Pindo::Command::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

run, #validate!

Methods included from Funlog::Mixin

#pindo_log_instance

Methods included from Pindoconfig::Mixin

#pindo_single_config

Methods included from Githelper

#add_branch, #add_tag, #add_tag_with_check, #clone_clang_repo, #clone_devclang_repo, #clone_pindo_common_config_repo, #clone_pindo_env_config_repo, #clong_buildconfig_repo, #get_repo_base_name, #getcode_to_dir, #git_addpush_repo, #git_latest_commit_id, #git_root_directory, #is_git_directory?, #local_branch_exists?, #local_tag_exists?, #prepare_gitenv, #process_need_add_files, #remote_branch_exists?, #remote_tag_exists?, #remove_branch, #remove_tag

Methods included from Executable

capture_command, #executable, execute_command, which, which!

Constructor Details

#initialize(argv) ⇒ Build

Returns a new instance of Build.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/pindo/command/dev/build.rb', line 51

def initialize(argv)

    @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



43
44
45
46
47
48
49
# File 'lib/pindo/command/dev/build.rb', line 43

def self.options
    [
        ['--proj', '指定上传到pgyer对应的项目名称(大小写空格忽略),用法:pindo dev build --proj=aichatv4'],
        ['--upload', '是否上传编译后的ipa, 用法:pindo dev build --upload'],
        ['--send',  '上传到之后是否发送测试信息,用法:pindo dev build --send'],
    ].concat(super)
end

Instance Method Details

#runObject



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
# File 'lib/pindo/command/dev/build.rb', line 66

def run

    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
    case project_type
    when :ios
        puts "iOS 工程, 请使用 pindo ios build"
        Pindo::Command::Ios::Build::run(args_temp)
    when :android
        puts "Android 工程, 请使用 pindo android build"
        Pindo::Command::Android::Build::run(args_temp)
    when :unity
        raise Informative, "Unity 工程, 请使用 pindo unity ipa 或者pindo unity apk"
    else
        raise Informative, "当前目录不是工程目录,不能编译"
    end

end