Method: AppPermissionStatistics::Analyzer#generate

Defined in:
lib/app_permission_statistics/analyze.rb

#generate(capabilities_diff) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/app_permission_statistics/analyze.rb', line 55

def generate(capabilities_diff)
    return unless @versions.length > 1
    cur_version = @versions[0]
    pre_version = @versions[1]
    output = ""
    output += "\n" + capabilities_diff unless capabilities_diff.empty?
    output += "\n\nThere is no difference between the two versions  【 #{@versions[0]} vs #{@versions[1]}】\n\n" unless !capabilities_diff.empty?
    puts output
    output += "\n\n\n#{cur_version} entitlements list: "
    output += "\n" + read_each_line(cur_version)
    output += "\n" + "----------------------------------------"
    output += "\n\n#{pre_version} entitlements list: "
    output += "\n" + read_each_line(pre_version)

    report_path = report_file_name(path: @report_path)
    File.open(report_path, 'w') { |file|
        file.write(output)
    }
    puts "detail file: #{File.expand_path(report_path)}"
    report_path
end