From 77259cb45d346d66c6feb5b5a5070837780e7bb9 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 11 Feb 2019 21:09:29 -0400 Subject: Updated license for 2019. --- license.json | 2 +- license.txt | 4 ++-- stdlib/source/lux/world/file.lux | 28 ++++++++++++------------- stdlib/source/program/licentia.lux | 42 ++++++++++++++++++++++---------------- 4 files changed, 41 insertions(+), 35 deletions(-) diff --git a/license.json b/license.json index 2613e3cd9..b65c22195 100644 --- a/license.json +++ b/license.json @@ -4,7 +4,7 @@ "name": "Eduardo Emilio Julián Pereyra", "period": { "start": 2014, - "end": 2018 + "end": 2019 } } ], diff --git a/license.txt b/license.txt index e12f6d586..f4ed59a02 100644 --- a/license.txt +++ b/license.txt @@ -1,7 +1,7 @@ Lux License 0.1 -Copyright (C) 2014-2018 Eduardo Emilio Julián Pereyra +Copyright (C) 2014-2019 Eduardo Emilio Julián Pereyra Definitions @@ -231,4 +231,4 @@ Once The Work has been published under a particular version of This License, Rec Recipient may also choose to use The Work under the terms of any subsequent version of This License published by The Licensor. No one other than The Licensor has the right to modify the terms applicable to The Work created under This License. -END OF TERMS AND CONDITIONS. +END OF TERMS AND CONDITIONS. \ No newline at end of file diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index b909578d8..0592d41af 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -144,20 +144,20 @@ (def: separator (:: system separator))))) -(def: #export (un-nest System file) +(def: #export (un-nest system file) (All [!] (-> (System !) Path (Maybe [Path Text]))) - (case (text.last-index-of (:: System separator) file) + (case (text.last-index-of (:: system separator) file) #.None #.None (#.Some last-separator) (let [[parent temp] (maybe.assume (text.split last-separator file)) - [_ child] (maybe.assume (text.split (text.size (:: System separator)) temp))] + [_ child] (maybe.assume (text.split (text.size (:: system separator)) temp))] (#.Some [parent child])))) -(def: #export (nest System [parent child]) +(def: #export (nest system [parent child]) (All [!] (-> (System !) [Path Text] Path)) - (format parent (:: System separator) child)) + (format parent (:: system separator) child)) (do-template [] [(exception: #export ( {file Path}) @@ -368,34 +368,34 @@ })) (do-template [ ] - [(def: #export ( Monad System path) + [(def: #export ( monad system path) (All [!] (-> (Monad !) (System !) Path (! (Error ( !))))) - (do Monad - [outcome (!.use (:: System ) path)] + (do monad + [outcome (!.use (:: system ) path)] (case outcome (#error.Success file) (wrap (#error.Success file)) (#error.Failure error) (if (ex.match? error) - (!.use (:: System ) path) + (!.use (:: system ) path) (wrap (#error.Failure error))))))] [get-file File create-file file ..cannot-create-file] [get-directory Directory create-directory directory ..cannot-create-directory] ) -(def: #export (exists? Monad System path) +(def: #export (exists? monad system path) (All [!] (-> (Monad !) (System !) Path (! Bit))) - (do Monad - [?file (!.use (:: System file) path)] + (do monad + [?file (!.use (:: system file) path)] (case ?file (#error.Success file) (wrap true) (#error.Failure _) - (do Monad - [?directory (!.use (:: System directory) path)] + (do monad + [?directory (!.use (:: system directory) path)] (case ?directory (#error.Success directory) (wrap true) diff --git a/stdlib/source/program/licentia.lux b/stdlib/source/program/licentia.lux index 479af7793..3300c380d 100644 --- a/stdlib/source/program/licentia.lux +++ b/stdlib/source/program/licentia.lux @@ -16,19 +16,21 @@ [control [remember (#+ to-do)] [monad (#+ do)] - ["." parser]] + ["." parser] + [security + ["!" capability]]] [data ["." maybe] - ["." error] + ["." error (#+ Error)] ["." text format ["." encoding]] [format ["." json]]] ["." cli (#+ program:)] - ["." io ("#/." monad)] + ["." io (#+ IO) ("#/." monad)] [world - ["." file (#+ File)]] + ["." file (#+ Path File)]] [host (#+ import:)]] [/ ["/." input] @@ -44,28 +46,32 @@ (def: default-output-file "LICENSE") (def: (success-message output) - (-> File Text) + (-> Path Text) (format "Your license has been made!" text.new-line "Check the file " output ".")) (program: [{input (cli.named "--input" cli.any)} {output (parser.default ..default-output-file (cli.named "--output" cli.any))}] - (do io.Monad - [?done (do io.Monad - [blob (:: file.JVM@System read input) - document (io/wrap (do error.Monad - [raw-json (encoding.from-utf8 blob) - json (|> raw-json - (:coerce java/lang/String) - java/lang/String::trim - (:: json.Codec decode)) - license (json.run json /input.license)] - (wrap (/output.license license))))] - (:: file.JVM@System write (encoding.to-utf8 document) output))] + (do io.monad + [?done (: (IO (Error Any)) + (do (error.with-error io.monad) + [file (!.use (:: file.system file) input) + blob (!.use (:: file content) []) + document (io/wrap (do error.monad + [raw-json (encoding.from-utf8 blob) + json (|> raw-json + (:coerce java/lang/String) + java/lang/String::trim + (:: json.codec decode)) + license (json.run json /input.license)] + (wrap (/output.license license)))) + output-file (: (IO (Error (File IO))) + (file.get-file io.monad file.system output))] + (!.use (:: output-file over-write) (encoding.to-utf8 document))))] (case ?done (#error.Success _) (wrap (log! (success-message output))) - (#error.Error message) + (#error.Failure message) (wrap (log! message))))) -- cgit v1.2.3