Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Mar 1, 2017
1 parent 350bca4 commit fab7b90
Show file tree
Hide file tree
Showing 43 changed files with 2,033 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Build and Release Folders
node_modules/
bin/

# Dev files
npm-debug.log

# Project property files
.idea/
.project
.DS_Store
*.iml

# Misc
deploy_key
deploy_key.pub
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- stable
script: bash ./deploy.sh
env:
global:
- ENCRYPTION_LABEL: 1336e6414326
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,64 @@
# docs
# Modules
Awayjs is composed of a series of modules which implement and isolate specific functionalities, allowing for a very flexible configuration of feature sets.
TODO

**More info needed.**

## [@awayjs/core](modules/core/)
Core-most API wrapping common math, loading, and miscelaneous utilities, including basic architectural implementations.

**More info needed.**

## [@awayjs/graphics](modules/graphics/)
Basic 2D image rendering logic capable of image management both in the gpu as well as the cpu.

*dependencies: core*

**More info needed.**

## [@awayjs/materials](modules/materials/)
General 3D material implementations for use in the 3D rendering.

*dependencies: core, graphics, renderer, scene, stage*

**More info needed.**

## [@awayjs/parsers](modules/parsers/)
Extensive support for file formats such as awd, md2, md5, max, obj, etc.

*dependencies: core, graphics, materials, player, renderer, scene, stage*

**More info needed.**

## [@awayjs/player](modules/player/)

*dependencies: core, graphics, renderer, scene, stage*

**More info needed.**

## [@awayjs/renderer](modules/renderer/)
Rendering pipeline implementations for webgl, cpu, etc.

*dependencies: core, graphics, scene, stage*

**More info needed.**

## [@awayjs/scene](modules/scene/)
General scenegraph implementation for things like camera, lights, graphic nodes, etc.

*dependencies: core, graphics*

**More info needed.**

## [@awayjs/stage](modules/stage/)
Low level GPU, CPU interface.

*dependencies: core, graphics*

**More info needed.**

## [@awayjs/view](modules/view/)

*dependencies: core, graphics, renderer, scene, stage*

**More info needed.**
872 changes: 872 additions & 0 deletions assets/css/main.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions assets/css/main.css.map

Large diffs are not rendered by default.

Binary file added assets/images/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/widgets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/js/main.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions assets/js/modernizr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 106 additions & 0 deletions awaydoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/env node

var typedoc = require('typedoc');
var handlebars = require('handlebars');
var fs = require('fs');
var nav = require("../../typedoc/dist/lib/output/models/NavigationItem.js");
var mini = require('minimist');

console.log("~awaydoc~ running typedoc API...");

// Read cli arguments.
var argv = mini(process.argv.slice(2));
// console.dir("arguments: " + JSON.stringify(argv));
var name = argv["name"] || "";
var out = argv["out"] || "bin";
var tsconfig = argv["tsconfig"] || "tsconfig.json";
var sources = argv["sources"] || "lib";

// Initialize typedoc API.
var options = {
"out": out,
"name": name,
"json": "",
"theme": ".",
"mode": "file",
"logger": "console",
"moduleResolution": "node",
"includeDeclarations": true,
"ignoreCompilerErrors": true,
"excludePrivate": true,
"excludeNotExported": true,
"excludeExternals": true,
"includes": "includes",
"tsconfig": tsconfig
};
// console.dir("arguments: " + JSON.stringify(options));
var app = new typedoc.Application(options);

// Register handlebars helpers.
handlebars.registerHelper('newLine', function () { return '\n'; });

// Tweak typedoc for custom output.
(function modifyTypedoc() {
"use strict";

// Modify Renderer.prepareTheme()
// The theme will be modified. Intercepting this method
// will make sure we do that when the theme is available.
var origPrepareTheme = app.renderer.prepareTheme;
app.renderer.prepareTheme = function modPrepareTheme() {
console.log("~awaydoc~ modifying prepareTheme()");

var success = origPrepareTheme.call(this);

// Remove unwanted plugins.
app.renderer.removeComponent('pretty-print');

// Always keep the nav at the project root.
app.renderer.removeComponent('toc');
function buildToc(model, parent, level) {
var children = model.children || [];
children.forEach((child) => {
nav.NavigationItem.create(child, parent, true);
});
}
this.listenTo(app.renderer, 'beginPage', function onRendererBeginPage(page){
var model = page.project;
page.toc = new nav.NavigationItem();
buildToc(model, page.toc, 0);
});

// Keep camelcase in URLs.
var origGetUrls = app.renderer.theme.getUrls;
app.renderer.theme.getUrls = function modGetURls(project) {
console.log("~awaydoc~ modifying theme.getUrls()");

// Reflection.getAlias() uses toLowerCase(),
// here, we state that we want the original class names as aliases.
function applyAlias(obj) {
if (obj.children) {
obj.children.forEach((child) => {
child._alias = child.name;
applyAlias(child);
});
}
}
applyAlias(project);

return origGetUrls.call(this, project);
}

// Modify existing files check.
app.renderer.theme.isOutputDirectory = function(path) {
return true;
}

return success;
};
})();

// Trigger doc generation.
var files = app.expandInputFiles([sources]);
app.generateDocs(files, options.out);
if(options.json && options.json !== "") {
app.generateJson(files, options.json);
}
74 changes: 74 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash

# See: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
# Script by Domenic

set -e # Exit with nonzero exit code if anything fails

SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"

function doCompile {
echo "Compiling docs..."
npm run docs
}

# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
echo "Not a dev branch commit, skipping docs deploy."
exit 0
fi

# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`

# Clone the existing gh-pages for this repo into out/
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply)
echo "Creating deploy branch..."
git clone $REPO out
cd out
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
cd ..

# Clean out existing contents
echo "Clearing docs..."
mv out/.git .git-gh-pages || true
rm -rf out || exit 0
mkdir out
mv .git-gh-pages out/.git
ls -la out

# Run our compile script
echo "Compiling documentation..."
doCompile
rm -f docs/bin/docs.json
cp -r docs/bin/* out/
ls -la out

# Now let's go have some fun with the cloned repo
cd out
git config user.name "Travis CI"
git config user.email "[email protected]"

# Commit the "changes", i.e. the new version.
# The delta will show diffs between new and old versions.
echo "Committing changes..."
git add -A
git commit -m "Deploy to GitHub Pages: ${SHA}"

# Get the deploy key by using Travis's stored variables to decrypt key.enc
echo "Decrypting github keys..."
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key

# Now that we're all set up, we can push.
echo "Pushing build..."
git push $SSH_REPO $TARGET_BRANCH
Binary file added deploy_key.enc
Binary file not shown.
43 changes: 43 additions & 0 deletions layouts/default.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!doctype html>
<html class="default no-js toggle-inherited">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{#ifCond model.name '==' project.name}}{{project.name}}{{else}}{{model.name}} | {{project.name}}{{/ifCond}}</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="{{relativeURL "assets/css/main.css"}}">
<script src="{{relativeURL "assets/js/modernizr.js"}}"></script>
</head>
<body>

{{> header}}

<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
{{{contents}}}
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
{{#each toc.children}}
{{> toc.root}}
{{/each}}
</ul>
</nav>
</div>
</div>
</div>

{{> footer}}

<div class="overlay"></div>
<script src="{{relativeURL "assets/js/main.js"}}"></script>
<script>if (location.protocol == 'file:') document.write('<script src="{{relativeURL "assets/js/search.js"}}"><' + '/script>');</script>

{{> analytics}}

</body>
</html>
3 changes: 3 additions & 0 deletions lib/dummy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**
* Dummy file needed for typedoc to compile root module.
*/
Loading

0 comments on commit fab7b90

Please sign in to comment.