Esempio n. 1
0
 /**
  * Determine if the collections definition has changed when compared to the manifest.
  *
  * @param  \Illuminate\Support\Collection  $assets
  * @param  \Basset\Manifest\Entry  $entry
  * @param  string  $group
  * @return bool
  */
 protected function collectionDefinitionHasChanged($assets, $entry, $group)
 {
     // If the manifest entry doesn't even have the group registered then it's obvious that the
     // collection has changed and needs to be rebuilt.
     if (!$entry->hasDevelopmentAssets($group)) {
         return true;
     }
     // Get the development assets from the manifest entry and flatten the keys so that we have
     // an array of relative paths that we can compare from.
     $manifest = $entry->getDevelopmentAssets($group);
     $manifest = array_flatten(array_keys($manifest));
     // Compute the difference between the collections assets and the manifests assets. If we get
     // an array of values then the collection has changed since the last build and everything
     // should be rebuilt.
     $difference = array_diff_assoc($manifest, $assets->map(function ($asset) {
         return $asset->getRelativePath();
     })->flatten()->toArray());
     return !empty($difference);
 }
Esempio n. 2
0
 /**
  * Clean collection development files.
  * 
  * @param  \Basset\Collection  $collection
  * @param  \Basset\Manifest\Entry  $entry
  * @return void
  */
 protected function cleanDevelopmentFiles(Collection $collection, Entry $entry)
 {
     foreach ($entry->getDevelopmentAssets() as $assets) {
         foreach ($assets as $asset) {
             $wildcardPath = $this->replaceFingerprintWithWildcard($asset);
             $this->deleteMatchingFiles($this->buildPath . '/' . $collection->getIdentifier() . '/' . $wildcardPath, array_values($assets));
         }
     }
 }