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

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

Class Method Summary collapse

Instance Method Summary collapse

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