Permalink
Browse files

Initial push

  • Loading branch information...
Etienne
Etienne committed Jun 3, 2017
0 parents commit 8ef62a71e032c5cceaf543c646fbea2a666a8e24
@@ -0,0 +1,30 @@
# macOS
.DS_Store
._*
.LSOverride
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Docker
_cache
_steps
_builds
_projects
# Dev
node_modules
build/
lib/
21 LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Etienne Pinchon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,49 @@
# Configuration
BIN = $(CURDIR)/node_modules/.bin
.PHONY: watch test debug release
default: lazy_bootstrap lazy_build test
# Utilities
bootstrap:
npm install
lazy_bootstrap: ; @test -d ./node_modules || make bootstrap
unbootstrap:
rm -Rf node_modules
clean:
rm -rf build
rm -Rf node_modules
# Building and testing
build: lazy_bootstrap
$(BIN)/gulp webpack:debug
lazy_build: ; @test -f ./build/hologram.debug.js || make build
test: lazy_build
$(BIN)/gulp test
lint: lazy_build
$(BIN)/gulp lint
release: lazy_bootstrap
$(BIN)/gulp webpack:release
# Distribution
dist: release
scripts/dist.sh
site-build: dist
scripts/site_builder.sh
site-upload: bootstrap site-build
$(BIN)/coffee scripts/site_builder.coffee upload
@@ -0,0 +1,24 @@
# Hologram Framework
Beyond Wonderland.
[Visit Hologram.cool](https://hologram.cool)
# Documentation
[Documentation](https://hologram.cool/docs)
[Twitter](https://twitter.com/etiennepinchon)
# Contribute
###### Reporting Issues
- Please use the issue tracker
- Try to include an example and clearly describe expected behaviour
# About
Created by Etienne Pinchon (@etiennepinchon)
[Twitter](https://twitter.com/etiennepinchon)
[Website](https://mage.cool)
©2017
@@ -0,0 +1,24 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hologram Builds</title>
<link rel="stylesheet" href="static/css/style.css">
</head>
<body>
<h1>Hologram Builds</h1>
<p>
These are builds for <a href="http://hologram.cool">Hologram</a>. Keep in mind that most of these are beta and some of them might be broken.
</p>
<table>
{{#commits}}
<tr>
<td><a href="https://github.com/etiennepinchon/Hologram/commit/{{hash}}">{{hash}}</a></td>
<td>{{date}}</td>
<td>{{author}}</td>
<td><a href="/{{hash}}/hologram.js">hologram.js</a></td>
<td><a href="/{{hash}}/Hologram.zip">download</a></td>
</tr>
{{/commits}}
</table>
</body>
</html>
@@ -0,0 +1,7 @@
body {
font: 13px/1.35em Menlo;
}
td {
padding: 4px 12px;
}
@@ -0,0 +1,127 @@
_ = require("lodash")
async = require("async")
gulp = require("gulp")
phantomjs = require("gulp-mocha-phantomjs")
webpack = require("webpack")
rename = require("gulp-rename")
template = require("gulp-template")
gutil = require("gulp-util")
{exec} = require("child_process")
coffeelint = require('gulp-coffeelint')
#-------------------------------------------------------------------------------
# Base webpack config
WEBPACK =
entry: "./hologram/Hologram.coffee"
module:
loaders: [{test: /\.coffee$/, loader: "coffee-loader"}]
resolve:
extensions: ["", ".web.coffee", ".web.js", ".coffee", ".js"]
devtool: "sourcemap"
cache: true
quiet: true
#-------------------------------------------------------------------------------
# Gulp tasks
gulp.task "watch", ["test"], ->
gulp.watch(["./*.coffee", "hologram/**", "test/tests/**", "!Version.coffee"], ["test"])
gulp.task "test", ["webpack:tests", "lint"], ->
return gulp
.src("test/phantomjs/index.html")
.pipe(phantomjs({
reporter: "dot",
viewportSize: {width: 1024, height: 768},
useColors: true,
loadImages: false
}))
gulp.task 'lint', ->
gulp.src(["./hologram/**/*.coffee", "!./hologram/Version.coffee.template", "./test/tests/**", "./test/tests.coffee", "./gulpfile.coffee", "scripts/site.coffee"])
.pipe(coffeelint())
.pipe(coffeelint.reporter())
gulp.task "version", (callback) ->
versionInfo (info) ->
# If we are on the wercker platform, we need to get the branch
# name from the env variables and remove the dirty from version.
if process.env.WERCKER_GIT_BRANCH
info.branch = process.env.WERCKER_GIT_BRANCH
info.hash = info.hash.replace("-dirty", "")
log "version", "#{info.branch}/#{info.hash} @#{info.build}"
task = gulp.src("hologram/Version.coffee.template")
.pipe(template(info))
.pipe(rename({
basename: "Version",
extname: ".coffee"
}))
.pipe(gulp.dest("build"))
callback(null, task)
################################################################################
# Webpack tasks
gulp.task "webpack:release", ["version"], (callback) ->
config = _.extend WEBPACK,
output:
filename: "build/hologram.js"
sourceMapFilename: "[file].map"
pathinfo: false
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
mangle: false
compress: {warnings: true}
})
]
webpackDev("webpack:release", config, callback)
gulp.task "webpack:tests", ["webpack:debug"], (callback) ->
config = _.extend WEBPACK,
entry: "./test/tests.coffee"
output:
filename: "test/phantomjs/tests.js"
debug: true
webpackDev("webpack:tests", config, callback)
################################################################################
# Utils
log = (task, args...) ->
gutil.log "[#{gutil.colors.yellow(task)}]", args...
command = (cmd, cb) ->
exec cmd, {cwd: __dirname}, (err, stdout, stderr) ->
cb?(null, stdout.split("\n").join(""))
webpackDev = (name, config, callback) ->
webpackDev._instances ?= {}
webpackDev._instances[name] ?= webpack(_.clone(config))
webpackBuilder = webpackDev._instances[name]
webpackBuilder.run (err, stats) ->
throw new gutil.PluginError("#{name}", err) if (err)
log name, gutil.colors.green("All ok")
callback()
versionInfo = (callback) ->
async.series [
(cb) -> command("git rev-parse --abbrev-ref HEAD", cb) # branch
(cb) -> command("git describe --always --dirty", cb) # hash
(cb) -> command("git rev-list --count HEAD", cb) # build
], (err, results) ->
callback
branch: results[0]
hash: results[1]
build: results[2]
date: Math.floor(Date.now() / 1000)
@@ -0,0 +1,12 @@
Hologram = {}
# Root level modules
Hologram.Utils = (require "./Utils")
Hologram.print = (require "./Print")
# Components
# ...
Hologram.Utils.extend(window, Hologram) if window
window.Hologram = Hologram if window
@@ -0,0 +1,36 @@
#
# Print.coffee
# Hologram Framework
#
# Created by Etienne Pinchon.
# Copyright © 2017 Etienne Pinchon. All rights reserved.
#
print = (args...)->
message = '» '+args.map((obj) -> Utils.inspect(obj)).join(", ")
sameOrigin = undefined
if App.inWebView()
try
sameOrigin = window.parent.location.host is window.location.host
catch e
sameOrigin = undefined
return if not sameOrigin
window.top._console.push message
if window.top._refreshConsole isnt undefined
window.top._refreshConsole()
else
console.log message
return
# Speed debugging
print._times = {}
print.time = (name)->
print._times[name] = window.performance.now()
return
print.timeEnd = (name)->
return if not log._times[name]
print Utils.round(window.performance.now()-print._times[name], 2)+'ms'
return
module.exports = print
Oops, something went wrong.

0 comments on commit 8ef62a7

Please sign in to comment.