@@ -61,11 +61,18 @@ module.exports = function(grunt) {
6161
6262  grunt . registerTask ( 'package' ,  'Package the operational codebase for deployment. Use package:compress to create an archive.' ,  function ( )  { 
6363    grunt . loadNpmTasks ( 'grunt-contrib-copy' ) ; 
64+     grunt . loadNpmTasks ( 'grunt-shell' ) ; 
6465
6566    var  config  =  grunt . config . get ( 'config.packages' ) ; 
6667    var  srcFiles  =  [ '**' ,  '!**/.gitkeep' ] . concat ( ( config  &&  config . srcFiles  &&  config . srcFiles . length )  ? config . srcFiles  : '**' ) ; 
6768    var  projFiles  =  ( config  &&  config . projFiles  &&  config . projFiles . length )  ? config . projFiles  : [ ] ; 
6869
70+     // Look for a package target spec, build destination path. 
71+     var  packageName  =  grunt . option ( 'name' )  ||  config . name  ||  'package' ; 
72+     var  destPath  =  grunt . config . get ( 'config.buildPaths.packages' )  +  '/'  +  packageName ; 
73+     var  tasks  =  [ ] ; 
74+     grunt . option ( 'package-dest' ,  destPath ) ; 
75+ 
6976    var  exclude  =  grunt . config ( 'config.packages.exclude' ) ; 
7077    if  ( exclude  !==  false )  { 
7178      var  excludePaths  =  grunt . config ( 'config.packages.excludePaths' ) ; 
@@ -76,44 +83,50 @@ module.exports = function(grunt) {
7683      for  ( var  i  =  0 ;  i  <  excludePaths . length ;  i ++ )  { 
7784        excludePaths [ i ]  =  '!**/'  +  excludePaths [ i ]  +  '/**' ; 
7885      } 
79-       srcFiles  =  srcFiles . concat ( excludePaths ) ; 
80-       projFiles  =  projFiles . concat ( excludePaths ) ; 
86+       // srcFiles = srcFiles.concat(excludePaths);
87+       // projFiles = projFiles.concat(excludePaths);
8188    } 
8289
83-     // Look for a package target spec, build destination path. 
84-     var  packageName  =  grunt . option ( 'name' )  ||  config . name  ||  'package' ; 
85-     var  destPath  =  grunt . config . get ( 'config.buildPaths.packages' )  +  '/'  +  packageName ; 
86-     var  tasks  =  [ ] ; 
87-     grunt . option ( 'package-dest' ,  destPath ) ; 
90+     var  rsync  =  'rsync -a ' 
91+         +  '--exclude node_modules ' 
92+         +  '--exclude bower_components ' 
93+         +  '--exclude .git ' 
94+         +  '--exclude sites/*/files ' 
95+         +  '--exclude xmlrpc.php ' ; 
96+ 
97+     var  srcPath  =  grunt . config ( 'config.buildPaths.html' ) ; 
98+     var  destSrc  =  path . resolve ( destPath ,  grunt . config . get ( 'config.packages.dest.docroot' )  ||  '' ) ; 
99+     var  command  =  rsync  +  srcPath  +  '/ '  +  destSrc  +  '/' ; 
100+     console . log ( command ) ; 
101+     console . log ( destSrc ) 
102+     grunt . config ( 'shell.mkSrc' ,  { 
103+       command : 'mkdir -p '  +  destSrc 
104+     } ) ; 
105+     grunt . config ( 'shell.srcFiles' ,  { 
106+       command : command 
107+     } ) ; 
88108
89-     grunt . config ( 'copy.package' ,  { 
90-       files : [ 
91-         { 
92-           expand : true , 
93-           cwd : '<%= config.buildPaths.html %>' , 
94-           src : srcFiles , 
95-           dest : path . resolve ( destPath ,  grunt . config . get ( 'config.packages.dest.docroot' )  ||  '' ) , 
96-           dot : true , 
97-           follow : true 
98-         } , 
99-         { 
100-           expand : true , 
101-           src : projFiles , 
102-           dest : path . resolve ( destPath ,  grunt . config . get ( 'config.packages.dest.devResources' )  ||  '' ) , 
103-           dot : true , 
104-           follow : true 
105-         } 
106-       ] , 
107-       options : { 
108-         gruntLogHeader : false , 
109-         mode : true 
110-       } 
109+     var  destProj  =  path . resolve ( destPath ,  grunt . config . get ( 'config.packages.dest.devResources' )  ||  '' ) ; 
110+     grunt . config ( 'shell.mkProj' ,  { 
111+       command : 'mkdir -p '  +  destProj 
111112    } ) ; 
113+     for  ( var  i  =  0 ;  i  <  projFiles . length ;  i ++ )  { 
114+       var  command  =  rsync  +  srcPath  +  '/'  +  projFiles [ i ]  +  ' '  +  destProj ; 
115+       console . log ( command ) ; 
116+       grunt . config ( 'shell.projFiles'  +  i ,  { 
117+         command : command 
118+       } ) ; 
119+     } 
112120
113121    grunt . config . set ( 'clean.packages' ,  [ destPath ] ) ; 
114122
115123    tasks . push ( 'clean:packages' ) ; 
116-     tasks . push ( 'copy:package' ) ; 
124+     tasks . push ( 'shell:mkSrc' ) ; 
125+     tasks . push ( 'shell:srcFiles' ) ; 
126+     tasks . push ( 'shell:mkProj' ) ; 
127+     for  ( var  i  =  0 ;  i  <  projFiles . length ;  i ++ )  { 
128+       tasks . push ( 'shell:projFiles'  +  i ) ; 
129+     } 
117130
118131    // If the `composer.json` file is being packaged, rebuild composer dependencies without dev. 
119132    if  ( projFiles . find ( function ( pattern )  { 
0 commit comments