Skip to content

Commit fe03a2c

Browse files
committed
Created Global Definitions
1 parent 5fc5461 commit fe03a2c

File tree

10 files changed

+157
-18
lines changed

10 files changed

+157
-18
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
# courses-community
2-
Community-Created courses for TuxLab
1+
# TuxLab Community Courses
2+
3+
## Available Libraries
4+
5+
__lodash__
6+
```
7+
import * as _ from "lodash";
8+
```
9+
10+
## Building

courses/intro_to_git/basic.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/// <reference path="../../index.d.ts" />
2+
3+
// Define Lab
4+
Lab = new TuxLab({
5+
name : "Basic Git",
6+
description: "Teaches users how to clone a repository.",
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+
.then(() => {
22+
return env.next();
23+
})
24+
25+
});
26+
27+
/* @Task 1
28+
Description of task. Task is pretty cool.
29+
*/
30+
Lab.nextTask({
31+
setup: function(env){
32+
env.next();
33+
},
34+
verify: function(env){
35+
env.next();
36+
}
37+
});
38+
39+
/* @Task 2
40+
Description of task. Task is pretty cool.
41+
*/
42+
Lab.nextTask({
43+
setup: function(env){
44+
env.next();
45+
},
46+
verify: function(env){
47+
env.fail();
48+
}
49+
})
50+
51+
// Destroy function for performing any final tasks
52+
Lab.destroy(function(env){
53+
env.next();
54+
});

courses/intro_to_git/cloning.js

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

courses/intro_to_git/cloning.ts

Whitespace-only changes.

courses/intro_to_git/dist/basic.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
** TuxLab Course File
3+
** Generated Thu, 24 Aug 2017 03:26:18 GMT
4+
**
5+
** Details at https://github.com/learnlinux/tuxlab-courses
6+
**/
7+
8+
Lab = new TuxLab({
9+
name: "Basic Git",
10+
description: "Teaches users how to clone a repository.",
11+
vm: 'alpine'
12+
});
13+
Lab.init(function (env) {
14+
Promise.resolve()
15+
.then(() => {
16+
return env.shell(["apk", "upgrade"]);
17+
})
18+
.then(() => {
19+
return env.shell(["apk", "add", "git"]);
20+
})
21+
.then(() => {
22+
return env.next();
23+
});
24+
});
25+
Lab.nextTask({
26+
setup: function (env) {
27+
env.next();
28+
},
29+
verify: function (env) {
30+
env.next();
31+
}
32+
});
33+
Lab.nextTask({
34+
setup: function (env) {
35+
env.next();
36+
},
37+
verify: function (env) {
38+
env.fail();
39+
}
40+
});
41+
Lab.destroy(function (env) {
42+
env.next();
43+
});

gulpfile.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,50 @@
1313
**
1414
** Details at https://github.com/learnlinux/tuxlab-courses
1515
**/
16+
1617
`;
1718

1819
/* IMPORTS */
1920
var fs = require('fs');
2021
var path = require('path');
22+
var del = require('del');
2123

2224
var gulp = require('gulp');
25+
var gulpRename = require('gulp-rename');
2326
var gulpInsert = require('gulp-insert');
2427
var gulpTypings = require('gulp-typings');
2528
var gulpTypescript = require('gulp-typescript');
2629

2730
/* TASKS */
31+
gulp.task('clean', function(){
32+
return del(['courses/*/dist/*.js'])
33+
})
34+
2835
gulp.task('typings', function(){
2936
return gulp.src("./typings.json")
3037
.pipe(gulpTypings());
3138
})
3239

33-
gulp.task('typescript', ['typings'], function(){
40+
gulp.task('typescript', ['typings', 'clean'], function(){
3441

3542
return gulp.src(coursesDir + '*/*.ts')
3643

3744
// Compile with Typescript
3845
.pipe(gulpTypescript({
46+
"target": "es2015",
3947
noImplicitAny: true,
40-
outdir: "./dist",
41-
filesGlob : [
42-
"node_modules/@types",
43-
"typings/index.d.ts"
44-
],
48+
removeComments: true
4549
})).js
4650

4751
// Append Warning Comment
4852
.pipe(gulpInsert.prepend(jsComment))
4953

5054
// Pipe to Output
51-
.pipe(gulp.dest(coursesDir))
55+
.pipe(gulpRename(function(path){
56+
path.dirname += "/dist";
57+
}))
58+
59+
.pipe(gulp.dest(coursesDir));
5260
})
5361

5462
gulp.task('default', ['typescript']);

index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference path="./typings/index.d.ts" />
2+
3+
import { Lab as _Lab } from 'tuxlab-api/lab';
4+
5+
declare global {
6+
const TuxLab: typeof _Lab;
7+
var Lab : _Lab;
8+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
},
2222
"devDependencies": {
2323
"@types/node": "^7.0.42",
24+
"del": "^3.0.0",
2425
"gulp": "^3.9.1",
2526
"gulp-insert": "^0.5.0",
27+
"gulp-rename": "^1.2.2",
2628
"gulp-typescript": "^3.2.2",
2729
"gulp-typings": "^2.0.4",
2830
"typescript": "^2.4.2"

tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2015",
4+
"lib": [
5+
"es6",
6+
"dom"
7+
],
8+
"experimentalDecorators": true,
9+
"emitDecoratorMetadata": true,
10+
"sourceMap": true
11+
},
12+
"exclude": [
13+
"node_modules"
14+
],
15+
"filesGlob" : [
16+
"index.d.ts"
17+
],
18+
"compileOnSave": false
19+
20+
}

typings.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"name" : "TuxLab Community Courses",
3-
"dependencies" : {},
2+
"name": "TuxLab Community Courses",
3+
"dependencies": {
4+
"bluebird": "registry:npm/bluebird#3.5.0+20170314181206"
5+
},
46
"globalDependencies": {
5-
"tuxlab-api" : "https://raw.githubusercontent.com/learnlinux/tuxlab-app/beta/imports/api/tuxlab-api.d.ts"
7+
"tuxlab-api": "https://raw.githubusercontent.com/learnlinux/tuxlab-app/beta/imports/api/tuxlab-api.d.ts"
68
}
79
}

0 commit comments

Comments
 (0)