Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Toolchain
sgc
Commits
b37dba8a
Commit
b37dba8a
authored
Jan 09, 2015
by
Philipp Nowinski
Browse files
[FEATURE] make path suggestions dependent on project type
parent
2f1985c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/index.js
View file @
b37dba8a
...
...
@@ -6,42 +6,65 @@ var yeoman = require('yeoman-generator'),
module
.
exports
=
yeoman
.
generators
.
Base
.
extend
((
function
()
{
var
Generator
=
{},
answers
;
answers
,
resourcePathsSuggestions
=
{
extbaseExtension
:
{
cssPath
:
path
.
join
(
'
Resources
'
,
'
Public
'
,
'
StyleSheets
'
),
sassPath
:
path
.
join
(
'
Resources
'
,
'
Public
'
,
'
Sass
'
),
imagesPath
:
path
.
join
(
'
Resources
'
,
'
Public
'
,
'
Images
'
),
javascriptPath
:
path
.
join
(
'
Resources
'
,
'
Public
'
,
'
Scripts
'
)
},
standalone
:
{
cssPath
:
'
css
'
,
sassPath
:
'
sass
'
,
imagesPath
:
'
images
'
,
javascriptPath
:
'
javascript
'
}
},
projectType
=
'
standalone
'
;
Generator
.
initializing
=
function
()
{
Generator
.
pkg
=
require
(
'
../package.json
'
);
};
Generator
.
prompting
=
function
()
{
var
done
=
this
.
async
(),
questions
;
var
done
=
this
.
async
();
// Greet the user
this
.
log
(
yosay
(
'
Welcome to the dandy
'
+
chalk
.
red
(
'
Sgalinski
'
)
+
'
generator!
'
));
this
.
prompt
({
type
:
'
list
'
,
name
:
'
projectType
'
,
message
:
'
What kind of project do you want me to build?
'
,
choices
:
[
{
value
:
'
extbaseExtension
'
,
name
:
'
Typo3 Extbase Extension
'
},
{
value
:
'
standalone
'
,
name
:
'
Standalone Frontend Project
'
},
{
value
:
'
typo3Frontend
'
,
name
:
'
Typo3 Frontend Setup
'
}
]
},
function
(
answers
)
{
projectType
=
answers
.
projectType
done
();
});
};
Generator
.
advancedPrompting
=
function
()
{
var
done
=
this
.
async
(),
questions
;
// define questions
questions
=
[
{
type
:
'
list
'
,
name
:
'
projectType
'
,
message
:
'
What kind of project do you want me to build?
'
,
choices
:
[
{
value
:
'
extbaseExtension
'
,
name
:
'
Typo3 Extbase Extension
'
},
{
value
:
'
standalone
'
,
name
:
'
Standalone Frontend Project
'
},
{
value
:
'
typo3Frontend
'
,
name
:
'
Typo3 Frontend Setup
'
}
]
},
{
type
:
'
input
'
,
name
:
'
projectName
'
,
...
...
@@ -52,19 +75,19 @@ module.exports = yeoman.generators.Base.extend((function() {
type
:
'
input
'
,
name
:
'
cssPath
'
,
message
:
'
Please specify the path to the compiled css files
'
,
default
:
'
css
'
default
:
resourcePathsSuggestions
[
projectType
].
cssPath
},
{
type
:
'
input
'
,
name
:
'
sassPath
'
,
message
:
'
Please specify the path to the sass source files
'
,
default
:
'
sass
'
default
:
resourcePathsSuggestions
[
projectType
].
sassPath
},
{
type
:
'
input
'
,
name
:
'
javascriptPath
'
,
message
:
'
Please specify the path to the javascript files
'
,
default
:
'
javascript
'
default
:
resourcePathsSuggestions
[
projectType
].
javascript
Path
},
{
type
:
'
input
'
,
...
...
@@ -76,7 +99,7 @@ module.exports = yeoman.generators.Base.extend((function() {
type
:
'
input
'
,
name
:
'
imagesPath
'
,
message
:
'
Please specify the path to the images
'
,
default
:
'
images
'
default
:
resourcePathsSuggestions
[
projectType
].
images
Path
}
];
...
...
@@ -99,36 +122,38 @@ module.exports = yeoman.generators.Base.extend((function() {
};
Generator
.
writeGulp
=
function
()
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_gulpfile.js
'
),
this
.
destinationPath
(
'
gulpfile.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/settings.js
'
),
this
.
destinationPath
(
'
gulp/settings.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/css.js
'
),
this
.
destinationPath
(
'
gulp/css.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/browser-sync.js
'
),
this
.
destinationPath
(
'
gulp/browser-sync.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/images.js
'
),
this
.
destinationPath
(
'
gulp/images.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/javascript.js
'
),
this
.
destinationPath
(
'
gulp/javascript.js
'
),
answers
);
if
(
answers
.
projectType
!==
'
extbaseExtension
'
)
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_gulpfile.js
'
),
this
.
destinationPath
(
'
gulpfile.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/settings.js
'
),
this
.
destinationPath
(
'
gulp/settings.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/css.js
'
),
this
.
destinationPath
(
'
gulp/css.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/browser-sync.js
'
),
this
.
destinationPath
(
'
gulp/browser-sync.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/images.js
'
),
this
.
destinationPath
(
'
gulp/images.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/javascript.js
'
),
this
.
destinationPath
(
'
gulp/javascript.js
'
),
answers
);
}
};
Generator
.
writeCompassConfig
=
function
()
{
...
...
@@ -167,11 +192,13 @@ module.exports = yeoman.generators.Base.extend((function() {
};
Generator
.
writeDependencyManagement
=
function
()
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_package.json
'
),
this
.
destinationPath
(
'
package.json
'
),
answers
);
if
(
answers
.
projectType
!==
'
extbaseExtension
'
)
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_package.json
'
),
this
.
destinationPath
(
'
package.json
'
),
answers
);
}
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_bower.json
'
),
this
.
destinationPath
(
'
bower.json
'
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment