-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This includes some fixes to the changelog tool including verification that no longer accepts everything, requiring the changelog file to have # Change Log at the top, restricting the arbitrary text at the top to be a single line, and adding tests for invalid changelog files. The command will also produce an exit code of 1 if it fails for any reason, unless it is called with zero arguments.
- Loading branch information
1 parent
34e2f1b
commit b8c2525
Showing
11 changed files
with
211 additions
and
123 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
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 |
---|---|---|
@@ -1,57 +1,83 @@ | ||
use "files" | ||
use "options" | ||
use "itertools" | ||
|
||
actor Main | ||
let help_text: String = | ||
""" | ||
changelog-tool COMMAND <changelog file> [...] | ||
Commands: | ||
verify Verify that the given changelog is valid. | ||
release Print a changelog that is prepared for release. | ||
Example: `changelog-tool release CHANGELOG.md 0.13.1` | ||
unreleased Add unreleased section to changelog if none exists. | ||
Options: | ||
--edit, -e Edit the changelog file (release and unreleased only). | ||
""" | ||
|
||
new create(env: Env) => | ||
// TODO use the cli package instead of options | ||
let options = | ||
Options(env.args) | ||
.> add("edit", "e", None) | ||
|
||
try | ||
var edit = false | ||
for option in options do | ||
match option | ||
| ("edit", None) => edit = true | ||
| let err: ParseError => | ||
err.report(env.err) | ||
error | ||
end | ||
// TODO use the cli package | ||
|
||
if env.args.size() == 1 then | ||
env.out.print(help_text) | ||
return | ||
end | ||
|
||
(let cmd, let filename) = | ||
try (env.args(1)?, env.args(2)?) | ||
else | ||
env.out.print(help_text) | ||
env.exitcode(1) | ||
return | ||
end | ||
|
||
let filepath = | ||
try | ||
FilePath(env.root as AmbientAuth, filename)? | ||
else | ||
env.out.print("unable to open: " + filename) | ||
env.exitcode(1) | ||
return | ||
end | ||
let tool = ChangelogTool(env, filename, filepath) | ||
|
||
let args = Array[String] | ||
for arg in options.remaining().values() do | ||
args.push(arg.clone()) | ||
var edit = false | ||
for arg in Iter[String](env.args.values()).skip(3) do | ||
if (arg == "-e") or (arg == "--edit") then | ||
edit = true | ||
break | ||
end | ||
end | ||
|
||
let filename = args(2)? | ||
let filepath = | ||
try | ||
FilePath(env.root as AmbientAuth, filename)? | ||
match cmd | ||
| "verify" => | ||
env.out.print("Verifying " + filename + "...") | ||
try | ||
tool.verify()? | ||
env.out.print(filename + " is a valid changelog.") | ||
else | ||
env.out.print(filename + " is not a valid changelog.") | ||
env.exitcode(1) | ||
return | ||
end | ||
| "release" => | ||
let version = | ||
try env.args(3)? | ||
else | ||
env.err.print("unable to open: " + filename) | ||
env.out.print("A release version must be provided.") | ||
env.exitcode(1) | ||
return | ||
end | ||
let tool = ChangelogTool(env, filename, filepath) | ||
|
||
match args(1)? | ||
| "verify" => tool.verify() | ||
| "release" => tool.release(args(3)?, edit) | ||
| "unreleased" => tool.unreleased(edit) | ||
else error | ||
try tool.release(version, edit)? | ||
else | ||
env.out.print("Unable to perform release prep.") | ||
env.exitcode(1) | ||
return | ||
end | ||
| "unreleased" => tool.unreleased(edit) | ||
else | ||
env.out.print( | ||
""" | ||
changelog-tool COMMAND <changelog file> [...] | ||
Commands: | ||
verify Verify that the given changelog is valid. | ||
release Print a changelog that is prepared for release. | ||
Example: `changelog-tool release CHANGELOG.md 0.13.1` | ||
unreleased Add unreleased section to changelog if none exists. | ||
Options: | ||
--edit, -e Edit the changelog file (release and unreleased only). | ||
""") | ||
env.out.print(help_text) | ||
env.exitcode(1) | ||
return | ||
end |
Empty file.
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,8 @@ | ||
# Change Log | ||
|
||
## [unreleased] - unreleased | ||
|
||
### Fixed | ||
- things | ||
|
||
## [0.1.] - 2017-04-07 |
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 @@ | ||
## [unreleased] - unreleased |
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,17 @@ | ||
# Change Log | ||
|
||
Stuff | ||
|
||
## [unreleased] - unreleased | ||
|
||
### Fixed | ||
- things | ||
|
||
### Adde | ||
- stuff | ||
|
||
## [0.13.0] - 2017-04-07 | ||
|
||
### Fixed | ||
|
||
- Do not allow capability subtyping when checking constraint subtyping. ([PR #1816](https://github.com/ponylang/ponyc/pull/1816)) |
Oops, something went wrong.