Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a simple source runner #7

Merged
merged 1 commit into from
Oct 1, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions source/ci_source/ci_source_selector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @flow
"strict mode"

import type { Env, CISource } from "./ci_source"
import Travis from "./travis"

export function getCISourceForEnv(env: Env) : ?CISource {
let travis = new Travis(env)
return travis
}
4 changes: 2 additions & 2 deletions source/ci_source/travis.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export default class Travis {
env: Env
constructor(env: Env) { this.env = env }

supportedPlatforms: ["github"]

get isCI() : boolean {
return ensureEnvKeysExist(this.env, ["HAS_JOSH_K_SEAL_OF_APPROVAL"])
}
Expand All @@ -22,4 +20,6 @@ export default class Travis {

get pullRequestID(): string { return this.env.TRAVIS_PULL_REQUEST }
get repoSlug(): string { return this.env.TRAVIS_REPO_SLUG }
get repoURL(): string { return "maybe not needed?" }
get supportedPlatforms() : string[] { return ["github"] }
}
16 changes: 15 additions & 1 deletion source/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// @flow

var program = require("commander")
import {version} from "../package.json"
import { version } from "../package.json"
import { getCISourceForEnv } from "./ci_source/ci_source_selector"

program
.version(version)
Expand All @@ -11,8 +12,21 @@ program
.option("-f, --fail-on-errors", "TODO: Fail on errors")
.parse(process.argv)

// program["head"]
// if (program.head) console.log(" - peppers")
// if (program.base) console.log(" - pineapple")
// if (program.fail_on_errors) console.log(" - bbq")

// console.log(" - %s cheese", program.cheese)

let source = getCISourceForEnv(process.env)
if (source) {
console.log("OK?")
console.log(source.isCI)
console.log("Is PR?")
console.log(source.isPR)
} else {
console.log("Could not find a CI source for this run")
process.exit(0)
}