Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial commit.
  • Loading branch information
drupol committed Jul 4, 2019
0 parents commit 7b9e202
Show file tree
Hide file tree
Showing 13 changed files with 674 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
charset = utf-8
max_line_length = 80
indent_style = space
indent_size = 4
insert_final_newline = true
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
/composer.lock
/vendor
/build
/.php_cs.cache
/example/
/.idea/
/test.php
/phpspec.yml
18 changes: 18 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,18 @@
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run

filter:
paths:
- 'src/*'

tools:
external_code_coverage:
timeout: 600
php_loc: true
php_pdepend: true
php_sim: true
php_changetracking: true
24 changes: 24 additions & 0 deletions .travis.yml
@@ -0,0 +1,24 @@
language: php

git:
depth: 1

cache:
directories:
- "$HOME/.cache/composer"
- "$HOME/.composer/cache"

php:
- 7.1
- 7.2
- 7.3

install:
- composer install

script:
- composer grumphp

after_success:
- phpenv config-rm xdebug.ini
- composer scrutinizer
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Pol Dellaiera

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.
66 changes: 66 additions & 0 deletions README.md
@@ -0,0 +1,66 @@
[![Latest Stable Version](https://img.shields.io/packagist/v/drupol/phposinfo.svg?style=flat-square)](https://packagist.org/packages/drupol/phposinfo)
[![GitHub stars](https://img.shields.io/github/stars/drupol/phposinfo.svg?style=flat-square)](https://packagist.org/packages/drupol/phposinfo)
[![Total Downloads](https://img.shields.io/packagist/dt/drupol/phposinfo.svg?style=flat-square)](https://packagist.org/packages/drupol/phposinfo)
[![Build Status](https://img.shields.io/travis/drupol/phposinfo/master.svg?style=flat-square)](https://travis-ci.org/drupol/phposinfo)
[![Build Status](https://img.shields.io/appveyor/ci/drupol/valuewrapper.svg?style=flat-square)](https://ci.appveyor.com/project/drupol/phposinfo)
[![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/drupol/phposinfo/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/phposinfo/?branch=master)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/drupol/phposinfo/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/phposinfo/?branch=master)
[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/drupol/phposinfo/master)](https://stryker-mutator.github.io)
[![License](https://img.shields.io/packagist/l/drupol/phposinfo.svg?style=flat-square)](https://packagist.org/packages/drupol/phposinfo)

# OS phposinfo

## Description

Allows you to launch a file or a resource with the your default OS application.

## Requirements

* PHP >= 7.1

## Installation

```composer require drupol/phposinfo```

## Usage

```php
<?php

declare(strict_types = 1);

include 'vendor/autoload.php';

use drupol\phposinfo\phposinfo;

// Open the default browser.
phposinfo::open('https://github.com/drupol/phposinfo');

// Open the default file manager.
phposinfo::open('/tmp');

// Open the default file manager.
phposinfo::open('C:\Windows');

// The parameter $resource is variadic.

// Open multiple resources.
phposinfo::open('https://google.com', 'https://github.com');
```

## Code quality, tests and benchmarks

Every time changes are introduced into the library, [Travis CI](https://travis-ci.org/drupol/phposinfo/builds) run the tests and the benchmarks.

The library has tests written with [PHPSpec](http://www.phpspec.net/).
Feel free to check them out in the `spec` directory. Run `composer phpspec` to trigger the tests.

Before each commit some inspections are executed with [GrumPHP](https://github.com/phpro/grumphp), run `./vendor/bin/grumphp run` to check manually.

[PHPBench](https://github.com/phpbench/phpbench) is used to benchmark the library, to run the benchmarks: `composer bench`

[PHPInfection](https://github.com/infection/infection) is used to ensure that your code is properly tested, run `composer infection` to test your code.

## Contributing

Feel free to contribute to this library by sending Github pull requests. I'm quite reactive :-)
48 changes: 48 additions & 0 deletions appveyor.yml
@@ -0,0 +1,48 @@
build: false
platform:
- x64
clone_folder: c:\projects\php-project-workspace

## Build matrix for lowest and highest possible targets
environment:
matrix:
- php_ver_target: 7.2
- php_ver_target: 7.3

## Cache composer, chocolatey and php bits
cache:
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
- composer.phar
- C:\ProgramData\chocolatey\bin -> .appveyor.yml
- C:\ProgramData\chocolatey\lib -> .appveyor.yml
- c:\tools\php -> .appveyor.yml

## Set up environment varriables
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1
- SET ANSICON=121x90 (121x90)

## Install PHP and composer, and run the appropriate composer command
install:
- IF EXIST c:\tools\php (SET PHP=0)
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php
- IF %PHP%==1 copy php.ini-production php.ini /Y
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
- IF %PHP%==1 echo extension_dir=ext >> php.ini
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\projects\php-project-workspace
- appveyor-retry composer self-update
- appveyor-retry composer install --no-progress --ansi
#- composer show

## Run the actual test
test_script:
- cd c:\projects\php-project-workspace
- phpdbg -qrr vendor\phpspec\phpspec\bin\phpspec run --no-code-generation -vvv
47 changes: 47 additions & 0 deletions composer.json
@@ -0,0 +1,47 @@
{
"name": "drupol/phposinfo",
"type": "library",
"description": "Try to guess where the host operating system.",
"keywords": [
"operating system detection"
],
"license": "MIT",
"authors": [
{
"name": "Pol Dellaiera",
"email": "pol.dellaiera@protonmail.com"
}
],
"require": {
"php": ">= 5.3.3"
},
"require-dev": {
"drupol/php-conventions": "^1",
"drupol/phpspec-annotation": "^1",
"drupol/phpspec-code-coverage": "^5",
"infection/infection": "^0.13",
"phpspec/phpspec": "^5",
"phptaskman/changelog": "^1.0",
"scrutinizer/ocular": "^1"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"drupol\\phposinfo\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"drupol\\phposinfo\\tests\\": "tests/src/"
}
},
"scripts": {
"apigen": "./vendor/bin/apigen generate src --destination build/docs",
"bench": "./vendor/bin/phpbench run --report=aggregate --store --precision=3",
"grumphp": "./vendor/bin/grumphp run",
"infection": "./vendor/bin/infection run -j 10",
"scrutinizer": "./vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml"
}
}
20 changes: 20 additions & 0 deletions grumphp.yml.dist
@@ -0,0 +1,20 @@
imports:
- { resource: vendor/drupol/php-conventions/config/php7/grumphp.yml }

parameters:
extensions:
- drupol\PhpConventions\GrumphpTasksExtension
extra_tasks:
phpspec:
verbose: true
metadata:
priority: 3000
infection:
threads: 10
test_framework: phpspec
configuration: infection.json.dist
min_msi: 50
min_covered_msi: 50
metadata:
priority: 2000

19 changes: 19 additions & 0 deletions infection.json.dist
@@ -0,0 +1,19 @@
{
"timeout": 10,
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "build/infection.log",
"summary": "build/summary.log",
"debug": "build/debug.log",
"perMutator": "build/per-mutator.md",
"badge": {
"branch": "master"
}
},
"testFramework":"phpspec",
"tmpDir": "build"
}
13 changes: 13 additions & 0 deletions phpspec.yml.dist
@@ -0,0 +1,13 @@
formatter.name: pretty
extensions:
drupol\PhpspecAnnotation\PhpspecAnnotation: ~
LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension:
format:
- html
- clover
- php
- text
output:
html: build/coverage
clover: build/logs/clover.xml
php: build/coverage.php

0 comments on commit 7b9e202

Please sign in to comment.