├── GitHub ├── Login.cls.xml ├── OrganizationPage.cls.xml ├── RepositoryPage.cls.xml ├── OrganizationLoader.cls.xml ├── RepositoriesLoader.cls.xml ├── RepositoryDetailsLoader.cls.xml ├── Task.cls.xml ├── Commit.cls.xml ├── Parser.cls.xml ├── Contributor.cls.xml ├── Organization.cls.xml ├── API.cls.xml ├── Repository.cls.xml ├── Loader.cls.xml ├── ActivityData.cls.xml └── Updater.cls.xml ├── History ├── Commits.cls.xml ├── Repositories.cls.xml ├── Clones.cls.xml ├── Contributors.cls.xml └── Views.cls.xml ├── sc-list.txt ├── README.md ├── LICENSE └── SSL └── Configuration.cls.xml /GitHub/Login.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /History/Commits.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GitHub/OrganizationPage.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GitHub/RepositoryPage.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GitHub/OrganizationLoader.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GitHub/RepositoriesLoader.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GitHub/RepositoryDetailsLoader.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /sc-list.txt: -------------------------------------------------------------------------------- 1 | GitHub.ActivityData.cls 2 | GitHub.API.cls 3 | GitHub.Commit.cls 4 | GitHub.Contributor.cls 5 | GitHub.Loader.cls 6 | GitHub.Login.cls 7 | GitHub.Organization.cls 8 | GitHub.OrganizationLoader.cls 9 | GitHub.OrganizationPage.cls 10 | GitHub.Parser.cls 11 | GitHub.RepositoriesLoader.cls 12 | GitHub.Repository.cls 13 | GitHub.RepositoryDetailsLoader.cls 14 | GitHub.RepositoryPage.cls 15 | GitHub.Task.cls 16 | GitHub.Updater.cls 17 | History.Clones.cls 18 | History.Commits.cls 19 | History.Contributors.cls 20 | History.Repositories.cls 21 | History.Views.cls 22 | SSL.Configuration.cls 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # github-analytics 2 | Repository activities monitoring in DeepSee 3 | 4 | ## Installation 5 | 6 | To install it 7 | + Download repository files(eg by cloning) 8 | + Create namespace(eg GitHubNS) 9 | + And import all files in crated namespace 10 | 11 | ## Usage 12 | 1.At first launch execute in namespace (that you created for this repository classes, eg GitHubNS) line below 13 | 14 | write ##class(GitHub.Task).LoadAll(organizationName, login, password) 15 | 16 | Where 17 | + organizationName takes from organization's github url(eg for [Intersystems corp. Russia](https://github.com/intersystems-ru) url is https://github.com/intersystems-ru and organizationName = "intersystems-ru") 18 | + login - your login on Github.com 19 | + password - your password on Github.com 20 | 21 | It need login and password for getting data of views and clones of repositories(where you can push) 22 | 23 | 2.Every next launch execute next line 24 | 25 | write ##class(GitHub.Task).UpdateAll(organizationName, login, password) 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 InterSystems Corp. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /SSL/Configuration.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %RegisteredObject 5 | 63909,4410.532062 6 | 7 | 8 | 9 | Check or create default ssl config 10 | 1 11 | config="github.com" 12 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /GitHub/Task.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %RegisteredObject 5 | 63920,67167.435712 6 | 7 | 8 | 1 9 | organization="intersystems-ru",login,password,verbose:%Boolean=1 10 | %Status 11 | 21 | 22 | 23 | 24 | 1 25 | organization="intersystems-ru",login,password,verbose:%Boolean=1 26 | %Status 27 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /History/Repositories.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %Persistent 5 | 63930,85855.479086 6 | 7 | 8 | GitHub.Organization 9 | one 10 | HistoryRepositories 11 | 1 12 | 1 13 | cascade 14 | 15 | 16 | 17 | %String 18 | 19 | 20 | 21 | %String 22 | 23 | 24 | 25 | 26 | %Boolean 27 | 28 | 29 | 30 | %TimeStamp 31 | DateOfData 32 | 33 | 34 | 35 | 1 36 | name:%String,link:%String,organizationId,new:%Boolean 37 | %Status 38 | 55 | 56 | 57 | 58 | %Library.CacheStorage 59 | ^History.RepositoriesD 60 | RepositoriesDefaultData 61 | ^History.RepositoriesD 62 | ^History.RepositoriesI 63 | ^History.RepositoriesS 64 | 65 | 66 | %%CLASSNAME 67 | 68 | 69 | Organization 70 | 71 | 72 | Name 73 | 74 | 75 | Link 76 | 77 | 78 | New 79 | 80 | 81 | Date 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /GitHub/Commit.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CommitTable 5 | %Persistent 6 | 63915,20730.548027 7 | 8 | 9 | GitHub.Repository 10 | one 11 | Commits 12 | 1 13 | 1 14 | cascade 15 | 16 | 17 | 18 | GitHub.Contributor 19 | one 20 | Commits 21 | 1 22 | 1 23 | cascade 24 | 25 | 26 | 27 | %String 28 | 29 | 30 | 31 | 32 | 33 | %String 34 | 35 | 36 | 37 | 38 | %TimeStamp 39 | 40 | 41 | 42 | 1 43 | 44 | %Status 45 | 57 | 58 | 59 | 60 | %Library.CacheStorage 61 | ^GitHub.CommitD 62 | CommitDefaultData 63 | ^GitHub.CommitD 64 | ^GitHub.CommitI 65 | ^GitHub.CommitS 66 | 67 | listnode 68 | 69 | 70 | %%CLASSNAME 71 | 72 | 73 | Repository 74 | 75 | 76 | Author 77 | 78 | 79 | Message 80 | 81 | 82 | Link 83 | 84 | 85 | Created 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /History/Clones.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %Persistent 5 | 63914,348.832704 6 | 7 | 8 | GitHub.Repository 9 | one 10 | HistoryClones 11 | 1 12 | 1 13 | cascade 14 | 15 | 16 | 17 | %Integer 18 | 19 | 20 | 21 | %TimeStamp 22 | DateOfData 23 | 24 | 25 | 26 | 1 27 | 28 | %Status 29 | start 34 | //86400 - senonds in 24 hours 35 | set num = 1 36 | while $data(data(num,("Date"))){ 37 | if ((start+data(num,"Date"))\secondsPerDay)>(+$horolog){ 38 | set num = num + 1 39 | Continue 40 | } 41 | set dateInternal = $zdt((start+data(num,"Date"))\secondsPerDay,3) 42 | set amount = data(num,"Unique") 43 | &sql(Insert Into History.Clones (Repository, Amount, DateOfData) 44 | Values (:data("RepositoryId"), :amount, :dateInternal)) 45 | set sc = sc!SQLCODE 46 | Quit:SQLCODE 47 | set num = num + 1 48 | } 49 | kill data 50 | Quit sc 51 | ]]> 52 | 53 | 54 | 55 | 1 56 | id,total 57 | 63 | 64 | 65 | 66 | %Library.CacheStorage 67 | ^History.ClonesD 68 | ClonesDefaultData 69 | ^History.ClonesD 70 | ^History.ClonesI 71 | ^History.ClonesS 72 | 73 | 74 | %%CLASSNAME 75 | 76 | 77 | Repository 78 | 79 | 80 | Amount 81 | 82 | 83 | Date 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /History/Contributors.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %Persistent 5 | 63923,47202.067647 6 | 7 | 8 | GitHub.Organization 9 | one 10 | HistoryContributors 11 | 1 12 | 1 13 | cascade 14 | 15 | 16 | 17 | %String 18 | 19 | 20 | 21 | %String 22 | 23 | 24 | 25 | 26 | %Boolean 27 | 28 | 29 | 30 | %TimeStamp 31 | DateOfData 32 | 33 | 34 | 35 | 1 36 | login:%String,link:%String,organizationId,new:%Boolean 37 | %Status 38 | 55 | 56 | 57 | 58 | %Library.CacheStorage 59 | ^History.ContributorsD 60 | ContributorsDefaultData 61 | ^History.ContributorsD 62 | ^History.ContributorsI 63 | ^History.ContributorsS 64 | 65 | 66 | %%CLASSNAME 67 | 68 | 69 | Organization 70 | 71 | 72 | Amount 73 | 74 | 75 | Date 76 | 77 | 78 | Login 79 | 80 | 81 | Link 82 | 83 | 84 | New 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /History/Views.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %Persistent 5 | 63913,83016.197951 6 | 7 | 8 | GitHub.Repository 9 | one 10 | HistoryViews 11 | 1 12 | 1 13 | cascade 14 | 15 | 16 | 17 | %Integer 18 | 19 | 20 | 21 | %Integer 22 | 23 | 24 | 25 | %TimeStamp 26 | DateOfData 27 | 28 | 29 | 30 | 1 31 | 32 | %Status 33 | start 38 | //86400 - senonds in 24 hours 39 | set num = 1 40 | while $data(data(num,"Date")){ 41 | if ((start+data(num,"Date"))\secondsPerDay)>(+$horolog){ 42 | set num = num + 1 43 | Continue 44 | } 45 | set dateInternal = $zdt((start+data(num,"Date"))\secondsPerDay,3) 46 | set amount = data(num,"Total") 47 | set unique = data(num,"Unique") 48 | &sql(Insert Into History.Views (Repository, Amount, UniqueVisitors, DateOfData) 49 | Values (:data("RepositoryId"), :amount, :unique, :dateInternal)) 50 | set sc = sc!SQLCODE 51 | Quit:SQLCODE 52 | set num = num + 1 53 | } 54 | kill data 55 | Quit sc 56 | ]]> 57 | 58 | 59 | 60 | 1 61 | id,total,unique 62 | 68 | 69 | 70 | 71 | %Library.CacheStorage 72 | ^History.ViewsD 73 | ViewsDefaultData 74 | ^History.ViewsD 75 | ^History.ViewsI 76 | ^History.ViewsS 77 | 78 | 79 | %%CLASSNAME 80 | 81 | 82 | Repository 83 | 84 | 85 | Amount 86 | 87 | 88 | UniqueVisitors 89 | 90 | 91 | Date 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /GitHub/Parser.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %RegisteredObject 5 | 63916,39510.739472 6 | 7 | 8 | 1 9 | 10 | %Status 11 | 18 | 19 | 20 | 21 | 1 22 | 23 | %Status 24 | 33 | 34 | 35 | 36 | 1 37 | 38 | %Status 39 | 59 | 60 | 61 | 62 | 1 63 | externalDate:%String 64 | %TimeStamp 65 | WC" ) ;2015-12-19 70 | set time = $piece( tmpDate,"T",2), time = $zstrip(time, "<>WC" ) ;21:59:35 71 | 72 | set dateh = $zdh( date, 3) 73 | set timeh = $zth( time ) 74 | 75 | #; Making Moscow timezone, eg adding 3 hours 76 | if timeh >= 75600{ ;if time more than 21:00:00 77 | set timeh = timeh - 75600 ;minus 21 hours 78 | set dateh = dateh + 1} 79 | else{ ;if time fewer than 21:00:00 80 | set timeh = timeh + 10800 ;plus 3 hours 81 | } 82 | set internalDate = $zdt( dateh_","_timeh, 3 ) ;odbc timestamp 83 | Quit internalDate 84 | ]]> 85 | 86 | 87 | 88 | 1 89 | 90 | %Status 91 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /GitHub/Contributor.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %Persistent 5 | 63915,38243.903748 6 | 7 | 8 | %String 9 | 1 10 | 11 | 12 | 13 | Name 14 | 1 15 | 16 | 17 | 18 | %String 19 | 20 | 21 | 22 | %String 23 | 24 | 25 | 26 | 27 | %TimeStamp 28 | 29 | 30 | 31 | GitHub.Commit 32 | many 33 | Author 34 | 1 35 | 36 | 37 | 38 | GitHub.Organization 39 | one 40 | Contributors 41 | 1 42 | cascade 43 | 44 | 45 | 46 | 1 47 | 48 | %Status 49 | 84 | 85 | 86 | 87 | 1 88 | 89 | %Status 90 | 103 | 104 | 105 | 106 | 1 107 | 108 | %Status 109 | 118 | 119 | 120 | 121 | %Library.CacheStorage 122 | ^GitHub.ContributorD 123 | ContributorDefaultData 124 | ^GitHub.ContributorD 125 | ^GitHub.ContributorI 126 | ^GitHub.ContributorS 127 | 128 | 129 | %%CLASSNAME 130 | 131 | 132 | Name 133 | 134 | 135 | eMail 136 | 137 | 138 | Link 139 | 140 | 141 | Member 142 | 143 | 144 | Existed 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /GitHub/Organization.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | This class contain information about organization of repositories 6 | %Persistent 7 | 63909,2427.981117 8 | 9 | 10 | %String 11 | 1 12 | 13 | 14 | 15 | Name 16 | 1 17 | 18 | 19 | 20 | %String 21 | 22 | 23 | 24 | %String 25 | 26 | 27 | 28 | %String 29 | 30 | 31 | 32 | %String 33 | 34 | 35 | 36 | 37 | %Integer 38 | 1 39 | set {*} = ##class(GitHub.Organization).GetRepositoriesAmount({Name}) 40 | 1 41 | 42 | 43 | 44 | 1 45 | name 46 | %Integer 47 | Name = ? " 49 | set rs = ##class(%SQL.Statement).%ExecDirect(,sql, name) 50 | if rs.%Next() {set result = rs.ReposAmount} 51 | Quit result 52 | ]]> 53 | 54 | 55 | 56 | GitHub.Contributor 57 | many 58 | Member 59 | 1 60 | 61 | 62 | 63 | 64 | organization's repositories collection 65 | GitHub.Repository 66 | many 67 | Organization 68 | 1 69 | 70 | 71 | 72 | History.Contributors 73 | many 74 | Organization 75 | 1 76 | 77 | 78 | 79 | History.Repositories 80 | many 81 | Organization 82 | 1 83 | 84 | 85 | 86 | %Integer 87 | 1 88 | set {*} = ##class(GitHub.Organization).GetPeople({Name}) 89 | 1 90 | 91 | 92 | 93 | 1 94 | name 95 | %Integer 96 | Name = ? " 98 | set rs = ##class(%SQL.Statement).%ExecDirect(,sql, name) 99 | if rs.%Next() {set result = rs.People} 100 | Quit result 101 | ]]> 102 | 103 | 104 | 105 | 106 | url 107 | %String 108 | 1 109 | set {*} = ##class(GitHub.Organization).GetLink({Name}) 110 | 1 111 | 112 | 113 | 114 | 1 115 | expression 116 | name 117 | 119 | 120 | 121 | 122 | 1 123 | 124 | %Status 125 | 136 | 137 | 138 | 139 | %Library.CacheStorage 140 | ^GitHub.OrganizationD 141 | OrganizationDefaultData 142 | ^GitHub.OrganizationD 143 | ^GitHub.OrganizationI 144 | ^GitHub.OrganizationS 145 | 146 | 147 | %%CLASSNAME 148 | 149 | 150 | Name 151 | 152 | 153 | FullName 154 | 155 | 156 | eMail 157 | 158 | 159 | OrgLink 160 | 161 | 162 | Description 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /GitHub/API.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | %RegisteredObject 6 | 63915,22620.787602 7 | 8 | 9 | %Net.HttpRequest 10 | 11 | 12 | 13 | 1 14 | login:%String,password:%String,verbose:%Boolean 15 | GitHub.API 16 | 36 | 37 | 38 | 39 | 1 40 | expression 41 | organizationName:%String 42 | 44 | 45 | 46 | 47 | 1 48 | expression 49 | organizationName:%String 50 | 52 | 53 | 54 | 55 | 1 56 | expression 57 | organizationName:%String 58 | 60 | 61 | 62 | 63 | 1 64 | expression 65 | organizationName:%String,repositoryName:%String 66 | 68 | 69 | 70 | 71 | 72 | %Status 73 | 84 | 85 | 86 | 87 | 88 | 1.set APIRequest.request.Location = "/orgs/"_organization 89 | Extract properties of Class Organization, all but People property 90 | 91 | %Status 92 | 99 | 100 | 101 | 102 | 103 | 2.set APIRequest.request.Location = "/orgs/"_organization_"/members" 104 | Properties of Class Contributor, all but eMail property 105 | Amount of people - Property People of Class Organization 106 | 107 | %Status 108 | 115 | 116 | 117 | 118 | 119 | 3.set APIRequest.request.Location = "/orgs/"_organization_"/repos" 120 | Properties of Class Repository, all but CommitsAmount, Contributors, Watchers 121 | 122 | %Status 123 | 130 | 131 | 132 | 133 | 134 | 4.set APIRequest.request.Location = "/repos/"_organization_"/"_repository_"/commits" 135 | Propery CommitsAmount of Class Repository 136 | Properties of Class Commit, all 137 | Properties of Class Contributor, all but Membership property 138 | 139 | %Status 140 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /GitHub/Repository.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | This class contain information about repositories 6 | %Persistent 7 | 63909,2460.601555 8 | 9 | 10 | %String 11 | 1 12 | 13 | 14 | 15 | Name 16 | 1 17 | 18 | 19 | 20 | GitHub.Commit 21 | many 22 | Repository 23 | 1 24 | 25 | 26 | 27 | History.Views 28 | many 29 | Repository 30 | 1 31 | 32 | 33 | 34 | History.Clones 35 | many 36 | Repository 37 | 1 38 | 39 | 40 | 41 | GitHub.Organization 42 | one 43 | Repositories 44 | 1 45 | 1 46 | cascade 47 | 48 | 49 | 50 | %Integer 51 | 52 | 53 | 54 | %Integer 55 | 56 | 57 | 58 | %String 59 | 60 | 61 | 62 | 63 | %Integer 64 | 65 | 66 | 67 | %String 68 | 69 | 70 | 71 | 72 | 73 | %TimeStamp 74 | 75 | 76 | 77 | %TimeStamp 78 | 79 | 80 | 81 | %TimeStamp 82 | 83 | 84 | 85 | %Integer 86 | 1 87 | set {*} = ##class(GitHub.Repository).GetCommitsAmount({Name}) 88 | 1 89 | 90 | 91 | 92 | 1 93 | name 94 | %Integer 95 | Name = ? " 97 | set rs = ##class(%SQL.Statement).%ExecDirect(,sql, name) 98 | if rs.%Next() {set result = rs.CommitsAmount} 99 | Quit result 100 | ]]> 101 | 102 | 103 | 104 | 1 105 | 106 | %Status 107 | 134 | 135 | 136 | 137 | 1 138 | 139 | %Status 140 | 158 | 159 | 160 | 161 | 162 | Created,Forks,IssuesOpened,Pushed,Updated,Stars 163 | 1 164 | 165 | %Status 166 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /GitHub/Loader.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GitHub.API 5 | 63916,39482.538124 6 | 7 | 8 | 1 9 | organizationName="intersystems-ru",login:%String="",password:%String="",verbose:%Boolean=1 10 | %Status 11 | Name = ? " 38 | set rs = ##class(%SQL.Statement).%ExecDirect(,sql, organizationName) 39 | while rs.%Next() { 40 | set repository("Name") = rs.Name, repository("Id") = rs.Id 41 | 42 | write:verbose !,numberOfRepository_"." 43 | set numberOfRepository = numberOfRepository + 1 44 | 45 | set sc = APIRequest.LoadRepoCommits(organizationName,.repository, verbose) Quit:'sc 46 | 47 | #; Views 48 | set sc = activityRequest.GetActivityData("/graphs/traffic-data", organizationName, repository("Name"), .objectZen) 49 | if sc = "html"{ 50 | write:verbose !, "Have no access to history of views and clones data",! 51 | set sc = 1 52 | Continue 53 | } 54 | else{ 55 | set sc = ##class(GitHub.ActivityData).ParseHistory(.views, objectZen) Quit:'sc 56 | 57 | set sc = ##class(GitHub.ActivityData).SetViewsHistory(.views,.repository,verbose) Quit:'sc 58 | } 59 | 60 | #; Clones 61 | set sc = activityRequest.GetActivityData("/graphs/clone-activity-data", organizationName, repository("Name"), .objectZen) Quit:'sc 62 | 63 | set sc = ##class(GitHub.ActivityData).ParseHistory(.clones, objectZen) Quit:'sc 64 | 65 | set sc = ##class(GitHub.ActivityData).SetClonesHistory(.clones,.repository,verbose) Quit:'sc 66 | } 67 | Quit sc 68 | ]]> 69 | 70 | 71 | 72 | 1 73 | organizationId 74 | 81 | 82 | 83 | 84 | 85 | %Status 86 | 97 | 98 | 99 | 100 | organizationName:%String,organizationId,verbose:%Boolean 101 | %Status 102 | count Quit ;#Count of Member objects on this page reduced, it means that next page will be empty 117 | set countPrevious = count, page = page + 1 118 | } 119 | 120 | Quit sc 121 | ]]> 122 | 123 | 124 | 125 | organizationName:%String,organizationId,verbose:%Boolean 126 | %Status 127 | count Quit ;#Count of Repos objects on this page reduced, it means that next page will be empty 142 | set countPrevious = count, page = page + 1 143 | } 144 | Quit sc 145 | ]]> 146 | 147 | 148 | 149 | 150 | %Status 151 | count Quit ;#Count of Repos objects on this page reduced, it means that next page will be empty 169 | set countPrevious = count , page = page + 1 170 | } 171 | Quit sc 172 | ]]> 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /GitHub/ActivityData.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %RegisteredObject 5 | 63916,69358.6097 6 | 7 | 8 | %Net.HttpRequest 9 | 10 | 11 | 12 | 1 13 | login="",password="",verbose:%Boolean 14 | GitHub.ActivityData 15 | 45 | 46 | 47 | 48 | -->
53 |
]]> 55 | 1 56 | html 57 | %String 58 | " ) 61 | set sc = html.MoveTo( begin ) 62 | set length = end - begin 63 | set authTokenHtml = html.Read( .length ) 64 | 65 | set authToken = $piece( authTokenHtml, "value=""", 2 ) 66 | set authToken = $piece( authToken, """") 67 | Quit authToken 68 | ]]> 69 | 70 | 71 | 72 | 73 | %Status 74 | 83 | 84 | 85 | 86 | 1 87 | 88 | %Status 89 | 97 | 98 | 99 | 100 | 1 101 | 102 | %Status 103 | 124 | 125 | 126 | 127 | 1 128 | 129 | %Status 130 | 137 | 138 | 139 | 140 | 1 141 | 142 | %Status 143 | 164 | 165 | 166 | 167 | 1 168 | 169 | %Status 170 | 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /GitHub/Updater.cls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GitHub.API 5 | 63917,41694.9819 6 | 7 | 8 | 1 9 | organizationName="intersystems-ru",login:%String="",password:%String="",verbose:%Boolean=1 10 | %Status 11 | Name = ? " 38 | set rs = ##class(%SQL.Statement).%ExecDirect(,sql, organizationName) 39 | while rs.%Next() { 40 | set repository("Name") = rs.Name, repository("Id") = rs.Id 41 | 42 | write:verbose !,numberOfRepository_".Repository "_repository("Name") 43 | set numberOfRepository = numberOfRepository + 1 44 | 45 | 46 | #; Views 47 | set sc = activityRequest.GetActivityData("/graphs/traffic-data", organizationName, repository("Name"), .objectZen) 48 | if sc = "html"{ 49 | write:verbose !, "Have no access to history of views and clones data",! 50 | set sc = 1 51 | Continue 52 | } 53 | else{ 54 | set sc = ##class(GitHub.ActivityData).ParseHistory(.views, objectZen) Quit:'sc 55 | 56 | set sql = "Select Count(Id) As CountOfViews From History.Views Where Repository = ?" 57 | set rsViews = ##class(%SQL.Statement).%ExecDirect(,sql, repository("Id")) 58 | if rsViews.%Next() { 59 | set count = rsViews.CountOfViews 60 | } 61 | if count = 0{set sc = ##class(GitHub.ActivityData).SetViewsHistory(.views,.repository, verbose) Quit:'sc} 62 | else{ 63 | set sc = ##class(GitHub.ActivityData).SetOrIgnoreViewsHistory(.views,.repository, verbose) Quit:'sc 64 | } 65 | } 66 | 67 | #; Clones 68 | set sc = activityRequest.GetActivityData("/graphs/clone-activity-data", organizationName, repository("Name"), .objectZen) Quit:'sc 69 | 70 | set sc = ##class(GitHub.ActivityData).ParseHistory(.clones, objectZen) Quit:'sc 71 | 72 | set sql = "Select Count(Id) As CountOfClones From History.Clones Where Repository = ?" 73 | set rsClones = ##class(%SQL.Statement).%ExecDirect(,sql, repository("Id")) 74 | if rsClones.%Next() { 75 | set count = rsClones.CountOfClones 76 | } 77 | if count = 0{set sc = ##class(GitHub.ActivityData).SetClonesHistory(.clones,.repository, verbose) Quit:'sc} 78 | else{ 79 | set sc = ##class(GitHub.ActivityData).SetOrIgnoreClonesHistory(.clones,.repository, verbose) Quit:'sc 80 | } 81 | } 82 | Quit sc 83 | ]]> 84 | 85 | 86 | 87 | organizationName:%String,organizationId,verbose:%Boolean 88 | %Status 89 | count Quit ;#Count of Member objects on this page reduced, it means that next page will be empty 103 | set countPrevious = count, page = page + 1 104 | } 105 | 106 | Quit sc 107 | ]]> 108 | 109 | 110 | 111 | 112 | %Status 113 | count Quit ;#Count of Repos objects on this page reduced, it means that next page will be empty 139 | set countPrevious = count, page = page + 1 140 | } 141 | Quit sc 142 | ]]> 143 | 144 | 145 | 146 | 147 | %Status 148 | 161 | 162 | 163 | 164 | 165 | %Status 166 | count Quit ;#Count of Repos objects on this page reduced, it means that next page will be empty 184 | set countPrevious = count, page = page + 1 185 | } 186 | Quit sc 187 | ]]> 188 | 189 | 190 | 191 | 192 | %Status 193 | count Quit ;#Count of Repos objects on this page reduced, it means that next page will be empty 226 | set countPrevious = count, page = page + 1 227 | } 228 | Quit sc 229 | ]]> 230 | 231 | 232 | 233 | --------------------------------------------------------------------------------