Class: Dependency::ExcelGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-dependency-graph/generator/excel_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#workbookObject

Returns the value of attribute workbook.



5
6
7
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 5

def workbook
  @workbook
end

#worksheetObject

Returns the value of attribute worksheet.



6
7
8
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 6

def worksheet
  @worksheet
end

Instance Method Details

#close_excelObject



35
36
37
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 35

def close_excel 
  @workbook.close
end

#create_content(specs) ⇒ Object

Parameters:

  • specs (Array<Specification>)

    a list specification



29
30
31
32
33
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 29

def create_content(specs) 
  specs.each { | spec | 
    create_row(spec)
  } 
end

#create_excelObject



8
9
10
11
12
13
14
15
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 8

def create_excel
  filename = 'cocoapods_dependency_list.xlsx' 
  File.delete(filename) if File.file?(filename)

  @workbook = FastExcel.open(filename, constant_memory: true)
  @worksheet = workbook.add_worksheet("cocoapods-dependency-list")
  @worksheet.auto_width = true
end

#create_row(spec) ⇒ Object



21
22
23
24
25
26
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 21

def create_row(spec) 
  return unless spec.source
  local = spec.local? if spec.source
  summary = spec.root.attributes_hash['summary']
  worksheet << [spec.module_name, local, spec.source, spec.version, spec.homepage, summary]
end

#create_titleObject



17
18
19
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 17

def create_title()
  @worksheet.append_row(["module name", "local", "source", "version", "homepage", "summary"], @workbook.bold_format)
end

#generate(umbrella_target, module_spec_hash) ⇒ Object

Parameters:

  • umbrella_target (UmbrellaTargetDescription)

    the CocoaPods umbrella targets generated by the installer.

  • module_spec_hash (Hash{<String, Specification>})


42
43
44
45
46
47
# File 'lib/cocoapods-dependency-graph/generator/excel_generator.rb', line 42

def generate(umbrella_target, module_spec_hash)
  create_excel
  create_title
  create_content(umbrella_target.specs)
  close_excel
end