create intellij metadata from flutter create (#6429)

This commit is contained in:
Devon Carew
2016-10-20 12:03:38 -07:00
committed by GitHub
parent e72e174461
commit f1d70fcdd3
5 changed files with 39 additions and 4 deletions

View File

@@ -168,8 +168,11 @@ Your main program file is lib/main.dart in the $relativePath directory.
templateContext['withDriverTest'] = renderDriverTest;
Template createTemplate = new Template.fromName('create');
fileCount += createTemplate.render(new Directory(dirPath), templateContext,
overwriteExisting: false);
fileCount += createTemplate.render(
new Directory(dirPath),
templateContext, overwriteExisting: false,
projectName: projectName
);
if (renderDriverTest) {
Template driverTemplate = new Template.fromName('driver');

View File

@@ -60,8 +60,12 @@ class Template {
Map<String /* relative */, String /* absolute source */> _templateFilePaths;
int render(Directory destination, Map<String, dynamic> context,
{ bool overwriteExisting: true }) {
int render(
Directory destination,
Map<String, dynamic> context, {
bool overwriteExisting: true,
String projectName
}) {
destination.createSync(recursive: true);
int fileCount = 0;
@@ -72,6 +76,8 @@ class Template {
.join(destinationDirPath, relativeDestPath)
.replaceAll(_kCopyTemplateExtension, '')
.replaceAll(_kTemplateExtension, '');
if (projectName != null)
finalDestinationPath = finalDestinationPath.replaceAll('projectName', projectName);
File finalDestinationFile = new File(finalDestinationPath);
String relativePathForLogging = path.relative(finalDestinationFile.path);