Ejemplo n.º 1
0
 private function generator_paths()
 {
     $paths = array(ZING_ROOT . '/framework/generators');
     $pm = \zing\plugin\Manager::instance();
     foreach ($pm->plugins() as $plugin) {
         if ($plugin->has_generators()) {
             $paths[] = $plugin->generator_path();
         }
     }
     return $paths;
 }
Ejemplo n.º 2
0
 protected function parse_args(array $args)
 {
     if (count($args) < 1) {
         throw new \InvalidArgumentException("Usage: script/generate plugin plugin_id [plugin_title]");
     }
     $this->plugin_id = array_shift($args);
     $this->plugin_class = str_replace('-', '_', \Inflector::camelize(str_replace('.', '_', $this->plugin_id)));
     $this->plugin_title = count($args) ? array_shift($args) : $this->plugin_id;
     $this->plugin_dir = 'plugins/' . $this->plugin_id;
     if (!\zing\plugin\Utils::is_valid_plugin_id($this->plugin_id)) {
         throw new \InvalidArgumentException("'{$this->plugin_id}' is not a valid plugin ID");
     }
     $manager = \zing\plugin\Manager::instance();
     if ($manager->is_plugin_installed($this->plugin_id)) {
         throw new \InvalidArgumentException("'{$this->plugin_id}' is already installed");
     }
 }
Ejemplo n.º 3
0
 protected function sources()
 {
     $sources = array('app' => Migrator::application_migration_dir());
     $plugin_manager = \zing\plugin\Manager::instance();
     foreach ($plugin_manager->plugins() as $plugin) {
         if ($plugin->has_migrations()) {
             $sources["plugin.{$plugin->id()}"] = $plugin->migration_path();
         }
     }
     return $sources;
 }