FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
generator-angular-fullstack/script-base.js at model_gen · forms-angular/generator-angular-fullstack · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
forms-angular
/
generator-angular-fullstack
Public
forked from
angular-fullstack/generator-angular-fullstack
Notifications
You must be signed in to change notification settings
Fork
4
Star
13
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
generator-angular-fullstack
/
script-base.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
139 lines (115 loc) · 4.34 KB
Breadcrumbs
generator-angular-fullstack
/
script-base.js
Copy path
File metadata and controls
139 lines (115 loc) · 4.34 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
'use strict'
;
var
util
=
require
(
'util'
)
;
var
path
=
require
(
'path'
)
;
var
yeoman
=
require
(
'yeoman-generator'
)
;
var
angularUtils
=
require
(
'./util.js'
)
;
var
Generator
=
module
.
exports
=
function
Generator
(
)
{
yeoman
.
generators
.
NamedBase
.
apply
(
this
,
arguments
)
;
try
{
this
.
appname
=
require
(
path
.
join
(
process
.
cwd
(
)
,
'bower.json'
)
)
.
name
;
}
catch
(
e
)
{
this
.
appname
=
path
.
basename
(
process
.
cwd
(
)
)
;
}
this
.
appname
=
this
.
_
.
slugify
(
this
.
_
.
humanize
(
this
.
appname
)
)
;
this
.
scriptAppName
=
this
.
_
.
camelize
(
this
.
appname
)
+
angularUtils
.
appName
(
this
)
;
this
.
cameledName
=
this
.
_
.
camelize
(
this
.
name
)
;
this
.
classedName
=
this
.
_
.
classify
(
this
.
name
)
;
if
(
typeof
this
.
env
.
options
.
appPath
===
'undefined'
)
{
try
{
this
.
env
.
options
.
appPath
=
require
(
path
.
join
(
process
.
cwd
(
)
,
'bower.json'
)
)
.
appPath
;
}
catch
(
e
)
{
}
this
.
env
.
options
.
appPath
=
this
.
env
.
options
.
appPath
||
'app'
;
}
if
(
typeof
this
.
env
.
options
.
testPath
===
'undefined'
)
{
try
{
this
.
env
.
options
.
testPath
=
require
(
path
.
join
(
process
.
cwd
(
)
,
'bower.json'
)
)
.
testPath
;
}
catch
(
e
)
{
}
this
.
env
.
options
.
testPath
=
this
.
env
.
options
.
testPath
||
'test/spec'
;
}
this
.
env
.
options
.
coffee
=
this
.
options
.
coffee
;
if
(
typeof
this
.
env
.
options
.
coffee
===
'undefined'
)
{
this
.
option
(
'coffee'
)
;
// attempt to detect if user is using CS or not
// if cml arg provided, use that; else look for the existence of cs
if
(
!
this
.
options
.
coffee
&&
this
.
expandFiles
(
path
.
join
(
this
.
env
.
options
.
appPath
,
'/scripts/**/*.coffee'
)
,
{
}
)
.
length
>
0
)
{
this
.
options
.
coffee
=
true
;
}
this
.
env
.
options
.
coffee
=
this
.
options
.
coffee
;
}
if
(
typeof
this
.
env
.
options
.
minsafe
===
'undefined'
)
{
this
.
option
(
'minsafe'
)
;
this
.
env
.
options
.
minsafe
=
this
.
options
.
minsafe
;
}
var
sourceRoot
=
'/templates/javascript'
;
this
.
scriptSuffix
=
'.js'
;
if
(
this
.
env
.
options
.
coffee
)
{
sourceRoot
=
'/templates/coffeescript'
;
this
.
scriptSuffix
=
'.coffee'
;
}
if
(
this
.
env
.
options
.
minsafe
)
{
sourceRoot
+=
'-min'
;
}
if
(
typeof
this
.
env
.
options
.
jade
===
'undefined'
)
{
this
.
option
(
'jade'
,
{
desc
:
'Generate views using Jade templates'
}
)
;
// attempt to detect if user is using jade or not
// if cml arg provided, use that; else look for the existence of cs
if
(
!
this
.
options
.
jade
&&
this
.
expandFiles
(
path
.
join
(
this
.
env
.
options
.
appPath
,
'/views/**/*.jade'
)
,
{
}
)
.
length
>
0
)
{
this
.
options
.
jade
=
true
;
}
this
.
env
.
options
.
jade
=
this
.
options
.
jade
;
}
this
.
viewSuffix
=
'.html'
;
if
(
this
.
env
.
options
.
jade
)
{
this
.
viewSuffix
=
'.jade'
;
}
this
.
sourceRoot
(
path
.
join
(
__dirname
,
sourceRoot
)
)
;
}
;
util
.
inherits
(
Generator
,
yeoman
.
generators
.
NamedBase
)
;
Generator
.
prototype
.
appTemplate
=
function
(
src
,
dest
)
{
yeoman
.
generators
.
Base
.
prototype
.
template
.
apply
(
this
,
[
src
+
this
.
scriptSuffix
,
path
.
join
(
this
.
env
.
options
.
appPath
,
dest
.
toLowerCase
(
)
)
+
this
.
scriptSuffix
]
)
;
}
;
Generator
.
prototype
.
testTemplate
=
function
(
src
,
dest
)
{
yeoman
.
generators
.
Base
.
prototype
.
template
.
apply
(
this
,
[
src
+
this
.
scriptSuffix
,
path
.
join
(
this
.
env
.
options
.
testPath
,
dest
.
toLowerCase
(
)
)
+
this
.
scriptSuffix
]
)
;
}
;
Generator
.
prototype
.
htmlTemplate
=
function
(
src
,
dest
)
{
yeoman
.
generators
.
Base
.
prototype
.
template
.
apply
(
this
,
[
src
,
path
.
join
(
this
.
env
.
options
.
appPath
,
dest
.
toLowerCase
(
)
)
]
)
;
}
;
Generator
.
prototype
.
addScriptToIndex
=
function
(
script
)
{
try
{
var
appPath
=
this
.
env
.
options
.
appPath
;
var
fullPath
=
path
.
join
(
appPath
,
'views'
,
'index'
+
this
.
viewSuffix
)
;
angularUtils
.
rewriteFile
(
{
file
:
fullPath
,
needle
:
'<!-- endbuild -->'
,
splicable
:
[
'<script src="scripts/'
+
script
.
replace
(
'\\'
,
'/'
)
+
'.js"></script>'
]
}
)
;
}
catch
(
e
)
{
console
.
log
(
'\nUnable to find '
.
yellow
+
fullPath
+
'. Reference to '
.
yellow
+
script
+
'.js '
+
'not added.\n'
.
yellow
)
;
}
}
;
Generator
.
prototype
.
generateSourceAndTest
=
function
(
appTemplate
,
testTemplate
,
targetDirectory
,
skipAdd
)
{
// Services use classified names
if
(
this
.
generatorName
.
toLowerCase
(
)
===
'service'
)
{
this
.
cameledName
=
this
.
classedName
;
}
this
.
appTemplate
(
appTemplate
,
path
.
join
(
'scripts'
,
targetDirectory
,
this
.
name
)
)
;
this
.
testTemplate
(
testTemplate
,
path
.
join
(
targetDirectory
,
this
.
name
)
)
;
if
(
!
skipAdd
)
{
this
.
addScriptToIndex
(
path
.
join
(
targetDirectory
,
this
.
name
)
)
;
}
}
;
Back
|
FazBrowse Home
|
New Git URL