-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from slheavner/feature/init-test
update test framework and make init better
- Loading branch information
Showing
4 changed files
with
145 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,53 @@ | ||
'use strict' | ||
|
||
const path = require('path') | ||
const fs = require('fs') | ||
const log = require('../lib/utils/log') | ||
const yaml = require('js-yaml') | ||
try { | ||
fs.mkdir('./src', () => { | ||
fs.mkdir('./src', (err) => { | ||
if (err && err.code !== 'EEXIST') throw err | ||
log.info('created ./src directory') | ||
}) | ||
fs.mkdir('./src/main', () => { | ||
fs.mkdir('./src/main', (err) => { | ||
if (err && err.code !== 'EEXIST') throw err | ||
log.info('created ./src/main directory') | ||
}) | ||
fs.mkdir('./src/test', () => { | ||
log.info('created ./src/main directory') | ||
fs.mkdir('./src/test', (err) => { | ||
if (err && err.code !== 'EEXIST') throw err | ||
log.info('created ./src/test directory') | ||
}) | ||
fs.mkdir('./src/test/source', (err) => { | ||
if (err && err.code !== 'EEXIST') throw err | ||
log.info('created ./src/test/source directory') | ||
}) | ||
fs.copyFile(path.resolve(__dirname, '../lib/raw/UnitTestFramework.brs'), './src/test/source/UnitTestFramework.brs', (err) => { | ||
if (err && err.code !== 'EEXIST') throw err | ||
log.info('copied UnitTestFramework.brs to ./src/test/source/') | ||
}) | ||
fs.copyFile(path.resolve(__dirname, '../lib/raw/default.properties'), './src/test/source/ukor.properties', (err) => { | ||
if (err && err.code !== 'EEXIST') throw err | ||
log.info('copy default properties to ukor.properties') | ||
}) | ||
|
||
const project = fs.createWriteStream('./ukor.properties.yaml') | ||
const defaults = { | ||
name: path.basename(process.cwd()), | ||
version: '0.0.1', | ||
buildDir: 'build', | ||
sourceDir: 'src', | ||
mainFlavor: 'main', | ||
flavors: { | ||
main: { | ||
src: ['main'] | ||
} | ||
} | ||
} | ||
project.write(yaml.safeDump(defaults), () => { | ||
project.close() | ||
log.info('created ukor.properties.yaml') | ||
}) | ||
|
||
} catch (e) { | ||
log.error(e.message) | ||
} | ||
|
||
let defaultProperties = | ||
'name: '+ path.basename(process.cwd()) +'\n' + | ||
'version: 0.0.1\n' + | ||
'buildDir: build\n' + | ||
'sourceDir: src\n' + | ||
'mainFlavor: main\n' | ||
|
||
const localProperties = fs.createWriteStream('./ukor.local') | ||
localProperties.write('', () => { | ||
localProperties.close() | ||
log.info('Created ukor.local') | ||
}) | ||
|
||
const project = fs.createWriteStream('./ukor.properties.yaml') | ||
project.write(defaultProperties, () => { | ||
project.close() | ||
log.info('created ukor.properties.yaml') | ||
}) |
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
Oops, something went wrong.