Class: Pod::Command::Util::Source
- Inherits:
-
Pod::Command::Util
- Object
- Pod::Command
- Pod::Command::Util
- Pod::Command::Util::Source
- Defined in:
- lib/cocoapods-util/command/libsource/source.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Source
constructor
A new instance of Source.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Source
Returns a new instance of Source.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cocoapods-util/command/libsource/source.rb', line 29 def initialize(argv) link = argv.flag?('link') @link_type = if argv.flag?('link') :link elsif argv.flag?('unlink') :unlink elsif argv.flag?('checklinked') :checklinked elsif argv.flag?('checkcompile') :checkcompile else :link end @file_path = argv.shift_argument @force = argv.flag?('force') @source_path = argv.option('source-path', nil) @compile_path = argv.option('compile-path', nil) super end |
Class Method Details
.options ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cocoapods-util/command/libsource/source.rb', line 16 def self. [ ['--link', '链接源码'], ['--unlink', '删除源码链接'], ['--checklinked', '检查源码链接'], ['--checkcompile', '输出二进制文件的编译信息,编译的工程路径,编译的源码路径等'], ['--force', 'link时覆盖已经添加的软链接'], ['--source-path', '需要链接的源码的路径'], ['--compile-path', '特殊情况获取的编译路径和真实源码编译的路径可能不一致,可自定义设置编译路径'] ] end |
Instance Method Details
#run ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cocoapods-util/command/libsource/source.rb', line 55 def run # 获取真实路径,~ 为进程所有者的主目录 @file_path = File.(@file_path) if (File.exist? @file_path) == false || !(@file_path =~ /\.(a|framework|xcframework)$/) help! "路径不存在或传入的路径不是.a、.framework、.xcframework文件" return end source_dir, basename = File.split(@file_path) file_name, file_type = basename.split('.') linker = SourceLinker.new( file_name, file_type, source_dir, @link_type, @force ) linker.allow_ask_source_path = true linker.source_path = @source_path linker.compile_path = @compile_path linker.execute end |
#validate! ⇒ Object
50 51 52 53 |
# File 'lib/cocoapods-util/command/libsource/source.rb', line 50 def validate! super help! '必须传入需链接的library、framework或xcframework路径或名称.' unless @file_path end |