Skip to content

Commit 8380bac

Browse files
committed
Test if network is available
1 parent 885635a commit 8380bac

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

default.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
system ? builtins.currentSystem,
44
pkgs ?
55
import sources.nixpkgs {
6-
overlays = [];
6+
overlays = [
7+
(final: previous: {
8+
defaultGemConfig = previous.defaultGemConfig // {
9+
jekyll-github-metadata = attrs: {
10+
dontBuild = false;
11+
patches = [./test.patch];
12+
};
13+
};
14+
})
15+
];
716
config = {};
817
inherit system;
918
},

test.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/lib/jekyll-github-metadata/client.rb b/lib/jekyll-github-metadata/client.rb
2+
index f655152..6be3d4c 100644
3+
--- a/lib/jekyll-github-metadata/client.rb
4+
+++ b/lib/jekyll-github-metadata/client.rb
5+
@@ -108,6 +108,7 @@ module Jekyll
6+
end
7+
8+
def internet_connected?
9+
+ GitHubMetadata.log :warn, " ------------ checking for an internet connection #{@internet_connected}"
10+
return @internet_connected if defined?(@internet_connected)
11+
12+
require "resolv"
13+
@@ -120,6 +121,7 @@ module Jekyll
14+
rescue Resolv::ResolvError
15+
@internet_connected = false
16+
end
17+
+ GitHubMetadata.log :warn, " ------------ checked for an internet connection #{@internet_connected}"
18+
end
19+
20+
private

0 commit comments

Comments
 (0)