| 88 | } |
| 89 | |
| 90 | func parseStats(statsJson string) (org.OrgStats, []InstallationInfo, error) { |
| 91 | var stats org.OrgStats |
| 92 | |
| 93 | jsonFile, err := os.Open(statsJson) |
| 94 | defer jsonFile.Close() |
| 95 | if err != nil { |
| 96 | return stats, nil, err |
| 97 | } |
| 98 | jsonBytes, err := ioutil.ReadAll(jsonFile) |
| 99 | if err != nil { |
| 100 | return stats, nil, err |
| 101 | } |
| 102 | json.Unmarshal(jsonBytes, &stats) |
| 103 | |
| 104 | var wrappedInstallations []InstallationInfo |
| 105 | for _, i := range stats.Installations { |
| 106 | perm := strings.Split(github.Stringify(i.Permissions), "{") |
| 107 | description := strings.Split(strings.Split(perm[1], "}")[0], ", ") |
| 108 | sort.Strings(description) |
| 109 | finalPerm := strings.Join(description, ", ") |
| 110 | wrappedInstallations = append(wrappedInstallations, |
| 111 | InstallationInfo{ |
| 112 | ID: *i.ID, |
| 113 | Name: *i.AppSlug, |
| 114 | Permissions: finalPerm, |
| 115 | }) |
| 116 | } |
| 117 | return stats, wrappedInstallations, nil |
| 118 | } |
| 119 | |
| 120 | func parseOauthApps(appJson string) ([]WrappedOAuthApp, error) { |
| 121 | var apps []scrape.OAuthApp |