Example #1
0
 /**
  * Set up a mock environment to test iBundle.
  *
  * @return  null
  */
 public function __construct()
 {
     // Start the bundle
     Bundle::start('ibundle');
     // Set test ibundle cache file
     $this->cache_file = ibundle_config('file', Bundle::path('ibundle') . 'storage/test.cache');
 }
Example #2
0
 /**
  * Gets a singleton of the iBundle\Driver class.
  *
  * @return iBundle\Driver
  */
 public static function instance()
 {
     if (static::$instance === null) {
         // Get iBundle active driver
         $driver = 'iBundle\\Driver\\' . ucfirst(ibundle_config('driver'));
         // Instantiate driver.
         static::$instance = new $driver();
     }
     return static::$instance;
 }
Example #3
0
 /**
  * Stop tracking a bundle.
  *
  * <code>
  * 	$ php artisan ibundle::untrack bundle
  * </code>
  *
  * @param  array  $arguments
  * @return  null
  */
 public function untrack($arguments = array())
 {
     $bundle = array_get($arguments, 0);
     if ($bundle === false or empty($bundle)) {
         Ibundle_Base_Task::error('Invalid iBundle name.');
     }
     if (!array_key_exists($bundle, iBundle::available(true))) {
         Ibundle_Base_Task::error("iBundle [{$bundle}] is not being tracked.");
     }
     // JSON file
     $json_file = ibundle_config('path') . $bundle . DS . 'ibundle.json';
     echo "Untracking bundle [{$bundle}]...";
     echo File::delete($json_file) ? "Done" : "Failed";
 }
Example #4
0
 /**
  * Saves activated bundle list to filesystem.
  *
  * @return boolean
  */
 protected function save()
 {
     return (bool) Laravel_File::put(ibundle_config('file'), $this->_data);
 }
Example #5
0
 /**
  * Starts the activated ibundles as bundles.
  *
  * @return array
  */
 public function register()
 {
     if (empty($this->registered)) {
         foreach ($this->activated() as $bundle => $config) {
             if (!Laravel_File::exists(ibundle_config('path') . $bundle)) {
                 // Remove it and skip registration
                 $this->deactivate($bundle);
                 continue;
             }
             if (!Bundle::exists($bundle)) {
                 // register the bundle using the ibundle.json data
                 Bundle::register($bundle, $config);
                 if (isset($config['auto']) and $config['auto'] === true) {
                     // Start the registered bundle
                     Bundle::start($bundle);
                     if (Bundle::started($bundle)) {
                         $this->registered[$bundle] = $config;
                     }
                 }
             }
         }
     }
     return (array) $this->registered;
 }