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

Commit

Permalink
feat(name): set the repo name in the settings file
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the project name is now required

a small step toward #1
  • Loading branch information
travi committed Jan 24, 2019
1 parent 65d1d7a commit 9fc7253
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/scaffolder.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import chalk from 'chalk';
import writeYaml from '../third-party-wrappers/write-yaml';

export function scaffold({projectRoot, projectType, description, homepage, visibility}) {
export function scaffold({projectRoot, projectName, projectType, description, homepage, visibility}) {
console.log(chalk.blue('Generating GitHub')); // eslint-disable-line no-console

return writeYaml(`${projectRoot}/.github/settings.yml`, {
repository: {
name: projectName,
description,
homepage,
private: 'Public' !== visibility,
Expand Down
18 changes: 12 additions & 6 deletions test/unit/scaffolder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {scaffold} from '../../src/scaffolder';
suite('github', () => {
let sandbox;
const projectRoot = any.string();
const projectName = any.string();

setup(() => {
sandbox = sinon.createSandbox();
Expand All @@ -16,16 +17,19 @@ suite('github', () => {

teardown(() => sandbox.restore());

test('that the settings file is produced', () => {
test('that the settings file is produced', async () => {
const description = any.sentence();
const homepage = any.url();
yamlWriter.default.resolves();

return scaffold({projectRoot, description, homepage}).then(() => assert.calledWith(
await scaffold({projectRoot, projectName, description, homepage});

assert.calledWith(
yamlWriter.default,
`${projectRoot}/.github/settings.yml`,
{
repository: {
name: projectName,
description,
homepage,
private: true,
Expand Down Expand Up @@ -58,13 +62,15 @@ suite('github', () => {
}
]
}
));
);
});

test('that the greenkeeper label is defined for javascript projects', () => {
test('that the greenkeeper label is defined for javascript projects', async () => {
yamlWriter.default.resolves();

return scaffold({projectRoot, projectType: 'JavaScript'}).then(() => assert.calledWith(
await scaffold({projectRoot, projectType: 'JavaScript'});

assert.calledWith(
yamlWriter.default,
`${projectRoot}/.github/settings.yml`,
sinon.match({
Expand All @@ -80,7 +86,7 @@ suite('github', () => {
{name: 'greenkeeper', color: '00c775'}
]
})
));
);
});

test('that the repository is marked as private when the visibility is `Private`', async () => {
Expand Down

0 comments on commit 9fc7253

Please sign in to comment.