-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #5171 - flip1995:deploy, r=Manishearth
Improve deployment and documentation **This should be merged shortly after** #5172 This extracts the python code that generated the `versions.json` file and now sorts the versions. in addition to that it improves the order on the website, respecting the new `rust-*` directories. The new appearance of the documentation site can be previewed here: https://flip1995.github.io/rust-clippy/ changelog: Add documentation for Clippy stable releases at https://rust-lang.github.io/rust-clippy/
- Loading branch information
Showing
3 changed files
with
56 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
|
||
import json | ||
import os | ||
import sys | ||
|
||
from lintlib import log | ||
|
||
|
||
def key(v): | ||
if v == 'master': | ||
return float('inf') | ||
if v == 'stable': | ||
return sys.maxsize | ||
|
||
v = v.replace('v', '').replace('rust-', '') | ||
|
||
s = 0 | ||
for i, val in enumerate(v.split('.')[::-1]): | ||
s += int(val) * 100**i | ||
|
||
return s | ||
|
||
|
||
def main(): | ||
if len(sys.argv) < 2: | ||
print("Error: specify output directory") | ||
return | ||
|
||
outdir = sys.argv[1] | ||
versions = [ | ||
dir for dir in os.listdir(outdir) if not dir.startswith(".") and os.path.isdir(os.path.join(outdir, dir)) | ||
] | ||
versions.sort(key=key) | ||
|
||
with open(os.path.join(outdir, "versions.json"), "w") as fp: | ||
json.dump(versions, fp, indent=2) | ||
log.info("wrote JSON for great justice") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |