Example #1
0
 /**
  * Make a new asset instance.
  *
  * @param  string  $path
  * @return \Basset\Asset
  */
 public function make($path)
 {
     $absolutePath = $this->buildAbsolutePath($path);
     $relativePath = $this->buildRelativePath($absolutePath);
     $asset = new Asset($this->files, $this->factory, $this->appEnvironment, $absolutePath, $relativePath);
     return $asset->setOrder($this->nextAssetOrder());
 }
Example #2
0
 /**
  * Get a development assets build path.
  *
  * @param  string|\Basset\Asset  $value
  * @param  string  $group
  * @return null|string
  */
 public function getDevelopmentAsset($value, $group = null)
 {
     if ($value instanceof Asset) {
         $group = $value->getGroup();
         $value = $value->getRelativePath();
     }
     return isset($this->development[$group][$value]) ? $this->development[$group][$value] : null;
 }
Example #3
0
 public function getAssetInstance($relative, $absolute, $group, $order)
 {
     $asset = new Asset(m::mock('Illuminate\\Filesystem\\Filesystem'), m::mock('Basset\\Factory\\FactoryManager'), 'testing', $absolute, $relative);
     return $asset->setOrder($order)->setGroup($group);
 }
Example #4
0
 /**
  * Adds an asset to the container.
  *
  * @param  string  $name
  * @param  string  $file
  * @param  array   $dependencies
  * @return object
  */
 public function add($name, $file = null, $dependencies = array())
 {
     if (is_null($file) and array_key_exists($name, static::$shared)) {
         $file = static::$shared[$name];
     }
     $asset = new Asset($name, $file, $dependencies);
     if ($asset->exists($this->directory) and !$asset->external()) {
         $asset->updated = filemtime($asset->directory . DS . $asset->file);
     }
     $this->assets[$this->group()][$name] = $asset;
     return $this;
 }
Example #5
0
 public function testAssetCanBeRemotelyHostedWithRelativeProtocol()
 {
     $asset = new Asset($this->files, $this->factory, 'testing', '//foo.com/bar.css', '//foo.com/bar.css');
     $this->assertTrue($asset->isRemote());
 }