use of org.eclipse.n4js.cli.init.InitResources.ExampleFile in project n4js by eclipse.
the class N4jscInit method initProject.
private static N4jscExitState initProject(N4jscOptions options, InitConfiguration config) throws N4jscException {
try {
config.projectRoot.resolve(config.projectFolderSrc).toFile().mkdirs();
config.projectRoot.resolve(config.projectFolderOutput).toFile().mkdirs();
config.packageJson.write(options, config.projectRoot);
for (ExampleFile exampleFile : config.files) {
exampleFile.writeToDisk(config.projectRoot);
}
} catch (IOException e) {
throw new N4jscException(N4jscExitCode.INIT_ERROR_WORKING_DIR, e);
}
return N4jscExitState.SUCCESS;
}
use of org.eclipse.n4js.cli.init.InitResources.ExampleFile in project n4js by eclipse.
the class InitConfiguration method toStringYarn.
private String toStringYarn() {
String str = "";
str += "FILE TREE AT " + yarnRoot + NL;
str += " ├── " + yarnRoot.relativize(workspacesDir) + NL;
str += " │ └── " + workspacesDir.relativize(projectRoot) + NL;
for (ExampleFile eFile : files) {
str += " │ ├── " + eFile.getDir() + NL;
str += " │ │ └── " + eFile.getName() + NL;
}
str += " │ └── package.json" + NL;
str += " └── package.json" + NL;
str += NL;
Gson gson = JsonUtils.createGson();
str += packageJson.exists ? (packageJson.hasModifications() ? "MODIFIED " : "UNMODIFIED ") : "";
str += "CONTENTS OF package.json at " + yarnRoot.relativize(projectRoot) + NL;
str += gson.toJson(packageJson) + NL;
str += NL;
str += yarnPackageJson.exists ? (yarnPackageJson.hasModifications() ? "MODIFIED " : "UNMODIFIED ") : "";
str += "CONTENTS OF package.json at " + yarnRoot + NL;
str += gson.toJson(yarnPackageJson) + NL;
return str;
}
use of org.eclipse.n4js.cli.init.InitResources.ExampleFile in project n4js by eclipse.
the class InitConfiguration method toStringSingleProject.
private String toStringSingleProject() {
String str = "";
str += "FILE TREE AT " + projectRoot + NL;
for (ExampleFile eFile : files) {
str += " ├── " + eFile.getDir() + NL;
str += " │ └── " + eFile.getName() + NL;
}
str += " └── package.json" + NL;
str += NL;
Gson gson = JsonUtils.createGson();
str += packageJson.exists ? (packageJson.hasModifications() ? "MODIFIED " : "UNMODIFIED ") : "";
str += "CONTENTS OF package.json";
str += gson.toJson(packageJson) + NL;
return str;
}
Aggregations