Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

setup validate#25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfeature/validate
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionsrc/build.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@ import * as util from "util";
import { parse } from "./utils/parse";
import { getArg } from "./utils/args";
import { getCommits, CommitLogObject } from "./utils/commits";
import { validateSchema } from "./utils/validate";
import { validateSchema } from "./utils/validateSchema";
import * as T from "../typings/tutorial";

const write = util.promisify(fs.writeFile);
Expand Down
17 changes: 13 additions & 4 deletionssrc/cli.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
import "./utils/logs";
import build from "./build";
import create from "./create";
import { help, create as createHelp, build as buildHelp } from "./help";
import validate from "./validate";
import * as help from "./help";

export async function cli(rawArgs: string[]): Promise<void> {
const command: string = rawArgs[2];
Expand All@@ -16,23 +17,31 @@ export async function cli(rawArgs: string[]): Promise<void> {

case "build":
if (args.length && ["--help", "-h"].includes(args[0])) {
buildHelp();
help.build();
return;
}
build(args);
break;

case "create":
if (args.length && ["--help", "-h"].includes(args[0])) {
createHelp();
help.create();
return;
}
create(args);
break;

case "validate":
if (args.length && ["--help", "-h"].includes(args[0])) {
help.validate();
return;
}
validate(args);
break;

case "--help":
case "-h":
default:
help();
help.main();
}
}
30 changes: 21 additions & 9 deletionssrc/help.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
export functionhelp() {
export functionmain() {
console.log(`
CodeRoad CLI
Usage: coderoad [options]

Options:
--help (-h) display these help docs
--version (-v) show coderoad cli version
create start a new tutorial from a template
build generate a coderoad.json file from markdown and yaml
validate run a variety of tests to ensure a tutorial works as intended

More docs at https://github.com/coderoad/coderoad-cli
`);
More docs at https://github.com/coderoad/coderoad-cli`);
}

export function create() {
console.log(`
console.log(`Create a new CodeRoad tutorial project from a template.

Usage: coderoad create [path] [options]

Options:
--help (-h) display these help docs
--lang (-l) programming language for template
--testRunner (-t) test runner module for template

More docs at https://github.com/coderoad/coderoad-cli
`);
More docs at https://github.com/coderoad/coderoad-cli`);
}

export function build() {
console.log(`
console.log(`Compile a coderoad.json file from markdown & yaml.

Usage: coderoad build [path] [options]

Options:
Expand All@@ -35,6 +37,16 @@ Options:
--yaml (-y) custom path to the tutorial yaml file (coderoad.yaml)
--output (-o) custom path to tutorial json config file (coderoad.json)

More docs at https://github.com/coderoad/coderoad-cli
`);
More docs at https://github.com/coderoad/coderoad-cli`);
}

export function validate() {
console.log(`Validates commits and tests across a tutorial.

Usage: coderoad validate [path] [options]

Options:
--help (-h) display these help docs

More docs at https://github.com/coderoad/coderoad-cli`);
}
File renamed without changes.
43 changes: 43 additions & 0 deletionssrc/validate.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
async function validate(args: string[]) {
// dir - default .
const dir = !args.length || args[0].match(/^-/) ? "." : args[0];
console.warn("Not yet implemented. Coming soon");
return;

// setup .tmp directory
// git clone branch

// VALIDATE SKELETON WITH COMMITS
// parse tutorial skeleton for order and commands

// on error, warn missing level/step

// VALIDATE COMMIT ORDER
// list all commits in order
// validate that a level number doesn't come before another level
// validate that a step falls within a level
// validate that steps are in order

// on error, show level/step out of order

// VALIDATE TUTORIAL TESTS
// load INIT commit(s)
// run test runner setup command(s)
// loop over commits:
// - load level commit
// - run level setup command(s)
// - load step setup commit(s)
// - run step setup command(s)
// - if next solution:
// - run test - expect fail
// - if solution
// - run test - expect pass

// log level/step
// on error, show level/step & error message

// CLEANUP
// finally: remove .tmp directory
}

export default validate;

[8]ページ先頭

©2009-2025 Movatter.jp