-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
2,048 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist/ | ||
vendor/ | ||
.gh_token | ||
*.min.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
language: php | ||
|
||
env: | ||
- DB=mysql | ||
|
||
before_script: | ||
- composer self-update | ||
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.4" ]]; then sed -e "s|.*"consolidation/robo".*$||" -i composer.json && composer update; fi | ||
- composer install -o | ||
# - mysql -u root -e 'create database glpitest;' | ||
# - php tools/cliinstall.php --lang=en_US --db=glpitest --user=root --tests | ||
- pear install pear/PHP_CodeSniffer | ||
- phpenv rehash | ||
|
||
script: | ||
# - mysql -u root -e 'select version();' | ||
# - phpunit --verbose | ||
- phpcs -p --ignore=vendor --ignore=js --standard=tools/phpcs-rules.xml . | ||
|
||
matrix: | ||
include: | ||
- php: 5.4 | ||
addons: | ||
mariadb: 5.5 | ||
- php: 5.5 | ||
addons: | ||
mariadb: 5.5 | ||
# - php: 5.6 | ||
# addons: | ||
# mariadb: 5.5 | ||
# - php: 5.6 | ||
# addons: | ||
# mariadb: 10.0 | ||
- php: 5.6 | ||
addons: | ||
mariadb: 10.1 | ||
# - php: 7.0 | ||
# addons: | ||
# mariadb: 10.0 | ||
- php: 7.0 | ||
addons: | ||
mariadb: 10.1 | ||
# - php: 7.1 | ||
# addons: | ||
# mariadb: 10.0 | ||
- php: 7.1 | ||
addons: | ||
mariadb: 10.1 | ||
- php: nightly | ||
addons: | ||
mariadb: 10.1 | ||
allow_failures: | ||
- php: nightly | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
#notifications: | ||
# irc: | ||
# channels: | ||
# - "irc.freenode.org#channel" | ||
# on_success: change | ||
# on_failure: always | ||
# use_notice: true | ||
# skip_join: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/** | ||
* This is project's console commands configuration for Robo task runner. | ||
* | ||
* @see http://robo.li/ | ||
*/ | ||
|
||
require_once 'RoboFilePlugin.php'; | ||
|
||
class RoboFile extends RoboFilePlugin | ||
{ | ||
//Own plugin's robo stuff | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<?php | ||
/** | ||
* This is project's console commands configuration for Robo task runner. | ||
* | ||
* @see http://robo.li/ | ||
*/ | ||
class RoboFilePlugin extends \Robo\Tasks | ||
{ | ||
/** | ||
* Minify all | ||
* | ||
* @return void | ||
*/ | ||
public function minify() | ||
{ | ||
$this->minifyCSS() | ||
->minifyJS(); | ||
} | ||
|
||
/** | ||
* Minify CSS stylesheets | ||
* | ||
* @return void | ||
*/ | ||
public function minifyCSS() | ||
{ | ||
$css_dir = __DIR__ . '/css'; | ||
if (is_dir($css_dir)) { | ||
foreach(glob("$css_dir/*.css") as $css_file) { | ||
if (!$this->endsWith($css_file, 'min.css')) { | ||
$this->taskMinify($css_file) | ||
->to(str_replace('.css', '.min.css', $css_file)) | ||
->type('css') | ||
->run(); | ||
} | ||
} | ||
} | ||
return $this; | ||
} | ||
|
||
/** | ||
* Minify JavaScript files stylesheets | ||
* | ||
* @return void | ||
*/ | ||
public function minifyJS() | ||
{ | ||
$js_dir = __DIR__ . '/js'; | ||
if (is_dir($js_dir)) { | ||
foreach(glob("$js_dir/*.js") as $js_file) { | ||
if (!$this->endsWith($js_file, 'min.js')) { | ||
$this->taskMinify($js_file) | ||
->to(str_replace('.js', '.min.js', $js_file)) | ||
->type('js') | ||
->run(); | ||
} | ||
} | ||
} | ||
return $this; | ||
} | ||
|
||
/** | ||
* Extract translatable strings | ||
* | ||
* @return void | ||
*/ | ||
public function localesExtract() | ||
{ | ||
$this->_exec('tools/extract_template.sh'); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Push locales to transifex | ||
* | ||
* @return void | ||
*/ | ||
public function localesPush() | ||
{ | ||
$this->_exec('tx push -s'); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Pull locales from transifex. | ||
* | ||
* @return void | ||
*/ | ||
public function localesPull($percent = 70) | ||
{ | ||
$this->_exec('tx pull -s --minimum-perc=' .$percent); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Build MO files | ||
* | ||
* @return void | ||
*/ | ||
public function localesMo() | ||
{ | ||
$this->_exec('./tools/release --compile-mo'); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Extract and send locales | ||
* | ||
* @return void | ||
*/ | ||
public function localesSend() | ||
{ | ||
$this->localesExtract() | ||
->localesPush(); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Retrieve locales and generate mo files | ||
* | ||
* @return void | ||
*/ | ||
public function localesGenerate($percent = 70) { | ||
$this->localesPull($percent) | ||
->localesMo(); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Checks if a string ends with another string | ||
* | ||
* @param string $haystack Full string | ||
* @param string $needle Ends string | ||
* | ||
* @return boolean | ||
* @see http://stackoverflow.com/a/834355 | ||
*/ | ||
private function endsWith($haystack, $needle) { | ||
$length = strlen($needle); | ||
if ($length == 0) { | ||
return true; | ||
} | ||
|
||
return (substr($haystack, -$length) === $needle); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"require-dev": { | ||
"consolidation/robo": "dev-master@dev", | ||
"patchwork/jsqueeze": "~1.0", | ||
"natxet/CssMin": "~3.0" | ||
} | ||
} |
Oops, something went wrong.