class PPL::Command::Publish

Public Class Methods

new(argv) click to toggle source
Calls superclass method PPL::Command::new
# File lib/pod-pipeline/command/publish.rb, line 37
def initialize(argv)
    @path                   = argv.arguments!
    @repo                   = argv.option('repo', '').split(',').first
    
    @projectPath = @path.count.zero? ? Pathname.pwd.to_s : @path.first
    @is_master = false
    unless @repo
        @repo = 'master'
        @is_master = true
    end

    super
end
options() click to toggle source
Calls superclass method PPL::Command::options
# File lib/pod-pipeline/command/publish.rb, line 22
def self.options
    [
        ['--repo=master', 'Pod库所属的repo。(默认使用官方repo:master)'],
    ].concat(super).concat(options_extension)
end
options_extension_hash() click to toggle source
# File lib/pod-pipeline/command/publish.rb, line 28
def self.options_extension_hash
    Hash[
        'build' => PPL::Command::Build.options,
        'update' => PPL::Command::Update.options,
        'trunk-push' => Pod::Command::Trunk::Push.options,
        'repo-push' => Pod::Command::Repo::Push.options
    ]
end

Public Instance Methods

run() click to toggle source
# File lib/pod-pipeline/command/publish.rb, line 51
def run
    PPL::Command::Build.run([@projectPath] + argv_extension['build'])
    PPL::Command::Update.run([@projectPath] + argv_extension['update'])

    PPL::Scanner.new(@projectPath, ['pod']).run
    
    podspec_file = PPL::Scanner.linter.file
    
    if @is_master
        puts "[发布 #{podspec_file}]"
        push_argv = [podspec_file] + argv_extension['trunk-push']
        Pod::Command::Trunk::Push.run(push_argv)
    else
        puts "[发布 #{@repo} #{podspec_file}]"
        push_argv = [@repo, podspec_file] + argv_extension['repo-push']
        Pod::Command::Repo::Push.run(push_argv)
    end
end