clean.js 984 B

1234567891011121314151617181920212223
  1. var exec = require('child_process').exec;
  2. var path = require('path');
  3. exec('rm -rf ' + path.join(path.resolve('.'), 'content') + ' && mkdir content && mkdir ' + path.join('content', 'patterns'), function(error, stdout, stderr) {
  4. console.log('Initializing new project...');
  5. if (error !== null) {
  6. console.error('Error creating folder structure.');
  7. return;
  8. }
  9. exec ('hugo new ' + path.join('patterns', 'pattern.md') + ' && hugo new _index.md && hugo new print-version.md --kind print-version', function(error, stdout, stderr) {
  10. if (error !== null) {
  11. console.error('Error creating new project files.');
  12. return;
  13. }
  14. exec ('cat ' + path.join('themes', 'infusion', 'data', 'README_BLANK.md') + ' > README.md', function(error, stdout, stderr) {
  15. if (error !== null) {
  16. console.error('Error initializing README file.');
  17. return;
  18. }
  19. console.log('New project ready. See patterns/pattern.md to get started.');
  20. });
  21. });
  22. });