pax_global_header00006660000000000000000000000064126604432230014514gustar00rootroot0000000000000052 comment=af104010d9e35bc53635cd0bdec16791e009e530 grunt-contrib-clean-1.0.0/000077500000000000000000000000001266044322300153675ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/.gitattributes000066400000000000000000000000141266044322300202550ustar00rootroot00000000000000* text=auto grunt-contrib-clean-1.0.0/.gitignore000066400000000000000000000000361266044322300173560ustar00rootroot00000000000000node_modules npm-debug.log tmpgrunt-contrib-clean-1.0.0/.jshintrc000066400000000000000000000003211266044322300172100ustar00rootroot00000000000000{ "boss": true, "curly": true, "eqeqeq": true, "eqnull": true, "immed": true, "latedef": true, "newcap": true, "noarg": true, "node": true, "sub": true, "undef": true, "unused": true } grunt-contrib-clean-1.0.0/.travis.yml000066400000000000000000000003071266044322300175000ustar00rootroot00000000000000sudo: false language: node_js node_js: - "0.10" - "0.12" - "4" - "5" - "iojs" before_install: - npm install -g npm before_script: - npm install -g grunt-cli matrix: fast_finish: true grunt-contrib-clean-1.0.0/AUTHORS000066400000000000000000000003571266044322300164440ustar00rootroot00000000000000Tim Branyen (http://tbranyen.com/) Tyler Kellen (http://goingslowly.com/) Chris Talkington (http://christalkington.com/) Sebastian Golasch (http://www.asciidisco.com/) Vlad Filippov (http://vf.io) "Cowboy" Ben Alman (http://benalman.com/) grunt-contrib-clean-1.0.0/CHANGELOG000066400000000000000000000025131266044322300166020ustar00rootroot00000000000000v1.0.0: date: 2016-02-15 changes: - Drop support for Node.js v0.8 - Grunt peer dependency tagged `>= 0.4.5` - Dependency updates v0.7.0: date: 2015-11-13 changes: - Dependency updates v0.6.0: date: 2014-07-27 changes: - Less verbose output. - README updates. v0.5.0: date: 2013-07-15 changes: - Use rimraf directly, version 2.2.1 to fix issue on Windows. - Add no-write option to mimic grunt.file.delete behavior. v0.4.1: date: 2013-04-16 changes: - Check if file exists to avoid trying to delete a non-existent file. v0.4.0: date: 2013-02-15 changes: - First official release for Grunt 0.4.0. v0.4.0rc6: date: 2013-01-18 changes: - Updating grunt/gruntplugin dependencies to rc6. - Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. v0.4.0rc5: date: 2013-01-09 changes: - Updating to work with grunt v0.4.0rc5. - Switching to this.filesSrc api. v0.4.0a: date: 2012-12-07 changes: - Conversion to grunt v0.4 conventions. - Remove node v0.6 and grunt v0.3 support. - Add force option to bypass CWD check. v0.3.0: date: 2012-09-23 changes: - Options no longer accepted from global config key. v0.2.0: date: 2012-09-10 changes: - Refactored from grunt-contrib into individual repo. grunt-contrib-clean-1.0.0/CONTRIBUTING.md000066400000000000000000000001771266044322300176250ustar00rootroot00000000000000Please see the [Contributing to grunt](http://gruntjs.com/contributing) guide for information on contributing to this project. grunt-contrib-clean-1.0.0/Gruntfile.js000066400000000000000000000037611266044322300176730ustar00rootroot00000000000000/* * grunt-contrib-clean * http://gruntjs.com/ * * Copyright (c) 2016 Tim Branyen, contributors * Licensed under the MIT license. */ 'use strict'; module.exports = function(grunt) { // Project configuration. grunt.initConfig({ jshint: { all: [ 'Gruntfile.js', 'tasks/*.js', '<%= nodeunit.tests %>' ], options: { jshintrc: '.jshintrc' } }, // Configuration to be run (and then tested). clean: { shortPathTest: ['tmp/sample_short'], longPathTest: { src: ['tmp/sample_long'] }, exclude: ['tmp/end_01/**/*', '!tmp/end_01/1.txt'], excludeSub: ['tmp/end_02/**/*.*', '!tmp/end_02/2/**/*'] }, // Unit tests. nodeunit: { tests: ['test/*_test.js'] } }); // Actually load this plugin's task(s). grunt.loadTasks('tasks'); // These plugins provide necessary tasks. grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-nodeunit'); grunt.loadNpmTasks('grunt-contrib-internal'); // Setup a test helper to create some folders to clean. grunt.registerTask('copy', 'Copy fixtures to a temp location.', function() { grunt.file.copy('test/fixtures/sample_long/long.txt', 'tmp/sample_long/long.txt'); grunt.file.copy('test/fixtures/sample_short/short.txt', 'tmp/sample_short/short.txt'); var cwd = 'test/fixtures/start'; grunt.file.expand({ cwd: cwd }, '**/*.*') .forEach(function (file) { var ecwd = 'test/expected'; grunt.file.expand({ cwd: ecwd }, '*') .forEach(function (dir) { grunt.file.copy(cwd + '/' + file, 'tmp/' + dir + '/' + file); }); }); }); // Whenever the 'test' task is run, first create some files to be cleaned, // then run this plugin's task(s), then test the result. grunt.registerTask('test', ['jshint', 'copy', 'clean', 'nodeunit']); // By default, lint and run all tests. grunt.registerTask('default', ['jshint', 'test', 'build-contrib']); }; grunt-contrib-clean-1.0.0/LICENSE-MIT000066400000000000000000000020551266044322300170250ustar00rootroot00000000000000Copyright (c) 2016 Tim Branyen, contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. grunt-contrib-clean-1.0.0/README.md000066400000000000000000000126541266044322300166560ustar00rootroot00000000000000# grunt-contrib-clean v0.7.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-clean.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-clean) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/li28411ceq3n833d/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-clean/branch/master) > Clean files and folders ## Getting Started If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: ```shell npm install grunt-contrib-clean --save-dev ``` Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: ```js grunt.loadNpmTasks('grunt-contrib-clean'); ``` *This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-clean/tree/grunt-0.3-stable).* ## Clean task _Run this task with the `grunt clean` command._ Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. *Due to the destructive nature of this task, always be cautious of the paths you clean.* ### Options #### force Type: `Boolean` Default: `false` This overrides this task from blocking deletion of folders outside current working dir (CWD). Use with caution. #### no-write Type: `Boolean` Default: `false` Will not actually delete any files or directories. If the task is run with the `--verbose` flag, the task will log messages of what files would have be deleted. _Note: As this task property contains a hyphen, you will need to surround it with quotes._ ### Usage Examples There are three formats you can use to run this task. #### Short ```js clean: ["path/to/dir/one", "path/to/dir/two"] ``` #### Medium (specific targets with global options) ```js clean: { build: ["path/to/dir/one", "path/to/dir/two"], release: ["path/to/another/dir/one", "path/to/another/dir/two"] }, ``` #### Long (specific targets with per target options) ```js clean: { build: { src: ["path/to/dir/one", "path/to/dir/two"] } } ``` "Compact" and "Files Array" formats support a few [additional properties](http://gruntjs.com/configuring-tasks#files) which help you deal with hidden files, process dynamic mappings and so on. #### Globbing Patterns Although documented [in the Grunt Docs](http://gruntjs.com/configuring-tasks#globbing-patterns), here are some globbing pattern examples to achieve some common tasks: ```js clean: { folder: ['path/to/dir/'], folder_v2: ['path/to/dir/**'], contents: ['path/to/dir/*'], subfolders: ['path/to/dir/*/'], css: ['path/to/dir/*.css'], all_css: ['path/to/dir/**/*.css'] } ``` * __`folder`:__ Deletes the `dir/` folder * __`folder_v2`:__ Deletes the `dir/` folder * __`contents`:__ Keeps the `dir/` folder, but deletes the contents * __`subfolders`:__ Keeps the files inside the `dir/` folder, but deletes all subfolders * __`css`:__ Deletes all `*.css` files inside the `dir/` folder, excluding subfolders * __`all_css`:__ Deletes all `*.css` files inside the `dir/` folder and its subfolders ##### Skipping Files ```js // Deletes all .js files, but skips min.js files clean: { js: ["path/to/dir/*.js", "!path/to/dir/*.min.js"] } ``` ###### Options Options can be specified for all `clean` tasks and for each `clean:target`. ####### All tasks ```js // Prevents all targets from deleting any files clean: { options: { 'no-write': true }, build: ['dev/build'], release: ['dist'] } ``` ####### Per-target ```js // Will delete files for `build` target // Will NOT delete files for `release` target clean: { build: ['dev/build'], release: { options: { 'no-write': true }, src: ['dist'] } } ``` ## Release History * 2016-02-15   v1.0.0   Drop support for Node.js v0.8 Grunt peer dependency tagged `>= 0.4.5` Dependency updates * 2015-11-13   v0.7.0   Dependency updates * 2014-07-27   v0.6.0   Less verbose output. README updates. * 2013-07-15   v0.5.0   Use rimraf directly, version 2.2.1 to fix issue on Windows. Add no-write option to mimic grunt.file.delete behavior. * 2013-04-16   v0.4.1   Check if file exists to avoid trying to delete a non-existent file. * 2013-02-15   v0.4.0   First official release for Grunt 0.4.0. * 2013-01-18   v0.4.0rc6   Updating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. * 2013-01-09   v0.4.0rc5   Updating to work with grunt v0.4.0rc5. Switching to this.filesSrc api. * 2012-12-07   v0.4.0a   Conversion to grunt v0.4 conventions. Remove node v0.6 and grunt v0.3 support. Add force option to bypass CWD check. * 2012-09-23   v0.3.0   Options no longer accepted from global config key. * 2012-09-10   v0.2.0   Refactored from grunt-contrib into individual repo. --- Task submitted by [Tim Branyen](http://tbranyen.com/) *This file was generated on Mon Feb 15 2016 13:42:25.* grunt-contrib-clean-1.0.0/appveyor.yml000066400000000000000000000020071266044322300177560ustar00rootroot00000000000000# Fix line endings on Windows init: - git config --global core.autocrlf true # What combinations to test environment: matrix: - nodejs_version: "0.10" - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "5" platform: - x86 - x64 install: - ps: Install-Product node $env:nodejs_version - npm install -g npm - npm install -g grunt-cli - npm install test_script: # Output useful info for debugging. - node --version && npm --version # We test multiple Windows shells because of prior stdout buffering issues # filed against Grunt. https://github.com/joyent/node/issues/3584 - ps: "npm test # PowerShell" # Pass comment to PS for easier debugging - cmd: npm test build: off matrix: fast_finish: true cache: - C:\Users\appveyor\AppData\Roaming\npm\node_modules -> package.json # global npm modules - C:\Users\appveyor\AppData\Roaming\npm-cache -> package.json # npm cache - node_modules -> package.json # local npm modules grunt-contrib-clean-1.0.0/docs/000077500000000000000000000000001266044322300163175ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/docs/clean-examples.md000066400000000000000000000041021266044322300215340ustar00rootroot00000000000000# Usage Examples There are three formats you can use to run this task. ## Short ```js clean: ["path/to/dir/one", "path/to/dir/two"] ``` ## Medium (specific targets with global options) ```js clean: { build: ["path/to/dir/one", "path/to/dir/two"], release: ["path/to/another/dir/one", "path/to/another/dir/two"] }, ``` ## Long (specific targets with per target options) ```js clean: { build: { src: ["path/to/dir/one", "path/to/dir/two"] } } ``` "Compact" and "Files Array" formats support a few [additional properties](http://gruntjs.com/configuring-tasks#files) which help you deal with hidden files, process dynamic mappings and so on. ## Globbing Patterns Although documented [in the Grunt Docs](http://gruntjs.com/configuring-tasks#globbing-patterns), here are some globbing pattern examples to achieve some common tasks: ```js clean: { folder: ['path/to/dir/'], folder_v2: ['path/to/dir/**'], contents: ['path/to/dir/*'], subfolders: ['path/to/dir/*/'], css: ['path/to/dir/*.css'], all_css: ['path/to/dir/**/*.css'] } ``` * __`folder`:__ Deletes the `dir/` folder * __`folder_v2`:__ Deletes the `dir/` folder * __`contents`:__ Keeps the `dir/` folder, but deletes the contents * __`subfolders`:__ Keeps the files inside the `dir/` folder, but deletes all subfolders * __`css`:__ Deletes all `*.css` files inside the `dir/` folder, excluding subfolders * __`all_css`:__ Deletes all `*.css` files inside the `dir/` folder and its subfolders ### Skipping Files ```js // Deletes all .js files, but skips min.js files clean: { js: ["path/to/dir/*.js", "!path/to/dir/*.min.js"] } ``` #### Options Options can be specified for all `clean` tasks and for each `clean:target`. ##### All tasks ```js // Prevents all targets from deleting any files clean: { options: { 'no-write': true }, build: ['dev/build'], release: ['dist'] } ``` ##### Per-target ```js // Will delete files for `build` target // Will NOT delete files for `release` target clean: { build: ['dev/build'], release: { options: { 'no-write': true }, src: ['dist'] } } ``` grunt-contrib-clean-1.0.0/docs/clean-options.md000066400000000000000000000007261266044322300214210ustar00rootroot00000000000000# Options ## force Type: `Boolean` Default: `false` This overrides this task from blocking deletion of folders outside current working dir (CWD). Use with caution. ## no-write Type: `Boolean` Default: `false` Will not actually delete any files or directories. If the task is run with the `--verbose` flag, the task will log messages of what files would have be deleted. _Note: As this task property contains a hyphen, you will need to surround it with quotes._ grunt-contrib-clean-1.0.0/docs/clean-overview.md000066400000000000000000000003421266044322300215660ustar00rootroot00000000000000Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. *Due to the destructive nature of this task, always be cautious of the paths you clean.*grunt-contrib-clean-1.0.0/docs/overview.md000066400000000000000000000004451266044322300205120ustar00rootroot00000000000000*This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-clean/tree/grunt-0.3-stable).* grunt-contrib-clean-1.0.0/package.json000066400000000000000000000016331266044322300176600ustar00rootroot00000000000000{ "name": "grunt-contrib-clean", "description": "Clean files and folders", "version": "1.0.0", "author": { "name": "Grunt Team", "url": "http://gruntjs.com/" }, "repository": "gruntjs/grunt-contrib-clean", "license": "MIT", "engines": { "node": ">= 0.10.0" }, "main": "tasks/clean.js", "scripts": { "test": "grunt test" }, "dependencies": { "async": "^1.5.2", "rimraf": "^2.5.1" }, "devDependencies": { "dir-compare": "0.0.2", "grunt": "^0.4.5", "grunt-cli": "^0.1.13", "grunt-contrib-internal": "^0.4.10", "grunt-contrib-jshint": "^0.12.0", "grunt-contrib-nodeunit": "^0.4.1" }, "peerDependencies": { "grunt": ">= 0.4.5" }, "keywords": [ "gruntplugin", "clean", "cleanup", "remove", "delete", "del", "rm", "rmrf", "rimraf" ], "files": [ "tasks" ], "appveyor_id": "li28411ceq3n833d" } grunt-contrib-clean-1.0.0/tasks/000077500000000000000000000000001266044322300165145ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/tasks/clean.js000066400000000000000000000035671266044322300201470ustar00rootroot00000000000000/* * grunt-contrib-clean * http://gruntjs.com/ * * Copyright (c) 2016 Tim Branyen, contributors * Licensed under the MIT license. */ 'use strict'; var async = require('async'); var rimraf = require('rimraf'); module.exports = function(grunt) { function clean(filepath, options, done) { if (!grunt.file.exists(filepath)) { return done(); } // Only delete cwd or outside cwd if --force enabled. Be careful, people! if (!options.force) { if (grunt.file.isPathCwd(filepath)) { grunt.verbose.error(); grunt.fail.warn('Cannot delete the current working directory.'); return done(); } else if (!grunt.file.isPathInCwd(filepath)) { grunt.verbose.error(); grunt.fail.warn('Cannot delete files outside the current working directory.'); return done(); } } grunt.verbose.writeln((options['no-write'] ? 'Not actually cleaning ' : 'Cleaning ') + filepath + '...'); // Actually delete. Or not. if (options['no-write']) { return done(); } rimraf(filepath, function (err) { if (err) { grunt.log.error(); grunt.fail.warn('Unable to delete "' + filepath + '" file (' + err.message + ').', err); } done(); }); } grunt.registerMultiTask('clean', 'Clean files and folders.', function() { // Merge task-specific and/or target-specific options with these defaults. var options = this.options({ force: grunt.option('force') === true, 'no-write': grunt.option('no-write') === true }); var done = this.async(); // Clean specified files / dirs. var files = this.filesSrc; async.eachSeries(files, function (filepath, cb) { clean(filepath, options, cb); }, function (err) { grunt.log.ok(files.length + ' ' + grunt.util.pluralize(files.length, 'path/paths') + ' cleaned.'); done(err); }); }); }; grunt-contrib-clean-1.0.0/test/000077500000000000000000000000001266044322300163465ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/clean_test.js000066400000000000000000000016331266044322300210300ustar00rootroot00000000000000'use strict'; var grunt = require('grunt'); var dircompare = require('dir-compare'); exports.clean = { shortPathTest: function(test) { test.expect(1); var expected = grunt.file.exists('tmp/sample_short'); test.equal(expected, false, 'should remove the short directory using clean'); test.done(); }, longPathTest: function(test) { test.expect(1); var expected = grunt.file.exists('tmp/sample_long'); test.equal(expected, false, 'should remove the long directory using clean'); test.done(); }, exclude: function (test) { var res = dircompare.compareSync('test/expected/end_01', 'tmp/end_01'); test.equal(true, res.same, 'should match exclusions'); test.done(); }, excludeSub: function (test) { var res = dircompare.compareSync('test/expected/end_02', 'tmp/end_02'); test.equal(true, res.same, 'should match exclusions for sub'); test.done(); } }; grunt-contrib-clean-1.0.0/test/expected/000077500000000000000000000000001266044322300201475ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/expected/end_01/000077500000000000000000000000001266044322300212155ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/expected/end_01/1.txt000066400000000000000000000000001266044322300221040ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/expected/end_02/000077500000000000000000000000001266044322300212165ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/expected/end_02/2/000077500000000000000000000000001266044322300213575ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/expected/end_02/2/1.txt000066400000000000000000000000001266044322300222460ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/000077500000000000000000000000001266044322300202175ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/sample_long/000077500000000000000000000000001266044322300225175ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/sample_long/long.txt000066400000000000000000000000041266044322300242110ustar00rootroot00000000000000txt grunt-contrib-clean-1.0.0/test/fixtures/sample_short/000077500000000000000000000000001266044322300227175ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/sample_short/short.txt000066400000000000000000000000041266044322300246110ustar00rootroot00000000000000txt grunt-contrib-clean-1.0.0/test/fixtures/start/000077500000000000000000000000001266044322300213545ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/start/1.txt000066400000000000000000000000001266044322300222430ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/start/2.txt000066400000000000000000000000001266044322300222440ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/start/2/000077500000000000000000000000001266044322300215155ustar00rootroot00000000000000grunt-contrib-clean-1.0.0/test/fixtures/start/2/1.txt000066400000000000000000000000001266044322300224040ustar00rootroot00000000000000