Skip to content

Commit

Permalink
晚上上传ftp任务。
Browse files Browse the repository at this point in the history
  • Loading branch information
binnng committed Jul 30, 2014
1 parent 732e31e commit 0603118
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
dist
doc
.tmp
.sass-cache
.ftppass
Expand Down
64 changes: 39 additions & 25 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module.exports = (grunt) ->
# Time how long tasks take. Can help when optimizing build times
require("time-grunt") grunt
grunt.config.set "ip", (require("ip").address())

today = grunt.template.today "yyyymmddss"
md5Today = require("md5").digest_s today

# Define the configuration for all the tasks
grunt.initConfig
Expand All @@ -24,12 +27,14 @@ module.exports = (grunt) ->
app: require("./bower.json").appPath or "app"
dist: "dist"

today: grunt.template.today "yyyymmddss"

md5: require("md5").digest_s grunt.template.today "yyyymmddss"
today: today
md5: md5Today
prefix: today

secret: grunt.file.readJSON "secret.json"

onlineURL: "http://115.29.49.123/mifan/app"


# Watches files for changes and runs tasks based on the changed files
watch:
Expand Down Expand Up @@ -126,6 +131,7 @@ module.exports = (grunt) ->
open: true
base: "<%= yeoman.dist %>"



# Make sure code styles are up to par and there are no obvious mistakes
jshint:
Expand Down Expand Up @@ -440,12 +446,12 @@ module.exports = (grunt) ->
actions:[
{
search: "scripts/mifan.js"
replace: "scripts/<%= yeoman.md5 %>.mifan.js"
replace: "scripts/<%= yeoman.prefix %>.mifan.js"
flags: 'g'
}
{
search: "styles/mifan.css"
replace: "styles/<%= yeoman.md5 %>.mifan.css"
replace: "styles/<%= yeoman.prefix %>.mifan.css"
flags: 'g'
}
]
Expand All @@ -458,32 +464,39 @@ module.exports = (grunt) ->
files: [
{
src: "<%= yeoman.dist %>/styles/mifan.css",
dest: "<%= yeoman.dist %>/styles/<%= yeoman.md5 %>.mifan.css"
dest: "<%= yeoman.dist %>/styles/<%= yeoman.prefix %>.mifan.css"
}
{
src: "<%= yeoman.dist %>/scripts/mifan.js",
dest: "<%= yeoman.dist %>/scripts/<%= yeoman.md5 %>.mifan.js"
dest: "<%= yeoman.dist %>/scripts/<%= yeoman.prefix %>.mifan.js"
}
]

sftp:
dist:
files: {
"./": [
"<%= yeoman.dist %>/styles/**"
"<%= yeoman.dist %>/scripts/**"
"<%= yeoman.dist %>/index.html"
]
}
options:
path: "<%= yeoman.secret.path %>"
'sftp-deploy':
build:
auth:
host: "<%= yeoman.secret.host %>"
username: "<%= yeoman.secret.username %>"
password: "<%= yeoman.secret.password %>"
#port: "<%= yeoman.secret.port %>"
progress: yes
srcBasePath: "<%= yeoman.dist %>"
createDirectories: yes
port: "<%= yeoman.secret.port %>"
authKey: 'key1'

src: "<%= yeoman.dist %>"
dest: "<%= yeoman.secret.path %>"
exclusions: [
"<%= yeoman.dist %>/bower"
"<%= yeoman.dist %>/fonts"
"<%= yeoman.dist %>/images"
"<%= yeoman.dist %>/favicon.ico"
"<%= yeoman.dist %>/.htaccess"
"<%= yeoman.dist %>/robots.txt"
]
serverSep: "/"
concurrency: 4
progress: yes

open:
online:
path: "<%= yeoman.onlineURL %>"
app: "Google Chrome"

grunt.registerTask "serve", (target) ->
if target is "dist"
Expand Down Expand Up @@ -539,7 +552,8 @@ module.exports = (grunt) ->
]
grunt.registerTask "publish", [
"build"
"sftp"
"sftp-deploy"
"open:online"
]
grunt.registerTask "default", [
# "newer:jshint"
Expand Down
52 changes: 31 additions & 21 deletions Gruntfile.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
"grunt-regex-replace": "~0.2.6",
"grunt-contrib-rename": "0.0.3",
"md5": "~1.0.0",
"grunt-ssh": "~0.11.2"
"grunt-sftp-deploy": "~0.2.1",
"grunt-open": "~0.2.3"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt test"
}
}
}

0 comments on commit 0603118

Please sign in to comment.