Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jersak committed Dec 3, 2018
0 parents commit 2cba201
Show file tree
Hide file tree
Showing 21 changed files with 6,494 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 2

jobs:
build:
environment:
CC_TEST_REPORTER_ID: dc0c3240ab8d23e47c03dbb7b7940e881bfb8ef428b9f743dc76c67d630e927b

docker:
- image: digitaltownorg/circleci:latest
user: root

working_directory: ~/project

steps:
- checkout

- restore_cache:
keys:
- composer-v1-{{ checksum "composer.lock" }}

- run: composer install -n --prefer-dist

- save_cache:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor

- run:
name: Setup Code Climate test-reporter
command: composer lint

- run:
name: Setup Code Climate test-reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- run:
name: Project testing
command: |
./cc-test-reporter before-build
composer tests
cp tests/_reports/clover.xml .
./cc-test-reporter after-build --coverage-input-type clover --exit-code $?
# - store_artifacts:
# path: ~/project/storage/logs
65 changes: 65 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
version: "2"
checks:
argument-count:
enabled: true
config:
threshold: 4
complex-logic:
enabled: true
config:
threshold: 4
file-lines:
enabled: true
config:
threshold: 250
method-complexity:
enabled: true
config:
threshold: 5
method-count:
enabled: true
config:
threshold: 20
method-lines:
enabled: true
config:
threshold: 25
nested-control-flow:
enabled: true
config:
threshold: 4
return-statements:
enabled: true
config:
threshold: 4
similar-code:
enabled: true
identical-code:
enabled: true
plugins:
fixme:
enabled: true
markdownlint:
enabled: false
phpcodesniffer:
enabled: true
checks:
Generic Files LineLength TooLong:
enabled: false
phpmd:
enabled: true
config:
rulesets: ".rulesets/rulesetPhpmd.xml"
phan:
enabled: false
config:
file_extensions: "php"
checks:
PhanUndeclaredClassMethod:
enabled: false
exclude_patterns:
- "public/"
- "!public/index.php"
- "tests/_reports/"
- "storage/"
- "vendor/"
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Project enviroment
.env


## Project logs
*.log
/logs
/log


## Project testing
/tests/_reports/*


## Project storage
/storage/*.key


## Project public content
/public/definition
/public/hot
/public/storage
/public/uploads


## VM related
.vagrant/


## Vendor/3rd party libs
/node_modules
/vendor


## misc.
/.idea
/nbproject/*
.DS_Store
37 changes: 37 additions & 0 deletions .rulesets/rulesetPhpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0"?>
<ruleset name="PHPMD rule set for a project" 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 rules for a project</description>


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

<rule ref="rulesets/cleancode.xml/StaticAccess">
<properties>
<property name="exceptions" value="\Illuminate\Support\Facades\Log, \Illuminate\Support\Facades\Schema, \DB, \Validator, \Log, \Illuminate\Support\Facades\Storage, \Illuminate\Http\Request" />
</properties>
</rule>

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

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

<rule ref="rulesets/naming.xml/ShortMethodName">
<properties>
<property name="minimum" value="2" />
</properties>
</rule>

<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedFormalParameter" />
</rule>

</ruleset>
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/23202b2306cf7398c403/maintainability)](https://codeclimate.com/repos/5bb54c844500f602860053ee/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/23202b2306cf7398c403/test_coverage)](https://codeclimate.com/repos/5bb54c844500f602860053ee/test_coverage)

# lib-laravel-git-versioning

# Descriptioin

This package pulls versioning information from github through an artisan command and appends it to the response headers on every api call through a middleware.


# Installation

**composer.json**

"require": {
"Jersak/lib-laravel-git-versioning": "0.*",
}
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Jersak/lib-laravel-git-versioning"
}
],

**bootstrap/app.php**

$app->middleware([
Jersak\Versioning\VersionHeaderMiddleware::class,
]);

$app->register('Jersak\Versioning\VersioningServiceProvider');


**Pull versioning information**
On the CLI, run:

php artisan github:getversion -S <commit or version SHA>
52 changes: 52 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "jersak/lib-laravel-git-versioning",
"description": "Jersak | lib-laravel-git-versioning.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.1",
"knplabs/github-api": "^2.10",
"php-http/guzzle6-adapter": "^1.1"
},
"require-dev": {
"albertcht/lumen-testing": "0.*",
"codedungeon/phpunit-result-printer": "0.*",
"gears/class-finder": "^1.0",
"johnkary/phpunit-speedtrap": "^3.0",
"mockery/mockery": "^1.2",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "~7.0",
"squizlabs/php_codesniffer": "^3.1",
"wizaplace/phpunit-slicer": "^0.1.0"
},
"autoload": {
"psr-4": {
"Jersak\\Versioning\\" : "src/"
},
"classmap": [
]
},
"autoload-dev": {
"psr-4": {
"Jersak\\Tests\\Versioning\\": "tests/"
},
"classmap": [
]
},
"scripts": {
"lint": [
"vendor/bin/phpcs -p --extensions=php --standard=ruleset.xml --error-severity=1 --warning-severity=0 --colors --tab-width=30 ./src"
],
"tests": [
"vendor/bin/phpunit -d memory_limit=512M --colors=always",
"vendor/bin/phpcs -p --extensions=php --standard=ruleset.xml --error-severity=1 --warning-severity=0 --colors --tab-width=30 ./src"
]
},
"config": {
"process-timeout": 20000,
"optimize-autoloader": true,
"preferred-install": "source",
"sort-packages": true
}
}
Loading

0 comments on commit 2cba201

Please sign in to comment.