Skip to content

Commit

Permalink
Getting build files, Makefile, etc. in place to import Handlebars.
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrove committed Oct 12, 2011
1 parent f1b4847 commit 5de853a
Show file tree
Hide file tree
Showing 16 changed files with 312 additions and 0 deletions.
31 changes: 31 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,40 @@ list of third party contributions to YUI.
Utility, Douglas Crockford's JSON parsing and stringifying methods are
adapted from work published at [JSON.org](http://json.org/). The adapted
work is in the public domain.

* **Robert Penner's animation-easing algorithms:** In the Animation Utility,
YUI makes use of Robert Penner's algorithms for easing.

* **Diego Perini's IEContentLoaded technique:** The Event Utility employs
[a technique developed by Diego Perini](http://javascript.nwbox.com/IEContentLoaded/)
and licensed under GPL. YUI's use of this technique is included under our
BSD license with the author's permission.

* **Handlebars.js**: The Handlebars component is a YUI port of
[Handlebars.js](https://github.com/wycats/handlebars.js) by Yehuda Katz. It
is distributed with YUI under the terms of the MIT License below.


Handlebars.js MIT License
-------------------------

Copyright (C) 2011 by Yehuda Katz
<https://github.com/wycats/handlebars.js>

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.
7 changes: 7 additions & 0 deletions src/handlebars/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Handlebars Change History
=========================

3.5.0
-----

* Initial release.
20 changes: 20 additions & 0 deletions src/handlebars/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (C) 2011 by Yehuda Katz
<https://github.com/wycats/handlebars.js>

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.
60 changes: 60 additions & 0 deletions src/handlebars/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -- Constants -----------------------------------------------------------------

# Path to the "lib" directory of a Handlebars.js git checkout.
HANDLEBARS_LIB = $(PWD)/../../../handlebars.js/lib

# Path to which YUI Handlebars source files should be written.
OUTPUT_DIR = $(PWD)/js

# Comment to prepend to the imported source files.
PREPEND_COMMENT = /* THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT! */\n

# Files that make up the handlebars-base module.
BASE_FILES = \
$(HANDLEBARS_LIB)/handlebars/base.js \
$(HANDLEBARS_LIB)/handlebars/utils.js \
$(HANDLEBARS_LIB)/handlebars/vm.js

# Files that make up the handlebars-compiler module.
COMPILER_FILES = \
$(HANDLEBARS_LIB)/handlebars/compiler/parser.js \
$(HANDLEBARS_LIB)/handlebars/compiler/base.js \
$(HANDLEBARS_LIB)/handlebars/compiler/ast.js \
$(HANDLEBARS_LIB)/handlebars/compiler/compiler.js

# -- Targets -------------------------------------------------------------------

BASE_TARGETS = $(addprefix $(OUTPUT_DIR)/handlebars-, $(notdir $(BASE_FILES)))
COMPILER_TARGETS = $(addprefix $(OUTPUT_DIR)/handlebars-compiler-, $(notdir $(COMPILER_FILES)))

# target: all - Default target.
all: import-base import-compiler

# target: clean - Removes imported source files.
clean:
rm -f $(BASE_TARGETS) $(COMPILER_TARGETS)

# target: import-base - Imports the source files that make up handlebars-base.
import-base: $(BASE_TARGETS)

# target: import-compiler - Imports the source files that make up handlebars-compiler.
import-compiler: $(COMPILER_TARGETS)

# target: help - Displays help.
help:
@egrep "^# target:" Makefile

$(OUTPUT_DIR)/handlebars-%.js: $(HANDLEBARS_LIB)/handlebars/%.js
@echo "$(notdir $@)"
@echo "$(PREPEND_COMMENT)" > $@
@sed -n '/^\/\/ BEGIN(BROWSER)$$/,/^\/\/ END(BROWSER)$$/p' $< >> $@

$(OUTPUT_DIR)/handlebars-compiler-%.js: $(HANDLEBARS_LIB)/handlebars/compiler/%.js
@echo "$(notdir $@)"
@echo "$(PREPEND_COMMENT)" > $@
@sed -n '/^\/\/ BEGIN(BROWSER)$$/,/^\/\/ END(BROWSER)$$/p' $< >> $@

$(OUTPUT_DIR)/handlebars-compiler-parser.js: $(HANDLEBARS_LIB)/handlebars/compiler/parser.js
@echo "$(notdir $@)"
@echo "$(PREPEND_COMMENT)" > $@
@cat $< >> $@
31 changes: 31 additions & 0 deletions src/handlebars/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Handlebars
==========

Handlebars is a simple template language inspired by Mustache. This is a YUI
port of the original Handlebars project, which can be found at
<https://github.com/wycats/handlebars.js>.


License
=======

Copyright (C) 2011 by Yehuda Katz
<https://github.com/wycats/handlebars.js>

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.
6 changes: 6 additions & 0 deletions src/handlebars/build-handlebars-base.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
builddir=../../../builder/componentbuild
srcdir=../..

component=handlebars-base
component.jsfiles=handlebars-copyright.js, handlebars-base.js, handlebars-utils.js, handlebars-vm.js
component.requires=escape
7 changes: 7 additions & 0 deletions src/handlebars/build-handlebars-base.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="YUI" default="local">
<property environment="env" />
<property file="build-handlebars-base.properties" />
<import file="${builddir}/3.x/bootstrap.xml"
description="Default Build Properties and Targets" />
</project>
6 changes: 6 additions & 0 deletions src/handlebars/build-handlebars-compiler.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
builddir=../../../builder/componentbuild
srcdir=../..

component=handlebars-compiler
component.jsfiles=handlebars-copyright.js, handlebars-compiler-parser.js, handlebars-compiler-base.js, handlebars-compiler-ast.js, handlebars-compiler-compiler.js
component.requires=yui-base
7 changes: 7 additions & 0 deletions src/handlebars/build-handlebars-compiler.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="YUI" default="local">
<property environment="env" />
<property file="build-handlebars-compiler.properties" />
<import file="${builddir}/3.x/bootstrap.xml"
description="Default Build Properties and Targets" />
</project>
26 changes: 26 additions & 0 deletions src/handlebars/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="YUI" default="local">
<description>Handlebars - Build All Modules</description>

<macrodef name="build-handlebars">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<fileset dir="." includes="build-*.xml"/>
</subant>
</sequential>
</macrodef>

<target name="local">
<build-handlebars target="local"/>
</target>
<target name="deploy">
<build-handlebars target="deploy"/>
</target>
<target name="all">
<build-handlebars target="all"/>
</target>
<target name="clean">
<build-handlebars target="clean"/>
</target>
</project>
12 changes: 12 additions & 0 deletions src/handlebars/docs/component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name" : "handlebars",
"displayName": "Handlebars",
"description": "A simple template language inspired by Mustache.",
"author" : ["rgrove"],

"tags": [
"utility", "beta", "template", "templating", "mustache", "view"
],

"use": ["handlebars"]
}
8 changes: 8 additions & 0 deletions src/handlebars/docs/index.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="intro">
<p>
Handlebars is a simple template language inspired by Mustache. This is a YUI port of the <a href="https://github.com/wycats/handlebars.js">original Handlebars project</a>.
</p>
</div>

{{>getting-started}}

4 changes: 4 additions & 0 deletions src/handlebars/js/handlebars-copyright.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*!
Handlebars.js - Copyright (C) 2011 Yehuda Katz
https://raw.github.com/rgrove/handlebars.js/master/LICENSE
*/
15 changes: 15 additions & 0 deletions src/handlebars/meta/handlebars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"handlebars": {
"use": ["handlebars-base", "handlebars-compiler"],

"submodules": {
"handlebars-base": {
"requires": ["escape"]
},

"handlebars-compiler": {
"requires": ["yui-base"]
}
}
}
}
32 changes: 32 additions & 0 deletions src/handlebars/tests/handlebars-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
YUI.add('handlebars-test', function (Y) {

var Assert = Y.Assert,

suite;

suite = new Y.Test.Suite({
name: 'Handlebars',

setUp: function () {
},

tearDown: function () {
}
});

// -- Lifecycle ----------------------------------------------------------------
suite.add(new Y.Test.Case({
name: 'Lifecycle',

setUp: function () {
},

tearDown: function () {
}
}));

Y.Test.Runner.add(suite);

}, '@VERSION@', {
requires: ['handlebars', 'test']
});
40 changes: 40 additions & 0 deletions src/handlebars/tests/handlebars.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Page</title>
</head>
<body class="yui3-skin-sam">

<div id="log"></div>

<script src="../../../build/yui/yui.js"></script>
<script>
var Y = YUI({
allowRollup: false,
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
modules: {
'test-console': {
fullpath : '../../common/tests/assets/test-console.js',
requires : ['console-filters'],
skinnable: true
},

'skin-sam-test-console': {
fullpath: '../../common/tests/assets/test-console.css',
type : 'css'
},

'handlebars-test': {
fullpath: 'handlebars-test.js',
requires: ['handlebars', 'test']
}
},
useBrowserConsole: false
}).use('handlebars-test', 'test-console', function (Y) {
Y.Test.Runner.run();
});
</script>

</body>
</html>

0 comments on commit 5de853a

Please sign in to comment.