forked from betagouv/beta.gouv.fr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gemfile
62 lines (46 loc) · 1.78 KB
/
Gemfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
require 'json'
require 'net/http'
source 'https://rubygems.org'
begin
uri = URI('https://pages.github.com/versions.json')
versions = JSON.parse(Net::HTTP.get(uri))
# We need to be sure jekyll gets built in CI using the same version
# than Github does.
gem 'github-pages', versions['github-pages'], group: :jekyll_plugins
# The reason to add a ruby version at .ruby-version and here is to prevent
# the CI server to push to Github if the versions mismatch.
# see <https://circleci.com/docs/unrecognized-ruby-version/>
ruby versions['ruby'] if ENV['CI']
# If DNS lookup fails or the versions endpoint is just unreacheable, we do the
# reasonable assumption that there's no internet connection.
rescue SocketError => socket_error
# Halt execution immediatly if CI server run.
raise socket_error if ENV['CI']
# Warn the user if we believe she's offline.
puts <<-MESSAGE
Couldn't reach #{uri.to_s}, assuming you're offline.
MESSAGE
# Try to use whatever version is already installed.
gem 'github-pages'
# If for any other reason the production versions check fails, we still need to provide
# a fallback scenario to the user.
rescue => standard_error
# Halt execution immediatly if CI server run.
raise standard_error if ENV['CI']
# We invite the user to report the incident by opening an issue.
puts <<-MESSAGE
Something went wrong trying to parse production versions.
Please report the incident at https://github.com/betagouv/beta.gouv.fr/issues:
Exception name: #{standard_error.class.name}
Exception message: #{standard_error.message}
MESSAGE
# Try to use whatever version is already installed.
gem 'github-pages'
end
group :test do
gem 'html-proofer'
gem 'jsonlint'
gem 'rake'
gem 'kwalify'
gem 'opengraph_parser'
end