Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git template fix #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ enyo unlink -g --unlink-all
enyo unlink -g -U
```

###<a name="commands-templates"></a>templates `enyo templates`
#### <a name="commands-templates"></a>templates `enyo templates`

```bash
Usage: enyo templates [action] [target] [options]
Expand Down Expand Up @@ -465,7 +465,7 @@ enyo templates add path/to/template
enyo templates install https://github.com/enyojs/moonstone-template.git
```

### <a name="commands-pack"></a> pack `enyo pack`
#### <a name="commands-pack"></a> pack `enyo pack`

```bash
Usage: enyo pack [package] [options]
Expand Down
3 changes: 2 additions & 1 deletion lib/enyo/lib/init.es6
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function initTemplate ({project, template, opts, env, log}) {

let templates = getTemplates(env)
, data = templates[template]
, isTemplate = true
, name = opts.name || path.basename(project)
, stat
, err;
Expand All @@ -107,7 +108,7 @@ function initTemplate ({project, template, opts, env, log}) {
return false;
}

if (stat.isDirectory()) err = fsync.copyDir(data.path, project);
if (stat.isDirectory()) err = fsync.copyDir(data.path, project, false, isTemplate);
else if (stat.isSymbolicLink()) err = fsync.copyLinkDir(data.path, project);

if (err) {
Expand Down
6 changes: 4 additions & 2 deletions lib/util-extra.es6
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ defineProperty(fsync, 'ensureDir', {value: ensureDirSync, enumerable: true});
/*
This operation should be used sparingly because of its slowness and memory consumption.
*/
function copyDirSync (dir, target, clean = false) {
function copyDirSync (dir, target, clean = false, isTemplate) {
let err, files;

dir = resolve(dir);
Expand Down Expand Up @@ -171,7 +171,9 @@ function copyDirSync (dir, target, clean = false) {
let src = join(dir, files[i])
, tgt = join(target, files[i])
, stat = statSync(src);
if (stat.isDirectory()) err = copyDirSync(src, tgt);
// for templates allow copying of .gitignore file, but not .git directory
if (isTemplate && files[i].indexOf('.gitignore') < 0 && src.indexOf('.git') > 0) continue;
else if (stat.isDirectory()) err = copyDirSync(src, tgt);
else if (stat.isFile()) err = copyFileSync(src, tgt);
else if (stat.isSymbolicLink()) err = copySymbolicLinkSync(src, tgt);
else {
Expand Down