Skip to content

Commit

Permalink
refactor(generators): adapt to yeoman-generator release v0.20.0's mov…
Browse files Browse the repository at this point in the history
  • Loading branch information
cueedee committed Jul 22, 2016
1 parent 660b80c commit c7c7198
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 78 deletions.
9 changes: 2 additions & 7 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ var generators = require( 'yeoman-generator' )

var clean = require( 'underscore.string/clean' );

// Use different delimiters when our template itself is meant to be a template or template-like.
// Use a different delimiter when our template itself is meant to be a template or template-like.
//
var tpl_tpl_settings =
{
evaluate: /#%([\s\S]+?)%#/g
, escape: /#-([\s\S]+?)-#/g

// Not (yet) used:
//
, interpolate: null
delimiter: '@'
}
;

Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/@AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
## | each line as a `Name <email> (url)` format, where `email` and `url` are
## | optional. Lines which start with a # or are blank, will be ignored.

<%= authorName %><% if ( authorEmail ) { %> <<%= authorEmail %>><% } %><% if ( authorUrl ) { %> (<%= authorUrl %>)<% } %>
<%- authorName %><% if ( authorEmail ) { %> <<%- authorEmail %>><% } %><% if ( authorUrl ) { %> (<%- authorUrl %>)<% } %>
34 changes: 17 additions & 17 deletions generators/app/templates/@Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
## * The application's code documentation
##
## * The build parts:
## * app#% if ( i18n ) { %#
## * i18n#% } %#
## * app<@ if ( i18n ) { @>
## * i18n<@ } @>
## * style
## * brief
## * bootstrap
Expand Down Expand Up @@ -74,7 +74,7 @@
##
## * The build parts can be processed seperately, but some depend on others:
## * The bootstrap build part needs a brief.
## * The app build part will also trigger builds of the #% if ( i18n ) { %#i18n, #% } %#style, brief, and bootstrap build parts.
## * The app build part will also trigger builds of the <@ if ( i18n ) { @>i18n, <@ } @>style, brief, and bootstrap build parts.
##
##
## Mapping to grunt tasks and targets:
Expand Down Expand Up @@ -183,11 +183,11 @@ module.exports = ( grunt ) ->

## NOTE: `tgt` - must - be a directory.
##
tgt: '<%= build.assembly.doc %>'#% if ( i18n ) { %#
tgt: '<%= build.assembly.doc %>'<@ if ( i18n ) { @>

i18n:
src: '<%= build.source %>i18n/'
tgt: '<%= build.assembly.app %>i18n/'#% } %#
tgt: '<%= build.assembly.app %>i18n/'<@ } @>

style:
src:
Expand Down Expand Up @@ -321,12 +321,12 @@ module.exports = ( grunt ) ->
doc:
files: [
src: '<%= build.part.doc.tgt %>'
]#% if ( i18n ) { %#
]<@ if ( i18n ) { @>

i18n:
files: [
src: '<%= build.part.i18n.tgt %>'
]#% } %#
]<@ } @>

style:
files: [
Expand Down Expand Up @@ -527,7 +527,7 @@ module.exports = ( grunt ) ->

options:
mode: true
timestamp: true#% if ( i18n ) { %#
timestamp: true<@ if ( i18n ) { @>

i18n:
files: [
Expand All @@ -536,7 +536,7 @@ module.exports = ( grunt ) ->
cwd: '<%= build.part.i18n.src %>'
src: '**/*'
dest: '<%= build.part.i18n.tgt %>'
]#% } %#
]<@ } @>

style:
files: [
Expand Down Expand Up @@ -662,8 +662,8 @@ module.exports = ( grunt ) ->
files: [
## Watch for changed assembly - targets -
##
'<%= build.part.app.tgt %>'#% if ( i18n ) { %#
'<%= build.part.i18n.tgt %>**/*'#% } %#
'<%= build.part.app.tgt %>'<@ if ( i18n ) { @>
'<%= build.part.i18n.tgt %>**/*'<@ } @>
'<%= build.part.style.tgt %>'

## Watch for changed bootstrap - source -
Expand All @@ -673,13 +673,13 @@ module.exports = ( grunt ) ->
tasks: [
'brief:debug'
'bootstrap:debug'
]#% if ( i18n ) { %#
]<@ if ( i18n ) { @>

i18n:
files: [
'<%= build.part.i18n.src %>**/*'
]
tasks: 'i18n'#% } %#
tasks: 'i18n'<@ } @>

style:
files: [
Expand Down Expand Up @@ -800,8 +800,8 @@ module.exports = ( grunt ) ->

'clean:app'

"browserify:app_#{debugging}"#% if ( i18n ) { %#
'i18n'#% } %#
"browserify:app_#{debugging}"<@ if ( i18n ) { @>
'i18n'<@ } @>
"style:#{debugging}"

## brief before bootstrap
Expand Down Expand Up @@ -850,7 +850,7 @@ module.exports = ( grunt ) ->
'clean:bootstrap'
'template:bootstrap'
]
)#% if ( i18n ) { %#
)<@ if ( i18n ) { @>

grunt.registerTask(
'i18n'
Expand All @@ -859,7 +859,7 @@ module.exports = ( grunt ) ->
'clean:i18n'
'copy:i18n'
]
)#% } %#
)<@ } @>

grunt.registerTask(
'lint'
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/@LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) <%= copyrightYear %>, <%= copyrightOwner %>
Copyright (c) <%- copyrightYear %>, <%- copyrightOwner %>
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
6 changes: 3 additions & 3 deletions generators/app/templates/@README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <%= packageName %>
# <%- packageName %>

<%= packageDescription %>
<%- packageDescription %>


## Development
Expand Down Expand Up @@ -53,7 +53,7 @@ command | description

## Install

_\[Ultimately, you may also want to include instructions on how to install and use a production release of *<%= packageName %>*. This text is just a placeholder.\]_
_\[Ultimately, you may also want to include instructions on how to install and use a production release of *<%- packageName %>*. This text is just a placeholder.\]_


## License
Expand Down
10 changes: 5 additions & 5 deletions generators/app/templates/@package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"author": {<% if ( authorEmail ) { %>
"email": "<%= authorEmail %>",<% } %>
"name": "<%= authorName %>"<% if ( authorUrl ) { %>,
"url": "<%= authorUrl %>"<% } %>
"email": "<%- authorEmail %>",<% } %>
"name": "<%- authorName %>"<% if ( authorUrl ) { %>,
"url": "<%- authorUrl %>"<% } %>
},
"browser": {},
"browserify": {
Expand All @@ -14,11 +14,11 @@
},
"browserify-shim": {},
"dependencies": {},
"description": "<%= packageDescription %>",
"description": "<%- packageDescription %>",
"devDependencies": {},
"license": "BSD-3-Clause",
"main": "dist/app/bundle.js",
"name": "<%= packageName %>",
"name": "<%- packageName %>",
"private": true,
"scripts": {
"prepublish": "command -v grunt > /dev/null || { echo >&2 'It appears that \"grunt\" is not installed. Consider running \"[sudo ]npm install -g grunt-cli\" first.'; exit ; } && grunt",
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/src/app.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###*<% if ( packageDescription ) { %>
#
# <%= packageDescription %><% } %>
# <%- packageDescription %><% } %>
#
# @module App
#
Expand Down
8 changes: 4 additions & 4 deletions generators/app/templates/src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>#- packageName -#</title>
<meta name="description" content="#- packageDescription -#">
<title><@= packageName @></title>
<meta name="description" content="<@= packageDescription @>">

<link rel="stylesheet" type="text/css" href="<%- style %>?<%- buildRun %>" />#% if ( ie8 ) { %#<%
<link rel="stylesheet" type="text/css" href="<%- style %>?<%- buildRun %>" /><@ if ( ie8 ) { @><%

//
// HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries.
Expand All @@ -40,7 +40,7 @@
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->#% } %#<% if ( debugging ) { %>
<![endif]--><@ } @><% if ( debugging ) { %>

<script src="//localhost:35729/livereload.js"></script><% } %>
</head>
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/src/views/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
) ->

###*<% if ( authorName ) { %>
# @author <%= authorName %><% } %>
# @author <%- authorName %><% } %>
# @module App
# @submodule Views
###
Expand Down
20 changes: 10 additions & 10 deletions generators/collection/templates/collection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,52 @@
if typeof exports is 'object'
module.exports = factory(
require( 'backbone' )
require( './../models/<%= modelFileName %>' )
require( './../models/<%- modelFileName %>' )
)
else if typeof define is 'function' and define.amd
define( [
'backbone'
'./../models/<%= modelFileName %>'
'./../models/<%- modelFileName %>'
], factory )

)((
Backbone
<%= modelClassName %>
<%- modelClassName %>
) ->

###*
# @author <%= userName %>
# @author <%- userName %>
# @module App
# @submodule Collections
###

'use strict'

###*<% if ( description ) { %>
# <%= description %>
# <%- description %>
#<% } %>
# @class <%= className %>
# @class <%- className %>
# @extends Backbone.Collection<% if ( singleton ) { %>
# @static<% } else { %>
# @constructor<% } %>
###

class <%= className %> extends Backbone.Collection
class <%- className %> extends Backbone.Collection

###*
# @property model
#
# @default <%= modelClassName %>
# @default <%- modelClassName %>
# @type Class
# @static
# @final
###

model: <%= modelClassName %><% if ( singleton ) { %>
model: <%- modelClassName %><% if ( singleton ) { %>


## Export singleton
##
return new <%= className %>()<% } %>
return new <%- className %>()<% } %>

)
9 changes: 2 additions & 7 deletions generators/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ var generators = require( 'yeoman-generator' )
, _ = require( 'lodash' )
;

// Use different delimiters when our template itself is meant to be a template or template-like.
// Use a different delimiter when our template itself is meant to be a template or template-like.
//
var tpl_tpl_settings =
{
evaluate: /#%([\s\S]+?)%#/g
, escape: /#-([\s\S]+?)-#/g

// Not (yet) used:
//
, interpolate: null
delimiter: '@'
}
;

Expand Down
8 changes: 4 additions & 4 deletions generators/demo/templates/src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>#- packageName -#</title>
<meta name="description" content="#- packageDescription -#">
<title><@= packageName @></title>
<meta name="description" content="<@= packageDescription @>">

<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

<link rel="stylesheet" type="text/css" href="<%- style %>?<%- buildRun %>" />#% if ( ie8 ) { %#<%
<link rel="stylesheet" type="text/css" href="<%- style %>?<%- buildRun %>" /><@ if ( ie8 ) { @><%

//
// HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries.
Expand All @@ -46,7 +46,7 @@
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->#% } %#<% if ( debugging ) { %>
<![endif]--><@ } @><% if ( debugging ) { %>

<script src="//localhost:35729/livereload.js"></script><% } %>
</head>
Expand Down
10 changes: 5 additions & 5 deletions generators/model/templates/model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@
) ->

###*
# @author <%= userName %>
# @author <%- userName %>
# @module App
# @submodule Models
###

'use strict'

###*<% if ( description ) { %>
# <%= description %>
# <%- description %>
#<% } %>
# @class <%= className %>
# @class <%- className %>
# @extends Backbone.Model<% if ( singleton ) { %>
# @static<% } else { %>
# @constructor<% } %>
###

class <%= className %> extends Backbone.Model<% if ( singleton ) { %>
class <%- className %> extends Backbone.Model<% if ( singleton ) { %>


## Export singleton
##
return new <%= className %>()<% } %>
return new <%- className %>()<% } %>

)
Loading

0 comments on commit c7c7198

Please sign in to comment.