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);

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/{{projectName}}.iml" filepath="$PROJECT_DIR$/{{projectName}}.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method />
</configuration>
</component>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="FLUTTER_MODULE_TYPE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/packages" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="application" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>