-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): add angular option to change the module name and add ad…
…ditional modules
- Loading branch information
Showing
17 changed files
with
200 additions
and
44 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
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
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
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,25 @@ | ||
module.exports = (config, rbDir) -> | ||
# init req | ||
# ======== | ||
req = | ||
rb: rbDir | ||
app: process.cwd() | ||
config: "#{rbDir}/config" | ||
files: "#{rbDir}/files" | ||
helpers: "#{rbDir}/helpers" | ||
init: "#{rbDir}/init" | ||
tasks: "#{rbDir}/tasks" | ||
|
||
# add req to config | ||
# ================= | ||
config.req = req | ||
|
||
# logs | ||
# ==== | ||
# console.log req, 'req =' | ||
|
||
# return | ||
# ====== | ||
config | ||
|
||
|
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 @@ | ||
module.exports = (config, options) -> | ||
log = require "#{config.req.helpers}/log" | ||
test = require("#{config.req.helpers}/test")() | ||
pkg = require "#{config.req.app}/package.json" | ||
|
||
# init spaFile | ||
# ============ | ||
spaFile = {} | ||
spaFile.title = options.spaFile.title or pkg.name or 'Application' | ||
spaFile.description = options.spaFile.description or pkg.description or null | ||
|
||
# add spaFile to config | ||
# ===================== | ||
config.spaFile = spaFile | ||
|
||
# logs | ||
# ==== | ||
# log.json spaFile, 'spaFile =' | ||
|
||
# tests | ||
# ===== | ||
test.log 'true', config.spaFile, 'add spaFile to config' | ||
|
||
# return | ||
# ====== | ||
config | ||
|
||
|
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,35 @@ | ||
# todo: move all templates to here | ||
# ================================ | ||
module.exports = (config) -> | ||
path = require 'path' | ||
log = require "#{config.req.helpers}/log" | ||
test = require("#{config.req.helpers}/test")() | ||
|
||
# init templates | ||
# ============== | ||
templates = {} | ||
templates.dir = path.join config.rb.dir, 'templates' | ||
templates.angularModules = | ||
src: | ||
path: path.join templates.dir, 'angular-modules.tpl' | ||
dest: | ||
file: 'app.coffee' | ||
dir: path.join config.src.rb.client.scripts.dir | ||
|
||
# add templates to config | ||
# ======================= | ||
config.templates = templates | ||
|
||
# logs | ||
# ==== | ||
# log.json templates, 'templates =' | ||
|
||
# tests | ||
# ===== | ||
test.log 'true', config.templates, 'add templates to config' | ||
|
||
# return | ||
# ====== | ||
config | ||
|
||
|
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
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<!doctype html> | ||
<html xmlns:ng="http://angularjs.org" xmlns:app="ignored" <% if (typeof appName === 'undefined') { %>ng-app="app"<% } else { %><% if (!!appName) { %>ng-app="<%= appName %>"<% } %><% } %>> | ||
<html xmlns:ng="http://angularjs.org" xmlns:app="ignored" ng-app="<%= moduleName %>"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<title>Rapid Build</title> | ||
<meta name="description" content="AngularJS Reference Architecture" /> | ||
<title><%= title %></title> | ||
<meta name="description" content="<%= description %>" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
|
||
<!-- ClickJacking Defense begin (https://www.owasp.org/index.php/Clickjacking_Defense_Cheat_Sheet) --> | ||
<style id="antiClickjack">body{display:none !important;}</style> | ||
<script>(function(w){if(w.top===w.self){var a=w.document.getElementById('antiClickjack');a.parentNode.removeChild(a);}else{w.top.location=w.self.location;}}(window));</script> | ||
<!-- ClickJacking Defense end --> | ||
|
||
<% _.forEach(styles, function (style) { %><link rel="stylesheet" href="<%= style %>" /> | ||
<% _.forEach(styles, function(style) { %><link rel="stylesheet" href="<%= style %>" /> | ||
<% }); %> | ||
<!-- When you load angular at the bottom, you need to create the "ng-cloak" rules yourself --> | ||
<style>[ng\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\:form{display:block;}</style> | ||
</head> | ||
<body ng-cloak class="ng-cloak"> | ||
<div ng-view></div> | ||
|
||
<% _.forEach(scripts, function (script) { %><script src="<%= script %>"></script> | ||
<% _.forEach(scripts, function(script) { %><script src="<%= script %>"></script> | ||
<% }); %> | ||
</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,36 @@ | ||
module.exports = (gulp, config) -> | ||
q = require 'q' | ||
rename = require 'gulp-rename' | ||
template = require 'gulp-template' | ||
|
||
# task | ||
# ==== | ||
runTask = (src, dest, file, data={}) -> | ||
defer = q.defer() | ||
gulp.src src | ||
.pipe rename file | ||
.pipe template data | ||
.pipe gulp.dest dest | ||
.on 'end', -> | ||
# console.log 'app.coffee built'.yellow | ||
defer.resolve() | ||
defer.promise | ||
|
||
# helpers | ||
# ======= | ||
getData = -> | ||
data = | ||
modules: config.angular.modules | ||
moduleName: config.angular.moduleName | ||
|
||
# register task | ||
# ============= | ||
gulp.task "#{config.rb.prefix.task}build-angular-modules", -> | ||
data = getData() | ||
runTask( | ||
config.templates.angularModules.src.path | ||
config.templates.angularModules.dest.dir | ||
config.templates.angularModules.dest.file | ||
data | ||
) | ||
|
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
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,6 @@ | ||
# Do not check this file in. | ||
# It gets generated from /templates/angular-modules.tpl | ||
# ===================================================== | ||
angular.module '<%= moduleName %>', [<% _.forEach(modules, function(module) { %> | ||
'<%= module %>'<% }); %> | ||
] |