diff --git a/lib/generator.js b/lib/generator.js index a33d5e8d0..334c2d60f 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -56,11 +56,11 @@ const generateFile = options => new Promise((resolve, reject) => { const file_name = options.file_name; const root = options.root; const data = options.data; + const source_path = path.resolve(root, file_name); if (isFileNonRenderable(file_name, template_config.nonRenderableFiles)) { const template_path = path.relative(templates_dir, path.resolve(root, file_name)); const generated_path = path.resolve(target_dir, template_path); - const source_path = path.resolve(root, file_name); fs.copyFile(source_path, generated_path, (err) => { if (err) return reject(err); @@ -72,7 +72,8 @@ const generateFile = options => new Promise((resolve, reject) => { const template_path = path.relative(templates_dir, path.resolve(root, file_name)); const generated_path = path.resolve(target_dir, template_path); - fs.writeFile(generated_path, parsed_content, 'utf8', (err) => { + const stats = fs.statSync(source_path); + fs.writeFile(generated_path, parsed_content, {encoding: 'utf8', mode: stats.mode}, (err) => { if (err) return reject(err); resolve(); }); diff --git a/templates/java-spring/gradlew b/templates/java-spring/gradlew old mode 100644 new mode 100755