Skip to content

Commit

Permalink
Merge tag '2.6.4' into develop
Browse files Browse the repository at this point in the history
v2.6.4
  • Loading branch information
btry committed Aug 14, 2018
2 parents e9a6b71 + 949b40b commit 05b199f
Show file tree
Hide file tree
Showing 10 changed files with 2,040 additions and 255 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
<a name="2.6.4"></a>
## [2.6.4](https://github.com-btry/pluginsGLPI/formcreator/compare/2.6.3...2.6.4) (2018-08-13)


### Bug Fixes

* **actorfield:** compatibility with GLPI 9.3 ([#1034](https://github.com-btry/pluginsGLPI/formcreator/issues/1034)) ([3b2051f](https://github.com-btry/pluginsGLPI/formcreator/commit/3b2051f))
* **actors:** fix edit of an existing question of type actors ([f1606af](https://github.com-btry/pluginsGLPI/formcreator/commit/f1606af))
* **actors:** use first / last name in generataed tickets ([1455708](https://github.com-btry/pluginsGLPI/formcreator/commit/1455708)), closes [#1016](https://github.com-btry/pluginsGLPI/formcreator/issues/1016)
* **description:** cannot apply hide/show condition on descriptions ([8693a6a](https://github.com-btry/pluginsGLPI/formcreator/commit/8693a6a))
* **filefield:** SQL single quote escaping ([e0b9bd6](https://github.com-btry/pluginsGLPI/formcreator/commit/e0b9bd6))
* **form:** access to form not properly checked ([#1047](https://github.com-btry/pluginsGLPI/formcreator/issues/1047)) ([1a40790](https://github.com-btry/pluginsGLPI/formcreator/commit/1a40790))
* **form:** check access to form only by entity ([c0973cb](https://github.com-btry/pluginsGLPI/formcreator/commit/c0973cb))
* **form:** forbid purge of a form when there are answers ([f84b353](https://github.com-btry/pluginsGLPI/formcreator/commit/f84b353))
* **form:** import restrictions by profile was broken ([34ae3bf](https://github.com-btry/pluginsGLPI/formcreator/commit/34ae3bf)), closes [#722](https://github.com-btry/pluginsGLPI/formcreator/issues/722)
* **form_answer:** allow view of form if the user has update entity right ([7dad4cb](https://github.com-btry/pluginsGLPI/formcreator/commit/7dad4cb))
* **form_answer:** fix compatibility with GLPI 9.4 ([001a82f](https://github.com-btry/pluginsGLPI/formcreator/commit/001a82f))
* **form_answer:** fix fatal error ([c292981](https://github.com-btry/pluginsGLPI/formcreator/commit/c292981))
* **form_profile:** UUID was not generated ([44f231b](https://github.com-btry/pluginsGLPI/formcreator/commit/44f231b))
* compatibility with GLPI 9.4 ([6dfaae9](https://github.com-btry/pluginsGLPI/formcreator/commit/6dfaae9)), closes [#1022](https://github.com-btry/pluginsGLPI/formcreator/issues/1022)
* **issue:** more consistent status display for status of issues ([2802a78](https://github.com-btry/pluginsGLPI/formcreator/commit/2802a78))
* **issue:** php warnings in service catalog ([0754b5f](https://github.com-btry/pluginsGLPI/formcreator/commit/0754b5f))
* **plugin:** update compatibility ([57c607f](https://github.com-btry/pluginsGLPI/formcreator/commit/57c607f))
* **question:** description displayed in italic ([e572b43](https://github.com-btry/pluginsGLPI/formcreator/commit/e572b43))
* **question:** fix loss of description ([4b39371](https://github.com-btry/pluginsGLPI/formcreator/commit/4b39371))
* **question_condition:** fix creation of conditions ([135d6c8](https://github.com-btry/pluginsGLPI/formcreator/commit/135d6c8))
* **target:** continue keyword in switch ([576c891](https://github.com-btry/pluginsGLPI/formcreator/commit/576c891))
* **target:** loading of instance from DB ([1d314de](https://github.com-btry/pluginsGLPI/formcreator/commit/1d314de))
* **target:** unescaped quote ([6afa05b](https://github.com-btry/pluginsGLPI/formcreator/commit/6afa05b))



<a name="2.6.3"></a>
## [2.6.3](https://github.com-btry/pluginsGLPI/formcreator/compare/2.6.2...2.6.3) (2018-04-30)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![GLPI Banner](https://user-images.githubusercontent.com/29282308/31666160-8ad74b1a-b34b-11e7-839b-043255af4f58.png)

[![License GPL 3.0](https://img.shields.io/badge/License-GPL%203.0-blue.svg)](https://github.com/Naylin15/formcreator/blob/develop/LICENSE.md)
[![License GPL 3.0](https://img.shields.io/badge/License-GPL%203.0-blue.svg)](https://github.com/pluginsGLPI/formcreator/blob/master/LICENSE.md)
[![Telegram GLPI](https://img.shields.io/badge/Telegram-GLPI-blue.svg)](https://t.me/glpien)
[![IRC Chat](https://img.shields.io/badge/IRC-%23GLPI-green.svg)](http://webchat.freenode.net/?channels=GLPI)
[![Follow Twitter](https://img.shields.io/badge/Twitter-GLPI%20Project-26A2FA.svg)](https://twitter.com/GLPI_PROJECT)
Expand Down Expand Up @@ -77,7 +77,7 @@ Obtain a personalized service experience, associated with benefits and opportuni
## Contribute

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our
guidelines for [contributing](https://github.com/pluginsGLPI/formcreator/blob/develop/.github/CONTRIBUTING.md) and then check out one of our issues in the [Issues Dashboard](https://github.com/pluginsGLPI/formcreator/issues).
guidelines for [contributing](https://github.com/pluginsGLPI/formcreator/blob/master/.github/CONTRIBUTING.md) and then check out one of our issues in the [Issues Dashboard](https://github.com/pluginsGLPI/formcreator/issues).

## Copying

Expand Down
124 changes: 100 additions & 24 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,50 +122,82 @@ public function archiveBuild($release = 'release') {
$release = strtolower($release);
$version = $this->getVersion();

if ($release == 'release') {
if ($this->getIsRelease() !== 'true') {
throw new Exception('The Official release constant must be true');
}
}

if (!$this->isSemVer($version)) {
throw new Exception("$version is not semver compliant. See http://semver.org/");
}

if ($this->tagExists($version)) {
throw new Exception("The tag $version already exists");
}
if ($release != 'release') {
if ($this->getIsRelease() === 'true') {
throw new Exception('The Official release constant must be false');
}
} else {
if ($this->getIsRelease() !== 'true') {
throw new Exception('The Official release constant must be true');
}

//if (!$this->isTagMatchesCurrentCommit($version)) {
//throw new Exception("HEAD is not pointing to the tag of the version to build");
//}
if ($this->tagExists($version)) {
throw new Exception("The tag $version already exists");
}

// if (!$this->isTagMatchesCurrentCommit($version)) {
// throw new Exception("HEAD is not pointing to the tag of the version to build");
// }

$versionTag = $this->getVersionTagFromXML($version);
if (!is_array($versionTag)) {
throw new Exception("The version does not exists in the XML file");
$versionTag = $this->getVersionTagFromXML($version);
if (!is_array($versionTag)) {
throw new Exception("The version does not exists in the XML file");
}
}

// update version in package.json
$this->sourceUpdatePackageJson($version);
$this->sourceUpdateComposerJson($version);

$this->updateChangelog();

$diff = $this->gitDiff(['package.json']);
$diff = implode("\n", $diff);
if ($diff != '') {
$this->taskGitStack()
->stopOnFail()
->add('package.json')
->commit('docs: bump version in package.json')
->run();
}

$this->taskGitStack()
->stopOnFail()
->add('package.json')
->add('composer.json')
->commit('build: bump version in JSON files')
->add('CHANGELOG.md')
->commit('build(changelog): update changelog')
->commit('docs(changelog): update changelog')
->run();

// Update locales
$this->localesGenerate();
$this->taskGitStack()
->stopOnFail()
->add('locales/*')
->commit('docs(locales): update translations')
->run();

$rev = 'HEAD';
$pluginName = $this->getPluginName();
$pluginPath = $this->getProjectPath();
$targetFile = $pluginPath. "/dist/glpi-" . $this->getPluginName() . "-$version.tar.bz2";
$toArchive = implode(' ', $this->getFileToArchive("HEAD"));
@mkdir($pluginPath. "/dist");
$this->_exec("git archive --prefix=$pluginName/ HEAD $toArchive | bzip2 > $targetFile");
$archiveWorkdir = "$pluginPath/output/dist/archive_workdir";
$archiveFile = "$pluginPath/output/dist/glpi-" . $this->getPluginName() . "-$version.tar.bz2";
$this->taskDeleteDir($archiveWorkdir)->run();
$this->taskDeleteDir($archiveFile)->run();
mkdir($archiveWorkdir, 0777, true);
$filesToArchive = implode(' ', $this->getFileToArchive($rev));

// Extract from the repo all files we want to have in the redistribuable archive
$this->_exec("git archive --prefix=$pluginName/ $rev $filesToArchive | tar x -C '$archiveWorkdir'");

// Add composer dependencies
$this->_exec("composer install --no-dev --working-dir='$archiveWorkdir/$pluginName'");

// Create the final archive
$this->taskPack($archiveFile)
->addDir("$pluginName", "$archiveWorkdir/$pluginName")
->run();
}

protected function getTrackedFiles($version) {
Expand Down Expand Up @@ -244,6 +276,9 @@ protected function getPluginXMLDescription() {
}

$xml = simplexml_load_string(file_get_contents($pluginXML));
if ($xml === false) {
throw new Exception("$pluginXML is not valid XML");
}
$json = json_encode($xml);
return json_decode($json, true);
}
Expand Down Expand Up @@ -487,4 +522,45 @@ protected function replaceSourceHeader($filename) {

file_put_contents($filename, $source);
}

/**
* @param array $files files to commit
* @param string $version1
* @param string $version2
*/
protected function gitDiff(array $files, $version1 = '', $version2 = '') {
if (count($files) < 1) {
$arg = '-u';
} else {
$arg = '"' . implode('" "', $files) . '"';
}

if ($version1 == '' && $version2 == '') {
$fromTo = '';
} else {
$fromTo = "$version1..$version2";
}

exec("git diff $fromTo -- $arg", $output, $retCode);
if ($retCode > 0) {
throw new Exception("Failed to diff $fromTo");
}

return $output;
}

/**
* Get a file from git tree
* @param string $path
* @param string $rev a commit hash, a tag or a branch
* @throws Exception
* @return string content of the file
*/
protected function getFileFromGit($path, $rev) {
$output = shell_exec("git show $rev:$path");
if ($output === null) {
throw new Exception ("coult not get file from git: $rev:$path");
}
return $output;
}
}
18 changes: 14 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{
"name": "Formcreator",
"description": "Formcreator is a plugin that allow creation of custom, easy to access forms for users when they want to create one or more GLPI tickets.",
"license": "GPL-2.0-or-later",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">= 5.4.0",
"config": {
"platform": {
"php": "5.6.0"
},
"optimize-autoloader": true
},
"require": {
"php": ">= 5.6.0",
"ext-xml": "*",
"docopt/docopt": "^1.0"
},
"require-dev": {
"ext-bz2": "*",
"pear/archive_tar": "^1.4",
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.0",
"glpi-project/tools": "^0.1.0",
"glpi-project/coding-standard": "0.5.0"
},
"version": "2.6.3"
}
}
Loading

0 comments on commit 05b199f

Please sign in to comment.