adding dependencies for supported platforms
This commit is contained in:
parent
770f987659
commit
ee46548f57
|
@ -48,6 +48,7 @@ class DependencyAnalyzer {
|
||||||
$this->analyzeDatabases();
|
$this->analyzeDatabases();
|
||||||
$this->analyzeCommands();
|
$this->analyzeCommands();
|
||||||
$this->analyzeLibraries();
|
$this->analyzeLibraries();
|
||||||
|
$this->analyzeOS();
|
||||||
return $this->missing;
|
return $this->missing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +136,26 @@ class DependencyAnalyzer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function analyzeOS() {
|
||||||
|
if (!isset($this->dependencies['os'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oss = $this->dependencies['os'];
|
||||||
|
if (empty($oss)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$oss = array_map(function($os) {
|
||||||
|
return $this->getValue($os);
|
||||||
|
}, $oss);
|
||||||
|
$currentOS = $this->platform->getOS();
|
||||||
|
if (!in_array($currentOS, $oss)) {
|
||||||
|
$this->addMissing((string)$this->l->t('Following platforms are supported: %s', join(', ', $oss)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $element
|
* @param $element
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"@value": "intl"
|
"@value": "intl"
|
||||||
},
|
},
|
||||||
"curl"
|
"curl"
|
||||||
]
|
],
|
||||||
|
"os": "Linux"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,6 @@
|
||||||
<lib min-version="1.2">xml</lib>
|
<lib min-version="1.2">xml</lib>
|
||||||
<lib max-version="2.0">intl</lib>
|
<lib max-version="2.0">intl</lib>
|
||||||
<lib>curl</lib>
|
<lib>curl</lib>
|
||||||
|
<os>Linux</os>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</info>
|
</info>
|
||||||
|
|
|
@ -141,6 +141,34 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
|
||||||
$this->assertEquals($expectedMissing, $missing);
|
$this->assertEquals($expectedMissing, $missing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providesOS
|
||||||
|
* @param $expectedMissing
|
||||||
|
* @param $oss
|
||||||
|
*/
|
||||||
|
function testOS($expectedMissing, $oss) {
|
||||||
|
$app = array(
|
||||||
|
'dependencies' => array()
|
||||||
|
);
|
||||||
|
if (!is_null($oss)) {
|
||||||
|
$app['dependencies']['os'] = $oss;
|
||||||
|
}
|
||||||
|
|
||||||
|
$analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock);
|
||||||
|
$missing = $analyser->analyze();
|
||||||
|
|
||||||
|
$this->assertTrue(is_array($missing));
|
||||||
|
$this->assertEquals($expectedMissing, $missing);
|
||||||
|
}
|
||||||
|
|
||||||
|
function providesOS() {
|
||||||
|
return array(
|
||||||
|
array(array(), null),
|
||||||
|
array(array(), array()),
|
||||||
|
array(array('Following platforms are supported: WINNT'), array('WINNT'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function providesLibs() {
|
function providesLibs() {
|
||||||
return array(
|
return array(
|
||||||
// we expect curl to exist
|
// we expect curl to exist
|
||||||
|
|
Loading…
Reference in New Issue