Skip to content

Commit cafd56e

Browse files
committed
Working
1 parent fe03a2c commit cafd56e

File tree

9 files changed

+266
-102
lines changed

9 files changed

+266
-102
lines changed

courses/git/dist/intro.js

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/**
2+
** TuxLab Course File
3+
** Generated Sat, 26 Aug 2017 22:13:09 GMT
4+
**
5+
** Details at https://github.com/learnlinux/tuxlab-courses
6+
**/
7+
8+
/// <reference path="../../index.d.ts" />
9+
// Define Lab
10+
Lab = new TuxLab({
11+
name: "Basic Git",
12+
description: "The basics of Git.",
13+
vm: 'alpine'
14+
});
15+
// Setup function run before all other tasks
16+
Lab.init(function (env) {
17+
// Upgrade Packages and install Git
18+
Promise.resolve()
19+
.then(function () {
20+
return env.shell(["apk", "upgrade"]);
21+
})
22+
.then(function () {
23+
return env.shell(["apk", "add", "git"]);
24+
})
25+
.then(function () {
26+
return env.shell(["mkdir", "/root/my_app"]);
27+
})
28+
.then(function () {
29+
return env.next();
30+
});
31+
});
32+
/* @Init
33+
Initialize a repository in `~/my_app`:
34+
35+
```
36+
cd ~/my_app/
37+
git init
38+
```
39+
40+
Setup your account:
41+
```
42+
git config --global user.name "Subra Suresh"
43+
git config --global user.email "ssuresh@cmu.edu"
44+
```
45+
*/
46+
Lab.nextTask({
47+
setup: function (env) {
48+
env.next();
49+
},
50+
verify: function (env) {
51+
// Determine if a Git Repository
52+
env.shell("cd /root/my_app && git rev-parse --git-dir")
53+
.then(function (_a) {
54+
var stdout = _a.stdout, stderr = _a.stderr;
55+
if (stderr.length === 0) {
56+
env.next();
57+
}
58+
else {
59+
return env.setFeedback("You didn't quite do this right. Try Again!")
60+
.then(function () {
61+
env.retry();
62+
});
63+
}
64+
});
65+
}
66+
});
67+
/* @Add Features
68+
69+
(Fast forward to having written some code:
70+
```bash
71+
ls
72+
featureA featureB
73+
```
74+
75+
Add one of them to the index:
76+
```
77+
git add featureA
78+
```
79+
80+
Notice that only one of them is added:
81+
```
82+
git status
83+
```
84+
85+
Save the changes by "commiting" them:
86+
```
87+
git commit .
88+
```
89+
90+
<iframe style="width: 100%; min-height: 400px;" src="https://www.youtube.com/embed/I1188GO4p1E" frameborder="0" allowfullscreen></iframe>
91+
*/
92+
Lab.nextTask({
93+
setup: function (env) {
94+
// Create Feature Files
95+
Promise.resolve()
96+
.then(function () {
97+
return env.shell("touch /root/my_app/featureA /root/my_app/featureB");
98+
})
99+
.then(function () {
100+
env.next();
101+
});
102+
},
103+
verify: function (env) {
104+
// Determine if featureA, and only featureA is tracked
105+
env.shell("cd /root/my_app/ && git ls-tree -r master --name-only")
106+
.then(function (_a) {
107+
var stdout = _a.stdout, stderr = _a.stderr;
108+
if (stdout.trim() === "featureA") {
109+
env.next();
110+
}
111+
else {
112+
return env.setFeedback("You didn't quite do this right. Try Again!")
113+
.then(function () {
114+
env.retry();
115+
});
116+
}
117+
});
118+
}
119+
});
120+
// Destroy function for performing any final tasks
121+
Lab.destroy(function (env) {
122+
env.next();
123+
});

courses/git/intro.ts

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/// <reference path="../../index.d.ts" />
2+
3+
// Define Lab
4+
Lab = new TuxLab({
5+
name : "Basic Git",
6+
description: "The basics of Git.",
7+
vm: 'alpine'
8+
});
9+
10+
// Setup function run before all other tasks
11+
Lab.init(function(env){
12+
13+
// Upgrade Packages and install Git
14+
Promise.resolve()
15+
.then(() => {
16+
return env.shell(["apk", "upgrade"])
17+
})
18+
.then(() => {
19+
return env.shell(["apk", "add", "git"])
20+
})
21+
22+
// Create Directory
23+
.then(() => {
24+
return env.shell(["mkdir","/root/my_app"])
25+
})
26+
27+
// Return
28+
.then(() => {
29+
return env.next();
30+
})
31+
32+
});
33+
34+
/* @Init
35+
Initialize a repository in `~/my_app`:
36+
37+
```
38+
cd ~/my_app/
39+
git init
40+
```
41+
42+
Setup your account:
43+
```
44+
git config --global user.name "Subra Suresh"
45+
git config --global user.email "ssuresh@cmu.edu"
46+
```
47+
*/
48+
Lab.nextTask({
49+
setup: function(env){
50+
env.next();
51+
},
52+
verify: function(env){
53+
54+
// Determine if a Git Repository
55+
env.shell("cd /root/my_app && git rev-parse --git-dir")
56+
57+
// Return Response
58+
.then(({stdout, stderr}) => {
59+
if(stderr.length === 0){
60+
env.next();
61+
} else {
62+
return env.setFeedback("You didn't quite do this right. Try Again!")
63+
.then(() => {
64+
env.retry()
65+
})
66+
}
67+
})
68+
}
69+
});
70+
71+
/* @Add Features
72+
73+
(Fast forward to having written some code:
74+
```bash
75+
ls
76+
featureA featureB
77+
```
78+
79+
Add one of them to the index:
80+
```
81+
git add featureA
82+
```
83+
84+
Notice that only one of them is added:
85+
```
86+
git status
87+
```
88+
89+
Save the changes by "commiting" them:
90+
```
91+
git commit .
92+
```
93+
94+
<iframe style="width: 100%; min-height: 400px;" src="https://www.youtube.com/embed/I1188GO4p1E" frameborder="0" allowfullscreen></iframe>
95+
*/
96+
Lab.nextTask({
97+
setup: function(env){
98+
99+
// Create Feature Files
100+
Promise.resolve()
101+
.then(() => {
102+
return env.shell("touch /root/my_app/featureA /root/my_app/featureB")
103+
})
104+
105+
// Return
106+
.then(() => {
107+
env.next();
108+
});
109+
},
110+
111+
verify: function(env){
112+
113+
// Determine if featureA, and only featureA is tracked
114+
env.shell("cd /root/my_app/ && git ls-tree -r master --name-only")
115+
.then(({stdout, stderr}) => {
116+
if(stdout.trim() === "featureA"){
117+
env.next();
118+
} else {
119+
return env.setFeedback("You didn't quite do this right. Try Again!")
120+
.then(() => {
121+
env.retry()
122+
})
123+
}
124+
});
125+
126+
}
127+
})
128+
129+
// Destroy function for performing any final tasks
130+
Lab.destroy(function(env){
131+
env.next();
132+
});

courses/intro_to_git/basic.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

courses/intro_to_git/dist/basic.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

gulpfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343

4444
// Compile with Typescript
4545
.pipe(gulpTypescript({
46-
"target": "es2015",
46+
target: "es5",
4747
noImplicitAny: true,
48-
removeComments: true
48+
removeComments: false
4949
})).js
5050

5151
// Append Warning Comment
@@ -55,7 +55,7 @@
5555
.pipe(gulpRename(function(path){
5656
path.dirname += "/dist";
5757
}))
58-
58+
5959
.pipe(gulp.dest(coursesDir));
6060
})
6161

index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/// <reference path="./typings/index.d.ts" />
22

33
import { Lab as _Lab } from 'tuxlab-api/lab';
4+
import * as _lodash from 'lodash';
45

56
declare global {
67
const TuxLab: typeof _Lab;
78
var Lab : _Lab;
9+
10+
const _ : typeof _lodash;
811
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "TuxLab Community Courses",
55
"main": "index.js",
66
"scripts": {
7-
"postinstall": "$(npm bin)/gulp"
7+
"build": "$(npm bin)/gulp"
88
},
99
"repository": {
1010
"type": "git",

0 commit comments

Comments
 (0)