Skip to content

Commit

Permalink
prepare to tag first version
Browse files Browse the repository at this point in the history
  • Loading branch information
mosbth committed Mar 3, 2017
1 parent 21d519e commit 81e21b1
Show file tree
Hide file tree
Showing 80 changed files with 11,112 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/bin
/build
/vendor
27 changes: 27 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<ruleset name="PHPCS rule set">
<description>Custom rule set.</description>

<file>src</file>
<file>test</file>

<exclude-pattern>*.tpl.*</exclude-pattern>
<exclude-pattern>test/config.php</exclude-pattern>

<!--
<arg name="encoding" value="utf-8"/>
<arg name="show_warnings" value="1"/>
<arg name="colors" value="1"/>
<arg name="tab_width" value="4"/>
-->
<!--<arg name="extensions" value=".php"/>-->
<!--<arg name="warning-severity" value="5"/>-->

<rule ref="PSR2">
<!--
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" /> <exclude name="Squiz.Commenting.FileComment" />
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" />
-->
</rule>
</ruleset>
13 changes: 13 additions & 0 deletions .phpdoc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>Anax API Documentation</title>
<parser>
<target>doc/api</target>
</parser>
<transformer>
<target>doc/api</target>
</transformer>
<files>
<directory>src</directory>
</files>
</phpdoc>
40 changes: 40 additions & 0 deletions .phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0"?>
<ruleset name="PHPMD rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Custom rule set for htmlphp course.
</description>

<exclude-pattern>vendor</exclude-pattern>

<rule ref="rulesets/cleancode.xml">
<exclude name="BooleanArgumentFlag" />
<exclude name="ElseExpression" />
</rule>

<rule ref="rulesets/codesize.xml" />

<rule ref="rulesets/controversial.xml">
<exclude name="Superglobals" />
</rule>

<rule ref="rulesets/design.xml" />

<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
</rule>

<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions" value="i,j,db,id" />
</properties>
</rule>

<rule ref="rulesets/unusedcode.xml" />

</ruleset>
22 changes: 22 additions & 0 deletions .phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit
bootstrap="test/config.php">

<testsuites>
<testsuite name="all">
<directory>test</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-html" target="build/coverage" charset="UTF-8" highlight="true" lowUpperBound="35" highLowerBound="70" />
<log type="coverage-clover" target="build/coverage.clover" />
</logging>

</phpunit>
20 changes: 20 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
imports:
- php

filter:
excluded_paths: [vendor/*, test/*]

build:

dependencies:
before:
-
command: "mkdir build"

tests:
override:
-
command: "phpunit --configuration .phpunit.xml"
coverage:
file: "build/coverage.clover"
format: "php-clover"
53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
language: php

php:
#- 5.4
#- 5.5
- 5.6
- hhvm
- nightly
- "7.0"



sudo: false



git:
submodules: false



addons:
apt:
packages:
#- php-codesniffer
#- phpmd
#- shellcheck



matrix:
allow_failures:
- php: nightly
- php: hhvm



before_script:
- make check


script:
- make test



notifications:
irc: "irc.freenode.org#dbwebb"
urls:
- https://webhooks.gitter.im/e/6e4660b0024de67de0af
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
179 changes: 179 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
#
#
#

# Detect OS
OS = $(shell uname -s)

# Defaults
ECHO = echo

# Make adjustments based on OS
# http://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux/27776822#27776822
ifneq (, $(findstring CYGWIN, $(OS)))
ECHO = /bin/echo -e
endif

# Colors and helptext
NO_COLOR = \033[0m
ACTION = \033[32;01m
OK_COLOR = \033[32;01m
ERROR_COLOR = \033[31;01m
WARN_COLOR = \033[33;01m

# Which makefile am I in?
WHERE-AM-I = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_MAKEFILE := $(call WHERE-AM-I)

# Echo some nice helptext based on the target comment
HELPTEXT = $(ECHO) "$(ACTION)--->" `egrep "^\# target: $(1) " $(THIS_MAKEFILE) | sed "s/\# target: $(1)[ ]*-[ ]* / /g"` "$(NO_COLOR)"

# Add local bin path for test tools
#PATH_ORIG = $(PATH)
PATH := "./bin:./vendor/bin:./node_modules/.bin:$(PATH)"



# target: help - Displays help.
.PHONY: help
help:
@$(call HELPTEXT,$@)
@$(ECHO) "Usage:"
@$(ECHO) " make [target] ..."
@$(ECHO) "target:"
@egrep "^# target:" $(THIS_MAKEFILE) | sed 's/# target: / /g'



# target: prepare - Prepare for tests and build
.PHONY: prepare
prepare:
@$(call HELPTEXT,$@)
[ -d bin ] || mkdir bin
[ -d build ] || mkdir build
rm -rf build/*



# target: clean - Removes generated files and directories.
.PHONY: clean
clean:
@$(call HELPTEXT,$@)
rm -rf build



# target: clean-all - Removes generated files and directories.
.PHONY: clean-all
clean-all:
@$(call HELPTEXT,$@)
rm -rf bin vendor composer.lock



# target: check - Check version of installed tools.
.PHONY: check
check: check-tools-php
@$(call HELPTEXT,$@)



# target: test - Run all tests.
.PHONY: test
test: phpunit phpcs phpmd
@$(call HELPTEXT,$@)



# target: doc - Generate documentation.
.PHONY: doc
doc: phpdoc
@$(call HELPTEXT,$@)



# target: build - Do all build
.PHONY: build
build: test doc #less-compile less-minify js-minify
@$(call HELPTEXT,$@)



# target: install - Install all tools
.PHONY: install
install: prepare install-tools-php
@$(call HELPTEXT,$@)



# target: update - Update the codebase and tools.
.PHONY: update
update:
@$(call HELPTEXT,$@)
git pull
composer update



# ------------------------------------------------------------------------
#
# PHP
#

# target: install-tools-php - Install PHP development tools.
.PHONY: install-tools-php
install-tools-php:
@$(call HELPTEXT,$@)
wget -O bin/phpdoc https://www.phpdoc.org/phpDocumentor.phar && chmod 755 bin/phpdoc



# target: check-tools-php - Check versions of PHP tools.
.PHONY: check-tools-php
check-tools-php:
@$(call HELPTEXT,$@)
which phpunit && phpunit --version
which phpcs && phpcs --version && echo
which phpmd && phpmd --version && echo
which phpcbf && phpcbf --version && echo
which phpdoc && phpdoc --version && echo



# target: phpunit - Run unit tests for PHP.
.PHONY: phpunit
phpunit: prepare
@$(call HELPTEXT,$@)
phpunit --configuration .phpunit.xml



# target: phpcs - Codestyle for PHP.
.PHONY: phpcs
phpcs: prepare
@$(call HELPTEXT,$@)
phpcs --standard=.phpcs.xml | tee build/phpcs



# target: phpcbf - Fix codestyle for PHP.
.PHONY: phpcbf
phpcbf:
@$(call HELPTEXT,$@)
phpcbf --standard=.phpcs.xml



# target: phpmd - Mess detector for PHP.
.PHONY: phpmd
phpmd: prepare
@$(call HELPTEXT,$@)
- phpmd . text .phpmd.xml | tee build/phpmd



# target: phpdoc - Create documentation for PHP.
.PHONY: phpdoc
phpdoc:
@$(call HELPTEXT,$@)
phpdoc --config=.phpdoc.xml
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Anax Request
==================================

[![Join the chat at https://gitter.im/mosbth/anax](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/canax?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/canax/request.svg?branch=master)](https://travis-ci.org/canax/request)
[![Build Status](https://scrutinizer-ci.com/g/canax/request/badges/build.png?b=master)](https://scrutinizer-ci.com/g/canax/request/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/canax/request/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/canax/request/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/canax/request/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/canax/request/?branch=master)

Request class for Anax.



License
------------------

This software carries a MIT license.



```
.
..: Copyright (c) 2013 - 2017 Mikael Roos, [email protected]
```
7 changes: 7 additions & 0 deletions REVISION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Revision history
=================================

v1.0.0 (2017-03-03)
---------------------------------

* Extracted from anax to be its own module.
Loading

0 comments on commit 81e21b1

Please sign in to comment.