8000 Change name · gitwinst/javascript-exercises@dd7078e · GitHub
[go: up one dir, main page]

Skip to content

Commit dd7078e

Browse files
author
Mohd Abbas Haidar
committed
Change name
Changed name of directory generator-exercise to exercise-generator so that students don't confuse it for an exercise
1 parent dd9a830 commit dd7078e

16 files changed

+5752
-2
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
These JavaScript exercises are intended to complement the JavaScript content on The Odin Project (TOP). They should only be done when instructed during the course of the curriculum.
44

5-
**Note:** The `generator-exercise` file is not actually an exercise; it is a script that generates exercises. It was created 8000 to help efficiently write these exercises.
6-
75
## Contributing
86

97
If you have a suggestion to improve an exercise, an idea for a new exercise, or notice an issue with an exercise, please feel free to open an issue after thoroughly reading our [contributing guide](https://github.com/TheOdinProject/.github/blob/main/CONTRIBUTING.md).

exercise-generator/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

exercise-generator/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage
2+
**/templates

exercise-generator/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

exercise-generator/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
coverage

exercise-generator/.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- 7
4+
- 6
5+
- 4

exercise-generator/.yo-rc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"generator-node": {
3+
"promptValues": {
4+
"authorName": "Cody Loyd",
5+
"authorEmail": "codyloyd@gmail.com",
6+
"authorUrl": "codyloyd.com"
7+
}
8+
}
9+
}

exercise-generator/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Cody Loyd <codyloyd@gmail.com> (codyloyd.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

exercise-generator/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# generator-exercise [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
2+
> generates boilerplate for The Odin Project exercises
3+
4+
## Installation
5+
6+
First, install [Yeoman](http://yeoman.io) and generator-exercise using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)).
7+
8+
```bash
9+
npm install -g yo
10+
npm install -g generator-exercise
11+
```
12+
13+
Then generate your new project:
14+
15+
```bash
16+
yo exercise
17+
```
18+
19+
## Getting To Know Yeoman
20+
21+
* Yeoman has a heart of gold.
22+
* Yeoman is a person with feelings and opinions, but is very easy to work with.
23+
* Yeoman can be too opinionated at times but is easily convinced not to be.
24+
* Feel free to [learn more about Yeoman](http://yeoman.io/).
25+
26+
## License
27+
28+
MIT © [Cody Loyd](codyloyd.com)
29+
30+
31+
[npm-image]: https://badge.fury.io/js/generator-exercise.svg
32+
[npm-url]: https://npmjs.org/package/generator-exercise
33+
[travis-image]: https://travis-ci.org/codyloyd/generator-exercise.svg?branch=master
34+
[travis-url]: https://travis-ci.org/codyloyd/generator-exercise
35+
[daviddm-image]: https://david-dm.org/codyloyd/generator-exercise.svg?theme=shields.io
36+
[daviddm-url]: https://david-dm.org/codyloyd/generator-exercise
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict';
2+
const Generator = require('yeoman-generator');
3+
const chalk = require('chalk');
4+
const yosay = require('yosay');
5+
6+
module.exports = class extends Generator {
7+
prompting() {
8+
// Have Yeoman greet the user.
9+
this.log(chalk.red('Let\'s do this'));
10+
11+
const prompts = [{
12+
type: 'input',
13+
name: 'title',
14+
message: 'Enter the exercise title',
15+
default: 'title'
16+
}];
17+
18+
return this.prompt(prompts).then(props => {
19+
// To access props later use this.props.someAnswer;
20+
this.props = props;
21+
});
22+
}
23+
24+
writing() {
25+
this.fs.copyTpl(
26+
this.templatePath(`title.js`),
27+
this.destinationPath(`${this.props.title}.js`),
28+
{title: this.props.title}
29+
);
30+
this.fs.copyTpl(
31+
this.templatePath(`title.spec.js`),
32+
this.destinationPath(`${this.props.title}.spec.js`),
33+
{title: this.props.title}
34+
);
35+
this.fs.copyTpl(
36+
this.templatePath(`README.md`),
37+
this.destinationPath(`README.md`),
38+
{title: this.props.title}
39+
);
40+
}
41+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Exercise XX - <%= title %>
2+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= title %>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let <%= title %> = function() {
2+
3+
};
4+
5+
module.exports = <%= title %>;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let <%= title %> = require('./<%=title%>')
2+
3+
describe('<%=title%>', function() {
4+
test('EDITME', function() {
5+
expect(<%=title%>()).toEqual(' ');
6+
});
7+
8+
});

0 commit comments

Comments
 (0)
0