diff options
Diffstat (limited to 'set_main_lang.pl')
| -rw-r--r-- | set_main_lang.pl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/set_main_lang.pl b/set_main_lang.pl new file mode 100644 index 0000000..5c3d153 --- /dev/null +++ b/set_main_lang.pl @@ -0,0 +1,25 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use YAML::Syck; +use lib ('lib'); +use githubexplorer; + +my $conf = LoadFile(shift); + +my $gh = githubexplorer->new( + api_token => $ENV{'GITHUB_APIKEY'}, + api_login => $ENV{'GITHUB_LOGIN'}, + connect_info => $conf->{connect_info}, +); + +$gh->_connect unless $gh->has_schema; +#my $graph = githubexplorer::Gexf->new( schema => $gh->schema ); + +my $repositories = $gh->schema->resultset('Repositories')->search(); +while (my $repos = $repositories->next) { + my $language = $gh->schema->resultset('RepoLang') ->search( { repository => $repos->id }, { order_by => 'size' } )->first; + if ($language) { + $repos->update({main_language => $language->language->name}); + } +} |
