示例#1
0
 public function check(InputInterface $input, OutputInterface $output)
 {
     if (!file_exists($this->target_dir)) {
         throw new \RuntimeException(sprintf('Site not found: %s', $this->site));
     }
     $path = Util::buildTargetPath('libraries/koowa/libraries/koowa.php', $this->target_dir);
     if (!file_exists($path)) {
         throw new \RuntimeException(sprintf('Koowa is not installed on site: %s', $this->site));
     }
 }
示例#2
0
 public function callHasChildren()
 {
     $filename = $this->getFilename();
     if ($filename[0] == '.') {
         return false;
     }
     $source = $this->key();
     $target = str_replace($this->source, '', $source);
     $target = str_replace('/site', '', $target);
     $target = Util::buildTargetPath($target, $this->target);
     if (is_link($target)) {
         unlink($target);
     }
     if (!is_dir($target)) {
         $this->createLink($source, $target);
         return false;
     }
     return parent::callHasChildren();
 }
    $component = 'com_' . $manifest->{'nooku-component'}->name;
    if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
        $output->writeln("Symlinking `{$component}` into `{$destination}`");
    }
    $dirs = array(Util::buildTargetPath('/libraries/koowa/components', $destination), Util::buildTargetPath('/media/koowa', $destination));
    foreach ($dirs as $dir) {
        if (!is_dir($dir)) {
            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                $output->writeln(" * creating empty directory `{$dir}`");
            }
            mkdir($dir, 0777, true);
        }
    }
    $code_destination = Util::buildTargetPath('/libraries/koowa/components/' . $component, $destination);
    if (!file_exists($code_destination)) {
        if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
            $output->writeln(" * creating link `{$code_destination}` -> {$project}");
        }
        `ln -sf {$project} {$code_destination}`;
    }
    // Special treatment for media files
    $media = $project . '/resources/assets';
    $target = Util::buildTargetPath('/media/koowa/' . $component, $destination);
    if (is_dir($media) && !file_exists($target)) {
        if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
            $output->writeln(" * creating link `{$target}` -> {$media}");
        }
        `ln -sf {$media} {$target}`;
    }
    return true;
});
        return false;
    }
    $manifest = json_decode(file_get_contents($project . '/composer.json'));
    if (!isset($manifest->name) || $manifest->name != 'joomlatools/framework') {
        return false;
    }
    // build the folders to symlink into
    $dirs = array(Util::buildTargetPath('/libraries/joomlatools/component', $destination), Util::buildTargetPath('/media/koowa', $destination));
    foreach ($dirs as $dir) {
        if (!is_dir($dir)) {
            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                $output->writeln(" * creating empty directory `{$dir}`");
            }
            mkdir($dir, 0777, true);
        }
    }
    /*
     * Special treatment for media files
     */
    $media = array($project . '/code/libraries/joomlatools/component/koowa/resources/assets' => Util::buildTargetPath('/media/koowa/com_koowa', $destination), $project . '/code/libraries/joomlatools/library/resources/assets' => Util::buildTargetPath('/media/koowa/framework', $destination));
    foreach ($media as $from => $to) {
        if (is_dir($from) && !file_exists($to)) {
            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                $output->writeln(" * creating link `{$to}` -> {$from}");
            }
            `ln -sf {$from} {$to}`;
        }
    }
    // Let the default symlinker handle the rest
    return false;
});