Skip to content

Commit

Permalink
Report from empty plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Nov 29, 2016
1 parent c2c9693 commit 4592153
Show file tree
Hide file tree
Showing 16 changed files with 2,048 additions and 402 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
vendor/
.gh_token
*.min.*
66 changes: 66 additions & 0 deletions .travis.yml
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
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Fields GLPi plugin

The fields plugin allows you to add custom fields on glpi types : tickets, computers, users...

Addionnal data can be added :
Expand All @@ -20,7 +22,14 @@ There is a [migration script](https://github.com/pluginsGLPI/customfields/blob/m
**WARNING : this one is experimental and deserved to be more tested. We strongly advise you to backup your data before using it**


Documentation
=============
## Documentation

For 0.84 plugin : https://github.com/pluginsGLPI/fields/blob/0.84/bugfixes/documentation/doc_plugin_fields.asciidoc

## Contributing

* Open a ticket for each bug/feature so it can be discussed
* Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/latest/plugins.html)
* Refer to [GitFlow](http://git-flow.readthedocs.io/) process for branching
* Work on a new branch on your own fork
* Open a PR that will be reviewed by a developer
13 changes: 13 additions & 0 deletions RoboFile.php
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
}
146 changes: 146 additions & 0 deletions RoboFilePlugin.php
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);
}
}
7 changes: 7 additions & 0 deletions composer.json
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"
}
}
Loading

0 comments on commit 4592153

Please sign in to comment.