diff --git a/composer.json b/composer.json index 91d4f12..a6d8b4d 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "require-dev": { }, "require": { - "piwik/searchengine-and-social-list": "^1.3" + "piwik/searchengine-and-social-list": "dev-master", + "piwik/device-detector": "dev-master" } } diff --git a/composer.lock b/composer.lock index 786d596..82faf97 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,124 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "91c091e41d6398ebc9858b24132b66af", + "content-hash": "7b669e7b9119bd3f2e26a451f9ae81c9", "packages": [ { - "name": "piwik/searchengine-and-social-list", - "version": "1.3.10", + "name": "mustangostang/spyc", + "version": "0.6.2", "source": { "type": "git", - "url": "https://github.com/piwik/searchengine-and-social-list.git", - "reference": "4ee85edc474a5e65cc785df470164037aaebc317" + "url": "https://github.com/mustangostang/spyc.git", + "reference": "23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/piwik/searchengine-and-social-list/zipball/4ee85edc474a5e65cc785df470164037aaebc317", - "reference": "4ee85edc474a5e65cc785df470164037aaebc317", + "url": "https://api.github.com/repos/mustangostang/spyc/zipball/23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d", + "reference": "23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "require-dev": { + "phpunit/phpunit": "4.3.*@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5.x-dev" + } + }, + "autoload": { + "files": [ + "Spyc.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "mustangostang", + "email": "vlad.andersen@gmail.com" + } + ], + "description": "A simple YAML loader/dumper class for PHP", + "homepage": "https://github.com/mustangostang/spyc/", + "keywords": [ + "spyc", + "yaml", + "yml" + ], + "time": "2017-02-24T16:06:33+00:00" + }, + { + "name": "piwik/device-detector", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/piwik/device-detector.git", + "reference": "12adf85645b92b9c3b574d840bda6309629036f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/piwik/device-detector/zipball/12adf85645b92b9c3b574d840bda6309629036f2", + "reference": "12adf85645b92b9c3b574d840bda6309629036f2", + "shasum": "" + }, + "require": { + "mustangostang/spyc": "*", + "php": ">=5.3.2" + }, + "require-dev": { + "fabpot/php-cs-fixer": "~1.7", + "matthiasmullie/scrapbook": "@stable", + "phpunit/phpunit": "^4.8.36", + "psr/cache": "^1.0", + "psr/simple-cache": "^1.0" + }, + "suggest": { + "doctrine/cache": "Can directly be used for caching purpose" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeviceDetector\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0+" + ], + "authors": [ + { + "name": "The Piwik Team", + "email": "hello@piwik.org", + "homepage": "http://piwik.org/the-piwik-team/" + } + ], + "description": "The Universal Device Detection library, that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, media players, mobile apps, feed readers, libraries, etc), operating systems, devices, brands and models.", + "homepage": "http://piwik.org", + "keywords": [ + "devicedetection", + "parser", + "useragent" + ], + "time": "2017-11-17T18:05:04+00:00" + }, + { + "name": "piwik/searchengine-and-social-list", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/piwik/searchengine-and-social-list.git", + "reference": "b6f0671d395139ea6eea31ecab2e303ce5191edf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/piwik/searchengine-and-social-list/zipball/b6f0671d395139ea6eea31ecab2e303ce5191edf", + "reference": "b6f0671d395139ea6eea31ecab2e303ce5191edf", "shasum": "" }, "type": "library", @@ -26,13 +130,16 @@ "Public Domain" ], "description": "Search engine and social network definitions used by Piwik", - "time": "2017-09-10T11:20:27+00:00" + "time": "2017-11-07T08:01:18+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "piwik/searchengine-and-social-list": 20, + "piwik/device-detector": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], diff --git a/devicedetector.php b/devicedetector.php new file mode 100644 index 0000000..3d44c46 --- /dev/null +++ b/devicedetector.php @@ -0,0 +1,14 @@ + \DeviceDetector\Parser\OperatingSystem::getAvailableOperatingSystems(), + "browsers" => \DeviceDetector\Parser\Client\Browser::getAvailableBrowsers(), + "brand" => $brands +]; + +echo json_encode($data); \ No newline at end of file diff --git a/tests.py b/tests.py index a4ec589..dfb6220 100755 --- a/tests.py +++ b/tests.py @@ -208,6 +208,27 @@ def test_if_all_search_and_social_sites_have_an_icon(): look_for_search_and_social_icon(load_yaml(searchEnginesFile), "searchengines", "src/searchEngines/") look_for_search_and_social_icon(load_yaml(socialsEnginesFile), "socials", "src/socials/") +def test_if_there_are_icons_for_all_device_detector_categories(): + process = Popen(["php", "devicedetector.php"], stdout=PIPE) + (output, err) = process.communicate() + exit_code = process.wait() + categories = json.loads(output) + for name, category in categories.items(): + for code in category: + if name == "brand": + slug = category[code] + else: + slug = code + found = False + for filetype in ["svg", "png", "gif", "jpg", "ico"]: + # print("src/{type}/{code}.{ext}".format(type=name, code=code, ext=filetype)) + if os.path.isfile("src/{type}/{slug}.{ext}".format(type=name, slug=slug, ext=filetype)): + found = True + if not found: + print("icon for {icon} missing (should be at src/{type}/{slug}.{{png|svg}})".format( + type=name, icon=category[code], slug=slug + )) + if __name__ == "__main__": error = False @@ -230,6 +251,5 @@ if __name__ == "__main__": print("travis_fold:end:small_icons") test_if_build_script_is_deleting_all_unneeded_files() else: - print() test_if_all_search_and_social_sites_have_an_icon() sys.exit(error)