more work on clonedev
This commit is contained in:
parent
e7bc6c74de
commit
e2b6f00d8e
|
@ -11,24 +11,22 @@ lookups:
|
|||
- "users/luca"
|
||||
extra_headers:
|
||||
- "Authorization: token ${TOKEN}"
|
||||
# - name: "github_starred_repos"
|
||||
# api_url: "https://api.github.com"
|
||||
# endpoint: "starred"
|
||||
# url_field: "ssh_url"
|
||||
# token_cmd: "rbw get 'Github' -f 'Clonedev PAT'"
|
||||
# block_unsorted: true
|
||||
# targets:
|
||||
# - "users/ssnailed"
|
||||
# extra_headers:
|
||||
# - "Authorization: Bearer ${TOKEN}"
|
||||
- name: "github_starred_repos"
|
||||
api_url: "https://api.github.com"
|
||||
endpoint: "starred"
|
||||
url_field: "ssh_url"
|
||||
token_cmd: "rbw get 'Github' -f 'Clonedev PAT'"
|
||||
block_unsorted: true
|
||||
targets:
|
||||
- "users/ssnailed"
|
||||
extra_headers:
|
||||
- "Authorization: Bearer ${TOKEN}"
|
||||
# - name: "tralios_gitlab"
|
||||
# api_url: "https://gitlab.tralios.de/api/v4/"
|
||||
# endpoint:
|
||||
# api_url: "https://gitlab.tralios.de/api/v4"
|
||||
# endpoint: "projects"
|
||||
# url_field: "ssh_url_to_repo"
|
||||
# token_cmd: "rbw get 'Gitlab Tralios' -f 'Clonedev PAT'"
|
||||
# block_unsorted: true
|
||||
# targets:
|
||||
# -
|
||||
# extra_headers:
|
||||
# - "Authorization: Bearer ${TOKEN}"
|
||||
|
||||
|
|
|
@ -72,10 +72,12 @@ sub exec_multicurl() {
|
|||
while ($active_requests) {
|
||||
my $active_transfers = $curlm->perform;
|
||||
if ( $active_transfers != $active_requests ) {
|
||||
while ( my ( $handle, $return_value ) = $curlm->info_read ) {
|
||||
while ( my ( $handle, $ret ) = $curlm->info_read ) {
|
||||
if ($handle) {
|
||||
$active_requests--;
|
||||
exec_callbacks($handle);
|
||||
# TODO: proper error checking
|
||||
# $handles[$handle]{curl}->getinfo(CURLINFO_HTTP_CODE);
|
||||
delete $handles[$handle];
|
||||
}
|
||||
}
|
||||
|
@ -225,6 +227,14 @@ sub read_conf() {
|
|||
%conf = %$hashref;
|
||||
}
|
||||
|
||||
sub curl_pipeline($handle) {
|
||||
add_callback( $handle, \&json_decode );
|
||||
add_callback( $handle, \&url_filter );
|
||||
add_callback( $handle, \&process_urls );
|
||||
add_callback($handle, \&dump);
|
||||
# add_callback( $handle, \&handle_repos );
|
||||
}
|
||||
|
||||
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
||||
# ░ ░░░░ ░░░ ░░░ ░░ ░░░ ░
|
||||
# ▒ ▒▒ ▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒ ▒
|
||||
|
@ -243,17 +253,22 @@ for my $i ( keys @{ $conf{lookups} } ) {
|
|||
for ( $lookup{extra_headers} ) {
|
||||
$_ = `printf "$_"`;
|
||||
}
|
||||
for my $j ( keys @{ $lookup{targets} } ) {
|
||||
if ($lookup{targets}) {
|
||||
for my $j ( keys @{ $lookup{targets} } ) {
|
||||
$last_handle++;
|
||||
$handles[$last_handle]{lookup} = $i;
|
||||
set_curl( $last_handle,
|
||||
"$lookup{api_url}/$lookup{targets}[$j]/$lookup{endpoint}",
|
||||
$lookup{extra_headers} );
|
||||
curl_pipeline($last_handle);
|
||||
}
|
||||
} else {
|
||||
$last_handle++;
|
||||
$handles[$last_handle]{lookup} = $i;
|
||||
set_curl( $last_handle,
|
||||
"$lookup{api_url}/$lookup{targets}[$j]/$lookup{endpoint}",
|
||||
"$lookup{api_url}/$lookup{endpoint}",
|
||||
$lookup{extra_headers} );
|
||||
add_callback( $last_handle, \&json_decode );
|
||||
add_callback( $last_handle, \&url_filter );
|
||||
add_callback( $last_handle, \&process_urls );
|
||||
add_callback( $last_handle, \&dump );
|
||||
# add_callback( $last_handle, \&handle_repos );
|
||||
curl_pipeline($last_handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue