Skip to content

Commit

Permalink
vimPlugins: Store deprecation date.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryneeverett committed Mar 27, 2020
1 parent 7cc024b commit 25fea45
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkgs/misc/vim-plugins/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ let
(checkInPkgs n alias)))
aliases;

deprecations = lib.mapAttrs (old: new:
throw "${old} was renamed to ${new}. Please update to ${new}."
deprecations = lib.mapAttrs (old: info:
throw "${old} was renamed to ${info.new} on ${info.date}. Please update to ${info.new}."
) (builtins.fromJSON (builtins.readFile ./deprecated.json));

in
Expand Down
20 changes: 16 additions & 4 deletions pkgs/misc/vim-plugins/deprecated.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"gist-vim": "vim-gist",
"vim-jade": "vim-pug",
"vundle": "Vundle.vim",
"youcompleteme": "YouCompleteMe"
"gist-vim": {
"date": "2020-03-27",
"new": "vim-gist"
},
"vim-jade": {
"date": "2020-03-27",
"new": "vim-pug"
},
"vundle": {
"date": "2020-03-27",
"new": "Vundle.vim"
},
"youcompleteme": {
"date": "2020-03-27",
"new": "YouCompleteMe"
}
}
6 changes: 5 additions & 1 deletion pkgs/misc/vim-plugins/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,17 @@ def rewrite_input(input_file: Path, output_file: Path, redirects: dict):
if redirects:
lines = [redirects.get(line, line) for line in lines]

cur_date_iso = datetime.now().strftime("%Y-%m-%d")
with open(DEPRECATED, "r") as f:
deprecations = json.load(f)
for old, new in redirects.items():
old_name = old.split("/")[1].split(" ")[0].strip("\n")
new_name = new.split("/")[1].split(" ")[0].strip("\n")
if old_name != new_name:
deprecations[old_name] = new_name
deprecations[old_name] = {
"new": new_name,
"date": cur_date_iso,
}
with open(DEPRECATED, "w") as f:
json.dump(deprecations, f, indent=4, sort_keys=True)

Expand Down

0 comments on commit 25fea45

Please sign in to comment.