function testGlob()
 {
     SimpleAsset::config(array('asset_dir' => dirname(__FILE__) . '/public'));
     $files = new SimpleAssetFiles();
     $paths = $files->glob();
     sort($paths);
     $this->assertEquals(array('/images/icon.png', '/images/main.jpg', '/javascripts/application.js', '/stylesheets/application.css'), $paths);
 }
Esempio n. 2
0
 /**
  * @param array $config
  */
 public static function precompile($config = null)
 {
     if (is_array($config) && sizeof($config) > 0) {
         SimpleAsset::config($config);
     }
     $store = SimpleAssetStore::factory();
     $files = new SimpleAssetFiles();
     foreach ($files->glob() as $path) {
         $store->setDigest($path);
     }
 }
Esempio n. 3
0
 /**
  * @param  string $path
  * @return string
  */
 public static function assetFullpath($path)
 {
     return self::joinpath(SimpleAsset::config('asset_dir'), $path);
 }
Esempio n. 4
0
 /**
  * @param  array $args
  * @return object
  */
 public static function factory()
 {
     return new SimpleAssetStoreFile(SimpleAsset::config());
 }
Esempio n. 5
0
 /**
  * @param array $opts
  */
 function __construct($opts = null)
 {
     if (is_array($opts) and sizeof($opts) > 0) {
         $this->config = SimpleAsset::config($opts);
     }
 }
 function testPrecompile()
 {
     $store_dir = dirname(__FILE__) . '/_digests/';
     SimpleAsset::precompile(array('store' => 'file', 'store_dir' => $store_dir, 'asset_dir' => dirname(__FILE__) . '/public/'));
 }
Esempio n. 7
0
 /**
  * @param  string $path
  * @return string
  */
 function _strip_asset_dir($path)
 {
     return str_replace(SimpleAsset::config('asset_dir'), '', $path);
 }