Repository: incubator-nifi
Updated Branches:
  refs/heads/develop c4d1666a2 -> 1f139e219


NIFI-592:
- Automating deployment of website changes.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/951cff9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/951cff9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/951cff9b

Branch: refs/heads/develop
Commit: 951cff9bda0e1efafd6dd7b5a13592cab668778b
Parents: c12778f
Author: Matt Gilman <[email protected]>
Authored: Wed May 13 18:57:51 2015 -0400
Committer: Matt Gilman <[email protected]>
Committed: Wed May 13 18:57:51 2015 -0400

----------------------------------------------------------------------
 nifi-site/Gruntfile.js | 100 +++++++++++++++++++++++++++++++++++++++++++-
 nifi-site/package.json |   3 +-
 2 files changed, 100 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/951cff9b/nifi-site/Gruntfile.js
----------------------------------------------------------------------
diff --git a/nifi-site/Gruntfile.js b/nifi-site/Gruntfile.js
index 2a3a5ba..782f5e4 100644
--- a/nifi-site/Gruntfile.js
+++ b/nifi-site/Gruntfile.js
@@ -1,6 +1,13 @@
+/* global module */
+
 module.exports = function (grunt) {
     // Project configuration.
     grunt.initConfig({
+        config: {
+            svn: {
+                url: 
'https://svn.apache.org/repos/asf/incubator/nifi/site/trunk'
+            }
+        },
         pkg: grunt.file.readJSON('package.json'),
         clean: {
             options: {
@@ -9,7 +16,8 @@ module.exports = function (grunt) {
             js: ['dist/js/'],
             css: ['dist/css/'],
             assets: ['dist/assets/*'],
-            generated: ['dist/docs']
+            generated: ['dist/docs'],
+            all: ['dist']
         },
         assemble: {
             options: {
@@ -115,6 +123,51 @@ module.exports = function (grunt) {
                     }]
             }
         },
+        prompt: {
+            username: {
+                options: {
+                    questions: [{
+                            config: 'config.svn.username',
+                            type: 'input',
+                            message: 'Enter SVN username if different from 
current user:'
+                    }]
+                }
+            },
+            commit: {
+                options: {
+                    questions: [{
+                            config: 'config.svn.commit.confirmation',
+                            type: 'list',
+                            choices: ['Show diff', 'Commit', 'Abort'],
+                            message: 'Commit the changes listed above?'
+                    }],
+                    then: function (results) {
+                        if (results['config.svn.commit.confirmation'] === 
'Commit') {
+                            grunt.task.run('prompt:message');
+                        } else if (results['config.svn.commit.confirmation'] 
=== 'Show diff') {
+                            grunt.task.run('exec:diff');
+                            grunt.task.run('prompt:commit');
+                        }
+                    }
+                }
+            },
+            message: {
+                options: {
+                    questions: [{
+                            config: 'config.svn.commit.message',
+                            type: 'input',
+                            message: 'Commit message:'
+                    }, {
+                            config: 'config.svn.password',
+                            type: 'password',
+                            message: 'SVN password:'
+                    }],
+                    then: function () {
+                        grunt.task.run('exec:commit');
+                    }
+                }
+            }
+        },
         exec: {
             generateDocs: {
                 command: 'mvn clean package',
@@ -127,6 +180,44 @@ module.exports = function (grunt) {
                 cwd: 
'../nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api',
                 stdout: true,
                 stderr: true
+            },
+            checkout: {
+                command: function() {
+                    var url = grunt.config('config.svn.url');
+                    var username = grunt.config('config.svn.username');
+                    if (username === '') {
+                        return 'svn checkout ' + url + ' --trust-server-cert 
--non-interactive dist';
+                    } else {
+                        return 'svn checkout --username ' + username + ' ' + 
url + ' --trust-server-cert --non-interactive dist';
+                    }
+                },
+                stdout: true,
+                stderr: true
+            },
+            status: {
+                cwd: 'dist',
+                command: 'svn status',
+                stdout: true,
+                stderr: true
+            },
+            diff: {
+                cwd: 'dist',
+                command: 'svn diff',
+                stdout: true,
+                stderr: true
+            },
+            commit: {
+                cwd: 'dist',
+                command: function() {
+                    var username = grunt.config('config.svn.username');
+                    var password = grunt.config('config.svn.password');
+                    var message = grunt.config('config.svn.commit.message');
+                    if (username === '') {
+                        return 'svn commit --password "' + password + '" -m "' 
+ message + '" --trust-server-cert --non-interactive .';
+                    } else {
+                        return 'svn commit --username ' + username + ' 
--password "' + password + '" -m "' + message + '" --trust-server-cert 
--non-interactive .';
+                    }
+                }
             }
         },
         replace: {
@@ -196,11 +287,16 @@ module.exports = function (grunt) {
     grunt.loadNpmTasks('grunt-contrib-watch');
     grunt.loadNpmTasks('grunt-exec');
     grunt.loadNpmTasks('grunt-text-replace');
+    grunt.loadNpmTasks('grunt-prompt');
 
     grunt.registerTask('img', ['newer:copy']);
     grunt.registerTask('css', ['clean:css', 'compass']);
     grunt.registerTask('js', ['clean:js', 'concat']);
     grunt.registerTask('generate-docs', ['clean:generated', 
'exec:generateDocs', 'exec:generateRestApiDocs', 'copy:generated', 
'replace:addGoogleAnalytics', 'replace:moveTearDrop', 'replace:removeVersion']);
-    grunt.registerTask('default', ['clean', 'assemble', 'css', 'js', 'img', 
'generate-docs', 'copy:dist']);
+
+    grunt.registerTask('build', ['assemble', 'css', 'js', 'img', 
'generate-docs', 'copy:dist']);
+    grunt.registerTask('deploy', ['clean:all', 'prompt:username', 
'exec:checkout', 'build', 'exec:status', 'prompt:commit']);
     grunt.registerTask('dev', ['default', 'watch']);
+    
+    grunt.registerTask('default', ['clean:all', 'build']);
 };

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/951cff9b/nifi-site/package.json
----------------------------------------------------------------------
diff --git a/nifi-site/package.json b/nifi-site/package.json
index f2ad8ca..dbd8ab5 100644
--- a/nifi-site/package.json
+++ b/nifi-site/package.json
@@ -1,6 +1,6 @@
 {
   "name": "apache-nifi-site",
-  "version": "0.0.2-incubating",
+  "version": "0.1.0-incubating",
   "description": "The artifacts for the Apache NiFi site.",
   "private": "true",
   "repository": {
@@ -17,6 +17,7 @@
     "grunt-contrib-watch": "^0.6.1",
     "grunt-exec": "^0.4.6",
     "grunt-newer": "^1.1.0",
+    "grunt-prompt": "^1.3.0",
     "grunt-text-replace": "^0.4.0"
   },
   "licenses": [

Reply via email to