initial commit

This commit is contained in:
Victoria Jeffrey 2016-08-24 08:58:40 -04:00 committed by Christoph Hartmann
parent 52b5b59b87
commit 1ea965080a
29 changed files with 377 additions and 1 deletions

View file

@ -13,7 +13,7 @@ commands.each do |keyname, command|
# save the result and put it in inspec/www/app/results with the keyname as filename
result = cmd.stdout
dir = 'www/app/results/'
dir = 'www/app/responses/'
out_file = File.new(File.join(dir, "#{keyname}.txt"), 'w')
out_file.puts(result)
out_file.close

22
www/npm-debug.log Normal file
View file

@ -0,0 +1,22 @@
0 info it worked if it ends with ok
1 verbose cli [ '/Users/vjeffrey/.nvm/versions/node/v5.6.0/bin/node',
1 verbose cli '/Users/vjeffrey/.nvm/versions/node/v5.6.0/bin/npm',
1 verbose cli 'start' ]
2 info using npm@3.6.0
3 info using node@v5.6.0
4 verbose stack Error: ENOENT: no such file or directory, open '/Users/vjeffrey/code/compliance/inspec/www/package.json'
4 verbose stack at Error (native)
5 verbose cwd /Users/vjeffrey/code/compliance/inspec/www
6 error Darwin 15.6.0
7 error argv "/Users/vjeffrey/.nvm/versions/node/v5.6.0/bin/node" "/Users/vjeffrey/.nvm/versions/node/v5.6.0/bin/npm" "start"
8 error node v5.6.0
9 error npm v3.6.0
10 error path /Users/vjeffrey/code/compliance/inspec/www/package.json
11 error code ENOENT
12 error errno -2
13 error syscall open
14 error enoent ENOENT: no such file or directory, open '/Users/vjeffrey/code/compliance/inspec/www/package.json'
15 error enoent ENOENT: no such file or directory, open '/Users/vjeffrey/code/compliance/inspec/www/package.json'
15 error enoent This is most likely not a problem with npm itself
15 error enoent and is related to npm not being able to find a file.
16 verbose exit [ -2, true ]

11
www/tutorial/.gitignore vendored Normal file
View file

@ -0,0 +1,11 @@
# Typing #
/src/typings/tsd/
/typings/
/tsd_typings/
# Node Files #
/node_modules
npm-debug.log
*.js
*.map.js

4
www/tutorial/README.md Normal file
View file

@ -0,0 +1,4 @@
## InSpec Demo
run `npm install` to load dependencies
run `npm start` to load demo in your browser

View file

@ -0,0 +1,28 @@
h1 {
color: white;
text-align: center;
font-size: 250%;
}
.demo-view {
display: block;
}
.instructions {
position: fixed;
top: 30%;
left: 35%;
width: 70%;
height: 35%;
margin-top: -9em;
margin-left: -15em;
color: white;
font-size: 18px;
line-height: 30px;
text-align: center;
}
.instructions-content {
margin: 20px 20px 20px 20px;
}

View file

@ -0,0 +1,9 @@
<h1>InSpec Demo</h1>
<div class="demo-view">
<div class="instructions">
<div class="instructions-content">
<pre> {{instructions}} </pre>
</div>
</div>
<terminal-view [responsesArray]="responsesArray" (stepCounter)="stepCounter=$event"></terminal-view>
</div>

View file

@ -0,0 +1 @@
{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAuD,eAAe,CAAC,CAAA;AACvE,qBAA+B,eAAe,CAAC,CAAA;AAC/C,mBAA2B,SAAS,CAAC,CAAA;AACrC,qBAA+B,eAAe,CAAC,CAAA;AAC/C,wCAAsC,yCAAyC,CAAC,CAAA;AAUhF;IAME,sBAAoB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;QAJ9B,gBAAW,GAAW,CAAC,CAAC;IAIU,CAAC;IAEnC,+BAAQ,GAAR;QACE,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAED,yCAAkB,GAAlB;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IACxE,CAAC;IAED,sCAAe,GAAf;QAAA,iBAYC;QAXC,eAAU,CAAC,QAAQ,CACf,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAC/C,CAAC,SAAS,CACT,UAAA,IAAI;YACF,KAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAC9B,KAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,CAAC,EACD,UAAA,GAAG,IAAI,OAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAlB,CAAkB,CAC1B,CAAC;IACJ,CAAC;IAED,mCAAY,GAAZ;QAAA,iBAaC;QAZC,eAAU,CAAC,QAAQ,CACf,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,IAAI;QAC9C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,EAAE,IAAI;QAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,EAAE,IAAI;QAC7C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,EAAE,IAAI;QACrD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC,IAAI;SAC1D,CAAC,SAAS,CACT,UAAA,IAAI;YACF,KAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,CAAC,EACD,UAAA,GAAG,IAAI,OAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAlB,CAAkB,CAC1B,CAAC;IACJ,CAAC;IApDH;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,wBAAwB;YACrC,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,SAAS,EAAE,CAAE,qBAAc,CAAE;YAC7B,UAAU,EAAE,CAAE,+CAAqB,CAAE;SACtC,CAAC;;oBAAA;IA+CF,mBAAC;AAAD,CAAC,AA7CD,IA6CC;AA7CY,oBAAY,eA6CxB,CAAA"}

View file

@ -0,0 +1,61 @@
import { Component, OnInit, Input, SimpleChange } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { HTTP_PROVIDERS } from '@angular/http';
import { TerminalViewComponent } from './terminal-view/terminal-view.component';
@Component({
selector: 'my-app',
templateUrl: 'app/app.component.html',
styleUrls: ['app/app.component.css'],
providers: [ HTTP_PROVIDERS ],
directives: [ TerminalViewComponent ]
})
export class AppComponent implements OnInit {
instructions: any;
currentStep: number = 0;
instructionsArray: any;
responsesArray: any;
constructor(private http: Http) { }
ngOnInit() {
this.getInstructions();
this.getResponses();
}
updateInstructions() {
this.instructions = this.instructionsArray[this.currentStep]['_body'];
}
getInstructions() {
Observable.forkJoin(
this.http.get('/app/instructions/step0.txt'),
this.http.get('/app/instructions/step1.txt'),
this.http.get('/app/instructions/step2.txt')
).subscribe(
data => {
this.instructionsArray = data;
this.updateInstructions();
},
err => console.error(err)
);
}
getResponses() {
Observable.forkJoin(
this.http.get('/app/responses/help.txt'), // 0
this.http.get('/app/responses/ls.txt'), // 1
this.http.get('/app/responses/pwd.txt'), // 2
this.http.get('/app/responses/inspec_exec.txt'), // 3
this.http.get('/app/responses/inspec_version.txt') // 4
).subscribe(
data => {
this.responsesArray = data;
},
err => console.error(err)
);
}
}

View file

@ -0,0 +1 @@
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAA8B,eAAe,CAAC,CAAA;AAC9C,iCAA8B,2BAA2B,CAAC,CAAA;AAE1D,8BAA8B,iBAAiB,CAAC,CAAA;AAOhD;IAAA;IAAyB,CAAC;IAL1B;QAAC,eAAQ,CAAC;YACR,OAAO,EAAO,CAAE,gCAAa,CAAE;YAC/B,YAAY,EAAE,CAAE,4BAAY,CAAE;YAC9B,SAAS,EAAK,CAAE,4BAAY,CAAE;SAC/B,CAAC;;iBAAA;IACuB,gBAAC;AAAD,CAAC,AAA1B,IAA0B;AAAb,iBAAS,YAAI,CAAA"}

View file

@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }

View file

@ -0,0 +1,7 @@
Step 0
write words here to tell people what to do.
stand up! turn around! reach high for the sky!
well done!
now start by typing
'next'

View file

@ -0,0 +1,7 @@
Step 1
hey look we made it to step 1!
here are more things to do
talk to a frog, smell a flower
stare at the sky
and try typing 'inspec exec examples/profile'

View file

@ -0,0 +1 @@
whoa there! that's all the steps we got! go experiment @ 'https://github.com/chef/inspec'

View file

@ -0,0 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,yCAAuC,mCAAmC,CAAC,CAAA;AAE3E,2BAA0B,cAAc,CAAC,CAAA;AAEzC,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC"}

5
www/tutorial/app/main.ts Normal file
View file

@ -0,0 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);

View file

@ -0,0 +1,18 @@
Commands:
inspec archive PATH # archive a profile to tar.gz (default) or zip
inspec check PATH # verify all tests at the specified PATH
inspec compliance SUBCOMMAND ... # Chef Compliance commands
inspec detect # detect the target OS
inspec env # Output shell-appropriate completion configuration
inspec exec PATHS # run all test files at the specified PATH.
inspec help [COMMAND] # Describe available commands or one specific command
inspec init TEMPLATE ... # Scaffolds a new project
inspec json PATH # read all tests in PATH and generate a JSON summary
inspec msccm SUBCOMMAND ... # Microsoft Systems Center Configuration Manager commands
inspec scap SUBCOMMAND ... # SCAP commands
inspec shell # open an interactive debugging shell
inspec supermarket SUBCOMMAND ... # Supermarket commands
inspec version # prints the version of this tool
Options:
[--diagnose], [--no-diagnose] # Show diagnostics (versions, configurations)

View file

@ -0,0 +1,10 @@
Target: local://
 ✔ tmp-1.0: Create /tmp directory
 File /tmp should be directory
File /tmp
 ✔ should be directory
Summary: 2 successful, 0 failures, 0 skipped

View file

@ -0,0 +1 @@
0.32.0

View file

@ -0,0 +1,4 @@
Berksfile Dockerfile LICENSE Rakefile docs lib test
Berksfile.lock Gemfile MAINTAINERS.md appveyor.yml examples omnibus www
CHANGELOG.md Gemfile.lock MAINTAINERS.toml bin inspec-0.30.0.gem profile.tar.gz
CONTRIBUTING.md ISSUE_TEMPLATE.md README.md coverage inspec.gemspec tasks

View file

@ -0,0 +1 @@
anonymous-web-user/inspec

View file

@ -0,0 +1,33 @@
.terminal-body {
display: inline-block;
position: fixed;
height: 50%;
width: 100%;
top: 40%;
color: white;
font-size: 18px;
}
.left {
float: left;
padding-right: 4px;
padding-top: 15px;
}
input {
display: inline-block;
background-color: black;
border: none;
color: white;
height: 50px;
width: 98%;
font-size: 18px;
}
textarea:focus, input:focus{
outline: none;
}
pre {
color: white;
}

View file

@ -0,0 +1,5 @@
<div class="terminal-body">
<div class="left"> $ </div>
<input type="text" id="input" #box (keyup.enter)="evalInput(box.value)" autofocus>
<pre id="result"> {{response}}</pre>
</div>

View file

@ -0,0 +1 @@
{"version":3,"file":"terminal-view.component.js","sourceRoot":"","sources":["terminal-view.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAuD,eAAe,CAAC,CAAA;AAOvE;IAAA;QAEY,gBAAW,GAAyB,IAAI,mBAAY,EAAU,CAAC;QAEzE,SAAI,GAAW,CAAC,CAAC;IAiCnB,CAAC;IA/BC,yCAAS,GAAT,UAAU,KAAK;QACb,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;YACf,oBAAoB;YACpB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CA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E,gDAAgD;YAC7D,SAAS,EAAE,CAAE,+CAA+C,CAAE;SAC/D,CAAC;;6BAAA;IAsCF,4BAAC;AAAD,CAAC,AArCD,IAqCC;AArCY,6BAAqB,wBAqCjC,CAAA"}

View file

@ -0,0 +1,45 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'terminal-view',
templateUrl: 'app/terminal-view/terminal-view.component.html',
styleUrls: [ 'app/terminal-view/terminal-view.component.css' ]
})
export class TerminalViewComponent {
@Input() responsesArray: any;
@Output() stepCounter: EventEmitter<number> = new EventEmitter<number>();
response: any;
step: number = 0;
evalInput(value) {
if (value.match(/^next\s*/)) {
this.step += 1;
// TODO: fix this!!!
this.stepCounter.emit(this.step);
}
else if (value.match(/^ls\s*/)) {
this.response = this.responsesArray[1]['_body'];
}
else if (value.match(/^pwd\s*/)) {
this.response = this.responsesArray[2]['_body'];
}
else if (value.match(/^inspec exec\s*(.*)/)) {
this.parseInspecExec(value);
}
else if (value.match(/^inspec\s*version\s*/)) {
this.response = this.responsesArray[4]['_body'];
}
else {
this.response = this.responsesArray[0]['_body'];
}
}
parseInspecExec(value) {
let target = value.match(/^inspec exec\s*(.*)/);
if (target === 'examples/profile') {
this.response = this.responsesArray[3]['_body'];
} else {
this.response = "Could not fetch inspec profile in '" + target[1] + "' ";
}
}
}

24
www/tutorial/index.html Normal file
View file

@ -0,0 +1,24 @@
<html>
<head>
<title>InSpec Demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>

38
www/tutorial/package.json Normal file
View file

@ -0,0 +1,38 @@
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@angular/router": "3.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.5",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.15",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings":"^1.0.4"
}
}

8
www/tutorial/styles.css Normal file
View file

@ -0,0 +1,8 @@
/* Master Styles */
body {
background-color: black;
margin: 2em;
font-family: 'Montserrat', sans-serif;
font-weight: 100;
}

View file

@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
}
}

View file

@ -0,0 +1,7 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160807145350"
}
}