Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inital grunt-contrib-symlink release
-adding implementation, tests and docs
- Loading branch information
0 parents
commit 497ad93
Showing
16 changed files
with
489 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
npm-debug.log | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- 0.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Paul Dixon (http://www.mintbridge.co.uk/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
v0.1.0: | ||
date: 2012-12-20 | ||
changes: | ||
- Initial Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2012 Tyler Kellen, 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# grunt-contrib-symlink [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-symlink.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-symlink) | ||
|
||
Create symlinks between files/directories | ||
|
||
## Overview | ||
|
||
This task can be used to create symlinks between files/directories in your project. It is a multitask and so can | ||
be used to create multiple links. | ||
|
||
### Getting Started | ||
Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-contrib-symlink` | ||
|
||
Then add this line to your project's `grunt.js` gruntfile: | ||
|
||
```javascript | ||
grunt.loadNpmTasks('grunt-contrib-symlink'); | ||
``` | ||
|
||
### Usage | ||
|
||
Inside your `grunt.js` file add a section named `symlink`. This section specifies the target and link path, and optionally any options you want to use. Once the section has been added you can run the task with `grunt symlink`. | ||
|
||
### Parameters | ||
|
||
#### target ```string``` | ||
|
||
Path to the file/directory you want to link to. Paths will be relative to the grunt.js file unless an absolute path is used. | ||
|
||
#### link ```string``` | ||
|
||
Path to the new file/directory link location. Paths will be relative to the grunt.js file unless an absolute path is used. | ||
|
||
#### type ```string``` | ||
|
||
|
||
#### options ```object``` | ||
|
||
A hash of options to configure the symlink and tasks behaviour | ||
|
||
##### overwrite ```boolean``` | ||
|
||
Choose whether or not to overwrite existing symlink/files, default is false. | ||
|
||
##### force ```boolean``` | ||
|
||
Force can be used to create the directory structure for the link path if it has not previously been | ||
created, default is false | ||
|
||
##### type ```boolean``` | ||
|
||
To specifically set the type of symlink to be created, default type will be inferred from | ||
the target type. Values can be 'dir', 'file', or 'junction'. see [node.js - fs][node_symlink] for more info | ||
|
||
#### Usage Examples | ||
|
||
```javascript | ||
symlink: { | ||
docroot: { | ||
target: 'path/to/target', | ||
link: path/to/link | ||
}, | ||
another: { | ||
target: 'path/to/target', | ||
link: path/to/link, | ||
options: { | ||
overwrite: true, | ||
force: true | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Release History | ||
* 2012-12-20 v0.1.0 Initial Release | ||
|
||
-- | ||
*Task submitted by [Paul Dixon](http://www.mintbridge.co.uk/).* | ||
|
||
[grunt]: https://github.com/gruntjs/grunt | ||
[getting_started]: https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md | ||
[node_symlink]: http://nodejs.org/api/fs.html#fs_fs_symlink_srcpath_dstpath_type_callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
```javascript | ||
symlink: { | ||
docroot: { | ||
target: 'path/to/target', | ||
link: path/to/link | ||
}, | ||
another: { | ||
target: 'path/to/target', | ||
link: path/to/link, | ||
options: { | ||
overwrite: true, | ||
force: true | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
### Parameters | ||
|
||
#### target ```string``` | ||
|
||
Path to the file/directory you want to link to. Paths will be relative to the grunt.js file unless an absolute path is used. | ||
|
||
#### link ```string``` | ||
|
||
Path to the new file/directory link location. Paths will be relative to the grunt.js file unless an absolute path is used. | ||
|
||
#### type ```string``` | ||
|
||
|
||
#### options ```object``` | ||
|
||
A hash of options to configure the symlink and tasks behaviour | ||
|
||
##### overwrite ```boolean``` | ||
|
||
Choose whether or not to overwrite existing symlink/files, default is false. | ||
|
||
##### force ```boolean``` | ||
|
||
Force can be used to create the directory structure for the link path if it has not previously been | ||
created, default is false | ||
|
||
##### type ```boolean``` | ||
|
||
To specifically set the type of symlink to be created, default type will be inferred from | ||
the target type. Values can be 'dir', 'file', or 'junction'. see [node.js - fs][node_symlink] for more info | ||
|
||
[node_symlink]: http://nodejs.org/api/fs.html#fs_fs_symlink_srcpath_dstpath_type_callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* grunt-contrib-symlink | ||
* http://gruntjs.com/ | ||
* | ||
* Copyright (c) 2012 Paul Dixon, contributors | ||
* Licensed under the MIT license. | ||
*/ | ||
|
||
module.exports = function(grunt) { | ||
'use strict'; | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
lint: { | ||
all: ['grunt.js', 'tasks/*.js', '<config:nodeunit.tasks>'] | ||
}, | ||
|
||
jshint: { | ||
options: { | ||
curly: true, | ||
eqeqeq: true, | ||
immed: true, | ||
latedef: true, | ||
newcap: true, | ||
noarg: true, | ||
sub: true, | ||
undef: true, | ||
boss: true, | ||
eqnull: true, | ||
node: true, | ||
es5: true | ||
} | ||
}, | ||
|
||
// Before generating any new files, remove any previously-created files. | ||
clean: { | ||
test: ['tmp', 'single.js', 'single2.js', 'folder_one', 'folder_two'] | ||
}, | ||
|
||
// Configuration to be run (and then tested). | ||
symlink: { | ||
single: { | ||
target: 'test/fixtures/single.js', | ||
link:'single.js' | ||
}, | ||
single2: { | ||
target: 'test/fixtures/single.js', | ||
link:'single2.js' | ||
}, | ||
singleOverwrite:{ | ||
target: 'test/fixtures/single2.js', | ||
link:'single2.js', | ||
options: { | ||
overwrite: true, | ||
force: false | ||
} | ||
}, | ||
singleInNewDirectory:{ | ||
target: 'test/fixtures/single.js', | ||
link:'tmp/single.js', | ||
options: { | ||
overwrite: true, | ||
force: true | ||
} | ||
}, | ||
directory: { | ||
target: 'test/fixtures/folder_one', | ||
link:'folder_one' | ||
}, | ||
directory2: { | ||
target: 'test/fixtures/folder_one', | ||
link:'folder_two' | ||
}, | ||
directoryOverwrite:{ | ||
target: 'test/fixtures/folder_two', | ||
link:'folder_two', | ||
options: { | ||
overwrite: true, | ||
force: false | ||
} | ||
}, | ||
directoryInNewDirectory:{ | ||
target: 'test/fixtures/folder_one', | ||
link:'tmp/test/folder_one', | ||
options: { | ||
overwrite: true, | ||
force: true | ||
} | ||
} | ||
}, | ||
|
||
// Unit tests. | ||
nodeunit: { | ||
tasks: ['test/*_test.js'] | ||
} | ||
}); | ||
|
||
// Actually load this plugin's task(s). | ||
grunt.loadTasks('tasks'); | ||
|
||
// The clean plugin helps in testing. | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
|
||
// Whenever the "test" task is run, first clean the "tmp" dir, then run this | ||
// plugin's task(s), then test the result. | ||
grunt.renameTask('test', 'nodeunit'); | ||
grunt.registerTask('test', 'clean symlink nodeunit clean'); | ||
|
||
// By default, lint and run all tests. | ||
grunt.registerTask('default', 'lint test'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "grunt-contrib-symlink", | ||
"description": "Create a symlink between paths", | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/mintbridge/grunt-contrib-symlink", | ||
"author": { | ||
"name": "Paul Dixon", | ||
"url": "http://www.mintbridge.co.uk/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mintbridge/grunt-contrib-symlink.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/mintbridge/grunt-contrib-symlink/issues" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/mintbridge/grunt-contrib-symlink/blob/master/LICENSE-MIT" | ||
} | ||
], | ||
"main": "grunt.js", | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"scripts": { | ||
"test": "grunt test" | ||
}, | ||
"dependencies": { | ||
"grunt-lib-contrib": "~0.3.0", | ||
"mkdirp": "~0.3.1", | ||
"rimraf": "~2.0.3" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.3.15", | ||
"grunt-contrib-clean": "~0.3.0" | ||
}, | ||
"keywords": [ | ||
"gruntplugin", "symlink" | ||
], | ||
"contributors": [ | ||
{ | ||
"name": "Paul Dixon", | ||
"url": "http://www.mintbridge.co.uk/" | ||
} | ||
] | ||
} |
Oops, something went wrong.