-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add User-Agent request header, use Makefile Targets as a base f…
…or commands (#9) * feat: remove hardcoded version from composer.json - https://getcomposer.org/doc/02-libraries.md#library-versioning * feat: move scripts into Makefile (#4) * feat: add User-Agent request header, add release command to Makefile * docs: added CHANGELOG.md
- Loading branch information
Showing
14 changed files
with
101 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ignore: | ||
- "src/InfluxDB2Generated/**/*" | ||
- "src/InfluxDB2/Model/*" | ||
- "src/InfluxDB2/Model/**/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ composer.lock | |
build/ | ||
.idea/ | ||
coverage.xml | ||
/scripts/.m2/ | ||
/generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 1.0.0 [unreleased] | ||
|
||
### Features | ||
1. [#4](https://github.com/influxdata/influxdb-client-php/issues/4): Use Makefile Targets Instead of scripts dir | ||
1. [#7](https://github.com/influxdata/influxdb-client-php/issues/7): Set User-Agent to influxdb-client-php/VERSION for all requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,52 @@ | ||
### | ||
# Docker Targets | ||
## | ||
TARGET=v2.0.0-alpha.4 | ||
.DEFAULT_GOAL := help | ||
|
||
help: | ||
@echo "Please use \`make <target>' where <target> is one of" | ||
@echo " start-server to start the InfluxDB server" | ||
@echo " stop-server to stop the InfluxDB server" | ||
@echo " test to perform unit tests" | ||
@echo " coverage to perform unit tests with code coverage" | ||
@echo " coverage-show to show the code coverage report" | ||
@echo " generate-sources to generate API sources from swagger.yml" | ||
@echo " generate-sources to generate API sources from swagger.yml" | ||
@echo " deps to installs the project dependencies" | ||
@echo " dshell to start Docker Shell for Local Development" | ||
@echo " release to release client with version specified by VERSION property . make release VERSION=1.5.0" | ||
|
||
# Docker Shell for Local Development | ||
dshell: | ||
@docker-compose run --entrypoint=ash --rm php | ||
|
||
# This needs hard-coded to a version when the beta drops | ||
generate-api-client: | ||
@rm -rf src/InfluxDB2Generated | ||
@docker container run --rm -it -v ${PWD}:/code -w /code openapitools/openapi-generator-cli:latest \ | ||
generate \ | ||
-i https://raw.githubusercontent.com/influxdata/influxdb/$(TARGET)/http/swagger.yml \ | ||
-g php \ | ||
-o /code/src/InfluxDB2Generated \ | ||
--api-package ApiClient \ | ||
--invoker-package InfluxDB2Generated | ||
|
||
### | ||
# Normal Targets | ||
### | ||
@docker-compose run --entrypoint=bash --rm php | ||
|
||
deps: | ||
@composer install | ||
|
||
test: | ||
@./bin/phpspec run | ||
@./bin/phpunit | ||
generate-sources: | ||
@scripts/generate-sources.sh | ||
|
||
test: start-server | ||
@docker-compose run php composer run test | ||
|
||
coverage: start-server | ||
@docker-compose run php composer run test-coverage | ||
|
||
coverage-show: | ||
open build/coverage-report/index.html | ||
|
||
start-server: | ||
@docker-compose up -d influxdb_v2 | ||
@scripts/influxdb-onboarding.sh ||: | ||
|
||
stop-server: | ||
@docker-compose stop influxdb_v2 | ||
|
||
release: | ||
$(if $(VERSION),,$(error VERSION is not defined. Pass via "make release VERSION=1.5.0")) | ||
@echo Tagging $(VERSION) | ||
git checkout master | ||
git pull | ||
sed -i '' -e "s/VERSION = '.*'/VERSION = '$(VERSION)'/" src/InfluxDB2/Client.php | ||
git commit -am "release influxdb-client-php-$(VERSION)" | ||
git tag v$(VERSION) | ||
sed -i '' -e "s/VERSION = '.*'/VERSION = 'dev'/" src/InfluxDB2/Client.php | ||
git commit -am "prepare for next development iteration" | ||
git push origin --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace InfluxDB2Test; | ||
|
||
use GuzzleHttp\Psr7\Response; | ||
|
||
require_once('BasicTest.php'); | ||
|
||
class DefaultApiTest extends BasicTest | ||
{ | ||
public function testUserAgent() | ||
{ | ||
$this->mockHandler->append(new Response(204)); | ||
$this->writeApi->write('h2o,location=west value=33i 15'); | ||
|
||
$request = $this->mockHandler->getLastRequest(); | ||
|
||
$this->assertStringStartsWith('influxdb-client-php/', | ||
strval($request->getHeader("User-Agent")[0])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters