Last change
on this file since 529 was
516,
checked in by hendrikvanantwerpen, 11 years ago
|
Enable deployment with Grunt.
|
File size:
1.7 KB
|
Rev | Line | |
---|
[516] | 1 | # grunt-git-deploy |
---|
| 2 | |
---|
| 3 | > Deploy files to any branch of any remote git repository. |
---|
| 4 | |
---|
| 5 | ## Getting Started |
---|
| 6 | This plugin requires Grunt `~0.4.1` |
---|
| 7 | |
---|
| 8 | 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: |
---|
| 9 | |
---|
| 10 | ```shell |
---|
| 11 | npm install grunt-git-deploy --save-dev |
---|
| 12 | ``` |
---|
| 13 | |
---|
| 14 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: |
---|
| 15 | |
---|
| 16 | ```js |
---|
| 17 | grunt.loadNpmTasks('grunt-git-deploy'); |
---|
| 18 | ``` |
---|
| 19 | |
---|
| 20 | ## The "git_deploy" task |
---|
| 21 | |
---|
| 22 | ### Overview |
---|
| 23 | The way this task works is it creates an empty git repository in the `src` directory you specify, creates an orphan branch and commits all files from that directory to it. Then it pushes the branch to the configured remote repository. **Be careful as this destroys the history of the remote branch.** |
---|
| 24 | |
---|
| 25 | In your project's Gruntfile, add a section named `git_deploy` to the data object passed into `grunt.initConfig()`. |
---|
| 26 | |
---|
| 27 | ```js |
---|
| 28 | grunt.initConfig({ |
---|
| 29 | git_deploy: { |
---|
| 30 | your_target: { |
---|
| 31 | options: { |
---|
| 32 | url: 'git@github.com:example/repo.git' |
---|
| 33 | }, |
---|
| 34 | src: 'directory/to/deploy' |
---|
| 35 | }, |
---|
| 36 | }, |
---|
| 37 | }) |
---|
| 38 | ``` |
---|
| 39 | |
---|
| 40 | ### Options |
---|
| 41 | |
---|
| 42 | #### options.url |
---|
| 43 | Type: `String` |
---|
| 44 | |
---|
| 45 | The URL to a remote git repository. This option is required. |
---|
| 46 | |
---|
| 47 | #### options.branch |
---|
| 48 | Type: `String` |
---|
| 49 | Default value: `'gh-pages'` |
---|
| 50 | |
---|
| 51 | The branch to push to. |
---|
| 52 | |
---|
| 53 | #### options.message |
---|
| 54 | Type: `String` |
---|
| 55 | Default value: `'autocommit'` |
---|
| 56 | |
---|
| 57 | Commit message. |
---|
| 58 | |
---|
| 59 | ## Contributing |
---|
| 60 | If you can think of a way to unit test this plugin please take a shot at it. |
---|
Note: See
TracBrowser
for help on using the repository browser.