Beispiel #1
0
    function onModulesReady(err) {
        if (err) { return cb(err); }

        if (opts.assets) {
            cpr(opts.assets, path.join(destination, 'assets'), cb);
        }

        if (opts.partials) {
            cpr(opts.partials, path.join(destination, 'partials'), cb);
        }
    }
Beispiel #2
0
  function copyAssets(err) {
    if (err) return done(err)

    cpr(path.join(__dirname, 'static'), options.output, function(err) {
      return done(err)
    })
  }
Beispiel #3
0
	mkdirp(dest, function(err) {
	    if (err) return cb(err);
	    cpr(src, dest, { overwrite: true }, function(err) {
	        if (err) return cb(err);
	        cb();
	    })
	});
    function moveBuild (cb) {
        var source = path.join(repositoryPath, 'build'),
            target = buildDir;

        log.debug('%s: Copying %s to %s', ref, source, target);

        cpr(source, target, {}, cb);
    }
Beispiel #5
0
 remote.download(function(err, tempFolder) {
   if (err) return done(err);
   cpr(tempFolder, CACHE_FOLDER, {
     deleteFirst: true,
     overwrite: true,
     confirm: false
   }, done);
 });
Beispiel #6
0
 fs.exists(from, function(exists) {
   if(exists) {
     cpr(from, to, cb);
   }
   else {
     cb();
   }
 });
export default (cb) => cpr(
  path.join(cacheDir, getConfig().user, 'media'),
  path.join(buildDir, 'media'),
  {
    deleteFirst: false,
    overwrite: false
  },
  typeof cb === 'function' ? cb : noop
);
Beispiel #8
0
module.exports = function () {
  let appName = Format.toConstName(process.argv[3]);
  let noSetup = (process.argv[4] || '').toLowerCase();

  noSetup = (noSetup === '--no-setup' || noSetup === '-ns');
  appName = Utils.ensureName('application', appName);

  const appFolderName = Format.toFolderName(appName);

  if (FSUtils.exists(appFolderName)) {
    Logger.log(message.new.alreadyExists(appName));

    const answer = prompt(`${message.new.overrideQuestion} ${message.yesNo}`);

    switch (answer.toLowerCase()) {
      case 'yes':
      case 'y':
        fs.removeSync(Format.toFolderName(appName));
        break;
      default:
        return Logger.warn(message.new.didNotOverride);
    }
  }

  Logger.log('Creating new application: '.white + appName.white);

  copy(path.join(ROOT, 'templates', 'angular' ,'app'), appFolderName, () => {
    Logger.directoryTree(appFolderName);

    // Correctly handle dot-files
    ['gitignore', 'npmrc', 'eslintrc'].forEach((filename) => {
      let filePath = path.join(appFolderName, filename);
      fs.renameSync(filePath, filePath.replace(filename, `.${filename}`));
    });

    replace({
      regex: "%APP_NAME%",
      replacement: appName,
      paths: [appFolderName],
      recursive: true,
      silent: true
    });

    Logger.blankLine();

    if (noSetup) {
      Logger.done();
      return;
    }

    process.chdir(appFolderName);
    setup();
  });
};
Beispiel #9
0
function buildSongs (err) {
  var soundEnginePath = buildDir + '/sound_engine.s'
  var songsOut = '\nNUM_SONGS = $0' + songs.length // kinda hacky :(
  var words = []
  var includes = []
  songsOut += '\n\nsong_headers:\n'

  if (!err) {

    cpr(libAsmDir, buildDir, function (err, files) {
      if (err) {
        console.error(err)
      } else {
        songs.forEach(function (song, i) {
          var filePath = buildDir + '/song' + i + '.i'
          var word = '\t.word song' + i + '_header\n'
          var include = '\t.include "song' + i + '.i"\n'

          fs.writeFile(filePath, song, function (err) {
            if (err) {
              console.error(err)
            }
          })

          words.push(word)
          includes.push(include)
        })

        words.forEach(function (w) {
          songsOut += w
        })

        songsOut += '\n\t.include "sound_opcodes.s"\n'
        songsOut += '\n\t.include "duty.s"\n'
        songsOut += '\n\t.include "note_table.i"\n'
        songsOut += '\n\t.include "note_length_table.i"\n'
        songsOut += '\n\t.include "vol_envelopes.i"\n'

        includes.forEach(function (inc) {
          songsOut += inc
        })

        fs.appendFile(soundEnginePath, songsOut, function (err) {
          if (err) {
            console.error(err)
          }
        })
      }
    })

  } else {
    console.error(err)
  }
}
Beispiel #10
0
  async.forEach(assets, function(asset, cb) {
    var from = asset.from;
    var stats = fs.statSync(from);

    if(from.indexOf('./') === 0 && stats.isFile()) {
        cp(from, path.join(buildDir, asset.to, from), cb);
    }
    else {
        cpr(from, path.join(buildDir, asset.to), cb);
    }
  }, cb);
Beispiel #11
0
function moveDirectories (callback) {
  var sourceDir = path.join(newDir, 'docs')
  cpr(sourceDir, settings.targetDir, {
    overwrite: true
  }, function moved (error) {
    if (error) return callback(error)
    formatInternalLinks(settings.targetDir, version, function fixedLinks (error, msg) {
      if (error) return callback(error)
      return callback(null, 'Done!')
    })
  })
}
Beispiel #12
0
    modules.forEach(function(name) {
      var src = path.join(node_modules, name)
      var dst = path.join(answerDir, 'node_modules', name)

      cpr(src, dst, {
        deleteFirst: false
        , overwrite: false
      }, function(err) {
        if (err) return (done(err), done = noop)
        if (++complete === modules.length) done()
      })
    })
let copySource = () => {
    cpr('src', 'bundles/src', {
        deleteFirst: false,
        overwrite: true,
        confirm: false
    }, function(err, files) {
        if (err) {
            console.error(err);
            return;
        }
    });
};
Beispiel #14
0
function buildSite(data) {
	// now parse, build and write everything

	/// do it with callbacks?
	parseMarkdown(data, 'pages', '/', '/site/')
	parseMarkdown(data, 'posts', '/posts/', '/site/blog/')
	parseHTML(data, 'html', '/', '/site/')
	// copy assets folder
	cpr('assets', 'site/assets', {overwrite: true}, function(errs, files) {
    if (errs) console.log(errs)
	})
}
Beispiel #15
0
 before(function (done) {
   this.timeout(10000)
   // create a symlinked, and a physical copy of yargs in
   // our fixtures directory, so that we can test that the
   // nearest package.json is appropriately loaded.
   cpr('./', './test/fixtures/yargs', {
     filter: /node_modules|example|test|package\.json/
   }, function () {
     fs.symlinkSync(process.cwd(), './test/fixtures/yargs-symlink')
     return done()
   })
 })
gulp.task('init', () => {
	cpr('./theme_boilerplate', themeDir, (err, files) => {
		console.log('theme files and directories structure succefully created');
	});
	
	cpr('./package.json', themeDir, (err, files) => {
		console.log('package.json file succefully copied');
	});

	cpr('./gulpfile.babel.js', themeDir, (err, files) => {
		console.log('gulpfile.js file succefully copied');
	});

	cpr('./.babelrc', themeDir, (err, files) => {
		console.log('.babelrc file succefully copied');
	});

	cpr('./bower.json', themeDir, (err, files) => {
		console.log('bower.json file succefully copied');
	});

});
Beispiel #17
0
 fs.exists(from, exists => {
   if (exists) {
     cpr(from, to, err => {
       if (err) {
         reject(err)
       } else {
         resolve()
       }
     })
   } else {
     resolve()
   }
 })
Beispiel #18
0
function cloneSkeleton(name, destDir, cb) {
  var sourceDir = config.project.skeletonDir;

  var filter = function(fileName) {
    fileName = fileName.substr(sourceDir.length + 1);
    if (fileName.length > 0) { emit('creating: ' + fileName); }
    return true;
  };

  emit('Copying files to %s...', destDir);
  cpr(sourceDir, destDir, { filter: filter }, function (err) {
    if (err) { return cb(err); }
    customizeClonedFiles(name, destDir, cb);
  });
}
Beispiel #19
0
function main() {
    cpr(
        path.join(__dirname, '..', 'public'),
        path.join(__dirname, '..', 'static'),
        onCopy
    );

    function onCopy() {
        console.log('copy complete');

        buildCSS();
        console.log('css build');
        buildTemplates();
        console.log('templates build');
    }
}
let copyAssets = (cb) => {
    cpr('.', 'bundles', {
        deleteFirst: false,
        overwrite: true,
        confirm: false,
        filter: (item) => {
            return !/node_modules/.test(item) && /.*\.md/.test(item);
        }
    }, function(err, files) {
        if (err) {
            console.error(err);
            return;
        }
        copySource();
    });
};
Beispiel #21
0
function run(folder, options){

  if(fs.existsSync(folder)){
    out.error('Output directory already exists.');
    process.exit(1);
  }

  // copy basic folder as project.
  var from = path.join(__dirname,'../examples/basic');

  cpr(from, folder, function(err, files) {
    if(err){
      out.error('Failed to create new project. Err:',err);
      process.exit(1);
    }
  });
}
Beispiel #22
0
export default function initFixture(fixturePath, callback) {
  const fixtureDir = path.resolve(__dirname, "./fixtures/" + fixturePath);
  const testDir = path.resolve(tmpDir, "test-" + Date.now() + "-" + (uniqueId++));

  createdDirectories.push(testDir);

  cpr(fixtureDir, testDir, {
    confirm: true
  }, err => {
    if (err) return callback(err);
    process.chdir(testDir);
    child.execSync("git init . && git add -A && git commit -m 'Init commit'");
    callback();
  });

  return testDir;
}
    tmp.dir({ unsafeCleanup: true }, function(err, tmpDir) {
      if (err) { return cb(err); }

      var sourceDir = path.resolve(__dirname, 'apiproxy');
      var destDir = path.resolve(tmpDir, 'apiproxy');

      cpr(sourceDir, destDir, function(err) {
        if (err) { return cb(err); }

        customizeCopiedFiles(destDir, options, function() {

          options.directory = tmpDir;
          apigeetool.deployProxy(options, function(err, reply) {
            cb(err, reply);
          });
        });
      });
    });
Beispiel #24
0
  static copyToSystemFontDirectory(filesNames){
    var fontsDirectory = [];
    fontsDirectory.win32 = '\\Windows\\Fonts';
    fontsDirectory.darwin = '/Library/Fonts';
    fontsDirectory.linux = '/usr/share/fonts';

    cpr('tmp', fontsDirectory[process.platform],{
      deleteFirst: false,
      overwrite: false,
      confirm: true
    }, (error) => {
      if (error)
        console.log(error);
      else if (process.platform === 'win32')
        this.registerFonts(filesNames);

      console.log('√ Fonts copied to system\'s fonts directory.'.green);
    });
  }
Beispiel #25
0
function copy(from, to, callback){
  cpr(from, to, {
    deleteFirst: true,
    overwrite: true
  }, done(from, 'copy', callback))
}
Beispiel #26
0
 function(cb) { cpr(paths.server, path.join(paths.files, "/code/server"), cb); },
Beispiel #27
0
 function(cb) { cpr(paths.client, path.join(paths.files, "/code/client"), cb); },
Beispiel #28
0
    function onThemeConfigured(err) {
        if (err) { return cb(err); }

        cpr(path.join(__dirname, 'theme'), destination, onThemeReady);
    }
Beispiel #29
0
    function onThemeReady(err) {
        if (err) { return cb(err); }

        cpr(path.join(__dirname, 'node_modules'), destination, onModulesReady);
    }
Beispiel #30
0
cpr('./demos', './site/demos', function(err, files) {
  if (err) return console.log(err)
  cpr('./js', './site/js', function(err, files) {
    if (err) return console.log(err)
  })
})