diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-14 15:42:48 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-14 15:43:24 -0800 |
| commit | c1c32688a4afc43f6addb99b8b5fa878944a70e3 (patch) | |
| tree | c886f21b5b08a9053aa74fcba4b241dae5ede76d /tools/upgrade.nom | |
| parent | 2309b696fc34b24f05f6658b94f9105ca8ee76e4 (diff) | |
Overhaul in progress, mostly working. Moved all the nomsu packages into
lib/, including core/*. Changes to how nomsu environments and importing
work.
Diffstat (limited to 'tools/upgrade.nom')
| -rwxr-xr-x | tools/upgrade.nom | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/tools/upgrade.nom b/tools/upgrade.nom deleted file mode 100755 index b9b8255..0000000 --- a/tools/upgrade.nom +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env nomsu -V6.14 -# - Tool to automatically update code from old versions of Nomsu. Usage: - nomsu tools/upgrade.nom [-i] file1 file2 directory1 ... - If "-i" is the first argument, upgrades will be performed in-place. Otherwise, the - upgraded code will be printed. - -use "compatibility" -use "lib/os" -use "lib/consolecolor" - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -$inplace = ($(COMMAND LINE ARGS).i or $(COMMAND LINE ARGS).inplace) -$start_version = $(COMMAND LINE ARGS)."upgrade-from" -$version = ($(COMMAND LINE ARGS)."upgrade-to" or (Nomsu version)) -$test = ($(COMMAND LINE ARGS).t or $(COMMAND LINE ARGS).test) -for $filename in $(COMMAND LINE ARGS).extras: - $file = (read file $filename) - unless $file: - fail "File does not exist: \$filename" - $leading_indent = ($file, matching "\n*([ ]*)") - $code = (NomsuCode from (Source $filename 1 (size of $file)) $file) - $tree = ($code parsed $start_version) - $uptree = - $tree upgraded from ($start_version or ($tree.version or (Nomsu version))) to - $version - $text = "\$leading_indent\($uptree as nomsu, text, with "\n" -> "\n\$leading_indent")" - when: - $inplace: - say "Upgraded \$filename" - write $text to file $filename - - $test: - if ($uptree == $tree): - say (dim "\$filename will not be changed") - ..else: - say (bright "\$filename will be changed") - - else: - say $text inline |
