Added grunt sftp-deploy

James Peret 8 years ago
parent
commit
8acd194e6c
4 changed files with 50 additions and 10 deletions
  1. 6 0
      .ftppass
  2. 42 10
      Gruntfile.js
  3. 1 0
      package.json
  4. 1 0
      sftpCache.json

+ 6 - 0
.ftppass

@@ -0,0 +1,6 @@
1
+{
2
+  "key1": {
3
+    "username": "root",
4
+    "password": "rdtatnjxxwfh"
5
+  }
6
+}

+ 42 - 10
Gruntfile.js

@@ -63,8 +63,8 @@ module.exports = function(grunt) {
63 63
         files: [
64 64
           {src: ['app/index.html'], dest: 'dist/index.html', filter: 'isFile'},
65 65
           {src: ['app/data.json'], dest: 'dist/data.json', filter: 'isFile'},
66
-          {expand: true, flatten: false, cwd: 'app/views/', src: ['**'], dest: 'dist/views/', filter: 'isFile'},
67
-          {expand: true, flatten: false, cwd: 'app/content/', src: ['**'], dest: 'dist/content/', filter: 'isFile'}
66
+          //{expand: true, flatten: false, cwd: 'app/views/', src: ['**'], dest: 'dist/views/', filter: 'isFile'},
67
+          //{expand: true, flatten: false, cwd: 'app/content/', src: ['**'], dest: 'dist/content/', filter: 'isFile'}
68 68
         ]
69 69
       }
70 70
     },
@@ -86,6 +86,20 @@ module.exports = function(grunt) {
86 86
         }
87 87
       }
88 88
     },
89
+    filerev: {
90
+      options: {
91
+        algorithm: 'md5',
92
+        length: 8
93
+      },
94
+      images: {
95
+        src: 'app/content/images/*.{jpg,jpeg,gif,png,webp}',
96
+        dest: 'dist/content/images'
97
+      },
98
+      videos: {
99
+        src: 'app/content/videos/*.mov',
100
+        dest: 'dist/content/videos'
101
+      }
102
+    },
89 103
   	serve: {
90 104
   	    options: {
91 105
   	        port: 8000,
@@ -105,6 +119,22 @@ module.exports = function(grunt) {
105 119
       options: {
106 120
         assetsDirs: ['dist/js', 'dist/css', 'dist/content']
107 121
       }
122
+    },
123
+    'sftp-deploy': {
124
+      build: {
125
+        auth: {
126
+          host: '162.243.10.246',
127
+          port: 22,
128
+          authKey: 'key1'
129
+        },
130
+        cache: 'sftpCache.json',
131
+        src: 'dist',
132
+        dest: '/var/www/gofoundation',
133
+        exclusions: ['/dist/**/.DS_Store', '/dist/**/Thumbs.db', 'dist/tmp'],
134
+        serverSep: '/',
135
+        concurrency: 4,
136
+        progress: true
137
+      }
108 138
     }
109 139
   });
110 140
 
@@ -118,22 +148,24 @@ module.exports = function(grunt) {
118 148
   grunt.loadNpmTasks('grunt-contrib-cssmin');
119 149
   grunt.loadNpmTasks('grunt-bower');
120 150
   grunt.loadNpmTasks('grunt-contrib-copy');
121
-  //grunt.loadNpmTasks('grunt-filerev');
151
+  grunt.loadNpmTasks('grunt-filerev');
122 152
   grunt.loadNpmTasks('grunt-usemin');
123
-
124
-
125
-
126
-  grunt.registerTask('test', ['jshint', 'qunit']);
127
-  grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin', 'wiredep' ]);
128
-  grunt.registerTask('deploy', ['jshint', 'bower', 'concat', 'uglify', 'cssmin', 'copy' ]);
153
+  grunt.loadNpmTasks('grunt-sftp-deploy');
129 154
 
130 155
   grunt.registerTask('build', [
156
+    'jshint',
131 157
     'copy',
132 158
     'useminPrepare',
133 159
     'concat:generated',
134 160
     'uglify:generated',
161
+    'cssmin:target',
162
+    'filerev',
135 163
     'usemin',
136
-    'cssmin:target'
164
+  ]);
165
+
166
+  grunt.registerTask('deploy', [
167
+    'build',
168
+    'sftp-deploy'
137 169
   ]);
138 170
 
139 171
 };

+ 1 - 0
package.json

@@ -14,6 +14,7 @@
14 14
     "grunt-contrib-watch": "^0.6.1",
15 15
     "grunt-filerev": "^2.3.1",
16 16
     "grunt-serve": "^0.1.6",
17
+    "grunt-sftp-deploy": "^0.2.4",
17 18
     "grunt-usemin": "^3.0.0",
18 19
     "grunt-wiredep": "^2.0.0",
19 20
     "jshint-stylish": "^2.0.1"

+ 1 - 0
sftpCache.json

@@ -0,0 +1 @@
1
+{"test/index.html":"2015-06-29T00:05:26.000Z","test/test.html":"2015-06-29T00:09:43.000Z"}