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

Feature/validate#34

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 11 commits intomasterfromfeature/validate
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
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
NextNext commit
validate progress
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 13, 2020
commit5b1a6dd4723f44649d6db1cdb34fcf3844bb7f52
67 changes: 37 additions & 30 deletionssrc/validate.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ import * as yamlParser from "js-yaml";
import { getArg } from "./utils/args";
import gitP, { SimpleGit } from "simple-git/promise";
import { getCommits, CommitLogObject } from "./utils/commits";
import simplegit from "simple-git/promise";

const mkdir = util.promisify(fs.mkdir);
const exists = util.promisify(fs.exists);
Expand All@@ -24,52 +25,58 @@ async function validate(args: string[]) {
const _yaml = await read(path.join(localDir, options.yaml), "utf8");

// parse yaml config
letconfig;
letskeleton;
try {
config = yamlParser.load(_yaml);
skeleton = yamlParser.load(_yaml);

console.log("config", skeleton);
// TODO: validate yaml
if (!config || !config.length) {
if (!skeleton) {
throw new Error("Invalid yaml file contents");
}
} catch (e) {
console.error("Error parsing yaml");
console.error(e.message);
}

const codeBranch: string = config.config.repo.branch;

// VALIDATE SKELETON WITH COMMITS
const commits = getCommits({ localDir, codeBranch });
const codeBranch: string = skeleton.config.repo.branch;

// parse tutorial skeleton for order and commands
// validate commits
const commits = await getCommits({ localDir, codeBranch });

// on error, warn missing level/step
// setup tmp dir
const tmpDir = path.join(localDir, ".tmp");

// 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
try {
if (!(await exists(tmpDir))) {
await mkdir(tmpDir);
}
const tempGit: SimpleGit = gitP(tmpDir);
await tempGit.init();

// on error, show level/step out of order
// VALIDATE TUTORIAL TESTS

// 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
// 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
// log level/step
// on error, show level/step & error message

// CLEANUP
// load INIT commit(s)
} catch (e) {
console.error(e.message);
} finally {
// cleanup
await rmdir(tmpDir);
}
}

export default validate;
File renamed without changes.

[8]ページ先頭

©2009-2025 Movatter.jp