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; }
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"); } }
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; }