Skip to content

Commit

Permalink
Merge pull request #19 from asyncapi/feature/support-marking-files-as…
Browse files Browse the repository at this point in the history
…-executable

#16 change gradlew permissions, keep template files permissions
  • Loading branch information
rmelian authored Nov 29, 2018
2 parents 05288cf + ebed06d commit 22f2e1b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
});
Expand Down
Empty file modified templates/java-spring/gradlew
100644 → 100755
Empty file.

0 comments on commit 22f2e1b

Please sign in to comment.