Class: Pod::Command::Util::Install::List
- Inherits:
-
Pod::Command::Util::Install
- Object
- Pod::Command
- Pod::Command::Util
- Pod::Command::Util::Install
- Pod::Command::Util::Install::List
- Defined in:
- lib/cocoapods-util/command/cocoapods-extend/install/list.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ List
constructor
A new instance of List.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ List
Returns a new instance of List.
19 20 21 22 23 24 25 |
# File 'lib/cocoapods-util/command/cocoapods-extend/install/list.rb', line 19 def initialize(argv) @lockfile_path = argv.shift_argument @name = argv.option('name') @all_componment = argv.flag?('all', true) && (@name.nil? || @name.empty?) @showmore = argv.flag?('showmore', false) || @name super end |
Class Method Details
.options ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cocoapods-util/command/cocoapods-extend/install/list.rb', line 11 def self. [ ['--all', 'list all component.'], ['--name', 'componment name.'], ['--showmore', 'show more information.'] ] end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cocoapods-util/command/cocoapods-extend/install/list.rb', line 31 def run if @lockfile_path.nil? # 新的方式解析依赖,原来的方式是使用正则分析 .lock 的文件 @lockfile = Pod::Config.instance.lockfile help! '你需要在Podfile所在目录执行本命令。' if @lockfile.nil? require_relative 'analysis' PodAnalysis.new(@name, @showmore).run return else @lockfile = Lockfile.from_file(Pathname.new(@lockfile_path)) help! '没有查找到Podfile.lock文件,你需要在Podfile所在目录执行或传入Podfile.lock文件路径。' unless @lockfile end if @all_componment check_all_componment else installed = pod_installed help! "没有找到#{@name}组件的相关信息,请检查输入的组件名称" unless installed.include?(@name) || installed.map do |item| downcase = item.downcase @name = item if @name.downcase == downcase downcase end.include?(@name.downcase) check_componment_with_name(@name) end end |
#validate! ⇒ Object
27 28 29 |
# File 'lib/cocoapods-util/command/cocoapods-extend/install/list.rb', line 27 def validate! super end |