最近ではGradleやGulpなどタスクランナーは、よりコードに近い形で定義できるツールが使われてきています。 PHPではJenkinsなどとの連携の容易さから、Phingが使われることが多かったと思いますが、XMLでの定義は容易ではありませんでした。 RoboはPHPのコードでタスクを定義できるモダンなタスクランナーで、私たちPHPerにも読みやすく理解しやすい構造をしています。
このセッションではRoboを使ったタスクの定義を、動作デモを交えて紹介したいと思います。
http://robo.li/
3PCPΛͬͨϞμϯͳλεΫཧphp conference 2017 by @sizuhiko
View Slide
,FOJDIJSP,JTIJEB5PLZP +"1"/TJ[VIJLP!HNBJMDPN !TJ[VIJLPIUUQTHJUIVCDPNTJ[VIJLPIUUQCMPHPQFOUPLZPKQ2QN[OGTEQGFQ
ࣗಈԽͯ͠·͔͢ʁ
%FW0QTIUUQTKBXJLJQFEJBPSHXJLJ%FW0QTΑΓҾ༻
wૣ͘ࢢʹग़͢wϑΟʔυόοΫΛಘΔw҆ఆ࣭ͨ͠wڞ௨ͷձ
ࣗಈԽతͰͳ͘खஈͰ͋Δ
} else {// 失敗パターンの処理this.log.error(“エラーメッセージ”);this.response.status = 500;throw new ServerError();}this.log.info(“何かのログ”);@@ -8,6 +8,7 @@ php:
if (results) {// 成功パターンの処理return this;} else {// 失敗パターンの処理this.log.error(“エラーメッセージ”);this.response.status = 500;throw new ServerError();}this.log.info(“何かのログ”);
wίʔυϨϏϡʔw੩తղੳwࣗಈςετwࣗಈσϓϩΠ
+FOLJOT
pipeline {agent anystages {stage('Install') {steps {sh 'npm install'}}stage('JsHint') {steps {sh 'npm run lint:ci'}}stage('Test') {steps {sh 'npm run test:ci'}}}post {always {step([$class: 'CheckStylePublisher',pattern: 'jshint-results.xml',unstableTotalAll: '0',usePreviousBuildAsReference: true])junit allowEmptyResults: true, testResults: 'test-results/*.xml'}}}
w(/6.BLF 3BLFͳͲؚΉwNBWFOBOUwHSBEMFwHSVOUwHVMQ
443 41"
$PNQPTFS
{"scripts": {"test": ["@composer install","@clear", "phpunit"], "clear": "rm -rf test-results/*”}}
• automate your common tasks• start workers• run parallel tasks• execute commands• run tests• watch filesystem changes
%FNPhttps://github.com/sizuhiko/phpkansai-2017-demo
1)1 /PEF+4ґଘؔͷղܾ $PNQPTFS /1.λεΫϥϯφʔ 3PCP (VMQ
sshrsyncphpunit
WJTJUNZCMPHHJUIVChttps://github.com/sizuhikohttp://blog.open.tokyo.jp