Class: SourceLinker

Inherits:
Object
  • Object
show all
Includes:
Pod
Defined in:
lib/cocoapods-util/command/libsource/source_linker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name, file_type, source_dir, link_type, force_link) ⇒ SourceLinker

Returns a new instance of SourceLinker.



7
8
9
10
11
12
13
14
15
16
# File 'lib/cocoapods-util/command/libsource/source_linker.rb', line 7

def initialize(file_name, file_type, source_dir, link_type, force_link)
    # 允许询问源码路径,默认为false
    @allow_ask_source_path = false
    @link_type = link_type

    @file_name = file_name.gsub(/^lib/, '')
    @file_type = file_type
    @source_dir = source_dir
    @force_link = force_link
end

Instance Attribute Details

#allow_ask_source_pathObject

Returns the value of attribute allow_ask_source_path.



5
6
7
# File 'lib/cocoapods-util/command/libsource/source_linker.rb', line 5

def allow_ask_source_path
  @allow_ask_source_path
end

#compile_pathObject

Returns the value of attribute compile_path.



5
6
7
# File 'lib/cocoapods-util/command/libsource/source_linker.rb', line 5

def compile_path
  @compile_path
end

#source_pathObject

Returns the value of attribute source_path.



5
6
7
# File 'lib/cocoapods-util/command/libsource/source_linker.rb', line 5

def source_path
  @source_path
end

Instance Method Details

#executeObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cocoapods-util/command/libsource/source_linker.rb', line 18

def execute
    compile_dir_path = if @compile_path
                            @compile_path
                        else
                            check_compile(get_libfile_path)
                        end
    if compile_dir_path.nil? || compile_dir_path.empty?
        UI.puts "没有获取到可执行文件的编译路径,链接结束。"
        return
    end

    case @link_type
    when :link
        add_link(compile_dir_path)
    when :unlink
        remove_link(compile_dir_path)
    when :checkcompile
        user_check_compile
    else
        linked_path = get_linked_path(compile_dir_path)
        check_linked(get_libfile_path, linked_path)
    end
end

#islinked(compile_dir_path) ⇒ Object



42
43
44
# File 'lib/cocoapods-util/command/libsource/source_linker.rb', line 42

def islinked(compile_dir_path)

end