Class: YJCocoa::PodRelease
- Defined in:
- lib/yjcocoa/pod/pod_release.rb
Overview
Usage
Constant Summary
Constants inherited from Command
Instance Attribute Summary collapse
-
#podfile ⇒ Object
文件路径.
-
#pods ⇒ Object
pods 库.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ PodRelease
constructor
初始化.
-
#run ⇒ Object
businrss.
- #validate! ⇒ Object
Methods inherited from Command
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
#podfile ⇒ Object
文件路径
31 32 33 |
# File 'lib/yjcocoa/pod/pod_release.rb', line 31 def podfile @podfile end |
#pods ⇒ Object
pods 库
32 33 34 |
# File 'lib/yjcocoa/pod/pod_release.rb', line 32 def pods @pods end |
Class Method Details
.options ⇒ Object
26 27 28 29 |
# File 'lib/yjcocoa/pod/pod_release.rb', line 26 def self. [['--podfile', '包含 pods 库的 podfile 文件路径'], ['--pods', 'pods 库,多 pod 用 "," 分隔']] + super end |
Instance Method Details
#run ⇒ Object
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. unless self.podfile && self.pods unless File.exist?(self.podfile) puts "podfile 文件路径 #{self.podfile} 不存在".red self. end end |