Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_PATH: "vendor/bundle"
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:
name: ci
jobs:
build:
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ '2.6' ]
name: Ruby ${{ matrix.ruby }} test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Build and test
run: |
gem install bundler
gem install bundler -v 2.4.22
bundle install
bundle exec jekyll build
bundle exec htmlproofer ./_site --only-4xx --check-favicon --check-html
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ _site
node_modules/
tmp
.jekyll-cache

vendor/bundle/
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source "http://rubygems.org"

gem 'json', github: 'flori/json', branch: 'v1.8'
gem 'json', git: 'https://github.com/ruby/json.git', branch: 'v1.8'
gem 'jekyll', '4.0.1'
gem 'jekyll-redirect-from'
gem 'html-proofer'
# pin ffi past 1.13.1: that version can't resolve size_t against modern Xcode CLT libffi headers
# (capped below 1.16 since this project still runs on Ruby 2.6, which newer ffi releases dropped support for)
gem 'ffi', '~> 1.15.5'
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GIT
remote: git://github.com/flori/json.git
remote: https://github.com/ruby/json.git
revision: 7f4cfd853f2c919d854fb95548a19980feff17e8
branch: v1.8
specs:
Expand All @@ -18,7 +18,7 @@ GEM
ethon (0.12.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
ffi (1.13.1)
ffi (1.15.5)
forwardable-extended (2.6.0)
html-proofer (3.15.3)
addressable (~> 2.3)
Expand Down Expand Up @@ -90,6 +90,7 @@ PLATFORMS
ruby

DEPENDENCIES
ffi (~> 1.15.5)
html-proofer
jekyll (= 4.0.1)
jekyll-redirect-from
Expand Down
46 changes: 15 additions & 31 deletions _layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,24 @@

<!-- Initializer -->
<script>
// use a service to wrap registry json in jsonp
var svcs = ['https://json2jsonp.com/', 'https://jsonp.afeld.me/']
var i = 0
var nextSvc = function () {
var svc = svcs[i++]
if (!svc) {
// no jsonp services worked, just use master
console.log('falling back to master branch :(')
return Flatdoc.run({
// registry.npmjs.org supports CORS, so we can fetch it directly
fetch('https://registry.npmjs.org/yargs')
.then(function (res) { return res.json() })
.then(function (data) {
var version = data['dist-tags'] && data['dist-tags'].latest
if (!version) throw new Error('no latest version found')
console.log('determined latest version as %s', version)
Flatdoc.run({
fetcher: Flatdoc.file('https://raw.githubusercontent.com/yargs/yargs/v' + version + '/docs/api.md')
})
})
.catch(function (err) {
// fall back to master branch if the registry lookup fails
console.log('falling back to master branch :(', err)
Flatdoc.run({
fetcher: Flatdoc.github('yargs/yargs', 'docs/api.md')
})
}
$.ajax(svc, {
data: {
url: 'https://registry.npmjs.org/yargs'
},
dataType: 'jsonp',
timeout: 2000,
jsonpCallback: svc.replace(/\W/g, ''),
success: function (data) {
var version = data['dist-tags'] && data['dist-tags'].latest
if (!version) return nextSvc()
console.log('determined latest version as %s via %s', version, svc)
Flatdoc.run({
fetcher: Flatdoc.file('https://raw.githubusercontent.com/yargs/yargs/v' + version + '/docs/api.md')
})
},
error: function () {
console.log('service failed: %s, trying next', svc)
nextSvc()
}
})
}
nextSvc()
</script>
</head>
<body role='flatdoc' class='no-literate'>
Expand Down
Loading