Skip to content

Instantly share code, notes, and snippets.

@bmeck
Forked from tbergeron/gist:3372274
Created August 16, 2012 18:18
Show Gist options
  • Select an option

  • Save bmeck/3372344 to your computer and use it in GitHub Desktop.

Select an option

Save bmeck/3372344 to your computer and use it in GitHub Desktop.

Revisions

  1. bmeck renamed this gist Aug 16, 2012. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions gistfile1.js → async-example.js
    Original file line number Diff line number Diff line change
    @@ -17,17 +17,18 @@
    })

    function createDirectories(list, callback) {
    async.map(list, createDirectory, function(err, results) {
    async.forEachSeries(list, createDirectory, function(err, results) {
    callback(true)
    })

    function createDirectory(name) {
    function createDirectory(name, next) {
    fs.mkdir('./app', 0755, function(e) {
    if (e) {
    console.error('Error while creating', name)
    callback(false)
    next(e)
    } else {
    console.warn(' - Created directory:', name)
    next()
    }
    })
    }
  2. Tommy Bergeron revised this gist Aug 16, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,8 @@

    function createDirectories(list, callback) {
    async.map(list, createDirectory, function(err, results) {
    callback()
    });
    callback(true)
    })

    function createDirectory(name) {
    fs.mkdir('./app', 0755, function(e) {
  3. Tommy Bergeron revised this gist Aug 16, 2012. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,21 @@
    var directories = [
    './app',
    './app/controllers',
    './app/helpers',
    './app/repositories',
    './app/validations',
    './app/views',
    './app/views/partials'
    ]

    createDirectories(directories, function(result) {
    if (result) {
    writeBasicAppFiles(function() {
    console.warn('New ThinAir has been created successfully!')
    })
    }
    })

    function createDirectories(list, callback) {
    async.map(list, createDirectory, function(err, results) {
    callback()
  4. Tommy Bergeron created this gist Aug 16, 2012.
    16 changes: 16 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    function createDirectories(list, callback) {
    async.map(list, createDirectory, function(err, results) {
    callback()
    });

    function createDirectory(name) {
    fs.mkdir('./app', 0755, function(e) {
    if (e) {
    console.error('Error while creating', name)
    callback(false)
    } else {
    console.warn(' - Created directory:', name)
    }
    })
    }
    }