           grunt.log.writeln "#{chalk.red('Overwriting:')} dist#{filePathInDist.replace(distDirectory, '')}"
 
         fs.writeFileSync filePathInDist, fs.readFileSync(filePath)
+
+    grunt.log.writeln "#{chalk.green('OK')}"


fs = require "fs"
wrench = require "wrench"

module.exports = (grunt)->


  grunt.loadNpmTasks 'grunt-contrib-concat'

  grunt.initConfig

    clean:
      # Clean dist/ folder (delete and create again)
      dist:
        ["dist/"]

    copy:
      # Copy controllers from app/controllers to dist/controllers
      controllers:
        expand: true
        cwd: 'app/controllers'
        src: ['**/*.js', '**/*.coffee']
        dest: 'dist/controllers/'
      # Copy models from app/models to dist/models
      models:
        expand:true
        cwd: 'app/models/'
        src: ['**/*.js', '**/*.coffee']
        dest: 'dist/models/'
      # Copy contents of www/ directory to dist/
      statics:
        src: 'www/*'
        dest: 'dist/'

    concat:
      # Concatenate all model files into one
      models:
        src: 'app/models/*.js'
        dest: 'dist/models/models.js'

  grunt.registerTask 'steroids-make', "Create the dist/ folder that is copied to the device.", [
    'clean:dist'
    'copy:controllers'
    'copy:models'
    'copy:statics'
    'concat:models'
    'steroids-compile-views'
    'steroids-cordova-merges'
  ]


  grunt.registerTask 'steroids-compile-views', "Compile views", ->

    buildDirectory            = "dist"
    buildControllersDirectory = path.join "dist", "controllers"

    appLayoutsDirectory       = path.join "app", "views", "layouts"

    wwwDirectory              = "www"

    viewDirectories = []

    # get each view folder (except layout)
    for dirPath in grunt.file.expand "app/views/*" when fs.statSync(dirPath).isDirectory()
      basePath = path.basename(dirPath)
      unless basePath is "layouts" + path.sep or basePath is "layouts"
        viewDirectories.push dirPath


    for viewDir in viewDirectories
