public function addMain($file) { $content = file_get_contents($file); $content = self::stripWhitespace(self::stripShebang($content)); $content = preg_replace("/(.+new[\\w \\\\]+Application\\('\\w+',).+?(\\);.+)/s", '$1\'' . Git::getVersion($this->config->getBasePath()) . '\'$2', $content); $this->phar->addFromString(FileUtils::pathDiff($this->config->getBasePath(), $file, true), $content); }
public function testPathDiff() { $path = FileUtils::pathDiff('/path/to/blah', '/path/to/blah/and/some/more'); $this->assertEquals('/and/some/more', $path); $path = FileUtils::pathDiff('/path/to/blah', '/path/to/blah/and/some/more', true); $this->assertEquals('and/some/more', $path); $path = FileUtils::pathDiff('/path/to/blah', '/path/to/cake'); $this->assertEquals('/path/to/cake', $path); }