Skip to content

Commit

Permalink
add a default .gitignore and make an initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpvar committed May 22, 2013
1 parent b24442f commit 18a3328
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion commands/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var path = require('path'),
fs = require('fs'),
mkdirp = require('mkdirp');
mkdirp = require('mkdirp'),
exec = require('child_process').exec;

var json = {
name : "default project name",
Expand All @@ -26,6 +27,11 @@ var main = [
''
].join('\n')

var gitignore = [
'.DS_Store',
'build'
].join('\n');


module.exports = function(argv, config) {

Expand All @@ -39,9 +45,22 @@ module.exports = function(argv, config) {
}

fs.writeFileSync(path.join(projectDir, 'main.c'), main);
fs.writeFileSync(path.join(projectDir, '.gitignore'), gitignore);
fs.writeFileSync(path.join(projectDir, 'readme.md'), '# ' + json.name + '\n');

fs.writeFileSync(
path.join(projectDir, 'avr.json'),
JSON.stringify(json, null, ' ')
);

exec(
'git init . && git add . && git commit -m "initial"',
{ cwd : projectDir },
function(err) {
if (err) {
console.log(arguments);
throw err;
}
}
);
}

0 comments on commit 18a3328

Please sign in to comment.