From cf9fe8780cc263bf17070c1875e1d533e67661bd Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Mon, 24 Jun 2013 21:21:41 +0300 Subject: [PATCH] Dependancy updates. --- Gruntfile.js | 5 +- app/scripts/handlebars.runtime.js | 374 ++++++++++++++++++++++++++++++ app/scripts/main.js | 5 +- app/styles/main.less | 2 +- bower.json | 17 ++ component.json | 18 -- lentolaskuri.sublime-project | 4 +- package.json | 2 +- 8 files changed, 398 insertions(+), 29 deletions(-) create mode 100644 app/scripts/handlebars.runtime.js create mode 100644 bower.json delete mode 100644 component.json diff --git a/Gruntfile.js b/Gruntfile.js index 7134df9..60df8f7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -218,7 +218,7 @@ module.exports = function (grunt) { cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>/font', src: [ - 'components/font-awesome/build/assets/font-awesome/font/*.{ttf,woff,otf,eot,svg}' + 'components/font-awesome/font/*.{ttf,woff,otf,eot,svg}' ] }, { expand: true, @@ -237,7 +237,7 @@ module.exports = function (grunt) { cwd: '<%= yeoman.app %>', dest: '.tmp/font', src: [ - 'components/font-awesome/build/assets/font-awesome/font/*.{ttf,woff,otf,eot,svg}' + 'components/font-awesome/font/*.{ttf,woff,otf,eot,svg}' ] }, { expand: true, @@ -314,7 +314,6 @@ module.exports = function (grunt) { ]); grunt.registerTask('default', [ - 'jshint', 'build' ]); }; diff --git a/app/scripts/handlebars.runtime.js b/app/scripts/handlebars.runtime.js new file mode 100644 index 0000000..fac2cc5 --- /dev/null +++ b/app/scripts/handlebars.runtime.js @@ -0,0 +1,374 @@ +/* + +Copyright (C) 2011 by Yehuda Katz + +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. + +@license +*/ + +// lib/handlebars/browser-prefix.js +(function(undefined) { + var Handlebars = {}; +; +// lib/handlebars/base.js + +Handlebars.VERSION = "1.0.0"; +Handlebars.COMPILER_REVISION = 4; + +Handlebars.REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '>= 1.0.0' +}; + +Handlebars.helpers = {}; +Handlebars.partials = {}; + +var toString = Object.prototype.toString, + functionType = '[object Function]', + objectType = '[object Object]'; + +Handlebars.registerHelper = function(name, fn, inverse) { + if (toString.call(name) === objectType) { + if (inverse || fn) { throw new Handlebars.Exception('Arg not supported with multiple helpers'); } + Handlebars.Utils.extend(this.helpers, name); + } else { + if (inverse) { fn.not = inverse; } + this.helpers[name] = fn; + } +}; + +Handlebars.registerPartial = function(name, str) { + if (toString.call(name) === objectType) { + Handlebars.Utils.extend(this.partials, name); + } else { + this.partials[name] = str; + } +}; + +Handlebars.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Error("Missing helper: '" + arg + "'"); + } +}); + +Handlebars.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + var type = toString.call(context); + + if(type === functionType) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if(type === "[object Array]") { + if(context.length > 0) { + return Handlebars.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + return fn(context); + } +}); + +Handlebars.K = function() {}; + +Handlebars.createFrame = Object.create || function(object) { + Handlebars.K.prototype = object; + var obj = new Handlebars.K(); + Handlebars.K.prototype = null; + return obj; +}; + +Handlebars.logger = { + DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3, + + methodMap: {0: 'debug', 1: 'info', 2: 'warn', 3: 'error'}, + + // can be overridden in the host environment + log: function(level, obj) { + if (Handlebars.logger.level <= level) { + var method = Handlebars.logger.methodMap[level]; + if (typeof console !== 'undefined' && console[method]) { + console[method].call(console, obj); + } + } + } +}; + +Handlebars.log = function(level, obj) { Handlebars.logger.log(level, obj); }; + +Handlebars.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + var type = toString.call(context); + if(type === functionType) { context = context.call(this); } + + if (options.data) { + data = Handlebars.createFrame(options.data); + } + + if(context && typeof context === 'object') { + if(context instanceof Array){ + for(var j = context.length; i": ">", + '"': """, + "'": "'", + "`": "`" +}; + +var badChars = /[&<>"'`]/g; +var possible = /[&<>"'`]/; + +var escapeChar = function(chr) { + return escape[chr] || "&"; +}; + +Handlebars.Utils = { + extend: function(obj, value) { + for(var key in value) { + if(value.hasOwnProperty(key)) { + obj[key] = value[key]; + } + } + }, + + escapeExpression: function(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof Handlebars.SafeString) { + return string.toString(); + } else if (string == null || string === false) { + return ""; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = string.toString(); + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + }, + + isEmpty: function(value) { + if (!value && value !== 0) { + return true; + } else if(toString.call(value) === "[object Array]" && value.length === 0) { + return true; + } else { + return false; + } + } +}; +; +// lib/handlebars/runtime.js + +Handlebars.VM = { + template: function(templateSpec) { + // Just add water + var container = { + escapeExpression: Handlebars.Utils.escapeExpression, + invokePartial: Handlebars.VM.invokePartial, + programs: [], + program: function(i, fn, data) { + var programWrapper = this.programs[i]; + if(data) { + programWrapper = Handlebars.VM.program(i, fn, data); + } else if (!programWrapper) { + programWrapper = this.programs[i] = Handlebars.VM.program(i, fn); + } + return programWrapper; + }, + merge: function(param, common) { + var ret = param || common; + + if (param && common) { + ret = {}; + Handlebars.Utils.extend(ret, common); + Handlebars.Utils.extend(ret, param); + } + return ret; + }, + programWithDepth: Handlebars.VM.programWithDepth, + noop: Handlebars.VM.noop, + compilerInfo: null + }; + + return function(context, options) { + options = options || {}; + var result = templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data); + + var compilerInfo = container.compilerInfo || [], + compilerRevision = compilerInfo[0] || 1, + currentRevision = Handlebars.COMPILER_REVISION; + + if (compilerRevision !== currentRevision) { + if (compilerRevision < currentRevision) { + var runtimeVersions = Handlebars.REVISION_CHANGES[currentRevision], + compilerVersions = Handlebars.REVISION_CHANGES[compilerRevision]; + throw "Template was precompiled with an older version of Handlebars than the current runtime. "+ + "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."; + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw "Template was precompiled with a newer version of Handlebars than the current runtime. "+ + "Please update your runtime to a newer version ("+compilerInfo[1]+")."; + } + } + + return result; + }; + }, + + programWithDepth: function(i, fn, data /*, $depth */) { + var args = Array.prototype.slice.call(arguments, 3); + + var program = function(context, options) { + options = options || {}; + + return fn.apply(this, [context, options.data || data].concat(args)); + }; + program.program = i; + program.depth = args.length; + return program; + }, + program: function(i, fn, data) { + var program = function(context, options) { + options = options || {}; + + return fn(context, options.data || data); + }; + program.program = i; + program.depth = 0; + return program; + }, + noop: function() { return ""; }, + invokePartial: function(partial, name, context, helpers, partials, data) { + var options = { helpers: helpers, partials: partials, data: data }; + + if(partial === undefined) { + throw new Handlebars.Exception("The partial " + name + " could not be found"); + } else if(partial instanceof Function) { + return partial(context, options); + } else if (!Handlebars.compile) { + throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); + } else { + partials[name] = Handlebars.compile(partial, {data: data !== undefined}); + return partials[name](context, options); + } + } +}; + +Handlebars.template = Handlebars.VM.template; +; +// lib/handlebars/browser-suffix.js + if (typeof module === 'object' && module.exports) { + // CommonJS + module.exports = Handlebars; + + } else if (typeof define === "function" && define.amd) { + // AMD modules + define(function() { return Handlebars; }); + + } else { + // other, i.e. browser + this.Handlebars = Handlebars; + } +}).call(this); +; diff --git a/app/scripts/main.js b/app/scripts/main.js index bcc8c95..fcfdd2f 100644 --- a/app/scripts/main.js +++ b/app/scripts/main.js @@ -11,7 +11,7 @@ require.config({ bootstrap: '../scripts/bootstrap', select2: '../components/select2/select2', lodash: '../components/lodash/lodash', - handlebars: '../components/handlebars/handlebars.runtime', + handlebars: 'handlebars.runtime', Template: '../scripts/templates', 'jquery-ui-core': '../components/jquery-ui/ui/jquery.ui.core', 'jquery-ui-mouse': '../components/jquery-ui/ui/jquery.ui.mouse', @@ -41,9 +41,6 @@ require.config({ 'jquery-ui-sortable': { deps: ['jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'], exports: 'jquery' - }, - handlebars: { - exports: 'Handlebars' } } }); diff --git a/app/styles/main.less b/app/styles/main.less index fc7205b..e68dbda 100644 --- a/app/styles/main.less +++ b/app/styles/main.less @@ -1,6 +1,6 @@ @import 'bootstrap/less/bootstrap'; @import 'bootstrap/less/responsive'; -@import 'font-awesome/build/assets/font-awesome/less/font-awesome'; +@import 'font-awesome/less/font-awesome'; @import (less) 'select2/select2.css'; .calculator { diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..9c31a0d --- /dev/null +++ b/bower.json @@ -0,0 +1,17 @@ +{ + "name": "lentolaskuri2", + "version": "0.0.0", + "dependencies": { + "backbone": "git://github.com/documentcloud/backbone.git#1.0.0", + "bootstrap": "~2.3.2", + "requirejs": "git://github.com/jrburke/requirejs#~2.1.5", + "jquery": "git://github.com/components/jquery.git#~1.8.3", + "select2": "3.4.0", + "lodash": "~1.3.1", + "font-awesome": "~3.2.1", + "jquery-ui": "~1.10.3", + "requirejs-plugins": "git://github.com/millermedeiros/requirejs-plugins.git", + "Backbone-Mediator": "latest", + "i18next": "~1.6.0" + } +} diff --git a/component.json b/component.json deleted file mode 100644 index c319647..0000000 --- a/component.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "lentolaskuri2", - "version": "0.0.0", - "dependencies": { - "backbone": "git://github.com/documentcloud/backbone.git#1.0.0", - "bootstrap": "git://github.com/twitter/bootstrap.git#2.3.1", - "requirejs": "git://github.com/jrburke/requirejs#2.1.5", - "jquery": "git://github.com/components/jquery.git#1.9.1", - "select2": "git://github.com/ivaynberg/select2.git#~3.3.1", - "lodash": "git://github.com/bestiejs/lodash.git#1.0.1", - "font-awesome": "~3.1.1", - "handlebars": "git://github.com/components/handlebars.js#1.0.0-rc.4", - "jquery-ui": "git://github.com/components/jqueryui#1.10.1", - "requirejs-plugins": "git://github.com/millermedeiros/requirejs-plugins.git", - "Backbone-Mediator": "latest", - "i18next": "~1.6.0" - } -} diff --git a/lentolaskuri.sublime-project b/lentolaskuri.sublime-project index db73789..d3372cf 100644 --- a/lentolaskuri.sublime-project +++ b/lentolaskuri.sublime-project @@ -2,8 +2,8 @@ "folders": [ { - "path": "/home/juho/Source/tyo/lentolaskuri2", - "folder_exclude_patterns": ["node_modules", ".cache", ".tmp", "app/components"] + "path": ".", + "folder_exclude_patterns": ["node_modules", ".cache", ".tmp"] } ], "ternjs": { diff --git a/package.json b/package.json index 75febb1..7e874d3 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "grunt-contrib-concat": "~0.1.2", "grunt-contrib-coffee": "~0.4.0", "grunt-contrib-uglify": "~0.1.1", - "grunt-contrib-less": "~0.5.0", + "grunt-contrib-less": "~0.6.1", "grunt-contrib-jshint": "~0.1.1", "grunt-contrib-cssmin": "~0.4.1", "grunt-contrib-connect": "0.1.2",