Class: Pindo::Command::Ios::Podlint
- Inherits:
-
Ios
- Object
- Ios
- Pindo::Command::Ios::Podlint
- Defined in:
- lib/pindo/command/ios/podlint.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Podlint
constructor
A new instance of Podlint.
- #podspecs_to_lint ⇒ Object
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Podlint
Returns a new instance of Podlint.
52 53 54 55 56 57 58 59 60 |
# File 'lib/pindo/command/ios/podlint.rb', line 52 def initialize(argv) @pod_spec_file = argv.shift_argument || nil @options = (argv) @project_dir = @options[:path] super(argv) @additional_args = argv.remainder! end |
Class Method Details
.option_items ⇒ Object
44 45 46 |
# File 'lib/pindo/command/ios/podlint.rb', line 44 def self.option_items @option_items ||= Pindo::Options::PodOptions.select(:path) end |
.options ⇒ Object
48 49 50 |
# File 'lib/pindo/command/ios/podlint.rb', line 48 def self. option_items.map(&:to_claide_option).concat(super) end |
Instance Method Details
#podspecs_to_lint ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/pindo/command/ios/podlint.rb', line 127 def podspecs_to_lint if !@podspecs_paths.empty? Array(@podspecs_paths) else podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.json,}') if podspecs.count.zero? raise Informative, 'Unable to find a podspec in the working ' \ 'directory' end podspecs end end |
#run ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/pindo/command/ios/podlint.rb', line 67 def run working_dir = @project_dir podspecs = [] if @pod_spec_file && (@pod_spec_file.to_s.end_with?('.podspec') || @pod_spec_file.to_s.end_with?('.json')) podspecs = [@pod_spec_file] else podspecs = Pathname.glob(File.join(working_dir, '*.podspec{.json,}')) end if podspecs.count.zero? raise Informative, '工作目录下没有任何podspec文件' end pod_array = pindo_single_config.pod_repo_dict pod_index_url = nil if !pod_array.nil? pod_index_url = pod_array['podindex'] else raise Informative, '私有Pod索引地址未知!!' end sources = Pod::Config.instance.sources_manager.all public_source = sources.select { |s| s.is_a?(Pod::CDNSource) }.first if public_source.nil? public_source = sources.select { |s| s.git? && s.url.to_s.include?("CocoaPods/Specs.git") }.first end if public_source.nil? raise Informative, '公有Pod地址未知,请pod install安装pod库' end private_source = sources.select { |s| s.git? && s.url.to_s.eql?(pod_index_url)}.first if private_source.nil? raise Informative, "私有Pod索引地址未知!" end command_array = [] puts "即将执行下列命令:" podspecs.each do |podspec| command = "pod lib lint #{podspec} --sources=#{private_source.url},#{public_source.url} --allow-warnings --use-libraries --use-modular-headers --no-clean --fail-fast --verbose" puts puts command puts command_array << command end answer = agree("是否运行以上命令(Y/n):") unless answer raise Informative, "停止运行!!!" end command_array.each do |command| puts "正在运行命令:" puts puts command system command end end |
#validate! ⇒ Object
62 63 64 65 |
# File 'lib/pindo/command/ios/podlint.rb', line 62 def validate! super @project_dir=Dir.pwd if @project_dir.nil? || @project_dir.empty? end |