Exemple #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setupEnvironment($input);
     $message = $this->env->isTemporary() ? 'Preparing ' . tinkr_version() . '...' : 'Preparing ' . tinkr_version() . ' at `' . $this->env->getPath() . '`...';
     $output->writeln('<info>' . $message . '</info>');
     tinkr('composer')->init($input->getArgument('initPackages'));
     tinkr('shell')->run();
     if ($this->env->isTemporary()) {
         $output->writeln('<info>Cleaning up temporary tinkr environment...</info>');
     }
 }
Exemple #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /* @var \EFrane\Tinkr\Environment\Environment $env */
     $env = tinkr('env');
     if (is_null($path = $input->getArgument('path'))) {
         $path = $env->getCWD() . '/tinkr-session-' . $env->getSessionStart();
     }
     if (is_dir($path) && !$input->getOption('force')) {
         $output->writeln("<info>Export at {$path} already exists. Use --force to overwrite.</info>");
         return;
     }
     $output->writeLn("Exporting to {$path}...");
     $fs = new Filesystem();
     $fs->mkdir($path);
     $fs->mirror($env->getPath(), $path, null, ['delete' => $input->getOption('force'), 'overwrite' => $input->getOption('force')]);
 }
Exemple #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /* @var \EFrane\Tinkr\Environment\Composer $composer */
     $composer = tinkr('composer');
     foreach ($input->getArgument('packages') as $package) {
         try {
             $composer->install($package);
             $output->writeln('<info>Resetting includes...</info>');
             /* @var \Psy\Shell $app */
             $app = $this->getApplication();
             $app->resetCodeBuffer();
             $app->addInput("require 'vendor/autoload.php'");
         } catch (\Exception $e) {
             $this->getApplication()->renderException($e, $output);
         }
     }
 }
Exemple #4
0
 protected function setup()
 {
     $this->cwd = getcwd();
     $this->sessionStart = Carbon::now();
     if (!is_dir($this->path)) {
         $this->fs->mkdir($this->path);
     }
     if ($this->temporary) {
         // remove everything if the session is temporary
         register_shutdown_function(function () {
             $this->fs->remove($this->path);
         });
     }
     tinkr()->instance('EFrane\\Tinkr\\Environment\\Environment', $this);
     tinkr()->alias('EFrane\\Tinkr\\Environment\\Environment', 'env');
     tinkr()->bind('composer', 'EFrane\\Tinkr\\Environment\\Composer');
     tinkr()->bind('shell', 'EFrane\\Tinkr\\Environment\\Shell');
 }