module.exports = (grunt) ->

  # Constants
  COFFEE_FILES_PATH = 'src'
  JS_FILES_PATH = 'lib'
  COFFEE_FILES = '**/*.coffee'

  # Project configuration
  grunt.initConfig
    coffee:
      dev:
        expand: true
        cwd: COFFEE_FILES_PATH
        src: [COFFEE_FILES]
        dest: JS_FILES_PATH
        rename: (dest, src)-> "#{dest}/#{src.replace(/\.coffee$/, '.js')}"

    watch:
      files: [COFFEE_FILES]
      tasks: ['newer:coffee:dev']


  # Dependencies
  grunt.loadNpmTasks 'grunt-contrib-watch'
  grunt.loadNpmTasks 'grunt-contrib-coffee'
  grunt.loadNpmTasks 'grunt-newer'

  grunt.registerTask 'default', ['coffee:dev']