From 95e90c787eccbd8707ade30ebf7cd35958b3b302 Mon Sep 17 00:00:00 2001 From: Matthias Wahl Date: Tue, 20 Nov 2018 22:54:46 +0100 Subject: [PATCH 1/5] replace usage of options with cli and do the necessary refactoring --- Makefile | 7 +- stable/_bundle_locator.pony | 34 +++++- stable/_test.pony | 11 +- stable/add.pony | 78 ++++++++----- stable/env.pony | 56 +++++++++ stable/fetch.pony | 14 +++ stable/main.pony | 149 ++++++++++-------------- stable/test/integration/test_env.pony | 16 +-- stable/test/integration/test_usage.pony | 69 +++++++++-- stable/test/main.pony | 4 +- stable/version.pony.in | 13 ++- 11 files changed, 303 insertions(+), 148 deletions(-) create mode 100644 stable/env.pony create mode 100644 stable/fetch.pony diff --git a/Makefile b/Makefile index 875169c..edd34fd 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,9 @@ ifdef config endif endif -ifeq ($(config),release) - PONYC = ponyc -else - PONYC = ponyc --debug +PONYC ?= ponyc +ifeq ($(config),debug) + PONYC += --debug endif ifneq ($(arch),) diff --git a/stable/_bundle_locator.pony b/stable/_bundle_locator.pony index 7c22ac8..02c3891 100644 --- a/stable/_bundle_locator.pony +++ b/stable/_bundle_locator.pony @@ -1,11 +1,21 @@ use "files" -primitive _BundleLocator - fun apply(env: Env, start_path: String): (String | None) => +class _BundleLocator + let _auth: AmbientAuth + let _log: Log + new create(auth: AmbientAuth, log: Log) => + _auth = auth + _log = log + + fun locate(start_path: String): (String | None) => + """ + find a path, starting from start_path, that contains a bundle.json, + ascend into parent directories if none is found locally. + """ var path = start_path while path.size() > 0 do let candidate = try - FilePath(env.root as AmbientAuth, path)?.join("bundle.json")? + FilePath(_auth, path)?.join("bundle.json")? else return None end @@ -17,3 +27,21 @@ primitive _BundleLocator end None + + fun load_from_cwd(create_on_missing: Bool = false): Bundle ? => + """ + locate and load a bundle from the current working directory + """ + let cwd = Path.cwd() + match locate(cwd) + | let path: String => + Bundle(FilePath(_auth, path)?, _log, false)? + | None => + if create_on_missing then + Bundle(FilePath(_auth, cwd)?, _log, true)? + else + _log("No bundle.json in current working directory or ancestors.") + error + end + end + diff --git a/stable/_test.pony b/stable/_test.pony index 2748355..7ecdd3a 100644 --- a/stable/_test.pony +++ b/stable/_test.pony @@ -16,17 +16,20 @@ class _TestBundleLocator is UnitTest Path.join("stable/test/testdata", subpath).string() fun apply(h: TestHelper) ? => + let locator = _BundleLocator( + h.env.root as AmbientAuth, + LogNone) h.assert_eq[String]("stable/test/testdata/nested", - _BundleLocator(h.env, bundle("nested")) as String) + locator.locate(bundle("nested")) as String) // nested has one, but so does nested/deeply h.assert_eq[String]("stable/test/testdata/nested/deeply", - _BundleLocator(h.env, bundle("nested/deeply")) as String) + locator.locate(bundle("nested/deeply")) as String) // nested/empty has no bundle.json h.assert_eq[String]("stable/test/testdata/nested", - _BundleLocator(h.env, bundle("nested/empty")) as String) + locator.locate(bundle("nested/empty")) as String) // stable itself has no bundle.json, so this ancestor-checking // from stable/test/testdata/empty yields no bundle.json - h.assert_eq[None](None, _BundleLocator(h.env, bundle("empty")) as None) + h.assert_eq[None](None, locator.locate(bundle("empty")) as None) diff --git a/stable/add.pony b/stable/add.pony index ab4593c..e5a6b48 100644 --- a/stable/add.pony +++ b/stable/add.pony @@ -1,10 +1,36 @@ use "json" -use options = "options" +use "cli" -primitive Add - fun apply(args: Array[String] box, log: Log): JsonObject ? => - let kind = args(0)? - let rest = args.slice(1) +primitive AddCmd + fun name(): String => "add" + fun command_spec(): CommandSpec ? => + CommandSpec.leaf( + name(), + "Adds a new dependency to the local `bundle.json`.", + [ // options + OptionSpec.string( + "tag", + "Specifies a tag from the source repository", + 't', + "") + OptionSpec.string( + "subdir", + "Fetch only a subdirectory of the repository", + 'd', + "") + ], + [ // args + ArgSpec.string( + "type", + "The type of the dependency to add. Possible values: github, gitlab, local-git, local") + ArgSpec.string( + "source", + "The path addressing the dependency to add. For github and gitlab: /, for local-git and local: a path.") + ] + )? + + fun apply(cmd: Command, bundle: Bundle, log: Log) ? => + let kind = cmd.arg("type").string() let prim = match kind | "github" => AddGitHosted @@ -18,35 +44,31 @@ primitive Add end let info: JsonObject ref = JsonObject info.data("type") = kind.clone() - prim(rest, info)? - - info + prim(cmd, info) + bundle.add_dep(info)? + bundle.fetch() primitive AddGitHosted - fun apply(args: Array[String] box, info: JsonObject) ? => - info.data("repo") = args(0)? - - let opts = options.Options(args.slice(1)) - opts.add("tag", "t", options.StringArgument) - opts.add("subdir", "d", options.StringArgument) - for opt in opts do - match opt - | (let name: String, let value: String) => info.data(name) = value - end + fun apply(cmd: Command, info: JsonObject) => + info.data("repo") = cmd.arg("source").string() + let git_tag = cmd.option("tag").string() + if git_tag.size() > 0 then + info.data("tag") = git_tag + end + let subdir = cmd.option("subdir").string() + if subdir.size() > 0 then + info.data("subdir") = subdir end primitive AddLocalGit - fun apply(args: Array[String] box, info: JsonObject) ? => - info.data("local-path") = args(0)? + fun apply(cmd: Command, info: JsonObject) => + info.data("local-path") = cmd.arg("source").string() - let opts = options.Options(args.slice(1)) - opts.add("tag", "t", options.StringArgument) - for opt in opts do - match opt - | (let name: String, let value: String) => info.data(name) = value - end + let git_tag = cmd.option("tag").string() + if git_tag.size() > 0 then + info.data("tag") = git_tag end primitive AddLocal - fun apply(args: Array[String] box, info: JsonObject) ? => - info.data("local-path") = args(0)? + fun apply(cmd: Command, info: JsonObject) => + info.data("local-path") = cmd.arg("source").string() diff --git a/stable/env.pony b/stable/env.pony new file mode 100644 index 0000000..faa217c --- /dev/null +++ b/stable/env.pony @@ -0,0 +1,56 @@ +use "cli" +use "files" + +primitive EnvCmd + fun name(): String => "env" + + fun command_spec(): CommandSpec ?=> + CommandSpec.leaf( + name(), + "Executes the given command within the environment defined by the local `bundle.json`.", + [], // options + [ // args + ArgSpec.string_seq( + "command", + "The command to execute.") + ] + )? + + fun apply(env: Env, cmd: Command, bundle: Bundle, log: Log) ? => + let command = cmd.arg("command").string_seq() + if command.size() == 0 then + log("Please provide a command to execute.") + error + end + let ponypath = + try + let ponypath' = recover trn String end + let iter = bundle.paths().values() + let sep = Path.list_sep()(0)? + for path in iter do + ponypath'.append(path) + if iter.has_next() then ponypath'.push(sep) end + end + + ponypath' + else + "" + end + try + ifdef windows then + var exec: String trn = recover String end + exec.append("cmd /C \"set \"PONYPATH=") + exec.append(ponypath) + exec.append("\" &&") + for arg in command.values() do + exec.append(" ") + exec.append(arg) + end + exec.append("\"") + Shell(consume exec, env.exitcode)? + else + Shell.from_array( + ["env"; "PONYPATH=" + ponypath] .> append(command), env.exitcode)? + end + end + diff --git a/stable/fetch.pony b/stable/fetch.pony new file mode 100644 index 0000000..c83ba51 --- /dev/null +++ b/stable/fetch.pony @@ -0,0 +1,14 @@ +use "cli" + +primitive FetchCmd + fun name(): String => "fetch" + + fun command_spec(): CommandSpec ? => + CommandSpec.leaf( + name(), + "Updates the local `.deps` directory with the most recent content from the source repositories." + )? + + fun apply(cmd: Command, bundle: Bundle, log: Log) => + bundle.fetch() + diff --git a/stable/main.pony b/stable/main.pony index 60b9a0c..2c5c851 100644 --- a/stable/main.pony +++ b/stable/main.pony @@ -1,4 +1,5 @@ use "files" +use "cli" actor Main let env: Env @@ -8,102 +9,72 @@ actor Main env = env' log = LogSimple(env.err) - command(try env.args(1)? else "" end, env.args.slice(2)) - - fun _print_usage() => - env.out.printv( - recover - [ "Usage: stable COMMAND [...]" - "" - " A simple dependency manager for the Pony language." - "" - " Invoke in a working directory containing a bundle.json." - "" - "Commands:" - " help - Print this message" - " version - Print version information" - " fetch - Fetch/update the deps for this bundle" - " env - Execute the following shell command inside an environment" - " with PONYPATH set to include deps directories. For example," - " `stable env ponyc myproject`" - " add - Add a new dependency. For example," - " `stable add github jemc/pony-inspect" - "" - ] - end) - - fun _load_bundle(create_on_missing: Bool = false): Bundle ? => - let cwd = Path.cwd() - match _BundleLocator(env, cwd) - | let path: String => - Bundle(FilePath(env.root as AmbientAuth, path)?, log, false)? - | None => - if create_on_missing then - Bundle(FilePath(env.root as AmbientAuth, cwd)?, log, true)? - else - log("No bundle.json in current working directory or ancestors.") - error - end - end + let cs = + try + CommandSpec.parent( + "stable", + """ + A simple dependency manager for the Pony language. - fun command_fetch() => - try _load_bundle()?.fetch() end + Invoke in a working directory containing a bundle.json. + """, + [], // options + [ // subcommands + VersionCmd.command_spec()? + FetchCmd.command_spec()? + EnvCmd.command_spec()? + AddCmd.command_spec()? + ])? .> add_help("help", "Shows this text and exits.")? + else + log("Error instantiating stable cli.") + env.exitcode(1) + return + end + let cmd = + match CommandParser(cs).parse(env.args, env.vars) + | let c: Command => c + | let ch: CommandHelp => + ch.print_help(env.out) + env.exitcode(0) + return + | let se: SyntaxError => + log(se.string()) + log("") + Help.general(cs).print_help(env.err) + env.exitcode(1) + return + end - fun command_env(rest: Array[String] box) => - let ponypath = + let locator = try - let bundle = _load_bundle()? - let ponypath' = recover trn String end - let iter = bundle.paths().values() - let sep = Path.list_sep()(0)? - for path in iter do - ponypath'.append(path) - if iter.has_next() then ponypath'.push(sep) end - end - - ponypath' + _BundleLocator(env.root as AmbientAuth, log) else - "" + log("unable to locate bundle.json, no sufficient Auth provided.") + env.exitcode(1) + return end + // dispatch to subcommands try - ifdef windows then - var cmd: String trn = recover String end - cmd.append("cmd /C \"set \"PONYPATH=") - cmd.append(ponypath) - cmd.append("\" &&") - for arg in rest.values() do - cmd.append(" ") - cmd.append(arg) - end - cmd.append("\"") - Shell(consume cmd, env.exitcode)? + match cmd.spec().name() + | VersionCmd.name() => + env.out.print(VersionCmd()) + | FetchCmd.name() => + let bundle = locator.load_from_cwd()? + FetchCmd(cmd, bundle, log) + | EnvCmd.name() => + let bundle = locator.load_from_cwd()? + EnvCmd(env, cmd, bundle, log)? + return // avoid overwriting the exitcode + | AddCmd.name() => + let bundle = locator.load_from_cwd(true)? + AddCmd(cmd, bundle, log)? else - Shell.from_array( - ["env"; "PONYPATH=" + ponypath] .> append(rest), env.exitcode)? + log("unknown subcommand") + Help.general(cs).print_help(env.err) + env.exitcode(1) end - end - - fun command_add(rest: Array[String] box) => - try - let bundle = _load_bundle(true)? - let added_json = Add(rest, log)? - bundle.add_dep(added_json)? - bundle.fetch() - end - - fun command_version(rest: Array[String] box) => - env.out.print(Version()) - - fun command(s: String, rest: Array[String] box) => - match s - | "fetch" => - command_fetch() - | "env" => - command_env(rest) - | "add" => - command_add(rest) - | "version" => - command_version(rest) + env.exitcode(0) else - _print_usage() + env.exitcode(1) end + diff --git a/stable/test/integration/test_env.pony b/stable/test/integration/test_env.pony index df4c0ab..7bb95a1 100644 --- a/stable/test/integration/test_env.pony +++ b/stable/test/integration/test_env.pony @@ -36,8 +36,8 @@ class TestEnvNoBundle is UnitTest let notifier: ProcessNotify iso = _ExpectClient(h, None, ["No bundle.json in current working directory or ancestors."], - 0) - _Exec(h, "stable env", tmp.path, consume notifier) + 1) + _Exec(h, "stable env env", tmp.path, consume notifier) class TestEnvEmptyBundleInSameDir is UnitTest new iso create() => None @@ -71,7 +71,7 @@ class TestEnvEmptyBundleInSameDir is UnitTest ["PONYPATH=\n"], // empty None, 0) - _Exec(h, "stable env", tmp.path, consume notifier) + _Exec(h, "stable env env", tmp.path, consume notifier) class TestEnvBundleInSameDir is UnitTest new iso create() => None @@ -122,7 +122,7 @@ class TestEnvBundleInSameDir is UnitTest ["PONYPATH=" + expected], None, 0) - _Exec(h, "stable env", tmp.path, consume notifier) + _Exec(h, "stable env env", tmp.path, consume notifier) class TestEnvBundleInSameDirWithCall is UnitTest new iso create() => None @@ -196,7 +196,7 @@ class TestEnvBundleInParentDir is UnitTest ["PONYPATH=" + Path.join(tmp.path, "../local/a")], None, 0) - _Exec(h, "stable env", nested.path, consume notifier) + _Exec(h, "stable env env", nested.path, consume notifier) class TestEnvBadBundleInNestedAndValidBundleInParentDir is UnitTest new iso create() => None @@ -236,7 +236,7 @@ class TestEnvBadBundleInNestedAndValidBundleInParentDir is UnitTest // This verifies that the parent-dir bundle.json isn't picked up if the // nested-dir bundle.json is invalid. let notifier: ProcessNotify iso = _ExpectClient(h, - ["PONYPATH=$"], + None, ["JSON error at: " + bad_bundle.path.path + ": missing \"deps\" array"], - 0) - _Exec(h, "stable env", nested.path, consume notifier) + 1) + _Exec(h, "stable env env", nested.path, consume notifier) diff --git a/stable/test/integration/test_usage.pony b/stable/test/integration/test_usage.pony index e4fac93..07426f7 100644 --- a/stable/test/integration/test_usage.pony +++ b/stable/test/integration/test_usage.pony @@ -9,7 +9,7 @@ class TestUsage is UnitTest _args = args None - fun name(): String => "integration.Usage(" + _args + ")" + fun name(): String => "integration.Usage()" fun apply(h: TestHelper) => h.long_test(2_000_000_000) @@ -24,14 +24,67 @@ class TestUsage is UnitTest h.dispose_when_done(_CleanTmp(tmp)) let notifier: ProcessNotify iso = _ExpectClient(h, - [ "Usage: stable COMMAND \\[\\.\\.\\.\\]" - "A simple dependency manager for the Pony language" - "help\\s+- Print this message" - "version\\s+- Print version information" - "fetch\\s+- Fetch/update the deps for this bundle" - "env\\s+- Execute the following shell command inside an environment" - "add\\s+- Add a new dependency. For example," + [ "usage: stable \\[\\\\] \\ \\[\\ \\.\\.\\.\\]" + "" + "A simple dependency manager for the Pony language\\." + "" + "Invoke in a working directory containing a bundle\\.json\\." + "" + "" + "Options:" + " -h, --help=false Shows this text and exits." + "" + "Commands:" + " env Executes the given command within the environment defined by the local `bundle.json`." + " help " + " add Adds a new dependency to the local `bundle.json`." + " version Prints the version of stable." + " fetch Updates the local `.deps` directory with the most recent content from the source repositories." ], None, // stderr 0) _Exec(h, "stable " + _args, tmp.path, consume notifier) + +class TestUsageOnError is UnitTest + let _args: String + new iso create(args: String = "") => + _args = args + None + + fun name(): String => "integration.UsageOnError(" + _args + ")" + + fun apply(h: TestHelper) => + h.long_test(2_000_000_000) + let tmp = + try + FilePath.mkdtemp(h.env.root as AmbientAuth, + "stable/test/integration/tmp/")? + else + h.fail("failed to create temporary directory") + return + end + h.dispose_when_done(_CleanTmp(tmp)) + + let notifier: ProcessNotify iso = _ExpectClient(h, + None, // stdout + [ "Error: .+" + "" + "usage: stable \\[\\\\] \\ \\[\\ \\.\\.\\.\\]" + "" + "A simple dependency manager for the Pony language\\." + "" + "Invoke in a working directory containing a bundle\\.json\\." + "" + "" + "Options:" + " -h, --help=false Shows this text and exits." + "" + "Commands:" + " env Executes the given command within the environment defined by the local `bundle.json`." + " help " + " add Adds a new dependency to the local `bundle.json`." + " version Prints the version of stable." + " fetch Updates the local `.deps` directory with the most recent content from the source repositories." + ], //stderr + 1) + _Exec(h, "stable " + _args, tmp.path, consume notifier) diff --git a/stable/test/main.pony b/stable/test/main.pony index ff7be9b..444f6bc 100644 --- a/stable/test/main.pony +++ b/stable/test/main.pony @@ -12,9 +12,9 @@ actor Main is TestList test(TestDep) PrivateTests.make().tests(test) - test(integration.TestUsage("")) // no arguments + test(integration.TestUsageOnError()) // no arguments + test(integration.TestUsageOnError("wrong")) // wrong subcommand test(integration.TestUsage("help")) - test(integration.TestUsage("unknown arguments")) test(integration.TestVersion) integration.EnvTests.make().tests(test) diff --git a/stable/version.pony.in b/stable/version.pony.in index 514c88b..7543277 100644 --- a/stable/version.pony.in +++ b/stable/version.pony.in @@ -1,3 +1,12 @@ -primitive Version - fun apply() : String => +use "cli" + +primitive VersionCmd + fun name(): String => "version" + + fun command_spec(): CommandSpec ? => + CommandSpec.leaf( + name(), + "Prints the version of stable.")? + + fun apply(): String => "%%VERSION%%" From 159a8a5671c449b5dbfd4b4b18bc2375a87f1f36 Mon Sep 17 00:00:00 2001 From: Matthias Wahl Date: Wed, 21 Nov 2018 11:36:41 +0100 Subject: [PATCH 2/5] update usage integration test regexes --- stable/test/integration/test_usage.pony | 40 ++++++++++--------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/stable/test/integration/test_usage.pony b/stable/test/integration/test_usage.pony index 07426f7..36dfadd 100644 --- a/stable/test/integration/test_usage.pony +++ b/stable/test/integration/test_usage.pony @@ -24,22 +24,18 @@ class TestUsage is UnitTest h.dispose_when_done(_CleanTmp(tmp)) let notifier: ProcessNotify iso = _ExpectClient(h, - [ "usage: stable \\[\\\\] \\ \\[\\ \\.\\.\\.\\]" - "" + [ + "usage: stable \\[\\\\] \\ \\[\\ \\.\\.\\.\\]" "A simple dependency manager for the Pony language\\." - "" "Invoke in a working directory containing a bundle\\.json\\." - "" - "" "Options:" - " -h, --help=false Shows this text and exits." - "" + "-h, --help=false\\s+Shows this text and exits\\." "Commands:" - " env Executes the given command within the environment defined by the local `bundle.json`." - " help " - " add Adds a new dependency to the local `bundle.json`." - " version Prints the version of stable." - " fetch Updates the local `.deps` directory with the most recent content from the source repositories." + "env \\s+Executes the given command within the environment defined by the local `bundle\\.json`\\." + "help " + "add \\s?\\s+Adds a new dependency to the local `bundle\\.json`\\." + "version\\s+Prints the version of stable\\." + "fetch\\s+Updates the local `\\.deps` directory with the most recent content from the source repositories\\." ], None, // stderr 0) @@ -68,23 +64,17 @@ class TestUsageOnError is UnitTest let notifier: ProcessNotify iso = _ExpectClient(h, None, // stdout [ "Error: .+" - "" - "usage: stable \\[\\\\] \\ \\[\\ \\.\\.\\.\\]" - "" + "usage: stable \\[\\\\] \\ \\[\\ \\.\\.\\.\\]" "A simple dependency manager for the Pony language\\." - "" "Invoke in a working directory containing a bundle\\.json\\." - "" - "" "Options:" - " -h, --help=false Shows this text and exits." - "" + "-h, --help=false\\s+Shows this text and exits\\." "Commands:" - " env Executes the given command within the environment defined by the local `bundle.json`." - " help " - " add Adds a new dependency to the local `bundle.json`." - " version Prints the version of stable." - " fetch Updates the local `.deps` directory with the most recent content from the source repositories." + "env \\s+Executes the given command within the environment defined by the local `bundle\\.json`\\." + "help " + "add \\s?\\s+Adds a new dependency to the local `bundle\\.json`\\." + "version\\s+Prints the version of stable\\." + "fetch\\s+Updates the local `\\.deps` directory with the most recent content from the source repositories\\." ], //stderr 1) _Exec(h, "stable " + _args, tmp.path, consume notifier) From b4149ef70ebeb881a686d8b845b7ffb41030c63a Mon Sep 17 00:00:00 2001 From: Matthias Wahl Date: Tue, 1 Jan 2019 20:21:23 +0100 Subject: [PATCH 3/5] Use -- for stable env everywhere in docs and tests --- README.md | 2 +- doc/cli/stable-env.md | 7 +++++-- stable/test/integration/test_env.pony | 12 ++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b077ee1..3798934 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ Checking connectivity... done. ## Compile in a stable environment. ```bash -stable env ponyc --debug +stable env -- ponyc --debug # The local paths to the dependencies listed in `bundle.json` # will be included in the `PONYPATH` environment variable, # available to `use` in the `ponyc` invocation. diff --git a/doc/cli/stable-env.md b/doc/cli/stable-env.md index c6826da..612c8c7 100644 --- a/doc/cli/stable-env.md +++ b/doc/cli/stable-env.md @@ -3,7 +3,7 @@ stable-env(1) -- run a command in a stable environment ## SYNOPSIS - stable env + stable env -- ## DESCRIPTION @@ -11,6 +11,9 @@ This command allows you to run another command with the environment needed for `ponyc` to use your stable-managed dependencies. Use this command with `ponyc` to build your project. +In order to separate options given to `command` from options for `stable`, +always separate the `command` with a double dash `--` from the `stable` parts of the command line. + ## EXAMPLES - stable env ponyc + stable env -- ponyc -- debug diff --git a/stable/test/integration/test_env.pony b/stable/test/integration/test_env.pony index 7bb95a1..fb924db 100644 --- a/stable/test/integration/test_env.pony +++ b/stable/test/integration/test_env.pony @@ -37,7 +37,7 @@ class TestEnvNoBundle is UnitTest None, ["No bundle.json in current working directory or ancestors."], 1) - _Exec(h, "stable env env", tmp.path, consume notifier) + _Exec(h, "stable env -- env", tmp.path, consume notifier) class TestEnvEmptyBundleInSameDir is UnitTest new iso create() => None @@ -71,7 +71,7 @@ class TestEnvEmptyBundleInSameDir is UnitTest ["PONYPATH=\n"], // empty None, 0) - _Exec(h, "stable env env", tmp.path, consume notifier) + _Exec(h, "stable env -- env", tmp.path, consume notifier) class TestEnvBundleInSameDir is UnitTest new iso create() => None @@ -122,7 +122,7 @@ class TestEnvBundleInSameDir is UnitTest ["PONYPATH=" + expected], None, 0) - _Exec(h, "stable env env", tmp.path, consume notifier) + _Exec(h, "stable env -- env", tmp.path, consume notifier) class TestEnvBundleInSameDirWithCall is UnitTest new iso create() => None @@ -158,7 +158,7 @@ class TestEnvBundleInSameDirWithCall is UnitTest ["../local/a"], None, 0) - _Exec(h, "stable env printenv PONYPATH", tmp.path, consume notifier) + _Exec(h, "stable env -- printenv PONYPATH", tmp.path, consume notifier) class TestEnvBundleInParentDir is UnitTest new iso create() => None @@ -196,7 +196,7 @@ class TestEnvBundleInParentDir is UnitTest ["PONYPATH=" + Path.join(tmp.path, "../local/a")], None, 0) - _Exec(h, "stable env env", nested.path, consume notifier) + _Exec(h, "stable env -- env", nested.path, consume notifier) class TestEnvBadBundleInNestedAndValidBundleInParentDir is UnitTest new iso create() => None @@ -239,4 +239,4 @@ class TestEnvBadBundleInNestedAndValidBundleInParentDir is UnitTest None, ["JSON error at: " + bad_bundle.path.path + ": missing \"deps\" array"], 1) - _Exec(h, "stable env env", nested.path, consume notifier) + _Exec(h, "stable env -- env", nested.path, consume notifier) From 1abea02451569f6dce42b346dcff458bbeaddac0 Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Sun, 10 Nov 2019 10:26:38 -0500 Subject: [PATCH 4/5] Keep Makefile consistent with others Well, consistent-ish. I'm still working on consistent --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index edd34fd..5273add 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,10 @@ ifdef config endif endif -PONYC ?= ponyc -ifeq ($(config),debug) - PONYC += --debug +ifeq ($(config),release) + PONYC = ponyc +else + PONYC = ponyc --debug endif ifneq ($(arch),) From b9a21bfd71ed52f319ab0c9962ae6570e048506d Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Sun, 10 Nov 2019 10:32:39 -0500 Subject: [PATCH 5/5] Fix incorrect documentation --- doc/cli/stable-env.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/cli/stable-env.md b/doc/cli/stable-env.md index 612c8c7..87bc881 100644 --- a/doc/cli/stable-env.md +++ b/doc/cli/stable-env.md @@ -16,4 +16,4 @@ always separate the `command` with a double dash `--` from the `stable` parts of ## EXAMPLES - stable env -- ponyc -- debug + stable env -- ponyc --debug