learn_create 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +40 -0
- data/Gemfile +2 -0
- data/LICENSE.md +23 -0
- data/README.md +30 -0
- data/bin/learn_create +4 -0
- data/lib/learn_create.rb +121 -58
- data/lib/templates/javascript_lab_template/CONTRIBUTING.md +40 -0
- data/lib/templates/javascript_lab_template/LICENSE.md +23 -0
- data/lib/templates/javascript_lab_template/README.md +15 -0
- data/lib/templates/javascript_lab_template/index.html +12 -0
- data/lib/templates/javascript_lab_template/index.js +5 -0
- data/lib/templates/javascript_lab_template/package-lock.json +1854 -0
- data/lib/templates/javascript_lab_template/package.json +21 -0
- data/lib/templates/javascript_lab_template/test/helpers.js +20 -0
- data/lib/templates/javascript_lab_template/test/indexTest.js +23 -0
- data/lib/templates/react-lab-template/README.md +13 -0
- data/lib/templates/react-lab-template/package-lock.json +12333 -0
- data/lib/templates/react-lab-template/package.json +38 -0
- data/lib/templates/react-lab-template/public/index.html +41 -0
- data/lib/templates/react-lab-template/public/manifest.json +13 -0
- data/lib/templates/react-lab-template/src/App.css +5 -0
- data/lib/templates/react-lab-template/src/App.js +18 -0
- data/lib/templates/react-lab-template/src/components/Button.js +19 -0
- data/lib/templates/react-lab-template/src/components/ExampleComponent.js +15 -0
- data/lib/templates/react-lab-template/src/components/Greeting.js +15 -0
- data/lib/templates/react-lab-template/src/index.js +8 -0
- data/lib/templates/react-lab-template/test/index.test.js +64 -0
- data/lib/templates/react-lab-template/test/mocha.opts +4 -0
- data/lib/templates/readme_template/CONTRIBUTING.md +40 -0
- data/lib/templates/readme_template/LICENSE.md +23 -0
- data/lib/templates/readme_template/README.md +16 -0
- data/lib/templates/ruby_lab_template/CONTRIBUTING.md +40 -0
- data/lib/templates/ruby_lab_template/Gemfile +4 -0
- data/lib/templates/ruby_lab_template/Gemfile.lock +32 -0
- data/lib/templates/ruby_lab_template/LICENSE.md +23 -0
- data/lib/templates/ruby_lab_template/README.md +16 -0
- data/lib/templates/ruby_lab_template/lib/example.rb +13 -0
- data/lib/templates/ruby_lab_template/spec/example_spec.rb +37 -0
- data/lib/templates/ruby_lab_template/spec/spec_helper.rb +64 -0
- metadata +43 -5
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"name": "react-lab-template",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"private": true,
|
5
|
+
"babel": {
|
6
|
+
"presets": [
|
7
|
+
"airbnb",
|
8
|
+
"env",
|
9
|
+
"stage-0",
|
10
|
+
"react"
|
11
|
+
]
|
12
|
+
},
|
13
|
+
"dependencies": {
|
14
|
+
"mocha-multi": "^1.0.1",
|
15
|
+
"react": "^16.4.1",
|
16
|
+
"react-dom": "^16.4.1",
|
17
|
+
"react-scripts": "1.1.4",
|
18
|
+
"webpack": "^3.11.0"
|
19
|
+
},
|
20
|
+
"scripts": {
|
21
|
+
"start": "react-scripts start",
|
22
|
+
"build": "react-scripts build",
|
23
|
+
"test": "mocha -w ./test/*.test.js",
|
24
|
+
"eject": "react-scripts eject"
|
25
|
+
},
|
26
|
+
"devDependencies": {
|
27
|
+
"babel-core": "^6.26.3",
|
28
|
+
"babel-preset-airbnb": "^2.5.1",
|
29
|
+
"babel-preset-env": "^1.7.0",
|
30
|
+
"babel-preset-react": "^6.24.1",
|
31
|
+
"babel-preset-stage-0": "^6.24.1",
|
32
|
+
"chai": "^4.1.2",
|
33
|
+
"enzyme": "^3.3.0",
|
34
|
+
"enzyme-adapter-react-16": "^1.1.1",
|
35
|
+
"mocha": "^5.2.0",
|
36
|
+
"sinon": "^6.1.0"
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
7
|
+
<meta name="theme-color" content="#000000">
|
8
|
+
<!--
|
9
|
+
manifest.json provides metadata used when your web app is added to the
|
10
|
+
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
11
|
+
-->
|
12
|
+
<!--
|
13
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
14
|
+
It will be replaced with the URL of the `public` folder during the build.
|
15
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
16
|
+
|
17
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
18
|
+
work correctly both with client-side routing and a non-root public URL.
|
19
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
20
|
+
-->
|
21
|
+
<title>React Lab</title>
|
22
|
+
</head>
|
23
|
+
|
24
|
+
<body>
|
25
|
+
<noscript>
|
26
|
+
You need to enable JavaScript to run this app.
|
27
|
+
</noscript>
|
28
|
+
<div id="root"></div>
|
29
|
+
<!--
|
30
|
+
This HTML file is a template.
|
31
|
+
If you open it directly in the browser, you will see an empty page.
|
32
|
+
|
33
|
+
You can add webfonts, meta tags, or analytics to this file.
|
34
|
+
The build step will place the bundled scripts into the <body> tag.
|
35
|
+
|
36
|
+
To begin the development, run `npm start` or `yarn start`.
|
37
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
38
|
+
-->
|
39
|
+
</body>
|
40
|
+
|
41
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"short_name": "React Lab",
|
3
|
+
"name": "Create React App Sample",
|
4
|
+
"icons": [{
|
5
|
+
"src": "favicon.ico",
|
6
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
7
|
+
"type": "image/x-icon"
|
8
|
+
}],
|
9
|
+
"start_url": "./index.html",
|
10
|
+
"display": "standalone",
|
11
|
+
"theme_color": "#000000",
|
12
|
+
"background_color": "#ffffff"
|
13
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React, { Component } from 'react';
|
2
|
+
import Greeting from './components/Greeting'
|
3
|
+
import Button from './components/Button'
|
4
|
+
|
5
|
+
class App extends Component {
|
6
|
+
|
7
|
+
render() {
|
8
|
+
return (
|
9
|
+
<div className="App">
|
10
|
+
<Greeting />
|
11
|
+
<Button />
|
12
|
+
</div>
|
13
|
+
);
|
14
|
+
}
|
15
|
+
|
16
|
+
}
|
17
|
+
|
18
|
+
export default App;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React, { Component } from 'react';
|
2
|
+
|
3
|
+
class ExampleComponent extends Component {
|
4
|
+
|
5
|
+
render() {
|
6
|
+
return (
|
7
|
+
<button onClick={this.handleClick}>
|
8
|
+
I am a button
|
9
|
+
</button>
|
10
|
+
)
|
11
|
+
}
|
12
|
+
|
13
|
+
handleClick(event) {
|
14
|
+
console.log(event.target.innerHTML)
|
15
|
+
}
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
export default ExampleComponent;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
import { configure, shallow } from 'enzyme';
|
4
|
+
import { expect } from 'chai';
|
5
|
+
import { spy, stub, useFakeTimers } from 'sinon'
|
6
|
+
import Adapter from 'enzyme-adapter-react-16';
|
7
|
+
|
8
|
+
configure({ adapter: new Adapter() });
|
9
|
+
|
10
|
+
import App from '../src/App';
|
11
|
+
import Button from '../src/components/Button';
|
12
|
+
|
13
|
+
describe('<Button />', () => {
|
14
|
+
var buttonWrapper
|
15
|
+
|
16
|
+
//tests specific method within a class
|
17
|
+
it('handles click correctly', () => {
|
18
|
+
|
19
|
+
//set spy on a particular component's class method
|
20
|
+
spy(Button.prototype, "handleClick")
|
21
|
+
|
22
|
+
//example shallow mount of a component
|
23
|
+
buttonWrapper = shallow(<Button />);
|
24
|
+
|
25
|
+
//should console log when handleClick fires
|
26
|
+
const fakeEvent = {target: {innerHTML: "test"}}
|
27
|
+
|
28
|
+
//calls method on Button
|
29
|
+
buttonWrapper.instance().handleClick(fakeEvent)
|
30
|
+
|
31
|
+
//spy confirms the method was called
|
32
|
+
expect(Button.prototype.handleClick.calledOnce, "handleClick was not called").to.equal(true)
|
33
|
+
|
34
|
+
//prevents hanging tests
|
35
|
+
buttonWrapper.unmount()
|
36
|
+
});
|
37
|
+
})
|
38
|
+
|
39
|
+
describe('<App />', () => {
|
40
|
+
var appWrapper
|
41
|
+
|
42
|
+
//test if a component is mounting correctly
|
43
|
+
it('mounts correctly', () => {
|
44
|
+
appWrapper = shallow(<App />);
|
45
|
+
|
46
|
+
expect(appWrapper, "App did not mount").to.exist
|
47
|
+
|
48
|
+
appWrapper.unmount()
|
49
|
+
});
|
50
|
+
|
51
|
+
//test if required content is present in rendered HTML
|
52
|
+
it('contains a Greeting and an Example component', () => {
|
53
|
+
|
54
|
+
appWrapper = shallow(<App />);
|
55
|
+
|
56
|
+
// check for html content directly
|
57
|
+
expect(appWrapper.html()).to.include('<div class="Greeting">Hello!</div>')
|
58
|
+
expect(appWrapper.html()).to.include('<strong>Example!</strong>')
|
59
|
+
|
60
|
+
appWrapper.unmount()
|
61
|
+
|
62
|
+
})
|
63
|
+
|
64
|
+
});
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Contributing to Learn.co Curriculum
|
2
|
+
|
3
|
+
We're really excited that you're about to contribute to the [open
|
4
|
+
curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co).
|
5
|
+
If this is your first time contributing, please continue reading to learn how
|
6
|
+
to make the most meaningful and useful impact possible.
|
7
|
+
|
8
|
+
## Raising an Issue to Encourage a Contribution
|
9
|
+
|
10
|
+
If you notice a problem with the curriculum that you believe needs improvement
|
11
|
+
but you're unable to make the change yourself, you should raise a Github issue
|
12
|
+
containing a clear description of the problem. Include relevant snippets of
|
13
|
+
the content and/or screenshots if applicable. Curriculum owners regularly review
|
14
|
+
issue lists and your issue will be prioritized and addressed as appropriate.
|
15
|
+
|
16
|
+
## Submitting a Pull Request to Suggest an Improvement
|
17
|
+
|
18
|
+
If you see an opportunity for improvement and can make the change yourself go
|
19
|
+
ahead and use a typical git workflow to make it happen:
|
20
|
+
|
21
|
+
* Fork this curriculum repository
|
22
|
+
* Make the change on your fork, with descriptive commits in the standard format
|
23
|
+
* Open a Pull Request against this repo
|
24
|
+
|
25
|
+
A curriculum owner will review your change and approve or comment on it in due
|
26
|
+
course.
|
27
|
+
|
28
|
+
# Why Contribute?
|
29
|
+
|
30
|
+
Curriculum on Learn is publicly and freely available under Learn's
|
31
|
+
[Educational Content License](https://learn.co/content-license). By
|
32
|
+
embracing an open-source contribution model, our goal is for the curriculum
|
33
|
+
on Learn to become, in time, the best educational content the world has
|
34
|
+
ever seen.
|
35
|
+
|
36
|
+
We need help from the community of Learners to maintain and improve the
|
37
|
+
educational content. Everything from fixing typos, to correcting
|
38
|
+
out-dated information, to improving exposition, to adding better examples,
|
39
|
+
to fixing tests—all contributions to making the curriculum more effective are
|
40
|
+
welcome.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Learn.co Educational Content License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Flatiron School, Inc
|
4
|
+
|
5
|
+
The Flatiron School, Inc. owns this Educational Content. However, the Flatiron
|
6
|
+
School supports the development and availability of educational materials in
|
7
|
+
the public domain. Therefore, the Flatiron School grants Users of the Flatiron
|
8
|
+
Educational Content set forth in this repository certain rights to reuse, build
|
9
|
+
upon and share such Educational Content subject to the terms of the Educational
|
10
|
+
Content License set forth [here](http://learn.co/content-license)
|
11
|
+
(http://learn.co/content-license). You must read carefully the terms and
|
12
|
+
conditions contained in the Educational Content License as such terms govern
|
13
|
+
access to and use of the Educational Content.
|
14
|
+
|
15
|
+
Flatiron School is willing to allow you access to and use of the Educational
|
16
|
+
Content only on the condition that you accept all of the terms and conditions
|
17
|
+
contained in the Educational Content License set forth
|
18
|
+
[here](http://learn.co/content-license) (http://learn.co/content-license). By
|
19
|
+
accessing and/or using the Educational Content, you are agreeing to all of the
|
20
|
+
terms and conditions contained in the Educational Content License. If you do
|
21
|
+
not agree to any or all of the terms of the Educational Content License, you
|
22
|
+
are prohibited from accessing, reviewing or using in any way the Educational
|
23
|
+
Content.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Contributing to Learn.co Curriculum
|
2
|
+
|
3
|
+
We're really excited that you're about to contribute to the [open
|
4
|
+
curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co).
|
5
|
+
If this is your first time contributing, please continue reading to learn how
|
6
|
+
to make the most meaningful and useful impact possible.
|
7
|
+
|
8
|
+
## Raising an Issue to Encourage a Contribution
|
9
|
+
|
10
|
+
If you notice a problem with the curriculum that you believe needs improvement
|
11
|
+
but you're unable to make the change yourself, you should raise a Github issue
|
12
|
+
containing a clear description of the problem. Include relevant snippets of
|
13
|
+
the content and/or screenshots if applicable. Curriculum owners regularly review
|
14
|
+
issue lists and your issue will be prioritized and addressed as appropriate.
|
15
|
+
|
16
|
+
## Submitting a Pull Request to Suggest an Improvement
|
17
|
+
|
18
|
+
If you see an opportunity for improvement and can make the change yourself go
|
19
|
+
ahead and use a typical git workflow to make it happen:
|
20
|
+
|
21
|
+
* Fork this curriculum repository
|
22
|
+
* Make the change on your fork, with descriptive commits in the standard format
|
23
|
+
* Open a Pull Request against this repo
|
24
|
+
|
25
|
+
A curriculum owner will review your change and approve or comment on it in due
|
26
|
+
course.
|
27
|
+
|
28
|
+
# Why Contribute?
|
29
|
+
|
30
|
+
Curriculum on Learn is publicly and freely available under Learn's
|
31
|
+
[Educational Content License](https://learn.co/content-license). By
|
32
|
+
embracing an open-source contribution model, our goal is for the curriculum
|
33
|
+
on Learn to become, in time, the best educational content the world has
|
34
|
+
ever seen.
|
35
|
+
|
36
|
+
We need help from the community of Learners to maintain and improve the
|
37
|
+
educational content. Everything from fixing typos, to correcting
|
38
|
+
out-dated information, to improving exposition, to adding better examples,
|
39
|
+
to fixing tests—all contributions to making the curriculum more effective are
|
40
|
+
welcome.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
coderay (1.1.2)
|
5
|
+
diff-lcs (1.3)
|
6
|
+
method_source (0.9.0)
|
7
|
+
pry (0.11.3)
|
8
|
+
coderay (~> 1.1.0)
|
9
|
+
method_source (~> 0.9.0)
|
10
|
+
rspec (3.8.0)
|
11
|
+
rspec-core (~> 3.8.0)
|
12
|
+
rspec-expectations (~> 3.8.0)
|
13
|
+
rspec-mocks (~> 3.8.0)
|
14
|
+
rspec-core (3.8.0)
|
15
|
+
rspec-support (~> 3.8.0)
|
16
|
+
rspec-expectations (3.8.1)
|
17
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
18
|
+
rspec-support (~> 3.8.0)
|
19
|
+
rspec-mocks (3.8.0)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (~> 3.8.0)
|
22
|
+
rspec-support (3.8.0)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
pry
|
29
|
+
rspec
|
30
|
+
|
31
|
+
BUNDLED WITH
|
32
|
+
1.16.6
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Learn.co Educational Content License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Flatiron School, Inc
|
4
|
+
|
5
|
+
The Flatiron School, Inc. owns this Educational Content. However, the Flatiron
|
6
|
+
School supports the development and availability of educational materials in
|
7
|
+
the public domain. Therefore, the Flatiron School grants Users of the Flatiron
|
8
|
+
Educational Content set forth in this repository certain rights to reuse, build
|
9
|
+
upon and share such Educational Content subject to the terms of the Educational
|
10
|
+
Content License set forth [here](http://learn.co/content-license)
|
11
|
+
(http://learn.co/content-license). You must read carefully the terms and
|
12
|
+
conditions contained in the Educational Content License as such terms govern
|
13
|
+
access to and use of the Educational Content.
|
14
|
+
|
15
|
+
Flatiron School is willing to allow you access to and use of the Educational
|
16
|
+
Content only on the condition that you accept all of the terms and conditions
|
17
|
+
contained in the Educational Content License set forth
|
18
|
+
[here](http://learn.co/content-license) (http://learn.co/content-license). By
|
19
|
+
accessing and/or using the Educational Content, you are agreeing to all of the
|
20
|
+
terms and conditions contained in the Educational Content License. If you do
|
21
|
+
not agree to any or all of the terms of the Educational Content License, you
|
22
|
+
are prohibited from accessing, reviewing or using in any way the Educational
|
23
|
+
Content.
|