Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $ctx = array();
     $ext = new Collection();
     $output->writeln("<info></info>");
     $basedir = new Path(getenv('HOME'));
     $ext->builders['dirs'] = new Dirs(array($basedir->string('.civix')));
     $ext->builders['ini'] = new Ini($basedir->string('.civix', 'civix.ini'));
     $ext->loadInit($ctx);
     $data = $ext->builders['ini']->get();
     if (!is_array($data)) {
         $data = array('parameters' => array());
     }
     $data['parameters'][$input->getArgument('key')] = $input->getArgument('value');
     $ext->builders['ini']->set($data);
     $ext->save($ctx, $output);
     \CRM\CivixBundle\Utils\Commands::createProcess('cache:clear --no-warmup')->run(function ($type, $buffer) {
         echo $buffer;
     });
 }
Example #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $licenses = new \LicenseData\Repository();
     $ctx = array();
     $ctx['type'] = 'module';
     $ctx['fullName'] = $input->getArgument('<full.ext.name>');
     $ctx['basedir'] = $ctx['fullName'];
     if (preg_match('/^[a-z0-9\\.]+\\.([a-z0-9]+)$/', $ctx['fullName'], $matches)) {
         $ctx['mainFile'] = $matches[1];
         $ctx['namespace'] = 'CRM/' . strtoupper($ctx['mainFile'][0]) . substr($ctx['mainFile'], 1);
     } else {
         $output->writeln('<error>Malformed package name</error>');
         return;
     }
     if ($input->getOption('author') && $input->getOption('email')) {
         $ctx['author'] = $input->getOption('author');
         $ctx['email'] = $input->getOption('email');
     } else {
         $output->writeln("<error>Missing author name or email address</error>");
         $output->writeln("<error>Please pass --author and --email, or set defaults in ~/.gitconfig</error>");
         return;
     }
     $ctx['license'] = $input->getOption('license');
     if ($licenses->get($ctx['license'])) {
         $output->writeln(sprintf('<comment>License set to %s (authored by %s \\<%s>)</comment>', $ctx['license'], $ctx['author'], $ctx['email']));
         $output->writeln('<comment>If this is in error, please correct info.xml and LICENSE.txt</comment>');
     } else {
         $output->writeln('<error>Unrecognized license (' . $ctx['license'] . ')</error>');
         return;
     }
     $ext = new Collection();
     $output->writeln("<info>Initalize module " . $ctx['fullName'] . "</info>");
     $basedir = new Path($ctx['basedir']);
     $ext->builders['dirs'] = new Dirs(array($basedir->string('build'), $basedir->string('templates'), $basedir->string('xml'), $basedir->string($ctx['namespace'])));
     $ext->builders['info'] = new Info($basedir->string('info.xml'));
     $ext->builders['module'] = new Module($this->getContainer()->get('templating'));
     $ext->builders['license'] = new License($licenses->get($ctx['license']), $basedir->string('LICENSE.txt'), FALSE);
     $ext->loadInit($ctx);
     $ext->save($ctx, $output);
     $this->tryEnable($input, $output, $ctx['fullName']);
 }