Skip to content

Commit

Permalink
Test if network is available
Browse files Browse the repository at this point in the history
  • Loading branch information
ibbem committed Jan 12, 2025
1 parent e69411c commit 8a24971
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
11 changes: 10 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
system ? builtins.currentSystem,
pkgs ?
import sources.nixpkgs {
overlays = [];
overlays = [
(final: previous: {
defaultGemConfig = previous.defaultGemConfig // {
jekyll-github-metadata = attrs: {
dontBuild = false;
patches = [./test.patch];
};
};
})
];
config = {};
inherit system;
},
Expand Down
20 changes: 20 additions & 0 deletions test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/lib/jekyll-github-metadata/client.rb b/lib/jekyll-github-metadata/client.rb
index f655152..6be3d4c 100644
--- a/lib/jekyll-github-metadata/client.rb
+++ b/lib/jekyll-github-metadata/client.rb
@@ -108,6 +108,7 @@ module Jekyll
end

def internet_connected?
+ GitHubMetadata.log :warn, " ----------- checking for an internet connection #{@internet_connected}"
return @internet_connected if defined?(@internet_connected)

require "resolv"
@@ -120,6 +121,7 @@ module Jekyll
rescue Resolv::ResolvError
@internet_connected = false
end
+ GitHubMetadata.log :warn, " ----------- checked for an internet connection #{@internet_connected}"
end

private

0 comments on commit 8a24971

Please sign in to comment.