From 3038aec20cd95e8e6ca4ca21cb123e8cbde5c9b9 Mon Sep 17 00:00:00 2001 From: addyosmani Date: Fri, 24 Aug 2012 16:01:31 +0100 Subject: [PATCH] Adding rewritten Backbone-Rails generator for #246 --- cli/lib/generators/backbone/all/index.js | 38 +- cli/lib/generators/backbone/app/index.js | 18 + .../backbone/app/templates/.gitattributes | 1 + .../backbone/app/templates/.gitignore | 2 + .../backbone/app/templates/Gruntfile.js | 174 + .../backbone/app/templates/app/.htaccess | 553 ++ .../backbone/app/templates/app/404.html | 157 + .../backbone/app/templates/app/favicon.ico | Bin 0 -> 4286 bytes .../backbone/app/templates/app/index.html | 56 + .../backbone/app/templates/app/robots.txt | 3 + .../app/scripts/vendor/backbone-min.js | 38 + .../app/scripts/vendor/jquery.min.js | 2 + .../app/scripts/vendor/lodash.min.js | 41 + .../app/templates/app/styles/main.css | 1 + .../backbone/app/templates/package.json | 7 + .../backbone/app/templates/test/index.html | 47 + .../backbone/app/templates/test/lib/chai.js | 3464 +++++++++++++ .../backbone/app/templates/test/lib/expect.js | 1202 +++++ .../templates/test/lib/mocha-1.2.2/mocha.css | 182 + .../templates/test/lib/mocha-1.2.2/mocha.js | 4494 +++++++++++++++++ .../app/templates/test/runner/mocha.js | 41 + cli/lib/generators/backbone/readme.md | 37 +- 22 files changed, 10499 insertions(+), 59 deletions(-) create mode 100644 cli/lib/generators/backbone/app/index.js create mode 100644 cli/lib/generators/backbone/app/templates/.gitattributes create mode 100644 cli/lib/generators/backbone/app/templates/.gitignore create mode 100644 cli/lib/generators/backbone/app/templates/Gruntfile.js create mode 100644 cli/lib/generators/backbone/app/templates/app/.htaccess create mode 100644 cli/lib/generators/backbone/app/templates/app/404.html create mode 100644 cli/lib/generators/backbone/app/templates/app/favicon.ico create mode 100644 cli/lib/generators/backbone/app/templates/app/index.html create mode 100644 cli/lib/generators/backbone/app/templates/app/robots.txt create mode 100644 cli/lib/generators/backbone/app/templates/app/scripts/vendor/backbone-min.js create mode 100644 cli/lib/generators/backbone/app/templates/app/scripts/vendor/jquery.min.js create mode 100644 cli/lib/generators/backbone/app/templates/app/scripts/vendor/lodash.min.js create mode 100644 cli/lib/generators/backbone/app/templates/app/styles/main.css create mode 100644 cli/lib/generators/backbone/app/templates/package.json create mode 100644 cli/lib/generators/backbone/app/templates/test/index.html create mode 100644 cli/lib/generators/backbone/app/templates/test/lib/chai.js create mode 100644 cli/lib/generators/backbone/app/templates/test/lib/expect.js create mode 100644 cli/lib/generators/backbone/app/templates/test/lib/mocha-1.2.2/mocha.css create mode 100644 cli/lib/generators/backbone/app/templates/test/lib/mocha-1.2.2/mocha.js create mode 100644 cli/lib/generators/backbone/app/templates/test/runner/mocha.js diff --git a/cli/lib/generators/backbone/all/index.js b/cli/lib/generators/backbone/all/index.js index 08e2ace0..8a6e70d9 100644 --- a/cli/lib/generators/backbone/all/index.js +++ b/cli/lib/generators/backbone/all/index.js @@ -1,7 +1,7 @@ var path = require('path'), - util = require('util'), - yeoman = require('../../../../'); + util = require('util'), + yeoman = require('../../../../'); module.exports = Generator; @@ -11,11 +11,12 @@ function Generator() { this.dirs = 'models collections views routes helpers templates'.split(' '); - // should we figure it out automatically? and made available through an - // appname property, function of something. this.appname = path.basename(process.cwd()); // the api to hookFor and pass arguments may vary a bit. + this.hookFor('backbone:app', { + args: [ 'application' ] + }); this.hookFor('backbone:view', { args: [ 'application' ] }); @@ -32,33 +33,6 @@ function Generator() { util.inherits(Generator, yeoman.generators.Base); -Generator.prototype.injectBackbone = function injectBackbone() { - - // Resolve path to index.html - var indexOut = path.resolve('index.html'); - - // Read in as string for further update - var indexData = this.readFileAsString(indexOut); - - // Workaround until copying underscore/lodash-like scripts don't cause issues. - indexData = this.appendScripts(indexData, - 'app/scripts/vendor.js', - ['http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.5.2/lodash.min.js', - 'http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js']); - - // Wire MVC components (usemin: app/scripts/myapp.js) - indexData = this.appendScripts(indexData, - 'app/scripts/myapp.js', - ['app/scripts/' + this.appname +'.js', - 'app/scripts/views/application-view.js', - 'app/scripts/models/application-model.js', - 'app/scripts/collections/application-collection.js', - 'app/scripts/routes/app-router.js']); - - // Write out final file - this.writeFileFromString(indexData, indexOut); - -}; Generator.prototype.createDirLayout = function createDirLayout() { var self = this; @@ -70,6 +44,6 @@ Generator.prototype.createDirLayout = function createDirLayout() { }; Generator.prototype.createAppFile = function createAppFile() { - this.template('app.js', 'app/scripts/' + this.appname + '.js'); + this.template('app.js', 'app/scripts/main.js'); }; diff --git a/cli/lib/generators/backbone/app/index.js b/cli/lib/generators/backbone/app/index.js new file mode 100644 index 00000000..6202e679 --- /dev/null +++ b/cli/lib/generators/backbone/app/index.js @@ -0,0 +1,18 @@ + +var util = require('util'), + path = require('path'), + yeoman = require('../../../../'); + +module.exports = Generator; + +function Generator() { + yeoman.generators.Base.apply(this, arguments); +} + +util.inherits(Generator, yeoman.generators.Base); + +Generator.prototype.setupEnv = function setupEnv() { + // Copies the contents of the generator `templates` + // directory into your users new application path + this.directory('.','.', true); +}; diff --git a/cli/lib/generators/backbone/app/templates/.gitattributes b/cli/lib/generators/backbone/app/templates/.gitattributes new file mode 100644 index 00000000..21256661 --- /dev/null +++ b/cli/lib/generators/backbone/app/templates/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/cli/lib/generators/backbone/app/templates/.gitignore b/cli/lib/generators/backbone/app/templates/.gitignore new file mode 100644 index 00000000..1de71cc1 --- /dev/null +++ b/cli/lib/generators/backbone/app/templates/.gitignore @@ -0,0 +1,2 @@ +intermediate/ +publish/ diff --git a/cli/lib/generators/backbone/app/templates/Gruntfile.js b/cli/lib/generators/backbone/app/templates/Gruntfile.js new file mode 100644 index 00000000..bc257c3e --- /dev/null +++ b/cli/lib/generators/backbone/app/templates/Gruntfile.js @@ -0,0 +1,174 @@ +module.exports = function( grunt ) { + 'use strict'; + // + // Grunt configuration: + // + // https://github.com/cowboy/grunt/blob/master/docs/getting_started.md + // + grunt.initConfig({ + + // Project configuration + // --------------------- + + // specify an alternate install location for Bower + bower: { + dir: 'app/scripts/vendor' + }, + + // Coffee to JS compilation + coffee: { + dist: { + src: 'app/scripts/**/*.coffee', + dest: 'app/scripts' + } + }, + + // compile .scss/.sass to .css using Compass + compass: { + dist: { + // http://compass-style.org/help/tutorials/configuration-reference/#configuration-properties + options: { + css_dir: 'styles', + sass_dir: 'styles', + images_dir: 'images', + javascripts_dir: 'scripts', + force: true + } + } + }, + + // generate application cache manifest + manifest:{ + dest: '' + }, + + // headless testing through PhantomJS + mocha: { + all: ['test/**/*.html'] + }, + + // default watch configuration + watch: { + coffee: { + files: '', + tasks: 'coffee reload' + }, + compass: { + files: [ + 'app/styles/**/*.{scss,sass}' + ], + tasks: 'compass reload' + }, + reload: { + files: [ + 'app/*.html', + 'app/styles/**/*.css', + 'app/scripts/**/*.js', + 'app/images/**/*' + ], + tasks: 'reload' + } + }, + + // default lint configuration, change this to match your setup: + // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#lint-built-in-task + lint: { + files: [ + 'Gruntfile.js', + 'app/scripts/**/*.js', + 'spec/**/*.js' + ] + }, + + // specifying JSHint options and globals + // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#specifying-jshint-options-and-globals + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + boss: true, + eqnull: true, + browser: true + }, + globals: { + jQuery: true + } + }, + + // Build configuration + // ------------------- + + // the staging directory used during the process + staging: 'temp', + // final build output + output: 'dist', + + mkdirs: { + staging: 'app/' + }, + + // Below, all paths are relative to the staging directory, which is a copy + // of the app/ directory. Any .gitignore, .ignore and .buildignore file + // that might appear in the app/ tree are used to ignore these values + // during the copy process. + + // concat css/**/*.css files, inline @import, output a single minified css + css: { + 'styles/main.css': ['styles/**/*.css'] + }, + + // renames JS/CSS to prepend a hash of their contents for easier + // versioning + rev: { + js: 'scripts/**/*.js', + css: 'styles/**/*.css', + img: 'images/**' + }, + + // usemin handler should point to the file containing + // the usemin blocks to be parsed + 'usemin-handler': { + html: 'index.html' + }, + + // update references in HTML/CSS to revved files + usemin: { + html: ['**/*.html'], + css: ['**/*.css'] + }, + + // HTML minification + html: { + files: ['**/*.html'] + }, + + // Optimizes JPGs and PNGs (with jpegtran & optipng) + img: { + dist: '' + }, + + // rjs configuration. You don't necessarily need to specify the typical + // `path` configuration, the rjs task will parse these values from your + // main module, using http://requirejs.org/docs/optimization.html#mainConfigFile + // + // name / out / mainConfig file should be used. You can let it blank if + // you're using usemin-handler to parse rjs config from markup (default + // setup) + rjs: { + // no minification, is done by the min task + optimize: 'none', + baseUrl: './scripts', + wrap: true + }, + }); + + // Alias the `test` task to run the `mocha` task instead + grunt.registerTask('test', 'mocha'); + +}; diff --git a/cli/lib/generators/backbone/app/templates/app/.htaccess b/cli/lib/generators/backbone/app/templates/app/.htaccess new file mode 100644 index 00000000..220c8689 --- /dev/null +++ b/cli/lib/generators/backbone/app/templates/app/.htaccess @@ -0,0 +1,553 @@ +# Apache configuration file +# httpd.apache.org/docs/2.2/mod/quickreference.html + +# Note .htaccess files are an overhead, this logic should be in your Apache +# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html + +# Techniques in here adapted from all over, including: +# Kroc Camen: camendesign.com/.htaccess +# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/ +# Sample .htaccess file of CMS MODx: modxcms.com + + +# ---------------------------------------------------------------------- +# Better website experience for IE users +# ---------------------------------------------------------------------- + +# Force the latest IE version, in various cases when it may fall back to IE7 mode +# github.com/rails/rails/commit/123eb25#commitcomment-118920 +# Use ChromeFrame if it's installed for a better experience for the poor IE folk + + + Header set X-UA-Compatible "IE=Edge,chrome=1" + # mod_headers can't match by content-type, but we don't want to send this header on *everything*... + + Header unset X-UA-Compatible + + + + +# ---------------------------------------------------------------------- +# Cross-domain AJAX requests +# ---------------------------------------------------------------------- + +# Serve cross-domain Ajax requests, disabled by default. +# enable-cors.org +# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity + +# +# Header set Access-Control-Allow-Origin "*" +# + + +# ---------------------------------------------------------------------- +# CORS-enabled images (@crossorigin) +# ---------------------------------------------------------------------- + +# Send CORS headers if browsers request them; enabled by default for images. +# developer.mozilla.org/en/CORS_Enabled_Image +# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html +# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ +# wiki.mozilla.org/Security/Reviews/crossoriginAttribute + + + + # mod_headers, y u no match by Content-Type?! + + SetEnvIf Origin ":" IS_CORS + Header set Access-Control-Allow-Origin "*" env=IS_CORS + + + + + +# ---------------------------------------------------------------------- +# Webfont access +# ---------------------------------------------------------------------- + +# Allow access from all domains for webfonts. +# Alternatively you could only whitelist your +# subdomains like "subdomain.example.com". + + + + Header set Access-Control-Allow-Origin "*" + + + + +# ---------------------------------------------------------------------- +# Proper MIME type for all files +# ---------------------------------------------------------------------- + +# JavaScript +# Normalize to standard type (it's sniffed in IE anyways) +# tools.ietf.org/html/rfc4329#section-7.2 +AddType application/javascript js jsonp +AddType application/json json + +# Audio +AddType audio/ogg oga ogg +AddType audio/mp4 m4a f4a f4b + +# Video +AddType video/ogg ogv +AddType video/mp4 mp4 m4v f4v f4p +AddType video/webm webm +AddType video/x-flv flv + +# SVG +# Required for svg webfonts on iPad +# twitter.com/FontSquirrel/status/14855840545 +AddType image/svg+xml svg svgz +AddEncoding gzip svgz + +# Webfonts +AddType application/vnd.ms-fontobject eot +AddType application/x-font-ttf ttf ttc +AddType font/opentype otf +AddType application/x-font-woff woff + +# Assorted types +AddType image/x-icon ico +AddType image/webp webp +AddType text/cache-manifest appcache manifest +AddType text/x-component htc +AddType application/xml rss atom xml rdf +AddType application/x-chrome-extension crx +AddType application/x-opera-extension oex +AddType application/x-xpinstall xpi +AddType application/octet-stream safariextz +AddType application/x-web-app-manifest+json webapp +AddType text/x-vcard vcf +AddType application/x-shockwave-flash swf +AddType text/vtt vtt + + +# ---------------------------------------------------------------------- +# Allow concatenation from within specific js and css files +# ---------------------------------------------------------------------- + +# e.g. Inside of script.combined.js you could have +# +# +# and they would be included into this single file. + +# This is not in use in the boilerplate as it stands. You may +# choose to use this technique if you do not have a build process. + +# +# Options +Includes +# AddOutputFilterByType INCLUDES application/javascript application/json +# SetOutputFilter INCLUDES +# + +# +# Options +Includes +# AddOutputFilterByType INCLUDES text/css +# SetOutputFilter INCLUDES +# + + +# ---------------------------------------------------------------------- +# Gzip compression +# ---------------------------------------------------------------------- + + + + # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ + + + SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding + RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding + + + + # HTML, TXT, CSS, JavaScript, JSON, XML, HTC: + + FilterDeclare COMPRESS + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject + FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf + FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype + FilterChain COMPRESS + FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no + + + + # Legacy versions of Apache + AddOutputFilterByType DEFLATE text/html text/plain text/css application/json + AddOutputFilterByType DEFLATE application/javascript + AddOutputFilterByType DEFLATE text/xml application/xml text/x-component + AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml + AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype + + + + + +# ---------------------------------------------------------------------- +# Expires headers (for better cache control) +# ---------------------------------------------------------------------- + +# These are pretty far-future expires headers. +# They assume you control versioning with filename-based cache busting +# Additionally, consider that outdated proxies may miscache +# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ + +# If you don't use filenames to version, lower the CSS and JS to something like +# "access plus 1 week". + + + ExpiresActive on + +# Perhaps better to whitelist expires rules? Perhaps. + ExpiresDefault "access plus 1 month" + +# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5) + ExpiresByType text/cache-manifest "access plus 0 seconds" + +# Your document html + ExpiresByType text/html "access plus 0 seconds" + +# Data + ExpiresByType text/xml "access plus 0 seconds" + ExpiresByType application/xml "access plus 0 seconds" + ExpiresByType application/json "access plus 0 seconds" + +# Feed + ExpiresByType application/rss+xml "access plus 1 hour" + ExpiresByType application/atom+xml "access plus 1 hour" + +# Favicon (cannot be renamed) + ExpiresByType image/x-icon "access plus 1 week" + +# Media: images, video, audio + ExpiresByType image/gif "access plus 1 month" + ExpiresByType image/png "access plus 1 month" + ExpiresByType image/jpeg "access plus 1 month" + ExpiresByType video/ogg "access plus 1 month" + ExpiresByType audio/ogg "access plus 1 month" + ExpiresByType video/mp4 "access plus 1 month" + ExpiresByType video/webm "access plus 1 month" + +# HTC files (css3pie) + ExpiresByType text/x-component "access plus 1 month" + +# Webfonts + ExpiresByType application/x-font-ttf "access plus 1 month" + ExpiresByType font/opentype "access plus 1 month" + ExpiresByType application/x-font-woff "access plus 1 month" + ExpiresByType image/svg+xml "access plus 1 month" + ExpiresByType application/vnd.ms-fontobject "access plus 1 month" + +# CSS and JavaScript + ExpiresByType text/css "access plus 1 year" + ExpiresByType application/javascript "access plus 1 year" + + + + +# ---------------------------------------------------------------------- +# Prevent mobile network providers from modifying your site +# ---------------------------------------------------------------------- + +# The following header prevents modification of your code over 3G on some +# European providers. +# This is the official 'bypass' suggested by O2 in the UK. + +# +# Header set Cache-Control "no-transform" +# + + +# ---------------------------------------------------------------------- +# ETag removal +# ---------------------------------------------------------------------- + +# FileETag None is not enough for every server. + + Header unset ETag + + +# Since we're sending far-future expires, we don't need ETags for +# static content. +# developer.yahoo.com/performance/rules.html#etags +FileETag None + + +# ---------------------------------------------------------------------- +# Stop screen flicker in IE on CSS rollovers +# ---------------------------------------------------------------------- + +# The following directives stop screen flicker in IE on CSS rollovers - in +# combination with the "ExpiresByType" rules for images (see above). + +# BrowserMatch "MSIE" brokenvary=1 +# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1 +# BrowserMatch "Opera" !brokenvary +# SetEnvIf brokenvary 1 force-no-vary + + +# ---------------------------------------------------------------------- +# Set Keep-Alive Header +# ---------------------------------------------------------------------- + +# Keep-Alive allows the server to send multiple requests through one +# TCP-connection. Be aware of possible disadvantages of this setting. Turn on +# if you serve a lot of static content. + +# +# Header set Connection Keep-Alive +# + + +# ---------------------------------------------------------------------- +# Cookie setting from iframes +# ---------------------------------------------------------------------- + +# Allow cookies to be set from iframes (for IE only) +# If needed, specify a path or regex in the Location directive. + +# +# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" +# + + +# ---------------------------------------------------------------------- +# Start rewrite engine +# ---------------------------------------------------------------------- + +# Turning on the rewrite engine is necessary for the following rules and +# features. FollowSymLinks must be enabled for this to work. + +# Some cloud hosting services require RewriteBase to be set: goo.gl/HOcPN +# If using the h5bp in a subdirectory, use `RewriteBase /foo` instead where +# 'foo' is your directory. + +# If your web host doesn't allow the FollowSymlinks option, you may need to +# comment it out and use `Options +SymLinksOfOwnerMatch`, but be aware of the +# performance impact: http://goo.gl/Mluzd + + + Options +FollowSymlinks +# Options +SymLinksIfOwnerMatch + Options +FollowSymlinks + RewriteEngine On +# RewriteBase / + + + +# ---------------------------------------------------------------------- +# Suppress or force the "www." at the beginning of URLs +# ---------------------------------------------------------------------- + +# The same content should never be available under two different URLs - +# especially not with and without "www." at the beginning, since this can cause +# SEO problems (duplicate content). That's why you should choose one of the +# alternatives and redirect the other one. + +# By default option 1 (no "www.") is activated. +# no-www.org/faq.php?q=class_b + +# If you'd prefer to use option 2, just comment out all option 1 lines +# and uncomment option 2. + +# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME! + +# ---------------------------------------------------------------------- + +# Option 1: +# Rewrite "www.example.com -> example.com". + + + RewriteCond %{HTTPS} !=on + RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] + RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] + + +# ---------------------------------------------------------------------- + +# Option 2: +# Rewrite "example.com -> www.example.com". +# Be aware that the following rule might not be a good idea if you use "real" +# subdomains for certain parts of your website. + +# +# RewriteCond %{HTTPS} !=on +# RewriteCond %{HTTP_HOST} !^www\..+$ [NC] +# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] +# + + +# ---------------------------------------------------------------------- +# Built-in filename-based cache busting +# ---------------------------------------------------------------------- + +# If you're not using the build script to manage your filename version revving, +# you might want to consider enabling this, which will route requests for +# /css/style.20110203.css to /css/style.css + +# To understand why this is important and a better idea than all.css?v1231, +# read: github.com/h5bp/html5-boilerplate/wiki/cachebusting + +# +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteCond %{REQUEST_FILENAME} !-d +# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] +# + + +# ---------------------------------------------------------------------- +# Prevent SSL cert warnings +# ---------------------------------------------------------------------- + +# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent +# https://www.example.com when your cert only allows https://secure.example.com + +# +# RewriteCond %{SERVER_PORT} !^443 +# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L] +# + + +# ---------------------------------------------------------------------- +# Prevent 404 errors for non-existing redirected folders +# ---------------------------------------------------------------------- + +# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the +# same name does not exist. +# webmasterworld.com/apache/3808792.htm + +Options -MultiViews + + +# ---------------------------------------------------------------------- +# Custom 404 page +# ---------------------------------------------------------------------- + +# You can add custom pages to handle 500 or 403 pretty easily, if you like. +# If you are hosting your site in subdirectory, adjust this accordingly +# e.g. ErrorDocument 404 /subdir/404.html +ErrorDocument 404 /404.html + + +# ---------------------------------------------------------------------- +# UTF-8 encoding +# ---------------------------------------------------------------------- + +# Use UTF-8 encoding for anything served text/plain or text/html +AddDefaultCharset utf-8 + +# Force UTF-8 for a number of file formats +AddCharset utf-8 .atom .css .js .json .rss .vtt .xml + + +# ---------------------------------------------------------------------- +# A little more security +# ---------------------------------------------------------------------- + +# To avoid displaying the exact version number of Apache being used, add the +# following to httpd.conf (it will not work in .htaccess): +# ServerTokens Prod + +# "-Indexes" will have Apache block users from browsing folders without a +# default document Usually you should leave this activated, because you +# shouldn't allow everybody to surf through every folder on your server (which +# includes rather private places like CMS system folders). + + Options -Indexes + + +# Block access to "hidden" directories or files whose names begin with a +# period. This includes directories used by version control systems such as +# Subversion or Git. + + RewriteCond %{SCRIPT_FILENAME} -d [OR] + RewriteCond %{SCRIPT_FILENAME} -f + RewriteRule "(^|/)\." - [F] + + +# Block access to backup and source files. These files may be left by some +# text/html editors and pose a great security danger, when anyone can access +# them. + + Order allow,deny + Deny from all + Satisfy All + + +# If your server is not already configured as such, the following directive +# should be uncommented in order to set PHP's register_globals option to OFF. +# This closes a major security hole that is abused by most XSS (cross-site +# scripting) attacks. For more information: http://php.net/register_globals +# +# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS: +# +# Your server does not allow PHP directives to be set via .htaccess. In that +# case you must make this change in your php.ini file instead. If you are +# using a commercial web host, contact the administrators for assistance in +# doing this. Not all servers allow local php.ini files, and they should +# include all PHP configurations (not just this one), or you will effectively +# reset everything to PHP defaults. Consult www.php.net for more detailed +# information about setting PHP directives. + +# php_flag register_globals Off + +# Rename session cookie to something else, than PHPSESSID +# php_value session.name sid + +# Disable magic quotes (This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.) +# php_flag magic_quotes_gpc Off + +# Do not show you are using PHP +# Note: Move this line to php.ini since it won't work in .htaccess +# php_flag expose_php Off + +# Level of log detail - log all errors +# php_value error_reporting -1 + +# Write errors to log file +# php_flag log_errors On + +# Do not display errors in browser (production - Off, development - On) +# php_flag display_errors Off + +# Do not display startup errors (production - Off, development - On) +# php_flag display_startup_errors Off + +# Format errors in plain text +# Note: Leave this setting 'On' for xdebug's var_dump() output +# php_flag html_errors Off + +# Show multiple occurrence of error +# php_flag ignore_repeated_errors Off + +# Show same errors from different sources +# php_flag ignore_repeated_source Off + +# Size limit for error messages +# php_value log_errors_max_len 1024 + +# Don't precede error with string (doesn't accept empty string, use whitespace if you need) +# php_value error_prepend_string " " + +# Don't prepend to error (doesn't accept empty string, use whitespace if you need) +# php_value error_append_string " " + +# Increase cookie security + + php_value session.cookie_httponly true + diff --git a/cli/lib/generators/backbone/app/templates/app/404.html b/cli/lib/generators/backbone/app/templates/app/404.html new file mode 100644 index 00000000..04465441 --- /dev/null +++ b/cli/lib/generators/backbone/app/templates/app/404.html @@ -0,0 +1,157 @@ + + + + + Page Not Found :( + + + +
+

Not found :(

+

Sorry, but the page you were trying to view does not exist.

+

It looks like this was the result of either:

+
    +
  • a mistyped address
  • +
  • an out-of-date link
  • +
+ + +
+ + diff --git a/cli/lib/generators/backbone/app/templates/app/favicon.ico b/cli/lib/generators/backbone/app/templates/app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..6527905307f19ba00762f9241f7eb535fa84a2f9 GIT binary patch literal 4286 zcmchaPe@cz6vpqQW1y54B@{_hhFD-kWPgyXjSGVaf);_51TESOlSPOdvy}@W5Q+** zs6~RrtlR}7(V|sCkP&1f7!5{Hixw@4+x@+HXSm*Z^WGalm2d8S=brO@=iGm9MyZ7P zPo)%}YN|=8W~EfSfibDm2H3qnGq$y%h@zqVv#zn@@WvhIGJ8*ECePe@roq(*vwGys z4?Q;bI~MRIM&jXu6Yg@wqQ#8&8x#z55E}ONd3<&rw_h!5AbBx{CcZ%&z736jHxFa0 zsBLqly3+dQ%MZGH{QU}GW6bsq=@$a@sXtac^<8>8uP>*+d!Qdtv&&mnKlvE_T-+SC z*QNCVwcvq%+&DDc+T}Uf(2_FavDN{-&hCpIs?aW=A$mcrzyD+9(025i1~K&uVf&w4 zItQLK9T{7k?s@bnU*&p+<^UI*aHA1aH+Fo^PAzM|xjNK09?2V(Cme7IFB(BP?7#at z(>DB3w`AUFS~=(LUBdZ>v-SG4J~%Mrfj&05Z)oj13l5tbEq4x>8+;FC0Dvr zbJY#7PS$+yE_Cf7gxqQEC@RoZX5J^}71l+`Q~qnOF4D za`lhjUuqZa-sj)EHDleV2i|mc!Ly-@7IwzPM{?pBUt(+@IHi8HTz#Iq9)9h|hrL3) zfOT#@|5$JCxmRjsOj>&kUt(m8*57|W(FoE`CX*8edYv%j=3sR5>!hvglJ#@8K6j$g z&IuUbRC_{)p}sbyx%UD6Fki;t6nDk0gT5&6Q_at7FbVVOu?4VK{oR#!kyYbCc;<4+LITzoZ8-~O5L+9MiLHL4NyME>! z;Ky7<)UR!gN_~GXhMvPMHNB;EmmIK}eHD&~cRx89jth}IM#tU%ablw0|GxfE9IjRR zl-)b-IvC#UD!IewzPL77SI>R+?}<2ERr|R2o~zCC8rJUR8>DI5*0O$6+k~wZ)Mt;b z(Hul-OFl+F))}lK&&Yi*+S2kJmHDbdBWOQnaSA6S|#* + + + + + + + + + + + + + + +
+
+

Cheerio!

+

You now have

+
    +
  • HTML5 Boilerplate
  • +
  • jQuery
  • +
  • Backbone.js
  • +
  • Lodash
  • +
  • Mocha
  • +
+

installed.

+

Enjoy coding! - Yeoman

+
+
+ + + + + + + + + + + + + + + + + + + diff --git a/cli/lib/generators/backbone/app/templates/app/robots.txt b/cli/lib/generators/backbone/app/templates/app/robots.txt new file mode 100644 index 00000000..ee2cc216 --- /dev/null +++ b/cli/lib/generators/backbone/app/templates/app/robots.txt @@ -0,0 +1,3 @@ +# robotstxt.org/ + +User-agent: * diff --git a/cli/lib/generators/backbone/app/templates/app/scripts/vendor/backbone-min.js b/cli/lib/generators/backbone/app/templates/app/scripts/vendor/backbone-min.js new file mode 100644 index 00000000..c1c0d4ff --- /dev/null +++ b/cli/lib/generators/backbone/app/templates/app/scripts/vendor/backbone-min.js @@ -0,0 +1,38 @@ +// Backbone.js 0.9.2 + +// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Backbone may be freely distributed under the MIT license. +// For all details and documentation: +// http://backbonejs.org +(function(){var l=this,y=l.Backbone,z=Array.prototype.slice,A=Array.prototype.splice,g;g="undefined"!==typeof exports?exports:l.Backbone={};g.VERSION="0.9.2";var f=l._;!f&&"undefined"!==typeof require&&(f=require("underscore"));var i=l.jQuery||l.Zepto||l.ender;g.setDomLibrary=function(a){i=a};g.noConflict=function(){l.Backbone=y;return this};g.emulateHTTP=!1;g.emulateJSON=!1;var p=/\s+/,k=g.Events={on:function(a,b,c){var d,e,f,g,j;if(!b)return this;a=a.split(p);for(d=this._callbacks||(this._callbacks= +{});e=a.shift();)f=(j=d[e])?j.tail:{},f.next=g={},f.context=c,f.callback=b,d[e]={tail:g,next:j?j.next:f};return this},off:function(a,b,c){var d,e,h,g,j,q;if(e=this._callbacks){if(!a&&!b&&!c)return delete this._callbacks,this;for(a=a?a.split(p):f.keys(e);d=a.shift();)if(h=e[d],delete e[d],h&&(b||c))for(g=h.tail;(h=h.next)!==g;)if(j=h.callback,q=h.context,b&&j!==b||c&&q!==c)this.on(d,j,q);return this}},trigger:function(a){var b,c,d,e,f,g;if(!(d=this._callbacks))return this;f=d.all;a=a.split(p);for(g= +z.call(arguments,1);b=a.shift();){if(c=d[b])for(e=c.tail;(c=c.next)!==e;)c.callback.apply(c.context||this,g);if(c=f){e=c.tail;for(b=[b].concat(g);(c=c.next)!==e;)c.callback.apply(c.context||this,b)}}return this}};k.bind=k.on;k.unbind=k.off;var o=g.Model=function(a,b){var c;a||(a={});b&&b.parse&&(a=this.parse(a));if(c=n(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection);this.attributes={};this._escapedAttributes={};this.cid=f.uniqueId("c");this.changed={};this._silent= +{};this._pending={};this.set(a,{silent:!0});this.changed={};this._silent={};this._pending={};this._previousAttributes=f.clone(this.attributes);this.initialize.apply(this,arguments)};f.extend(o.prototype,k,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.get(a);return this._escapedAttributes[a]=f.escape(null== +b?"":""+b)},has:function(a){return null!=this.get(a)},set:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c||(c={});if(!d)return this;d instanceof o&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=c.changes={},h=this.attributes,g=this._escapedAttributes,j=this._previousAttributes||{};for(e in d){a=d[e];if(!f.isEqual(h[e],a)||c.unset&&f.has(h,e))delete g[e],(c.silent?this._silent: +b)[e]=!0;c.unset?delete h[e]:h[e]=a;!f.isEqual(j[e],a)||f.has(h,e)!=f.has(j,e)?(this.changed[e]=a,c.silent||(this._pending[e]=!0)):(delete this.changed[e],delete this._pending[e])}c.silent||this.change(c);return this},unset:function(a,b){(b||(b={})).unset=!0;return this.set(a,null,b)},clear:function(a){(a||(a={})).unset=!0;return this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)}; +a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},save:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c=c?f.clone(c):{};if(c.wait){if(!this._validate(d,c))return!1;e=f.clone(this.attributes)}a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;c.success=function(a,b,e){b=h.parse(a,e);if(c.wait){delete c.wait;b=f.extend(d||{},b)}if(!h.set(b,c))return false;i?i(h,a):h.trigger("sync",h,a,c)};c.error=g.wrapError(c.error, +h,c);b=this.isNew()?"create":"update";b=(this.sync||g.sync).call(this,b,this,c);c.wait&&this.set(e,a);return b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d(),!1;a.success=function(e){a.wait&&d();c?c(b,e):b.trigger("sync",b,e,a)};a.error=g.wrapError(a.error,b,a);var e=(this.sync||g.sync).call(this,"delete",this,a);a.wait||d();return e},url:function(){var a=n(this,"urlRoot")||n(this.collection,"url")||t(); +return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){a||(a={});var b=this._changing;this._changing=!0;for(var c in this._silent)this._pending[c]=!0;var d=f.extend({},a.changes,this._silent);this._silent={};for(c in d)this.trigger("change:"+c,this,this.get(c),a);if(b)return this;for(;!f.isEmpty(this._pending);){this._pending= +{};this.trigger("change",this,a);for(c in this.changed)!this._pending[c]&&!this._silent[c]&&delete this.changed[c];this._previousAttributes=f.clone(this.attributes)}this._changing=!1;return this},hasChanged:function(a){return!arguments.length?!f.isEmpty(this.changed):f.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)if(!f.isEqual(d[e],b=a[e]))(c||(c={}))[e]=b;return c},previous:function(a){return!arguments.length|| +!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);if(!c)return!0;b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b);return!1}});var r=g.Collection=function(a,b){b||(b={});b.model&&(this.model=b.model);b.comparator&&(this.comparator=b.comparator); +this._reset();this.initialize.apply(this,arguments);a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(r.prototype,k,{model:o,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},add:function(a,b){var c,d,e,g,i,j={},k={},l=[];b||(b={});a=f.isArray(a)?a.slice():[a];c=0;for(d=a.length;c=b))this.iframe=i('