Skip to content

Commit

Permalink
Base feed crawler, parser and presenter
Browse files Browse the repository at this point in the history
  • Loading branch information
PeeHaa committed Jun 23, 2019
0 parents commit 7c12ddf
Show file tree
Hide file tree
Showing 253 changed files with 28,212 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/appveyor.yml export-ignore
/CHANGELOG.md export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
/tests export-ignore
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/vendor
/.idea
.phpunit.result.cache
infection.log
config.php
phinx.yml
node_modules
166 changes: 166 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
sudo: false

language: php

matrix:
include:
- name: '[REQUIRE_CHECK] With Locked Dependencies'
php: '7.3'
env: require=1
- name: '[REQUIRE_CHECK] With Lowest Dependencies'
php: '7.3'
env: require=1 dependencies=lowest
- name: '[REQUIRE_CHECK] With Highest Dependencies'
php: '7.3'
env: require=1 dependencies=highest

- name: '[CS] PHP 7.3 With Locked Dependencies'
php: '7.3'
env: cs=1
- name: '[CS] PHP 7.3 With Lowest Dependencies'
php: '7.3'
env: cs=1 dependencies=lowest
- name: '[CS] PHP 7.3 With Highest Dependencies'
php: '7.3'
env: cs=1 dependencies=highest
- name: '[CS] PHP Nightly With Locked Dependencies'
php: nightly
env: cs=1
- name: '[CS] PHP Nightly With Lowest Dependencies'
php: nightly
env: cs=1 dependencies=lowest
- name: '[CS] PHP Nightly With Highest Dependencies'
php: nightly
env: cs=1 dependencies=highest

- name: '[UNIT] PHP 7.3 With Locked Dependencies'
php: '7.3'
env: unit=1
- name: '[UNIT] PHP 7.3 With Lowest Dependencies'
php: '7.3'
env: dependencies=lowest unit=1
- name: '[UNIT] PHP 7.3 With Highest Dependencies'
php: '7.3'
env: dependencies=highest unit=1
- name: '[UNIT] PHP Nightly With Locked Dependencies'
php: nightly
env: unit=1
- name: '[UNIT] PHP Nightly With Highest Dependencies'
php: nightly
env: dependencies=highest unit=1
- name: '[UNIT] PHP Nightly With Lowest Dependencies'
php: nightly
env: dependencies=lowest unit=1

- name: '[INTEGRATION] PHP 7.3 With Locked Dependencies'
php: '7.3'
env: integration=1
- name: '[INTEGRATION] PHP 7.3 With Lowest Dependencies'
php: '7.3'
env: dependencies=lowest integration=1
- name: '[INTEGRATION] PHP 7.3 With Highest Dependencies'
php: '7.3'
env: dependencies=highest integration=1
- name: '[INTEGRATION] PHP Nightly With Locked Dependencies'
php: nightly
env: integration=1
- name: '[INTEGRATION] PHP Nightly With Highest Dependencies'
php: nightly
env: dependencies=highest integration=1
- name: '[INTEGRATION] PHP Nightly With Lowest Dependencies'
php: nightly
env: dependencies=lowest integration=1

- name: '[PHPSTAN] PHP 7.3 With Locked Dependencies'
php: '7.3'
env: phpstan=1
- name: '[PHPSTAN] PHP 7.3 With Lowest Dependencies'
php: '7.3'
env: phpstan=1 dependencies=lowest
- name: '[PHPSTAN] PHP 7.3 With Highest Dependencies'
php: '7.3'
env: phpstan=1 dependencies=highest
- name: '[PHPSTAN] PHP Nightly With Locked Dependencies'
php: nightly
env: phpstan=1
- name: '[PHPSTAN] PHP Nightly With Lowest Dependencies'
php: nightly
env: phpstan=1 dependencies=lowest
- name: '[PHPSTAN] PHP Nightly With Highest Dependencies'
php: nightly
env: phpstan=1 dependencies=highest
allow_failures:
- name: '[CS] PHP Nightly With Locked Dependencies'
php: nightly
env: cs=1
- name: '[CS] PHP Nightly With Lowest Dependencies'
php: nightly
env: cs=1 dependencies=lowest
- name: '[CS] PHP Nightly With Highest Dependencies'
php: nightly
env: cs=1 dependencies=highest

- name: '[UNIT] PHP Nightly With Locked Dependencies'
php: nightly
env: unit=1
- name: '[UNIT] PHP Nightly With Highest Dependencies'
php: nightly
env: dependencies=highest unit=1
- name: '[UNIT] PHP Nightly With Lowest Dependencies'
php: nightly
env: dependencies=lowest unit=1

- name: '[INTEGRATION] PHP Nightly With Locked Dependencies'
php: nightly
env: integration=1
- name: '[INTEGRATION] PHP Nightly With Highest Dependencies'
php: nightly
env: dependencies=highest integration=1
- name: '[INTEGRATION] PHP Nightly With Lowest Dependencies'
php: nightly
env: dependencies=lowest integration=1

- name: '[INFECTION] PHP Nightly With Locked Dependencies'
php: nightly
env: infection=1
- name: '[INFECTION] PHP Nightly With Lowest Dependencies'
php: nightly
env: infection=1 dependencies=lowest
- name: '[INFECTION] PHP Nightly With Highest Dependencies'
php: nightly
env: infection=1 dependencies=highest

- name: '[PHPSTAN] PHP Nightly With Locked Dependencies'
php: nightly
env: phpstan=1
- name: '[PHPSTAN] PHP Nightly With Lowest Dependencies'
php: nightly
env: phpstan=1 dependencies=lowest
- name: '[PHPSTAN] PHP Nightly With Highest Dependencies'
php: nightly
env: phpstan=1 dependencies=highest
services:
- redis-server

before_install:
- phpenv config-rm xdebug.ini || echo "No xdebug config."
- composer self-update

install:
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar
- chmod +x php-coveralls.phar

before_script:
- if [ -z "$dependencies" ]; then travis_retry composer install -n; fi;
- if [ "$dependencies" = "lowest" ]; then travis_retry composer update --prefer-lowest -n; fi;
- if [ "$dependencies" = "highest" ]; then travis_retry composer update -n; fi;

script:
- if [ "$unit" = 1 ]; then phpdbg -qrr vendor/bin/phpunit --testsuite HarmonIOCacheUnitTestSuite --coverage-text --coverage-clover build/logs/clover.xml; fi;
- if [ "$integration" = 1 ]; then phpdbg -qrr vendor/bin/phpunit --testsuite HarmonIOCacheIntegrationTestSuite --coverage-text --coverage-clover build/logs/clover.xml; fi;
- if [ "$cs" = 1 ]; then vendor/bin/phpcs -s; fi;
- if [ "$require" = 1 ]; then vendor/bin/composer-require-checker check; fi;
- if [ "$phpstan" = 1 ]; then vendor/bin/phpstan analyse src --level max; fi;

after_success:
- if [ "$unit" = 1 ]; then travis_retry php php-coveralls.phar; fi;
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - 0000-00-00

### Added

*None*

### Changed

*None*

### Deprecated

*None*

### Removed

*None*

### Fixed

*None*

### Security

*None*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 HarmonyIO

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# FeedMe

[![Latest Stable Version](https://poser.pugx.org/peehaa/feedme/v/stable)](https://packagist.org/packages/peehaa/feedme)
[![Build Status](https://travis-ci.org/PeeHaa/feedme.svg?branch=master)](https://travis-ci.org/PeeHaa/feedme)
[![Build status](https://ci.appveyor.com/api/projects/status/3ohrrm40gmmemd7i/branch/master?svg=true)](https://ci.appveyor.com/project/PeeHaa/feedme/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/PeeHaa/feedme/badge.svg?branch=master)](https://coveralls.io/github/PeeHaa/feedme?branch=master)
[![License](https://poser.pugx.org/peehaa/feedme/license)](https://packagist.org/packages/peehaa/feedme)

Feeds

## Requirements

- PHP 7.3
- Redis

In addition for non-blocking context one of the following event libraries should be installed:

- [ev](https://pecl.php.net/package/ev)
- [event](https://pecl.php.net/package/event)
- [php-uv](https://github.com/bwoebi/php-uv)
75 changes: 75 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
build: false
clone_folder: c:\projects\cache
clone_depth: 1
platform:
- x64
environment:
matrix:
- dependencies: current
php_ver_target: 7.3
- dependencies: lowest
php_ver_target: 7.3
- dependencies: highest
php_ver_target: 7.3

project_directory: c:\projects\cache
composer_directory: c:\tools\composer
composer_executable: c:\tools\composer\composer.phar
composer_installer: c:\tools\composer\installer.php
php_directory: c:\tools\php
cache:
- c:\ProgramData\chocolatey\bin -> appveyor.yml
- c:\ProgramData\chocolatey\lib -> appveyor.yml
- c:\tools\composer -> appveyor.yml
- '%LOCALAPPDATA%\Composer -> appveyor.yml'
- c:\tools\php -> appveyor.yml
init:
- ps: $Env:PATH = $Env:php_directory + ';' + $Env:composer_directory + ';' + $Env:PATH
- SET PATH=C:\Program Files\OpenSSL;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1
- SET ANSICON=121x90 (121x90)
install:
# Setup WSUS
- choco install chocolatey-windowsupdate.extension

# Install Redis
- nuget install redis-64 -excludeversion
- redis-64\tools\redis-server.exe --service-install
- redis-64\tools\redis-server.exe --service-start

# Install PHP
- ps: If ((Test-Path $Env:php_directory) -eq $False) { New-Item -Path $Env:php_directory -ItemType 'directory' }
- ps: $php_install_parameters = '"/DontAddToPath /InstallDir:' + $Env:php_directory + '"'
- ps: appveyor-retry choco upgrade php --yes --version=$Env:exact_php_version --params=$php_install_parameters

# Prepare PHP
- ps: cd $Env:php_directory
- ps: Copy-Item php.ini-production -Destination php.ini
- ps: Add-Content -Path php.ini -Value 'memory_limit=1G'
- ps: Add-Content -Path php.ini -Value 'date.timezone="UTC"'
- ps: Add-Content -Path php.ini -Value 'extension_dir=ext'
- ps: Add-Content -Path php.ini -Value 'extension=php_curl.dll'
- ps: Add-Content -Path php.ini -Value 'extension=php_mbstring.dll'
- ps: Add-Content -Path php.ini -Value 'extension=php_openssl.dll'
- ps: Add-Content -Path php.ini -Value 'extension=php_intl.dll'
- ps: Add-Content -Path php.ini -Value 'extension=php_fileinfo.dll'
- ps: Add-Content -Path php.ini -Value 'extension=php_gd2.dll'
- ps: php --version

# Prepare composer
- ps: If ((Test-Path $Env:composer_directory) -eq $False) { New-Item -Path $Env:composer_directory -ItemType 'directory' }
- ps: If ((Test-Path $Env:composer_installer) -eq $False) { appveyor-retry appveyor DownloadFile https://getcomposer.org/installer -FileName $Env:composer_installer }
- ps: If ((Test-Path $Env:composer_executable) -eq $False) { php $Env:composer_installer --install-dir=$Env:composer_directory }
- ps: Set-Content -Path ($Env:composer_directory + '\composer.bat') -Value ('@php ' + $Env:composer_executable + ' %*')

# Install dependencies
- ps: cd $Env:project_directory
- IF %dependencies%==current composer install --no-progress -n
- IF %dependencies%==lowest composer update --prefer-lowest --no-progress -n
- IF %dependencies%==highest composer update --prefer-dist --no-progress -n

## Run the actual test
test_script:
- ps: cd $Env:project_directory
- phpdbg -qrr vendor/phpunit/phpunit/phpunit --coverage-text
45 changes: 45 additions & 0 deletions assets/js/Connection/WebSocket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export default class WebSocket {
constructor() {
this.socket = null;
this.eventListeners = [];
}

connect(connectedCallback) {
this.socket = new window.WebSocket(this.getUrl());

this.socket.addEventListener('open', connectedCallback);

this.socket.addEventListener('message', (event) => {
const response = JSON.parse(event.data);

console.log('RECEIVED');
console.log(response);

if (this.eventListeners.hasOwnProperty(response.requestId)) {
this.eventListeners[response.requestId](response);
}
});
}

send(data) {
console.log('SENDING');
console.log(data);
this.socket.send(data);
}

addEventListener(id, callback) {
this.eventListeners[id] = callback;
}

getUrl() {
let url = 'ws';

if (location.protocol === 'https') {
url += 's://';
}

url += '://';

return url + location.host + '/ws';
}
}
Loading

0 comments on commit 7c12ddf

Please sign in to comment.