grunt-aws不处理任何文件

时间:2015-03-28 02:32:46

标签: amazon-s3 gruntjs

我正在尝试使用:https://github.com/jpillora/grunt-aws#the-s3-task

自动将文件上传到S3存储桶

我的Gruntfile.js"编译"正确地说,但是当它被执行时它只是在到达S3部分时挂起 - 没有错误。

以下是我的Gruntfile.js:

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        aws: grunt.file.readJSON('aws.json'),
        concat: {
            options: {
                separator: '\n',
                stripBanners: {
                    block: true
                }
            },
            scripts: {
                src: [
                    'scripts/bootstrap.js', 
                    'scripts/bootstrap-select.js', 
                    'scripts/bootbox.js',
                    'scripts/app.js',
                    'scripts/jquery.validate.js', 
                    'scripts/additional-methods.js',
                    'scripts/captcha.js',
                    'scripts/mail.js',
                    'scripts/render.js'
                ],
                dest: 'scripts/bundle.js'
            },
            style: {
                src: [
                    'style/jquery-ui.css', 
                    'style/bootstrap.css', 
                    'style/bootstrap-select.css',
                    'style/en-us.css'
                ],
                dest: 'style/bundle.css'
            }
        },
        uglify: {
            options: {
                banner: '/*! <%= grunt.template.today("dd-mm-yyyy") %> */\n',
                mangle: {
                    except: ['jQuery']
                }
            },
            scripts: {
                files: {
                    'scripts/bundle.min.js': 'scripts/bundle.js'    
                }
            }
        },
        cssmin: {
            target: {
                files: [{
                    expand: true,
                        cwd: 'style',
                        src: ['bundle.css'],
                        dest: 'style',
                        ext: '.min.css'
                    }]
            }   
        },
        s3: {
            options: {
                accessKeyId: '<%= aws.key %>',
                secretAccessKey: '<%= aws.secret %>',
                bucket: '<%= aws.bucket %>',
                region: '<%= aws.region %>',
                access: 'public-read'
            },
            upload: {
                headers: {
                    CacheControl: 604800,
                    Expires: new Date(Date.now() + 604800000).toUTCString()
                },
                cwd: "/",
                src: "**"
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-aws');

    grunt.registerTask('default', ['concat', 'uglify', 'cssmin', 's3']);
};

sudo grunt s3 -v --force 的相关输出如下:

  

正在加载&#34; cloudfront.js&#34;任务... OK   + cloudfront Loading&#34; route53.js&#34;任务... OK   + route53 Loading&#34; s3.js&#34;任务... OK   + s3正在加载&#34; aws.js&#34;任务... OK

     
    
      

未注册或取消注册任务。正在加载&#34; cache-mgr.js&#34;任务... OK       没有注册或未注册任务。正在加载&#34; Gruntfile.js&#34;任务... OK       +默认

    
  
     

正在运行的任务:s3

     

跑步&#34; s3&#34;任务

     

运行&#34; s3:上传&#34; (s3)任务验证属性s3.upload存在于   配置...行

那时,它挂起......

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

问题在于这一行:cwd: "/"

应该是cwd: "."