jpillora / grunt-aws

A Grunt interface into the Amazon Node.JS SDK
171 stars 44 forks source link

grunt-aws Not Processing Any Files #28

Closed eat-sleep-code closed 9 years ago

eat-sleep-code commented 9 years ago

I am trying to automate uploading files to an S3 bucket by using: https://github.com/jpillora/grunt-aws#the-s3-task

My Gruntfile.js "compiles" correctly, but when executed it simply hangs when it gets to the S3 portion -- without errors.

The following is my 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']);
};

The associated output of _sudo grunt s3 -v --force_ is as follows:

Loading "cloudfront.js" tasks...OK

  • cloudfront Loading "route53.js" tasks...OK
  • route53 Loading "s3.js" tasks...OK
  • s3 Loading "aws.js" tasks...OK

    No tasks were registered or unregistered. Loading "cache-mgr.js" tasks...OK No tasks were registered or unregistered. Loading "Gruntfile.js" tasks...OK

  • default

Running tasks: s3

Running "s3" task

Running "s3:upload" (s3) task Verifying property s3.upload exists in config...OK

At that point, it hangs...

Any ideas?

jpillora commented 9 years ago

cwd: "/" is the root of your drive, so grunt is trying to glob it all and that'll take a while, you probably meant cwd: "."

eat-sleep-code commented 9 years ago

That was the answer. :+1: