Skip to content

Commit 2c05b33

Browse files
authored
Merge pull request #298 from phase2/feature/package_rewrite_composer_updates
Updates to feature/package_rewrite_composer
2 parents 58ad0d7 + 88dff49 commit 2c05b33

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

example/Gruntconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"srcFiles": ["!sites/*/files/**", "!xmlrpc.php", "!modules/php/*"],
1212
"projFiles": ["README*", "bin/**", "hooks/**", "src/*.make", "vendor/**"],
1313
"dest": {
14-
"docroot": "build/html",
14+
"docroot": "html",
1515
"devResources": ""
1616
}
1717
},

tasks/package.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function(grunt) {
1919
var destPath = grunt.option('package-dest');
2020
var composer = grunt.file.readJSON(destPath + '/composer.json');
2121
// Determine new installer-paths
22-
var pathInstall = pathPackage + '/';
22+
var pathInstall = pathPackage ? pathPackage + '/' : '';
2323
if (pathVendor) {
2424
// Make sure install path is relative to vendor location.
2525
var regexVendor = new RegExp('^' + pathVendor + '/');
@@ -28,7 +28,7 @@ module.exports = function(grunt) {
2828
var regex = new RegExp('^' + pathBuild + '/');
2929
for (var key in composer.extra['installer-paths']) {
3030
// Add an unnecessary if check just for eslint rules.
31-
if (composer.extra['installer-paths'][key]) {
31+
if (composer.extra['installer-paths'].hasOwnProperty(key)) {
3232
var newKey = key.replace(regex, pathInstall);
3333
if (newKey !== key) {
3434
// Alter keys in `extra.installer-paths` object to change `build/html`
@@ -48,7 +48,7 @@ module.exports = function(grunt) {
4848
if (pathVendor) {
4949
// Remove the original file if we moved it.
5050
grunt.file.delete(destPath + '/composer.json');
51-
// Change working directory for composer install.
51+
// Change working directory for later `composer install`.
5252
grunt.config(['composer'], {
5353
options: {
5454
flags: ['no-dev'],
@@ -113,6 +113,8 @@ module.exports = function(grunt) {
113113
}
114114
});
115115
tasks.push('composer:install');
116+
grunt.config(['composer', 'drupal-scaffold'], {});
117+
tasks.push('composer:drupal-scaffold');
116118
}
117119

118120
if (this.args[0] && this.args[0] === 'compress') {

test/build.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('grunt', function() {
114114
});
115115

116116
// Ensure a custom library file is available under package.
117-
var librariesPackageDest = (drupalCore === '8') ? 'build/packages/package/build/html/libraries/example_lib/example.md' : 'build/packages/package/sites/all/libraries/example_lib/example.md';
117+
var librariesPackageDest = (drupalCore === '8') ? 'build/packages/package/html/libraries/example_lib/example.md' : 'build/packages/package/sites/all/libraries/example_lib/example.md';
118118
it('custom library file should exist in package', function(done) {
119119
fs.exists(librariesPackageDest, function(exists) {
120120
assert.ok(exists);
@@ -123,7 +123,7 @@ describe('grunt', function() {
123123
});
124124

125125
// Ensure a custom module file is available under package.
126-
var modulesPackageDest = (drupalCore === '8') ? 'build/packages/package/build/html/modules/custom/test.php' : 'build/packages/package/sites/all/modules/custom/test.php';
126+
var modulesPackageDest = (drupalCore === '8') ? 'build/packages/package/html/modules/custom/test.php' : 'build/packages/package/sites/all/modules/custom/test.php';
127127
it('custom module file should exist in package', function(done) {
128128
fs.exists(modulesPackageDest, function(exists) {
129129
assert.ok(exists);
@@ -132,7 +132,7 @@ describe('grunt', function() {
132132
});
133133

134134
// Ensure a custom theme file is available under package.
135-
var themesPackageDest = (drupalCore === '8') ? 'build/packages/package/build/html/themes/custom/example_theme/example_theme.info.yml' : 'build/packages/package/sites/all/themes/custom/example_theme/example_theme.info';
135+
var themesPackageDest = (drupalCore === '8') ? 'build/packages/package/html/themes/custom/example_theme/example_theme.info.yml' : 'build/packages/package/sites/all/themes/custom/example_theme/example_theme.info';
136136
it('custom theme file should exist in package', function(done) {
137137
fs.exists(themesPackageDest, function(exists) {
138138
assert.ok(exists);
@@ -202,7 +202,7 @@ describe('grunt', function() {
202202
it('should place the build codebase in build/packages/package by default', function(done) {
203203
this.timeout(180000);
204204
exec('grunt package', function(error) {
205-
var indexPackageDest = (drupalCore === '8') ? 'build/packages/package/build/html/index.php' : 'build/packages/package/index.php';
205+
var indexPackageDest = (drupalCore === '8') ? 'build/packages/package/html/index.php' : 'build/packages/package/index.php';
206206
fs.exists(indexPackageDest, function(exists) {
207207
assert.ok(!error && exists);
208208
done();
@@ -213,7 +213,7 @@ describe('grunt', function() {
213213
it('should allow override of grunt package destination with --name', function(done) {
214214
this.timeout(180000);
215215
exec('grunt package --name=upstream', function(error) {
216-
var indexPackageDest = (drupalCore === '8') ? 'build/packages/upstream/build/html/index.php' : 'build/packages/upstream/index.php';
216+
var indexPackageDest = (drupalCore === '8') ? 'build/packages/upstream/html/index.php' : 'build/packages/upstream/index.php';
217217
fs.exists(indexPackageDest, function(exists) {
218218
assert.ok(!error && exists);
219219
done();

test/test_assets_d8/Gruntconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"srcFiles": ["!sites/*/files/**", "!xmlrpc.php", "!modules/php/*"],
1111
"projFiles": ["README*", "bin/**", "hooks/**", "src/*.make", "vendor/**", "composer.*"],
1212
"dest": {
13-
"docroot": "build/html",
13+
"docroot": "html",
1414
"devResources": ""
1515
}
1616
},

0 commit comments

Comments
 (0)