diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-03-25 17:54:22 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-03-25 17:54:22 +0100 |
commit | 8e128604b9bace8a834daa3b02f242f976df85e7 (patch) | |
tree | d520ad25a04ab839eec838fbde16e8cab1094240 | |
parent | 7e9d8b396a87999b7abef7d08c6038af824a70e6 (diff) |
add makefile for building the project
38 files changed, 697 insertions, 406 deletions
diff --git a/.gitignore b/.gitignore index 63d4e433c..f1e9c46ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ #specific to news app +composer.phar node_modules/ *.log /build/ @@ -1,83 +1,43 @@ # Makefile for building the project +app_name=$(notdir $(CURDIR)) +build_directory=$(CURDIR)/build/artifacts/source +package_name=$(build_directory)/$(app_name) -app_name=news -project_dir=$(CURDIR)/../$(app_name) -build_dir=$(CURDIR)/build/artifacts -appstore_dir=$(build_dir)/appstore -source_dir=$(build_dir)/source -package_name=$(app_name) +all: build -all: appstore +.PHONY: build +build: + make composer + make npm -clean: - rm -rf $(build_dir) +.PHONY: composer +composer: + curl -sS https://getcomposer.org/installer | php + php composer.phar install --prefer-dist + php composer.phar update --prefer-dist + rm -f composer.phar -update-composer: - rm -f composer.lock - git rm -r vendor - composer install --prefer-dist +.PHONY: npm +npm: + cd js && npm run build -dist: clean - mkdir -p $(source_dir) - tar cvzf $(source_dir)/$(package_name).tar.gz $(project_dir) \ - --exclude-vcs \ - --exclude=$(project_dir)/build/artifacts \ - --exclude=$(project_dir)/js/node_modules \ - --exclude=$(project_dir)/js/coverage +.PHONY: clean +clean: + rm -rf ./build -appstore: clean - mkdir -p $(appstore_dir) - tar cvzf $(appstore_dir)/$(package_name).tar.gz $(project_dir) \ +.PHONY: dist +dist: + make clean + make build + make test + mkdir -p $(build_directory) + tar cvzf $(package_name).tar.gz ../$(app_name) \ --exclude-vcs \ - --exclude=$(project_dir)/build/artifacts \ - --exclude=$(project_dir)/js/node_modules \ - --exclude=$(project_dir)/js/.bowerrc \ - --exclude=$(project_dir)/js/.jshintrc \ - --exclude=$(project_dir)/js/.jshintignore \ - --exclude=$(project_dir)/js/gulpfile.js \ - --exclude=$(project_dir)/js/*.json \ - --exclude=$(project_dir)/js/*.conf.js \ - --exclude=$(project_dir)/js/*.log \ - --exclude=$(project_dir)/js/README.md \ - --exclude=$(project_dir)/js/.bowerrc \ - --exclude=$(project_dir)/js/app \ - --exclude=$(project_dir)/js/controller \ - --exclude=$(project_dir)/js/coverage \ - --exclude=$(project_dir)/js/directive \ - --exclude=$(project_dir)/js/filter \ - --exclude=$(project_dir)/js/gui \ - --exclude=$(project_dir)/js/plugin \ - --exclude=$(project_dir)/js/service \ - --exclude=$(project_dir)/js/tests \ - --exclude=$(project_dir)/js/vendor/jquery \ - --exclude=$(project_dir)/js/vendor/angular-mocks \ - --exclude=$(project_dir)/\.* \ - --exclude=$(project_dir)/phpunit*xml \ - --exclude=$(project_dir)/composer* \ - --exclude=$(project_dir)/issue_template.md \ - --exclude=$(project_dir)/Makefile \ - --exclude=$(project_dir)/tests \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/.gitattributes \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/Doxyfile \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/FOCUS \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/INSTALL* \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/NEWS \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/phpdoc.ini \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/README \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/TODO \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/VERSION \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/WHATSNEW \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/WYSIWYG \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/art \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/benchmarks \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/configdoc \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/docs \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/extras \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/maintenance \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/plugins \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/smoketests \ - --exclude=$(project_dir)/vendor/ezyang/htmlpurifier/tests \ - --exclude=$(project_dir)/vendor/fguillot/picofeed/docs \ - --exclude=$(project_dir)/vendor/fguillot/picofeed/tests \ - --exclude=$(project_dir)/vendor/pear/net_url2/docs \ - --exclude=$(project_dir)/vendor/pear/net_url2/tests + --exclude=../$(app_name)/build \ + --exclude=../$(app_name)/js/node_modules \ + +.PHONY: test +test: + cd js && npm run test + phpunit -c phpunit.xml + phpunit -c phpunit.integration.xml diff --git a/composer.lock b/composer.lock index cf3f2e04d..3b4ed28a8 100644 --- a/composer.lock +++ b/composer.lock @@ -57,12 +57,12 @@ "source": { "type": "git", "url": "https://github.com/fguillot/picoFeed.git", - "reference": "c270ef4474a2460d857f99c84612025c5f9975f2" + "reference": "d6bbdd248fa4a3eef7831ffaae0491a2ea58f897" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/c270ef4474a2460d857f99c84612025c5f9975f2", - "reference": "c270ef4474a2460d857f99c84612025c5f9975f2", + "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/d6bbdd248fa4a3eef7831ffaae0491a2ea58f897", + "reference": "d6bbdd248fa4a3eef7831ffaae0491a2ea58f897", "shasum": "" }, "require": { @@ -97,7 +97,7 @@ ], "description": "Modern library to handle RSS/Atom feeds", "homepage": "https://github.com/fguillot/picoFeed", - "time": "2016-02-11 19:52:02" + "time": "2016-03-24 12:09:56" }, { "name": "pear/net_url2", diff --git a/js/package.json b/js/package.json index e189c3907..96b0ca7e0 100644 --- a/js/package.json +++ b/js/package.json @@ -3,7 +3,9 @@ "description": "An RSS/Atom feed reader", "main": "build/app.min.js", "scripts": { - "test": "gulp karma" + "test": "node node_modules/gulp-cli/bin/gulp.js karma", + "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update", + "build": "node node_modules/gulp-cli/bin/gulp.js" }, "repository": { "type": "git", @@ -23,12 +25,14 @@ "url": "https://github.com/owncloud/news/issues" }, "engines": { - "node": ">=5.6" + "node": ">=5.6" }, "private": true, "homepage": "https://github.com/owncloud/news", "devDependencies": { + "bower": "^1.7.7", "gulp": "^3.9.1", + "gulp-cli": "^1.2.1", "gulp-concat": "^2.6.0", "gulp-jshint": "^2.0.0", "gulp-ng-annotate": "^2.0.0", diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 5e1469e83..ff6ecfb82 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -13,9 +13,7 @@ namespace Composer\Autoload; /** - * ClassLoader implements a PSR-0 class loader - * - * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. * * $loader = new \Composer\Autoload\ClassLoader(); * @@ -39,6 +37,8 @@ namespace Composer\Autoload; * * @author Fabien Potencier <fabien@symfony.com> * @author Jordi Boggiano <j.boggiano@seld.be> + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ */ class ClassLoader { @@ -147,7 +147,7 @@ class ClassLoader * appending or prepending to the ones previously set for this namespace. * * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-0 base directories + * @param array|string $paths The PSR-4 base directories * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index c8d57af8b..1a2812488 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2015 Nils Adermann, Jordi Boggiano +Copyright (c) 2016 Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 915496bea..c25686b15 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', + '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 9d756efad..d963d9da7 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -41,15 +41,19 @@ class ComposerAutoloaderInit1865bc95e48cb97339d0616ae5d8b993 $loader->register(true); $includeFiles = require __DIR__ . '/autoload_files.php'; - foreach ($includeFiles as $file) { - composerRequire1865bc95e48cb97339d0616ae5d8b993($file); + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire1865bc95e48cb97339d0616ae5d8b993($fileIdentifier, $file); } return $loader; } } -function composerRequire1865bc95e48cb97339d0616ae5d8b993($file) +function composerRequire1865bc95e48cb97339d0616ae5d8b993($fileIdentifier, $file) { - require $file; + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 7f5c5b671..6e19b3984 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -209,12 +209,12 @@ "source": { "type": "git", "url": "https://github.com/fguillot/picoFeed.git", - "reference": "c270ef4474a2460d857f99c84612025c5f9975f2" + "reference": "d6bbdd248fa4a3eef7831ffaae0491a2ea58f897" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/c270ef4474a2460d857f99c84612025c5f9975f2", - "reference": "c270ef4474a2460d857f99c84612025c5f9975f2", + "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/d6bbdd248fa4a3eef7831ffaae0491a2ea58f897", + "reference": "d6bbdd248fa4a3eef7831ffaae0491a2ea58f897", "shasum": "" }, "require": { @@ -229,7 +229,7 @@ "suggest": { "ext-curl": "PicoFeed will use cURL if present" }, - "time": "2016-02-11 19:52:02", + "time": "2016-03-24 12:09:56", "bin": [ "picofeed" ], diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Base.php b/vendor/fguillot/picofeed/lib/PicoFeed/Base.php new file mode 100644 index 000000000..4be0985e4 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Base.php @@ -0,0 +1,34 @@ +<?php + +namespace PicoFeed; + +use PicoFeed\Config\Config; +use PicoFeed\Logging\Logger; + +/** + * Base class + * + * @package PicoFeed + * @author Frederic Guillot + */ +abstract class Base +{ + /** + * Config class instance + * + * @access protected + * @var \PicoFeed\Config\Config + */ + protected $config; + + /** + * Constructor. + * + * @param \PicoFeed\Config\Config $config Config class instance + */ + public function __construct(Config $config = null) + { + $this->config = $config ?: new Config(); + Logger::setTimezone($this->config->getTimezone()); + } +} diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php index 34e21dc19..5fd8d6da9 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php @@ -2,25 +2,18 @@ namespace PicoFeed\Filter; -use DOMXpath; +use DOMXPath; +use PicoFeed\Base; use PicoFeed\Parser\XmlParser; -use PicoFeed\Config\Config; /** * Tag Filter class. * * @author Frederic Guillot */ -class Tag +class Tag extends Base { /** - * Config object. - * - * @var \PicoFeed\Config\Config - */ - private $config; - - /** * Tags blacklist (Xpath expressions). * * @var array @@ -76,11 +69,6 @@ class Tag 'q', ); - public function __construct(Config $config) - { - $this->config = $config; - } - /** * Check if the tag is allowed and is not a pixel tracker. * diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Generator/ContentGeneratorInterface.php b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/ContentGeneratorInterface.php new file mode 100644 index 000000000..5c2f205c6 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/ContentGeneratorInterface.php @@ -0,0 +1,23 @@ +<?php + +namespace PicoFeed\Generator; + +use PicoFeed\Parser\Item; + +/** + * Content Generator Interface + * + * @package PicoFeed\Generator + * @author Frederic Guillot + */ +interface ContentGeneratorInterface +{ + /** + * Execute Content Generator + * + * @access public + * @param Item $item + * @return boolean + */ + public function execute(Item $item); +} diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php new file mode 100644 index 000000000..03f37e16f --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/FileContentGenerator.php @@ -0,0 +1,36 @@ +<?php + +namespace PicoFeed\Generator; + +use PicoFeed\Base; +use PicoFeed\Parser\Item; + +/** + * File Content Generator + * + * @package PicoFeed\Generator + * @author Frederic Guillot + */ +class FileContentGenerator extends Base implements ContentGeneratorInterface +{ + private $extensions = array('pdf'); + + /** + * Execute Content Generator + * + * @access public + * @param Item $item + * @return boolean + */ + public function execute(Item $item) + { + foreach ($this->extensions as $extension) { + if (substr($item->getUrl(), - strlen($extension)) === $extension) { + $item->setContent('<a href="'.$item->getUrl().'" target="_blank">'.$item->getUrl().'</a>'); + return true; + } + } + + return false; + } +} diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Generator/YoutubeContentGenerator.php b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/YoutubeContentGenerator.php new file mode 100644 index 000000000..198090d4f --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Generator/YoutubeContentGenerator.php @@ -0,0 +1,67 @@ +<?php + +namespace PicoFeed\Generator; + +use PicoFeed\Base; +use PicoFeed\Parser\Item; + +/** + * Youtube Content Generator + * + * @package PicoFeed\Generator + * @author Frederic Guillot + */ +class YoutubeContentGenerator extends Base implements ContentGeneratorInterface +{ + /** + * Execute Content Generator + * + * @access public + * @param Item $item + * @return boolean + */ + public function execute(Item $item) + { + if ($item->hasNamespace('yt')) { + return $this->generateHtmlFromXml($item); + } + + return $this->generateHtmlFromUrl($item); + } + + /** + * Generate HTML + * + * @access public + * @param Item $item + * @return boolean + */ + private function generateHtmlFromXml(Item $item) + { + $videoId = $item->getTag('yt:videoId'); + + if (! empty($videoId)) { + $item->setContent('<iframe width="560" height="315" src="//www.youtube.com/embed/'.$videoId[0].'" frameborder="0"></iframe>'); + return true; + } + + return false; + } + + /** + * Generate HTML from item URL + * + * @access public + * @param Item $item + * @return bool + */ + public function generateHtmlFromUrl(Item $item) + { + if (preg_match('/youtube\.com\/watch\?v=(.*)/', $item->getUrl(), $matches)) { + $item->setContent('<iframe width="560" height="315" src="//www.youtube.com/embed/'.$matches[1].'" frameborder="0"></iframe>'); + return true; + } + + return false; + } +} diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php index 356453c9d..63259235f 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php @@ -150,7 +150,7 @@ class Atom extends Parser $updated = XmlParser::getXPathResult($xml, 'atom:updated', $this->namespaces) ?: XmlParser::getXPathResult($xml, 'updated'); - $feed->date = $this->date->getDateTime((string) current($updated)); + $feed->date = $this->getDateParser()->getDateTime((string) current($updated)); } /** @@ -168,8 +168,8 @@ class Atom extends Parser $updated = XmlParser::getXPathResult($entry, 'atom:updated', $this->namespaces) ?: XmlParser::getXPathResult($entry, 'updated'); - $published = !empty($published) ? $this->date->getDateTime((string) current($published)) : null; - $updated = !empty($updated) ? $this->date->getDateTime((string) current($updated)) : null; + $published = !empty($published) ? $this->getDateParser()->getDateTime((string) current($published)) : null; + $updated = !empty($updated) ? $this->getDateParser()->getDateTime((string) current($updated)) : null; if ($published === null && $updated === null) { $item->date = $feed->getDate(); // We use the feed date if there is no date for the item diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php index e4d08b527..4ad00789a 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/DateParser.php @@ -4,20 +4,22 @@ namespace PicoFeed\Parser; use DateTime; use DateTimeZone; +use PicoFeed\Base; /** * Date Parser. * * @author Frederic Guillot */ -class DateParser +class DateParser extends Base { /** * Timezone used to parse feed dates. * + * @access private * @var string */ - public $timezone = 'UTC'; + private $timezone = 'UTC'; /** |