Created
April 30, 2015 05:10
-
-
Save markdboyd/2aba928f6fb2e7ab50a7 to your computer and use it in GitHub Desktop.
Add file copy support for GDT on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
/** | |
* Define "copy" tasks. | |
* | |
* grunt copy:modules | |
* Copies modules from src/modules to sites/all/modules/custom in | |
* the build/html directory. | |
* | |
* grunt copy:profiles | |
* Copies profiles from src/profiles to profiles in the build/html | |
* directory. | |
* | |
* grunt copy:sites | |
* Copies directories from src/sites (except for src/sites/all | |
* since the all directory needs to be preserved) to sites | |
* in the build/html directry. | |
* | |
* grunt copy:themes | |
* Copy themes from src/themes to sites/all/themes/custom in the | |
* build/html directory. | |
*/ | |
if (grunt.config.get('platform') == 'win32') { | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.config(['copy', 'modules'], { | |
files: [{ | |
expand: true, | |
cwd: '<%= config.srcPaths.drupal %>/modules', | |
src: ['**'], | |
dest: '<%= config.buildPaths.html %>/sites/all/modules/custom' | |
}] | |
}); | |
grunt.config(['copy', 'sites'], { | |
files: [{ | |
expand: true, | |
cwd: '<%= config.srcPaths.drupal %>/sites', | |
src: ['**'], | |
dest: '<%= config.buildPaths.html %>/sites', | |
filter: function (path) { | |
return (path !== '<%= config.srcPaths.drupal %>/sites/all'); | |
} | |
}] | |
}); | |
grunt.config(['copy', 'themes'], { | |
files: [{ | |
expand: true, | |
cwd: '<%= config.srcPaths.drupal %>/themes', | |
src: ['**'], | |
dest: '<%= config.buildPaths.html %>/sites/all/themes/custom' | |
}] | |
}); | |
grunt.config(['copy', 'profiles'], { | |
files: [{ | |
expand: true, | |
cwd: '<%= config.srcPaths.drupal %>/profiles', | |
src: ['**'], | |
dest: '<%= config.buildPaths.html %>/profiles', | |
}] | |
}); | |
grunt.config(['copy', 'libraries'], { | |
files: [{ | |
expand: true, | |
cwd: '<%= config.buildPaths.html %>/profiles/panopoly/libraries', | |
src: ['**'], | |
dest: '<%= config.buildPaths.html %>/sites/all/libraries', | |
filter: 'isDirectory' | |
}] | |
}); | |
grunt.registerTask('create:modules', ['copy:modules']); | |
grunt.registerTask('create:sites', ['copy:sites']); | |
grunt.registerTask('create:themes', ['copy:themes']); | |
grunt.registerTask('create:profiles', ['copy:profiles']); | |
grunt.registerTask('create:libraries', ['copy:libraries']); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// Load all plugins and tasks defined by the grunt-drupal-tasks package. | |
require('grunt-drupal-tasks')(grunt); | |
// Get the OS and set it as a variable. | |
var os = require('os'); | |
var platform = os.platform(); | |
grunt.config('platform', platform); | |
// Load additional custom tasks. | |
grunt.loadTasks(__dirname + '/grunt/tasks'); | |
// Define the default task to fully build and configure the project. | |
grunt.config(['mkdir', 'libraries'], { | |
options: { | |
create: [ | |
'<%= config.buildPaths.html %>/sites/all/libraries', | |
] | |
} | |
}); | |
var tasksDefault = [ | |
'validate', | |
'newer:drushmake:default', | |
'create:profiles', | |
'mkdir:libraries', | |
'create:libraries', | |
'clean:sites', | |
'create:sites', | |
'mkdir:files', | |
'create:modules', | |
'create:themes' | |
]; | |
if (grunt.config.get(['composer', 'install'])) { | |
tasksDefault.unshift('composer:install'); | |
} | |
if (grunt.task.exists('compile-theme')) { | |
tasksDefault.push('compile-theme'); | |
} | |
if (grunt.task.exists('bundleInstall')) { | |
tasksDefault.unshift('bundleInstall'); | |
} | |
grunt.registerTask('default', tasksDefault); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
/** | |
* Define "symlink" tasks. | |
* | |
* grunt symlink:libraries | |
* Makes symbolic links in the sites directory in build/html for all | |
* Panopoly libraries | |
*/ | |
var config = grunt.config.get('config'); | |
if (grunt.config.get('platform') !== 'win32') { | |
grunt.loadNpmTasks('grunt-contrib-symlink'); | |
grunt.config('symlink', { | |
modules: { | |
src: '<%= config.srcPaths.drupal %>/modules', | |
dest: '<%= config.buildPaths.html %>/sites/all/modules/custom' | |
}, | |
profiles: { | |
expand: true, | |
cwd: '<%= config.srcPaths.drupal %>/profiles', | |
src: ['*'], | |
dest: '<%= config.buildPaths.html %>/profiles', | |
filter: 'isDirectory' | |
}, | |
sites: { | |
expand: true, | |
cwd: '<%= config.srcPaths.drupal %>/sites', | |
src: ['*'], | |
dest: '<%= config.buildPaths.html %>/sites', | |
filter: function (path) { | |
return (path !== '<%= config.srcPaths.drupal %>/sites/all'); | |
} | |
}, | |
themes: { | |
src: '<%= config.srcPaths.drupal %>/themes', | |
dest: '<%= config.buildPaths.html %>/sites/all/themes/custom' | |
} | |
}); | |
grunt.config(['symlink', 'libraries'], { | |
expand: true, | |
cwd: '<%= config.buildPaths.html %>/profiles/panopoly/libraries', | |
src: ['*'], | |
dest: '<%= config.buildPaths.html %>/sites/all/libraries', | |
filter: 'isDirectory' | |
}); | |
grunt.registerTask('create:modules', 'symlink:modules'); | |
grunt.registerTask('create:profiles', 'symlink:profiles'); | |
grunt.registerTask('create:sites', 'symlink:sites'); | |
grunt.registerTask('create:themes', 'symlink:themes'); | |
grunt.registerTask('create:libraries', 'symlink:libraries'); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment