-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #1
- Loading branch information
Showing
15 changed files
with
337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var through = require('through2'); | ||
var gutil = require('gulp-util'); | ||
var PluginError = gutil.PluginError; | ||
|
||
module.exports = function() { | ||
|
||
function processHspFile(file, enc, cb){ | ||
|
||
if(file.isStream()){ | ||
this.emit('error', new PluginError('gulp-html2hsp', 'Streaming not supported')); | ||
return cb(); | ||
} | ||
|
||
if(file.isBuffer()){ | ||
try { | ||
var content = String(file.contents); | ||
content = "{export template description()}\r\n" + content + "\r\n{/template}"; | ||
file.contents = new Buffer(content); | ||
file.path = gutil.replaceExtension(file.path, ".hsp"); | ||
} catch(e) { | ||
this.emit('error', e); | ||
} | ||
} | ||
|
||
this.push(file); | ||
cb(); | ||
} | ||
|
||
return through.obj(processHspFile); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var through = require('through2'); | ||
var gutil = require('gulp-util'); | ||
var PluginError = gutil.PluginError; | ||
|
||
module.exports = function() { | ||
|
||
function processHspFile(file, enc, cb){ | ||
|
||
if(file.isStream()){ | ||
this.emit('error', new PluginError('gulp-removehtmlcommenttags', 'Streaming not supported')); | ||
return cb(); | ||
} | ||
|
||
if(file.isBuffer()){ | ||
try { | ||
var content = String(file.contents); | ||
content = content.replace("<!--", "").replace("-->", ""); | ||
file.contents = new Buffer(content); | ||
} catch(e) { | ||
this.emit('error', e); | ||
} | ||
} | ||
this.push(file); | ||
cb(); | ||
} | ||
|
||
return through.obj(processHspFile); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is the documentation of the carousel component! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var description = require('./README.hsp').description; | ||
var carouselCpt = require('../../carousel/carousel.hsp').carousel; | ||
|
||
{export template demo()} | ||
This is a demo of the carousel component! | ||
<#carouselCpt /> | ||
Updated again! | ||
<#description /> | ||
{/template} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="./demo.css"> | ||
<title>Hashspace - Bootstrap</title> | ||
<script src="http://noder-js.ariatemplates.com/dist/master/noder.min.js" type="text/javascript"> | ||
{ | ||
packaging: { | ||
baseUrl: "/" | ||
} | ||
} | ||
</script> | ||
<script src="http://hashspace.ariatemplates.com/dist/0.0.4/hashspace-noder.min.js" type="text/javascript"></script> | ||
<!--<script src="./hashspace-bootstrap.js" type="text/javascript"></script> | ||
<script src="./hashspace-bootstrap-demo.js" type="text/javascript"></script>--> | ||
<script type="noder"> | ||
var carousel = require('./demo/carousel/demo.hsp').demo; | ||
carousel().render(document.body); | ||
</script> | ||
|
||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = function (grunt) { | ||
|
||
grunt.initConfig({ | ||
atpackager : { | ||
options : { | ||
sourceDirectories : ['target/dev'], | ||
sourceFiles : [ '**/*.js', '**/*.hsp'], | ||
outputDirectory : 'target/prod/', | ||
visitors : ["NoderDependencies"] | ||
}, | ||
bootstrap : { | ||
options : { | ||
defaultBuilder : { | ||
type : "NoderPackage", | ||
cfg : { | ||
outputFileWrapper : "(function(define){$CONTENT$;})(noder.define);" | ||
} | ||
}, | ||
packages : [ | ||
{ | ||
name : "hashspace-bootstrap-demo.js", | ||
files : ['demo/**/*.js', 'demo/**/*.hsp'] | ||
}, { | ||
name : "hashspace-bootstrap.js", | ||
files : ['**/*.js', '**/*.hsp', '!demo/**/*.*'] | ||
}] | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// Automatically load all the grunt tasks | ||
require('load-grunt-tasks')(grunt); | ||
grunt.loadNpmTasks('atpackager'); | ||
require('atpackager').loadNpmPlugin('noder-js'); | ||
|
||
grunt.registerTask('package', ['atpackager:bootstrap']); | ||
grunt.registerTask('default', ['package']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
var gulp = require('gulp'); | ||
var gutil = require('gulp-util'); | ||
var watch = require('gulp-watch'); | ||
var markdown = require('gulp-markdown'); | ||
var hsp = require('gulp-hashspace'); | ||
var clean = require('gulp-clean'); | ||
var uglify = require('gulp-uglify'); | ||
var jshint = require('gulp-jshint'); | ||
var html2hsp = require('./build/gulp-html2hsp'); | ||
var removehtmlcommenttags = require('./build/gulp-removehtmlcommenttags'); | ||
var http = require('http'); | ||
var karma = require('karma').server; | ||
var connect = require('connect'); | ||
var _ = require('lodash'); | ||
|
||
|
||
require('gulp-grunt')(gulp); | ||
var wwwServerPort = 8080; | ||
var _destFolder = "target"; | ||
var _devFolder = _destFolder + "/dev"; | ||
var _prodFolder = _destFolder + "/prod"; | ||
|
||
var karmaCommonConf = { | ||
browsers: ['Chrome'], | ||
files: [ | ||
'src/**/*.hsp', | ||
'src/**/*.js', | ||
'test/**/*.spec.js', | ||
'./node_modules/hashspace/hsp/*.js', | ||
'./node_modules/hashspace/hsp/rt/**/*.js', | ||
'./node_modules/hashspace/hsp/gestures/**/*.js' | ||
], | ||
frameworks: ['mocha', 'chai', 'commonjs'], | ||
preprocessors: { | ||
'src/**/*.hsp': ['hsp-compile', 'commonjs'], | ||
'src/**/*.js': ['hsp-transpile', 'commonjs'], | ||
'test/**/*.spec.js': ['commonjs'], | ||
'./node_modules/hashspace/hsp/**/*.js': ['commonjs'] | ||
}, | ||
commonjsPreprocessor: { | ||
modulesRoot: './node_modules/hashspace' | ||
} | ||
}; | ||
|
||
gulp.task('checkstyle', function() { | ||
return gulp.src(['src/**/*.js', 'demo/**/*.js', 'test/**/*.js', 'build/**/*.js']).pipe(jshint()).pipe(jshint.reporter("default")).pipe(jshint.reporter("fail")); | ||
}); | ||
|
||
gulp.task('clean', ['checkstyle'], function(){ | ||
return gulp.src(_destFolder, {read: false}).pipe(clean()); | ||
}); | ||
|
||
gulp.task('build', ['clean'], function() { | ||
gulp.src(['demo/**/*.html', 'demo/**/*.css']).pipe(gulp.dest(_devFolder)); | ||
gulp.src('demo/**/*.md').pipe(markdown()).pipe(html2hsp()).pipe(hsp.compile()).pipe(gulp.dest(_devFolder + '/demo')); | ||
gulp.src('demo/**/*.hsp').pipe(hsp.compile()).pipe(gulp.dest(_devFolder + '/demo')); | ||
gulp.src('demo/**/*.js').pipe(hsp.transpile()).pipe(gulp.dest(_devFolder + '/demo')); | ||
gulp.src('src/**/*.hsp').pipe(hsp.compile()).pipe(gulp.dest(_devFolder)); | ||
gulp.src('src/**/*.js').pipe(hsp.transpile()).pipe(gulp.dest(_devFolder)); | ||
}); | ||
|
||
gulp.task('test', ['checkstyle'], function (done) { | ||
return karma.start(_.assign({}, karmaCommonConf, {singleRun: true}), done); | ||
}); | ||
|
||
gulp.task('play', ['clean'], function () { | ||
watch({glob: ['demo/**/*.html', 'demo/**/*.css']}, function (files) { | ||
files.pipe(gulp.dest(_devFolder)); | ||
}); | ||
watch({glob: 'demo/**/*.md'}, function (files) { | ||
files.pipe(markdown().on('error', gutil.log)).pipe(html2hsp()).pipe(hsp.compile()).pipe(gulp.dest(_devFolder + '/demo')); | ||
}); | ||
watch({glob: 'demo/**/*.hsp'}, function (files) { | ||
files.pipe(hsp.compile().on('error', gutil.log)).pipe(gulp.dest(_devFolder + '/demo')); | ||
}); | ||
watch({glob: 'src/**/*.hsp'}, function (files) { | ||
files.pipe(hsp.compile().on('error', gutil.log)).pipe(gulp.dest(_devFolder)); | ||
}); | ||
watch({glob: 'src/**/*.js'}, function (files) { | ||
files.pipe(hsp.transpile().on('error', gutil.log)).pipe(gulp.dest(_devFolder)); | ||
}); | ||
|
||
gutil.log('Starting WWW server at http://localhost:' + wwwServerPort); | ||
http.createServer(connect().use(connect.static('./' + _devFolder))).listen(wwwServerPort); | ||
}); | ||
|
||
gulp.task('tdd', function (done) { | ||
karma.start(_.assign({}, karmaCommonConf), done); | ||
}); | ||
|
||
gulp.task('package', ['build', 'grunt-package'], function() { | ||
gulp.src([_devFolder + '/**/*.html', _devFolder + '/**/*.css']).pipe(removehtmlcommenttags()).pipe(gulp.dest(_prodFolder)); | ||
gulp.src(_prodFolder + '/*.js').pipe(uglify()).pipe(gulp.dest(_prodFolder)); | ||
}) | ||
|
||
gulp.task('www', ['package'], function() { | ||
gutil.log('Starting WWW server at http://localhost:' + wwwServerPort); | ||
http.createServer(connect().use(connect.static('./' + _prodFolder))).listen(wwwServerPort); | ||
}); | ||
|
||
gulp.task('default', ['package']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"author": "ariatemplates <[email protected]> (http://github.com/ariatemplates)", | ||
"name": "hashspace-bootstrap", | ||
"description": "Hashspace components for Bootstrap", | ||
"version": "0.0.1-SNAPSHOT", | ||
"homepage": "http://ariatemplates.github.io/hashspace-bootstrap/", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"gulp": "~3.8.1", | ||
"gulp-util": "~2.2.17", | ||
"gulp-watch": "~0.6.8", | ||
"gulp-clean": "~0.3.0", | ||
"gulp-markdown": "~0.1.2", | ||
"gulp-grunt": "~0.5.1", | ||
"gulp-hashspace": "~0.0.2", | ||
"gulp-uglify": "~0.3.1", | ||
"gulp-jshint" : "~1.6.3", | ||
"hashspace": "~0.0.4", | ||
"through2": "~0.4.1", | ||
"grunt": "~0.4.2", | ||
"load-grunt-tasks": "~0.2.1", | ||
"noder-js": "1.4.0", | ||
"atpackager": "~0.2.2", | ||
"connect": "~2.14.2", | ||
"karma-chrome-launcher": "~0.1.2", | ||
"karma-mocha": "~0.1.3", | ||
"karma-commonjs": "~0.0.9", | ||
"karma-hashspace": "~0.0.1", | ||
"chai": "~1.9.1", | ||
"karma-chai": "~0.1.0", | ||
"lodash": "~2.4.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var CarouselController = require("./carousel").CarouselController; | ||
|
||
{export template carousel using ctrl:CarouselController} | ||
<h1 class="carousel">Hello carousel</h1> | ||
{/template} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var klass = require("hsp/klass"); | ||
|
||
exports.CarouselController = new klass({ | ||
$constructor: function () { | ||
this.slide = 0; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var carouselTpl = require('../../src/carousel/carousel.hsp').carousel; | ||
|
||
describe('Carousel', function() { | ||
|
||
it('should say Hello carousel', function() { | ||
var n = carouselTpl(); | ||
expect(n.node.firstChild.textContent).to.equal('Hello carousel'); | ||
var a = 1; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var CarouselController = require('../../src/carousel/carousel.js').CarouselController; | ||
|
||
describe('Carousel controller', function() { | ||
|
||
var ctrl; | ||
beforeEach(function(){ | ||
ctrl = new CarouselController(); | ||
}); | ||
|
||
it('should have the index 0 slide by default', function() { | ||
expect(ctrl.slide).to.equal(0); | ||
}); | ||
}); |