{"size": 1149, "ext": "js", "max_stars_repo_path": "gulpfile.js/tasks/global/projects.js", "max_stars_repo_name": "HR-Cover/gunmetal", "max_stars_repo_stars_event_min_datetime": "2015-05-12T01:17:17.000Z", "max_stars_repo_stars_event_max_datetime": "2015-08-15T04:49:28.000Z", "max_issues_repo_path": "gulpfile.js/tasks/global/projects.js", "max_issues_repo_name": "HR-Cover/gunmetal", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gulpfile.js/tasks/global/projects.js", "max_forks_repo_name": "HR-Cover/gunmetal", "max_forks_repo_forks_event_min_datetime": "2021-06-17T03:46:38.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-17T03:46:38.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 26.7209302326, "max_line_length": 95, "alphanum_fraction": 0.5805047868}

var path = require('path');
var fs = require('fs-extra');
var del = require('del');

gulp.task('projects:new', function(cb) {
    var name = gulp.requireArgv('project-name', cb);
    var newDir = path.join(gulp.config.projectsDirFull, name);

    fs.stat(newDir, function(err, stat) {
        if (stat && !err) {
            gulp.logError('projects:new: directory exists!')
            return;
        }

        fs.ensureDir(newDir, function() {
            fs.writeFileSync(path.join(newDir, 'config.yml'), '');
            cb();
        });
    });
});

gulp.task('projects:delete', function(cb) {
    var projDir = path.join(gulp.config.projectsDirFull, gulp.requireArgv('project-name', cb));
    del(projDir).then(function() {
        cb();
    });
});

gulp.task('projects:copy', function(cb) {
    var srcDir = path.join(gulp.config.projectsDirFull,gulp.requireArgv('from-project', cb));
    var dstDir = path.join(gulp.config.projectsDirFull, gulp.requireArgv('to-project', cb));

    fs.copy(srcDir, dstDir, function(err) {
        if (err) {
            gulp.logError(err.message);
            return;
        }

        cb();
    })
});
