Class: Xcodeproj::ModuleItem

Inherits:
Object
  • Object
show all
Defined in:
lib/core_blur/check/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_name) ⇒ ModuleItem

Returns a new instance of ModuleItem.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/core_blur/check/item.rb', line 29

def initialize(module_name)
  @module_name = module_name
  @module_path = nil
  @podspec_path = nil
  @header_files = {}
  @source_files = {}
  @import_items = []
  @absolute_import_items = []
  @is_development_module = false
  @frameworks = []
end

Instance Attribute Details

#absolute_import_itemsObject

Returns the value of attribute absolute_import_items.



27
28
29
# File 'lib/core_blur/check/item.rb', line 27

def absolute_import_items
  @absolute_import_items
end

#frameworksObject

Returns the value of attribute frameworks.



28
29
30
# File 'lib/core_blur/check/item.rb', line 28

def frameworks
  @frameworks
end

#header_filesObject

Returns the value of attribute header_files.



23
24
25
# File 'lib/core_blur/check/item.rb', line 23

def header_files
  @header_files
end

#import_itemsObject

Returns the value of attribute import_items.



26
27
28
# File 'lib/core_blur/check/item.rb', line 26

def import_items
  @import_items
end

#is_development_moduleObject

Returns the value of attribute is_development_module.



25
26
27
# File 'lib/core_blur/check/item.rb', line 25

def is_development_module
  @is_development_module
end

#module_nameObject

Returns the value of attribute module_name.



20
21
22
# File 'lib/core_blur/check/item.rb', line 20

def module_name
  @module_name
end

#module_pathObject

Returns the value of attribute module_path.



21
22
23
# File 'lib/core_blur/check/item.rb', line 21

def module_path
  @module_path
end

#podspec_pathObject

Returns the value of attribute podspec_path.



22
23
24
# File 'lib/core_blur/check/item.rb', line 22

def podspec_path
  @podspec_path
end

#source_filesObject

Returns the value of attribute source_files.



24
25
26
# File 'lib/core_blur/check/item.rb', line 24

def source_files
  @source_files
end

Instance Method Details

#init_absolute_import_infoObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/core_blur/check/item.rb', line 40

def init_absolute_import_info
  source_files.each_value do |source_file_path|
    if File.directory?(source_file_path)
      next
    end
    line_array = IO.readlines(source_file_path)
    line_array.each_with_index { |line, line_index|
      line = line.gsub(" ", "")
      if line.start_with?("#import\"NBSAppAgent.h\"")
        line = "#import<tingyunApp/NBSAppAgent.h>"
      end
      if not line.start_with?("#import<") and not line.start_with?("#include<")
        next
      end
      if line.start_with?("@implementation")
        break
      end
      pre_line = ""
      import_item = other_module_import(line, source_file_path, line_index, @module_name, pre_line)
      if import_item
        absolute_import_items << import_item
      end
    }
  end
  absolute_import_items
end

#init_import_infoObject



66
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
# File 'lib/core_blur/check/item.rb', line 66

def init_import_info
  source_files.each_value do |source_file_path|
    if File.directory?(source_file_path)
      next
    end
    line_array = IO.readlines(source_file_path)
    line_array.each_with_index { |line, line_index|
      line = line.gsub(" ", "")
      unless line.start_with?("#import")
        next
      end
      if line.start_with?("@implementation")
        break
      end
      pre_index = line_index-1 < 0 ? 0 : line_index-1
      pre_line = line_array[pre_index]
      if line.start_with?("#import\"") #本组件
        import_item = own_module_import(line, source_file_path, line_index, @module_name, pre_line)
        if import_item
          import_items << import_item
        end
      elsif line.start_with?("#import<") #其他组件
      end
    }
  end
  import_items
end