Class: YJCocoa::PodRelease

Inherits:
Pod
  • Object
show all
Defined in:
lib/yjcocoa/pod/pod_release.rb

Overview

Usage

Constant Summary

Constants inherited from Command

Command::DEFAULT_OPTIONS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#askWithAnswers

Constructor Details

#initialize(argv) ⇒ PodRelease

初始化



35
36
37
38
39
40
# File 'lib/yjcocoa/pod/pod_release.rb', line 35

def initialize(argv)
    super
    self.podfile = argv.option('podfile')
    self.pods = argv.option('pods')
    self.pods = self.pods.split(",").reject {|i| i.empty? } if self.pods
end

Instance Attribute Details

#podfileObject

文件路径



31
32
33
# File 'lib/yjcocoa/pod/pod_release.rb', line 31

def podfile
  @podfile
end

#podsObject

pods 库



32
33
34
# File 'lib/yjcocoa/pod/pod_release.rb', line 32

def pods
  @pods
end

Class Method Details

.optionsObject



26
27
28
29
# File 'lib/yjcocoa/pod/pod_release.rb', line 26

def self.options
    [['--podfile', '包含 pods 库的 podfile 文件路径'],
    ['--pods', 'pods 库,多 pod 用 "," 分隔']] + super
end

Instance Method Details

#runObject

businrss



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/yjcocoa/pod/pod_release.rb', line 54

def run
    content = []
    File.open(self.podfile, "r") { |file|
        while line = file.gets   #标准输入流
            result = check(self.pods, line)
            content << "#{result}" if result
        end
    }
    puts "YJCocoa Pod Release".green
    puts content.sort * "\n"
end

#validate!Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/yjcocoa/pod/pod_release.rb', line 42

def validate!
    super
    puts "podfile 为空".red unless self.podfile
    puts "pods 为空".red unless self.pods
    self.banner! unless self.podfile && self.pods
    unless File.exist?(self.podfile)
        puts "podfile 文件路径 #{self.podfile} 不存在".red
        self.banner!
    end
end