Skip to content

Commit

Permalink
WIP on sources
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Oct 1, 2016
1 parent fe6ba9a commit f8fee6c
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 18 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"env": {
"es6": true,
"jest": true
},
"parser": "babel-eslint",
"extends": "standard",
"plugins": [
Expand All @@ -19,6 +23,11 @@
"flowtype/use-flow-type": 1,
"flowtype/valid-syntax": 1
},
"ignore": [
"**/*.test.js",
"distribution",
"**/_tests/"
],
"settings": {
"flowtype": {
"onlyFilesWithFlowAnnotation": false
Expand Down
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ distribution
[include]

[libs]
interfaces/
flow-typed/

[options]
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jspm_packages
.node_repl_history

distribution
typings
flow-typed
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ npm run flow

---

You'll have a nicer experience as a developer if you use VS Code with Flow enabled, and if you install typings.
### Dev Life

You'll have a nicer experience as a developer if you use VS Code with Flow enabled, and if you install flow-typed.

``` sh
npm install -g typings
typings install
```
npm install -g flow-typed
flow-typed install
```

( and maybe `flow-typed install jest@14`)

You can run the `danger` command globally from your dev build by running `npm link`.

### What is the TODO?

Expand All @@ -38,3 +44,4 @@ typings install
* A way to do git.diff metadata see [EnvironmentManager](https://github.com/danger/danger/blob/c7880ebd870407e9effa1bb4295540d1fa6b4bbc/lib/danger/danger_core/environment_manager.rb) for setup, needs to get info from request source

The aim is to be able to have this library self testing with Danger-js ASAP, then smarter abstractions can be thought about.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"scripts": {
"test": "jest",
"flow": "flow; test $? -eq 0 -o $? -eq 2",
"lint": "eslint ./source ./test",
"fixlint": "eslint ./source ./test --fix",
"lint": "eslint ./source",
"fixlint": "eslint ./source --fix",
"build": "babel source --out-dir distribution",
"lock": "npm prune; npm dedupe; npm shrinkwrap --dev"
},
Expand Down
7 changes: 7 additions & 0 deletions source/ci_source/_tests/_travis.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

test("adds 1 + 2 to equal 3", () => {
// import { Travis } from "../travis.js"
let Travis = require("../travis.js")
let travis = new Travis({thing: ""})
expect(travis.env).toBe({thing: ""})
})
10 changes: 10 additions & 0 deletions source/ci_source/ci_source.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @flow

export interface CISource {
/** hello */
env: any,
/** validates */
isCI: (env: any) => boolean,
/** PRs */
isPR: (env: any) => boolean
}
14 changes: 14 additions & 0 deletions source/ci_source/travis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// @flow
"use strict"

export default class Travis {
env = []
constructor (env: any) { this.env = env }

isCI (env: any) : boolean {
return true
}
isPR (env: any) : boolean {
return true
}
}
1 change: 1 addition & 0 deletions source/platforms/github.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// @flow
1 change: 1 addition & 0 deletions source/platforms/platform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// @flow
21 changes: 10 additions & 11 deletions source/runner.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#! /usr/bin/env node
// @flow

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

program
.version("0.0.1")
.option("-p, --peppers", "Add peppers")
.option("-P, --pineapple", "Add pineapple")
.option("-b, --bbq-sauce", "Add bbq sauce")
.option("-c, --cheese [type]", "Add the specified type of cheese [marble]", "marble")
.version(version)
.option("-h, --head [commitish]", "TODO: Set the head commitish")
.option("-b, --base [commitish]", "TODO: Set the base commitish")
.option("-f, --fail-on-errors", "TODO: Fail on errors")
.parse(process.argv)

console.log("you ordered a pizza with:")
// if (program.head) console.log(" - peppers")
// if (program.base) console.log(" - pineapple")
// if (program.fail_on_errors) console.log(" - bbq")

if (program.peppers) console.log(" - peppers")
if (program.pineapple) console.log(" - pineapple")
if (program.bbqSauce) console.log(" - bbq")

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

0 comments on commit f8fee6c

Please sign in to comment.