Changeset 517 for Dev/trunk/Gruntfile.js


Ignore:
Timestamp:
03/14/14 16:11:32 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Deployment and database management now done through Grunt. Look mom, no shell\!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/Gruntfile.js

    r516 r517  
    88    // TASKS
    99
     10    // default task
    1011    grunt.registerTask('default', ['compile']);
    11     grunt.registerTask('compile', ['svn-ignore:compile'
     12    // development
     13    grunt.registerTask('compile', ['path-check:svn'
     14                                  ,'svn-ignore:compile'
    1215                                  ,'jshint:lint-sources'
    1316                                  ,'htmlhint:lint'
     
    2225                                //,'amd-check' // too smart about plugins, r.js can't find them
    2326                                  ]);
     27    grunt.registerTask('run', ['path-check:foreman'
     28                              ,'compile'
     29                              ,'foreman:dev']);
    2430    grunt.registerTask('build', ['compile'
    2531                                ,'clean:build'
     
    2733                                ,'dojo:build'
    2834                                ]);
    29     grunt.registerTask('deploy', ['path-check:deploy',
    30                                   'svninfo',
    31                                   'build',
    32                                   'git_deploy:deploy']);
     35    grunt.registerTask('run-build', ['path-check:foreman'
     36                                    ,'build'
     37                                    ,'foreman:build']);
     38    grunt.registerTask('deploy', ['path-check:svn'
     39                                 ,'path-check:git'
     40                                 ,'svninfo'
     41                                 ,'build'
     42                                 ,'git_deploy:deploy']);
     43    // database management
     44    grunt.registerTask('db-backup-cloud-to-dated-local',
     45                       ['path-check:heroku'
     46                       ,'heroku-config'
     47                       ,'http:db-backup-cloud-to-dated-local']);
     48    grunt.registerTask('db-pull-cloud-to-local',
     49                       ['path-check:heroku'
     50                       ,'heroku-config'
     51                       ,'http:db-pull-cloud-to-local']);
     52    grunt.registerTask('db-push-local-to-cloud',
     53                       ['path-check:heroku'
     54                       ,'heroku-config'
     55                       ,'http:db-push-local-to-cloud']);
    3356
    3457    // FILES AND FOLDERS
     
    4669
    4770    // TASK CONFIG
    48    
     71
    4972    grunt.initConfig({
     73        localDbURL: "http://localhost:5984",
     74        timestamp: "<%= grunt.template.today(\"UTC:yyyymmdd't'HHMMss'z'\") %>",
     75
    5076        'amd-check': {
    5177            files: [ srcDir+'client/qed-client/**/*.js' ]
     
    7399                                releaseDir: '../../'+buildDir }}
    74100        },
     101        foreman: {
     102            dev: {
     103                options: {
     104                    cwd: srcDir
     105                }
     106            },
     107            build: {
     108                options: {
     109                    cwd: buildDir
     110                }
     111            }
     112        },
    75113        git_deploy: {
    76114            deploy: {
     
    83121            }
    84122        },
     123        'heroku-config': {
     124            options: {
     125                app: 'quod-erat',
     126                keys: ['CLOUDANT_URL']
     127            }
     128        },
    85129        htmlhint: {
    86130            options: { htmlhintrc: srcDir+".htmlhintrc" },
     
    89133                              src: ['client/*.html', 'client/qed-client/**/*.html'] }]}
    90134        },
     135        http: {
     136            'db-backup-cloud-to-dated-local': {
     137                options: {
     138                    url: "<%= localDbURL %>/_replicate",
     139                    method: 'POST',
     140                    body: {
     141                        source: "<%= herokuConfig.CLOUDANT_URL %>/qed",
     142                        target: "qed-<%= timestamp %>",
     143                        create_target: true
     144                    },
     145                    json: true
     146                }
     147            },
     148            'db-pull-cloud-to-local': {
     149                options: {
     150                    url: "<%= localDbURL %>/_replicate",
     151                    method: 'POST',
     152                    body: {
     153                        source: "<%= herokuConfig.CLOUDANT_URL %>/qed",
     154                        target: "qed"
     155                    },
     156                    json: true
     157                }
     158            },
     159            'db-push-local-to-cloud': {
     160                options: {
     161                    url: "<%= localDbURL %>/_replicate",
     162                    method: 'POST',
     163                    body: {
     164                        source: "qed",
     165                        target: "<%= herokuConfig.CLOUDANT_URL %>/qed"
     166                    },
     167                    json: true
     168                }
     169            }
     170        },
    91171        jshint: {
    92172            'lint-sources': { options: { jshintrc: srcDir+".jshintrc" },
     
    104184        },
    105185        'path-check': {
    106             'deploy': {
    107                 src: [ 'git', 'svn' ]
     186            'heroku': {
     187                src: ['heroku']
     188            },
     189            'foreman': {
     190                src: ['foreman']
     191            },
     192            'svn': {
     193                src: ['svn']
     194            },
     195            'git': {
     196                src: ['git']
    108197            }
    109198        },
     
    164253    grunt.loadNpmTasks('grunt-git-deploy');
    165254    grunt.loadNpmTasks('grunt-htmlhint');
     255    grunt.loadNpmTasks('grunt-http');
    166256    grunt.loadNpmTasks('grunt-jsonlint');
    167257    grunt.loadNpmTasks('grunt-path-check');
Note: See TracChangeset for help on using the changeset viewer.