Skip to content
This repository has been archived by the owner on Apr 22, 2018. It is now read-only.

Commit

Permalink
change project name to UST
Browse files Browse the repository at this point in the history
  • Loading branch information
mvcds committed Feb 19, 2017
1 parent 1b19475 commit a2daa02
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Samples As Templates
# Use Samples as Templates

In a node project is common to have a folder structure where files follow some naming convention, to avoid copying and pasting on the folder's name and files you could type `sat` to use samples as templates
In a node project is common to have a folder structure where files follow some naming convention, to avoid copying and pasting on the folder's name and files you could type `ust` to use samples as templates

$ yarn global add @marvinc.silva/sat
$ yarn global add ust

Test it by checking the version

$ sat --version
$ ust --version

You can also install it on the current project, for developers only.

$ yarn add @marvinc.silva/sat --dev
$ yarn add @marvinc.silva/ust --dev

In this case you'll need to refer to the bin folder

$ node_modules/.bin/sat --version
$ node_modules/.bin/ust --version

## WIP

Expand All @@ -24,9 +24,9 @@ We welcome suggestions as issues on github.

## How to start using it

On your project's `package.json` file create an object `sat`, its keys will be considered as 'the name of your samples', and the value the sample itself.
On your project's `package.json` file create an object `ust`, its keys will be considered as 'the name of your samples', and the value the sample itself.

"sat": {
"ust": {
"sampleA": "path\to\file.js",
"sampleB": path\to\directory
}
Expand All @@ -35,13 +35,13 @@ On your project's `package.json` file create an object `sat`, its keys will be c

To duplicate a sample use:

sat use [sample] [name]
ust use [sample] [name]

You can list all commands from the command line with:

sat list
ust list

### Planned

sat create [sample]
sat delete [sample]
ust create [sample]
ust delete [sample]
4 changes: 2 additions & 2 deletions commands/ListPackageSamples/ListPackageSamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const dependencies = {
module.exports = (injection) => {
const { require, log, colors } = Object.assign({}, dependencies, injection)

const { sat } = require('../../package.json')
const { ust } = require('../../package.json')

Object.keys(sat).forEach((key) => {
Object.keys(ust).forEach((key) => {
log(colors.yellow(key))
})
}
4 changes: 2 additions & 2 deletions commands/ListPackageSamples/ListPackageSamples.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ListPackageSamples = require('./ListPackageSamples')
describe('List Package Samples', () => {
describe('Read all samples', () => {
const pkg = {
sat: {
ust: {
key1: 'path\\to\\file.js',
key2: 'path\\to\\directory'
}
Expand All @@ -32,7 +32,7 @@ describe('List Package Samples', () => {

yellow.verify()

Object.keys(pkg.sat).forEach((key, i) => {
Object.keys(pkg.ust).forEach((key, i) => {
expect(yellow.args[i][0]).to.equal(key)
})
})
Expand Down
2 changes: 1 addition & 1 deletion commands/UseSampleAsTemplate/UseSampleAsTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const AsSampleArray = (result) => result.length ? result : [result]
module.exports = (sample, name, injection) => {
const { Sample, SecureDirectoryService, GetPackageService } = Object.assign({}, dependencies, injection)

const path = GetPackageService(injection).sat[sample]
const path = GetPackageService(injection).ust[sample]

return Sample(name, path, injection)
.then(AsSampleArray)
Expand Down
8 changes: 4 additions & 4 deletions commands/UseSampleAsTemplate/UseSampleAsTemplate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ describe('Use Sample As Template', () => {
.withExactArgs(file, target, match.object)
.returns(Promise.resolve())
const pkg = {
sat: {
ust: {
[sample]: file
}
}
const Sample = mock().once()
.withExactArgs(name, pkg.sat[sample], match.object)
.withExactArgs(name, pkg.ust[sample], match.object)
.returns(Promise.resolve(resultSample))
const SecureDirectoryService = mock().once()
.withExactArgs([resultSample], match.object)
Expand Down Expand Up @@ -61,12 +61,12 @@ describe('Use Sample As Template', () => {

const DuplicationService = mock().thrice()
const pkg = {
sat: {
ust: {
[sample]: folder
}
}
const Sample = mock().once()
.withExactArgs(name, pkg.sat[sample], match.object)
.withExactArgs(name, pkg.ust[sample], match.object)
.returns(Promise.resolve(samples))
const SecureDirectoryService = mock().once()
.withExactArgs(samples, match.object)
Expand Down
2 changes: 1 addition & 1 deletion domain/GetPackageService/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "GetPackageService",
"description": "Gets sat's package.json file",
"description": "Gets ust's package.json file",
"private": true,
"main": "./GetPackageService.js"
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@marvinc.silva/sat",
"name": "ust",
"version": "1.0.0",
"description": "use samples as templates",
"main": "sat.js",
"main": "ust.js",
"author": "MVCDS",
"license": "MIT",
"dependencies": {
Expand All @@ -19,16 +19,16 @@
"test": "mocha -c -S --recursive commands domain usage --require tests/support.js",
"tdd": "yarn test -- -w"
},
"sat": {
"ust": {
"usage": "usage/use.js",
"command": "commands/UseSampleAsTemplate",
"domain": "domain/DuplicationService"
},
"bin": {
"sat": "./sat.js"
"ust": "./ust.js"
},
"repository": {
"type": "git",
"url": "https://github.com/mvcds/sat.git"
"url": "https://github.com/mvcds/ust.git"
}
}
2 changes: 1 addition & 1 deletion sat.js → ust.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require('./usage')(program)
program.version(package.version)
.usage('<command>')
.on('*', () => {
const help = `Cannot run '${colors.red('sat', program.args[0])}' try '${colors.green('sat --help')}' to get the following help`
const help = `Cannot run '${colors.red('ust', program.args[0])}' try '${colors.green('ust --help')}' to get the following help`

console.log(help)
program.help()
Expand Down

0 comments on commit a2daa02

Please sign in to comment.