forked from Luracast/Restler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
846 lines (721 loc) · 41.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
VERSION = 0.1.12
CONFIG_TOOL = .foundation/repo/bin/project-config.php
GENERATE_TOOL = .foundation/repo/bin/project-generate.php
SHELL = /bin/sh
PACKAGES_PEAR = pear config-get php_dir
.title:
@echo "Respect/Foundation - $(VERSION)\n"
.check-foundation: .title
@test -d .foundation || make -f Makefile foundation-develop
# Help is not the default target cause its mainly used as the main
# build command. We're reserving it.
default: .title
@echo " ====================================================================="
@echo " Respect/Foundation Menu"
@echo " ====================================================================="
@echo " help: Shows Respect/Foundation Help Menu: type: make help"
@echo " foundation: Installs and updates Foundation"
@echo " ====================================================================="
@echo " Other Targets Menus"
@echo " ====================================================================="
@echo " project-menu: Project Scripts Menu"
@echo " package-menu: Show Packaging Toolbox Menu"
@echo " dev-menu: Show Dev Toolbox Menu"
@echo " deploy-menu: Show Deploy & Release"
@echo ""
help: .title
@echo " ====================================================================="
@echo " Respect/Foundation Help"
@echo " ====================================================================="
@echo " Info: As you probably figured out by now the menu lists the make"
@echo " targets on the left, right aligned like Happy Pandas and the"
@echo " descriptions listed in the menu block like this."
@echo ""
@echo " To make use of any targets you simply add the target name after"
@echo " make cammand in your shell."
@echo ""
@echo " Example: make help"
@echo ""
@echo " Which will bring up this screen."
@echo " ====================================================================="
@echo " help-menu: The target for the help-menu, for more info, enter: make help-menu"
@echo " ====================================================================="
@echo " Info: For developers: if you happen to get the following error:"
@echo ""
@echo " make: *** [target-name] Error 255"
@echo ""
@echo " It means the shell command that was executed for this target has"
@echo " failed and the problem lies not with the Makefile."
@echo " ====================================================================="
@echo " Note: Respect/Foundation is currently still under active development"
@echo " and such is the affairs with the help as well, I am affraid."
@echo " More information will be added here in the future, if you want"
@echo " to give us a hand there's no better time than now."
@echo " ====================================================================="
@echo ""
help-menu: .title
@echo " ====================================================================="
@echo " Respect/Foundation Help Menu"
@echo " ====================================================================="
@echo " Info: The make targets listed on the left, serves as navigation to"
@echo " the sections where you might find more information."
@echo ""
@echo " To make use of any targets you simply add the target name after"
@echo " make cammand in your shell."
@echo ""
@echo " Example: make help-menu"
@echo ""
@echo " Do the same with any of the targets listed here."
@echo " ====================================================================="
@echo " help-skelgen: Information about PHPUnit_SkelGen and how it is facilitated through"
@echo " Respect/Foundation to make your life a little easier."
@echo " ====================================================================="
@echo " Note: Respect/Foundation is currently still under active development"
@echo " and such is the affairs with the help as well, I am affraid."
@echo " More information will be added here in the future, if you want"
@echo " to give us a hand there's no better time than now."
@echo " ====================================================================="
@echo ""
help-skelgen: .title
@echo " ====================================================================="
@echo " Respect/Foundation Help - Skelgen"
@echo " ====================================================================="
@echo " info-skelgen: Info: Generate boilerplate PHPUnit skeleton tests per class of already"
@echo " implemented source code."
@echo ""
@echo " We have greatly reduced the complexity involved with using this"
@echo " utility. All you need to provide is the fully qualified classname"
@echo " of the the source you want to generate the unit test for."
@echo " * We will find the class in question;"
@echo " * We will bootstrap the gen bot so it doesn't complain;"
@echo " * Based on the project info we know where the tests should go."
@echo ""
@echo " Usage:"
@echo " make test-skelgen class:\"My\Awesome\Class"
@echo ""
@echo " test-skelgen: Info: Generate boilerplate PHPUnit skeleton tests per class of already"
@echo " implemented source code."
@echo ""
@echo " We have greatly reduced the complexity involved with using this"
@echo " utility. All you need to provide is the fully qualified classname"
@echo " of the the source you want to generate the unit test for."
@echo " * We will find the class in question;"
@echo " * We will bootstrap the gen bot so it doesn't complain;"
@echo " * Based on the project info we know where the tests should go."
@echo ""
@echo " Usage:"
@echo " make test-skelgen class:\"My\Awesome\Class"
@echo ""
@echo ""
@echo " Not yet implemented following references skelgen assertion shorthand"
@echo ""
@echo " @assert (...) == X \tassertEquals(X, method(...))"
@echo " @assert (...) != X \tassertNotEquals(X, method(...))"
@echo " @assert (...) === X \tassertSame(X, method(...))"
@echo " @assert (...) !== X \tassertNotSame(X, method(...))"
@echo " @assert (...) > X \tassertGreaterThan(X, method(...))"
@echo " @assert (...) >= X \tassertGreaterThanOrEqual(X, method(...))"
@echo " @assert (...) < X \tassertLessThan(X, method(...))"
@echo " @assert (...) <= X \tassertLessThanOrEqual(X, method(...))"
@echo " @assert (...) throws X \t@expectedException X"
@echo ""
project-menu: .title
@echo " ====================================================================="
@echo " Respect/Foundation Menu 1"
@echo " ====================================================================="
@echo " Project Scripts"
@echo " ====================================================================="
@echo " : INFO & SCAFFOLDING"
@echo " project-info: Shows project configuration"
@echo " project-init: Initilize current folder and create boilerplate project structure"
@echo " : TESTING"
@echo " test: Run project tests"
@echo " coverage: Run project tests and report coverage status"
@echo " clean: Removes code coverage reports"
@echo " bootstrap-php: (Re)create all purpose bootstrap.php for phpunit in test folder"
@echo " bootstrap-php-opt: Optimized all purpose bootstrap.php with static pear path in test folder"
@echo " phpunit-xml: (Re)create phpunit.xml in test folder"
@echo " travis-yml: (Re)create .travis.yml in root folder"
@echo " travis-lint: Validate your .travis.yml comfiguration"
@echo " gitignore: (Re)create .gitignore file"
@echo " test-skelgen: Generate boilerplate PHPUnit skeleton tests per class see help-skelgen"
@echo " test-skelgen-all: Generate tests for all classes and it's overwrite safe of course"
@echo " : CLEANUP UTILITIES"
@echo " clean-whitespace: All in one does tabs2spaces, unix-line-ends and trailing_spaces"
@echo " tabs2spaces: Turns tabs into 4 spaces properly handling mixed tab/spaces"
@echo " unix-line-ends: Fixes unix line endings"
@echo " trailing_spaces: Removes trailing whitespace"
@echo " : CODE CONTENT UTILITIES"
@echo " cs-fixer: Run PHP Coding Standards Fixer to ensure your cs-style is correct"
@echo " codesniff: Run PHP Code Sniffer to generate a report of code analysis"
@echo " phpcpd: Run PHP Copy Paste detector"
@echo " phpdcd: Run PHP Dead Code detector"
@echo " phploc: Run PHP Lines Of Code analyzer for project code statistics"
@echo " phpdoc: Run PhpDocumentor2 to generate the project API documentation"
@echo " : CONFIGURATION"
@echo " package-ini: Creates the basic package.ini file"
@echo " package-xml: Propagates changes from package.ini to package.xml"
@echo " composer-json: Propagates changes from package.ini to composer.json"
@echo " package: Generates package.ini, package.xml and composer.json files"
@echo " pear: Generates a PEAR package"
@echo ""
package-menu: .title
@echo " ====================================================================="
@echo " Respect/Foundation Menu 2"
@echo " ====================================================================="
@echo " Toolbox - Packaging"
@echo " ====================================================================="
@echo " composer-validate: Validate composer.json for syntax and other problems"
@echo " composer-install: Install this project with composer which will create vendor folder"
@echo " composer-update: Update an exiting composer instalation and refresh repositories"
@echo " install: Install this project and its dependencies in the local PEAR"
@echo " info-php: Show information about your PHP"
@echo " config-php: Locate your PHP configuration file aka. php.ini"
@echo " include-php: Show the PHP configured (php.ini) include path"
@echo " info-pear: Show information about your PEAR"
@echo " locate-pear: Locate the PEAR packages installation folder"
@echo " install-pear: PEAR installation instructions"
@echo " updated-pear: See if there are any updates for PEAR and the installed packages"
@echo " update-all-pear: Update all packages if any updates are available"
@echo " packages-pear: Show the list of PEAR installed packages and their version numbers"
@echo " verify-pear: Verify that we can include System.php in PHP script"
@echo " info-check-pear: PEAR installation verification checklist instructions"
@echo " check-pear-1: PEAR Checklist: 1. list PEAR commands"
@echo " check-pear-2: PEAR Checklist: 2. PEAR version information aka. make info-pear"
@echo " check-pear-3: PEAR Checklist: 3. locate package install folder aka. make locate-pear"
@echo " check-pear-4: PEAR Checklist: 4. verify path configured in PHP aka. make include-php"
@echo " check-pear-5: PEAR Checklist: 5. include PEAR System.php check aka. make verify-pear"
@echo " info-pyrus: Show information about your PEAR2_Pyrus - PEAR2 Installer"
@echo " install-pyrus: Downlod and install PEAR2_Pyrus"
@echo " info-composer: Show information about your composer"
@echo " install-composer: Downlod and install composer"
@echo ""
dev-menu: .title
@echo " ====================================================================="
@echo " Respect/Foundation Menu 3"
@echo " ====================================================================="
@echo " Toolbox - Development"
@echo " ====================================================================="
@echo " info-git-extras: Show information about your installed git extras"
@echo " install-git-extras: Install git extras"
@echo " info-cs-fixer: Show information about your installed PHP Coding Standards Fixer"
@echo " install-cs-fixer: Install PHP Coding Standards Fixer"
@echo " info-codesniff: Show information about your installed PHP_CodeSniffer"
@echo " install-codesniff: Install PHP_CodeSniffer"
@echo " install-psr-sniff: Install Code Sniffer PSR sniffs to allow for PSR 0-3 compliancy checks"
@echo " info-phpunit: Show information about your installed PHPUnit"
@echo " install-phpunit: Install PHPUnit"
@echo " info-phpcpd: Show information about your installed PHP Copy Paste detector"
@echo " install-phpcpd: Install PHPcpd"
@echo " info-phpdcd: Show information about your installed PHP Dead Code detector"
@echo " install-phpdcd: Install PHPdcd"
@echo " info-phploc: Show information about your installed PHP LOC analyzer"
@echo " install-phploc: Install PHPloc"
@echo " info-skelgen: Show information about your installed PHPUnit Skeleton Generator"
@echo " install-skelgen: Install PHPUnit Skeleton Generator"
@echo " info-test-helpers: Show information about your installed PHPUnit Test Helpers extension"
@echo " install-test-helpers: Install PHPUnit Test Helpers extension"
@echo " info-phpdoc: Show information about your installed PhpDocumentor2"
@echo " install-phpdoc: Install PhpDocumentor2"
@echo " info-phpsh: Show information about your installed PHP Shell (phpsh)"
@echo " install-phpsh: Install PHP Shell (phpsh) - Requires Python"
@echo " install-travis-lint: Install travis-lint configuration checker - Requires ruby gems"
@echo " install-uri-template: Install uri_template a php extension. Might require sudo."
@echo ""
deploy-menu: .title
@echo " ====================================================================="
@echo " Respect/Foundation Menu 4"
@echo " ====================================================================="
@echo " Deploy & Release"
@echo " ====================================================================="
@echo " patch: Increases the patch version of the project (X.X.++)"
@echo " minor: Increases the minor version of the project (X.++.0)"
@echo " major: Increases the major version of the project (++.0.0)"
@echo " alpha: Changes the stability of the current version to alpha"
@echo " beta: Changes the stability of the current version to beta"
@echo " stable: Changes the stability of the current version to stable"
@echo " tag: Makes a git tag of the current project version/stability"
@echo " pear-push: Pushes the latest PEAR package. Custom pear_repo='' and pear_package='' available."
@echo " release: Runs tests, coverage reports, tag the build and pushes to package repositories"
@echo ""
# Foundation puts its files into .foundation inside your project folder.
# You can delete .foundation anytime and then run make foundation again if you need
foundation: .title
@echo "Updating Makefile"
curl -LO git.io/Makefile
@echo "Creating .foundation folder"
-rm -Rf .foundation
-mkdir .foundation
git clone --depth 1 git://github.com/Respect/Foundation.git .foundation/repo
@make -f Makefile .gitignore-foundation
@echo "Downloading Onion"
-curl -L https://github.com/c9s/Onion/raw/master/onion > .foundation/onion;chmod +x .foundation/onion
@echo "Done."
# Target for Respect/Foundation development and internal use only. This target will not appear on the menus.
foundation-develop:
@if make .prompt-yesno message="Do you want to update your Makefile?" 2> /dev/null; then \
echo "Updating Makefile"; \
curl -LO https://raw.github.com/Respect/Foundation/develop/Makefile; \
fi
@echo "Creating .foundation folder"
-rm -Rf .foundation
-mkdir .foundation
git clone --depth 1 git://github.com/Respect/Foundation.git .foundation/repo
cd .foundation/repo/ && git fetch && git checkout develop && cd -
@make -f Makefile .gitignore-foundation
@echo "Downloading Onion"
-curl -L https://github.com/c9s/Onion/raw/master/onion > .foundation/onion;chmod +x .foundation/onion
@echo "Done."
.gitignore-foundation:
@test -f .gitignore || make -f Makefile .gen-gitignore
@grep -q .foundation .gitignore || echo .foundation >> .gitignore
.gen-gitignore:
@echo "(Re)create .gitignore"
@$(GENERATE_TOOL) config-template gitignore > gitignore.tmp && mv -f gitignore.tmp .gitignore
gitignore: .title .gen-gitignore
project-info: .check-foundation
@echo "\nProject Information\n"
@echo " php-version:" `$(CONFIG_TOOL) php-version `
@echo " project-repository:" `$(CONFIG_TOOL) project-repository `
@echo " library-folder:" `$(CONFIG_TOOL) library-folder `
@echo " test-folder:" `$(CONFIG_TOOL) test-folder `
@echo " config-folder:" `$(CONFIG_TOOL) config-folder `
@echo " public-folder:" `$(CONFIG_TOOL) public-folder `
@echo " vendor-folder:" `$(CONFIG_TOOL) vendor-folder `
@echo " sandbox-folder:" `$(CONFIG_TOOL) sandbox-folder `
@echo " documentation-folder:" `$(CONFIG_TOOL) documentation-folder `
@echo " executables-folder:" `$(CONFIG_TOOL) executables-folder `
@echo " vendor-name:" `$(CONFIG_TOOL) vendor-name `
@echo " package-name:" `$(CONFIG_TOOL) package-name `
@echo " project-name:" `$(CONFIG_TOOL) project-name `
@echo " one-line-summary:" `$(CONFIG_TOOL) one-line-summary `
@echo " package-description:" `$(CONFIG_TOOL) package-description `
@echo " package-version:" `$(CONFIG_TOOL) package-version `
@echo " package-stability:" `$(CONFIG_TOOL) package-stability `
@echo "\r project-authors: "`$(CONFIG_TOOL) package-authors ` \
| tr ',' '\n' \
| awk -F' <' '{ printf " %-10-s \t<%15-s \n",$$1,$$2 }'
@echo "\r project-contributors: "`$(CONFIG_TOOL) package-contributors ` \
| tr ',' '\n' \
| awk -F' <' '{ printf " %-10-s \t<%15-s \n",$$1,$$2 }'
@echo " package-date-time:" `$(CONFIG_TOOL) package-date-time `
@echo " pear-path:" `$(CONFIG_TOOL) pear-path `
@echo " pear-channel:" `$(CONFIG_TOOL) pear-channel `
@echo " pear-repository:" `$(CONFIG_TOOL) pear-repository `
@echo " phar-repository:" `$(CONFIG_TOOL) phar-repository `
@echo " pear-dependencies:" `$(CONFIG_TOOL) pear-dependencies `
@echo " extension-dependencies:" `$(CONFIG_TOOL) extension-dependencies `
@echo " readme-file:" `$(CONFIG_TOOL) readme-file `
@echo " project-license:" `$(CONFIG_TOOL) project-license `
@echo " project-homepage:" `$(CONFIG_TOOL) project-homepage `
@echo " user-name:" `$(CONFIG_TOOL) user-name `
@echo " user-email:" `$(CONFIG_TOOL) user-email `
@echo " user-home:" `$(CONFIG_TOOL) user-home `
@echo ""
test-skelgen: .check-foundation
@test -f $(shell $(CONFIG_TOOL) test-folder)/bootstrap.php || make bootstrap-php > /dev/null
@$(eval source-folder=$(shell $(CONFIG_TOOL) library-folder))
-@if test "$(class)"; then \
cd $(shell $(CONFIG_TOOL) test-folder) && ../.foundation/repo/bin/phpunit-skelgen-classname "${class}" $(source-folder); \
else \
echo "Usage:"; \
echo " make test-skelgen class=\"My\\Awesome\\Class\""; \
echo; \
fi; \
test-skelgen-all:
@$(eval source-folder=$(shell $(CONFIG_TOOL) library-folder))
@find $(source-folder) -type f -name "*.php" \
| sed -E 's%$(source-folder)/(.*).php%class=\\"\1\\"%' \
| sed 's%/%\\\\\\\\%g' \
| xargs -L 1 make test-skelgen;
# Re-usable target for yes no prompt. Usage: make .prompt-yesno message="Is it yes or no?"
# Will exit with error if not yes
.prompt-yesno:
@printf "$(message) (Y/N) :"
@read yn; \
if ! echo $$yn | grep -qi y; then \
exit 1; \
fi;
project-init: .check-foundation
@if test -d .git; then \
echo; \
echo "It appears you already have a git repository configured."; \
echo "This target, will run git init and auto add + commit."; \
if ! make .prompt-yesno message="Do you want to continue?" 2> /dev/null; then \
echo "Aborting on request."; \
exit; \
fi; \
fi; \
make -f Makefile .project-init
.project-init: git-init project-folders phpunit-xml bootstrap-php package git-add-all
sleep 1
git add -A
git commit -a -m"Project initialized."
project-folders: .check-foundation
@$(GENERATE_TOOL) project-folders createFolders
info-git-extras:
@echo "This is what I know about your git extras:"
git extras --version
install-git-extras: .check-foundation
@make -f Makefile info-git-extras > /dev/null || (cd .foundation && curl https://raw.github.com/visionmedia/git-extras/master/bin/git-extras | INSTALL=y sh)
git-init: .check-foundation git-init-only git-add-all
@git commit -a -m"Initial commit."
git-init-only: .check-foundation
@git init --shared=all
git-add-all: .check-foundation
@git add -A
codesniff: .check-foundation
@echo "Running PHP Codesniffer to assess PSR compliancy"
phpcs -p --report-full=`$(CONFIG_TOOL) documentation-folder `/full2.out `$(CONFIG_TOOL) library-folder `
phpunit-codesniff: .check-foundation
@echo "Running PHP Codesniffer to assess PHPUnit compliancy"
phpcs -p --extensions=PHPUnit --report-full=`$(CONFIG_TOOL) documentation-folder `/full2.out `$(CONFIG_TOOL) library-folder `
phpcpd: .check-foundation
@echo Running PHP Copy paste detection on library folder
phpcpd --verbose `$(CONFIG_TOOL) library-folder `
phpdcd: .check-foundation
@echo Running PHP Dead Code detection on library folder
phpdcd --verbose `$(CONFIG_TOOL) library-folder `
phploc: .check-foundation
@echo Running PHP Lines of code statistics on library folder
phploc --verbose `$(CONFIG_TOOL) library-folder `
phpdoc: .check-foundation
@echo generating documentation with PhpDocumentor2.
phpdoc -d `$(CONFIG_TOOL) library-folder ` -t `$(CONFIG_TOOL) documentation-folder ` -p
phpunit-xml: .check-foundation
@$(GENERATE_TOOL) config-template phpunit.xml > phpunit.xml.tmp && mkdir -p $(shell $(CONFIG_TOOL) test-folder) && mv -f phpunit.xml.tmp $(shell $(CONFIG_TOOL) test-folder)/phpunit.xml
bootstrap-php: .check-foundation
@$(GENERATE_TOOL) config-template bootstrap.php > bootstrap.php.tmp && mkdir -p $(shell $(CONFIG_TOOL) test-folder) && mv -f bootstrap.php.tmp $(shell $(CONFIG_TOOL) test-folder)/bootstrap.php
bootstrap-php-opt: .check-foundation
@$(GENERATE_TOOL) config-template bootstrap.php.opt > bootstrap.php.tmp && mkdir -p $(shell $(CONFIG_TOOL) test-folder) && mv -f bootstrap.php.tmp $(shell $(CONFIG_TOOL) test-folder)/bootstrap.php
package-ini: .check-foundation
@$(GENERATE_TOOL) package-ini > package.ini.tmp && mv -f package.ini.tmp package.ini
travis-yml: .check-foundation
@$(GENERATE_TOOL) config-template travis.yml > travis.yml.tmp && mv -f travis.yml.tmp .travis.yml
# Generates a package.xml from the package.ini
package-xml: .check-foundation
@.foundation/onion build; echo
@if test -f package.xml; then \
echo Respect/Foundation:; \
echo; echo " $$ make pear"; echo; \
fi;
composer-json: .check-foundation
@$(GENERATE_TOOL) composer-json > composer.json.tmp && mv -f composer.json.tmp composer.json
# Generates all package files
package: .check-foundation package-ini package-xml composer-json
# Phony target so the test folder don't conflict
.PHONY: test
test: .check-foundation
@cd `$(CONFIG_TOOL) test-folder`;phpunit --testdox .
coverage: .check-foundation
@cd `$(CONFIG_TOOL) test-folder`;phpunit --coverage-html=reports/coverage --coverage-text .
@echo "Done. Reports also available on `$(CONFIG_TOOL) test-folder`/reports/coverage/index.html"
cs-fixer: .check-foundation
@cd `$(CONFIG_TOOL) library-folder`;../.foundation/php-cs-fixer -v fix --level=all --fixers=indentation,linefeed,trailing_spaces,unused_use,return,php_closing_tag,short_tag,visibility,braces,extra_empty_lines,phpdoc_params,eof_ending,include,controls_spaces,elseif .
@echo "Library folder done. `$(CONFIG_TOOL) library-folder`"
@cd `$(CONFIG_TOOL) test-folder`;../.foundation/php-cs-fixer -v fix --level=all --fixers=indentation,linefeed,trailing_spaces,unused_use,return,php_closing_tag,short_tag,visibility,braces,extra_empty_lines,phpdoc_params,eof_ending,include,controls_spaces,elseif .
@echo "Test folder done. `$(CONFIG_TOOL) test-folder` "
@echo "Done. You may verify the changes and commit if you are happy."
# Any cleaning mechanism should be here
clean: .check-foundation
@rm -Rf `$(CONFIG_TOOL) test-folder`/reports
# Targets below use the same rationale. They change the package.ini file, so you'll need a
# package-sync after them
patch: .check-foundation
@$(GENERATE_TOOL) package-ini patch > package.ini.tmp && mv -f package.ini.tmp package.ini
minor: .check-foundation
@$(GENERATE_TOOL) package-ini minor > package.ini.tmp && mv -f package.ini.tmp package.ini
major: .check-foundation
@$(GENERATE_TOOL) package-ini major > package.ini.tmp && mv -f package.ini.tmp package.ini
alpha: .check-foundation
@$(GENERATE_TOOL) package-ini alpha > package.ini.tmp && mv -f package.ini.tmp package.ini
beta: .check-foundation
@$(GENERATE_TOOL) package-ini beta > package.ini.tmp && mv -f package.ini.tmp package.ini
stable: .check-foundation
@$(GENERATE_TOOL) package-ini stable > package.ini.tmp && mv -f package.ini.tmp package.ini
tag: .check-foundation
-git tag `$(CONFIG_TOOL) package-version ` -m 'Tagging.'
# Runs on the current package.xml file
pear: .check-foundation
@$(eval count=$(shell grep -c dir package.xml)) \
if test $(count) -gt 1; then \
pear package; \
else \
echo "There are no <contents> defined in package.xml"; \
echo "Nothing to build"; \
fi;
info:
@pear info $(shell $(CONFIG_TOOL) package-name)|egrep 'Version|Name|Summary|Description|-'
# On root PEAR installarions, this need to run as sudo
install: .check-foundation
@if ! test -f package.xml; then \
echo "No package.xml found."; \
echo "Nothing to install"; \
elif ! make info 2> /dev/null; then \
echo "You may need to run this as sudo."; \
echo "Discovering channel"; \
pear channel-info $(shell $(CONFIG_TOOL) pear-channel) || pear channel-discover $(shell $(CONFIG_TOOL) pear-channel); \
pear install package.xml; \
fi;
info-php: .check-foundation
@echo "This is what I know about your PHP."
php --version
config-php: .check-foundation
@echo "The location of your PHP configuration file."
php --ini
include-php: .check-foundation
@echo "The PHP configured include path where external packages can be found, like PEAR packages for example."
php -r 'echo get_include_path()."\n";'
info-pear: .check-foundation
@echo "This is what I know about your PEAR."
pear -V
updated-pear: .check-foundation
@echo "Fetching possible upgrade information from all channels."
pear list-upgrades
update-all-pear: .check-foundation
@echo "Updating all PEAR packages if any updates are available."
pear upgrade-all
packages-pear: .check-foundation
@echo "The following PEAR packages are currently installed."
pear list
locate-pear: .check-foundation
@echo "The PEAR installed package can be found at:"
pear config-get php_dir
verify-pear: .check-foundation
@echo "If the following PHP script:"
@echo "<?php"
@echo " require_once 'System.php';"
@echo " echo 'Can we include PEAR System.php? : ';"
@echo " var_export(class_exists('System', false));"
@echo "?>"
@echo ""
@echo "Executes without any error and answers true fully to our question then may safely assume that the PEAR installation is sound."
echo "<?php require_once 'System.php'; echo 'Can we include PEAR System.php? : ', var_export(class_exists('System', false), true), PHP_EOL;"
install-pear: .check-foundation
@echo "Because we rely so extensively on a proper PEAR installation it is pertinent that PEAR is installed propeprly."
@echo "Unfortunately I am not cenfident that I am capable, at this point, to successfully install PEAR on every system,"
@echo "yours in particular, without baking a complete mess of things."
@echo ""
@echo "Don't worry this is not difficult and I am sure you will succeed by following the detailed instructions at the"
@echo "following URL: http://pear.php.net/manual/en/installation.getting.php"
@echo ""
@echo "Once you're done you are welcome to return so I may assist you with the installation verification process."
@echo "Good luck!"
info-check-pear: .check-foundation
@echo "At the address: http://pear.php.net/manual/en/guide.users.commandline.packageinfo.php PEAR lists a comprehensive"
@echo "list of insructions to execute and verify that the installation is sound."
@echo ""
@echo "For your convenience you may verify these routiens by executing the targets make check-pear-1 through 5 but before"
@echo "you eagerly run all the scripts one by one, they are non changing and only informative in nature, I know this must"
@echo "be very exciting I can still remember when I did my first installation back in 1977 when I was created by Dr. Stuart"
@echo "Feldman at Bell Labs who later received the ACM Software System Award in 2003, on my behalf. It seems like yesterday."
@echo ""
@echo "There is a trick to the checklist which might save you some time, I really don't mind if you follow them one by one"
@echo "and the Respect/Foundation developers were so maticulous to add them all but let me share a little secret with you."
@echo ""
@echo "If making the final target : make check-pear-5 succeeds then we have verified that the installation was a success."
@echo ""
@echo "Should you however hav"
check-pear-1: .check-foundation
@echo "PEAR Checklist step 1"
@echo ""
@echo "By executing the pear command we should see a list of commands."
@echo "If the did no succeed verify that the pear command is on your system path."
@echo "The command is piped through more, press spacebar to page or q to abort."
pear | more
check-pear-2: .check-foundation
@echo "PEAR Checklist step 2"
@echo ""
@echo "Display PEAR version information"
make info-pear
check-pear-3: .check-foundation
@echo "PEAR Checklist step 3"
@echo ""
@echo "Display the PEAR install location where packages are installed"
make locate-pear
check-pear-4: .check-foundation
@echo "PEAR Checklist step 4"
@echo ""
@echo "Verify the presence of the PEAR install directory in the PHP include path."
make include-php
check-pear-5: .check-foundation
@echo "PEAR Checklist step 5"
@echo ""
@echo "Test to see if we can include packages from PEAR."
@echo "For troubleshooting please refer to the target : make info-check-pear."
make verify-pear
info-cs-fixer: .check-foundation
@echo "This is what I know about your PHP Coding Standards Fixer."
.foundation/php-cs-fixer -V
install-cs-fixer: .check-foundation
@echo "Attempting to download PHP Coding Standards Fixer."
curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o .foundation/php-cs-fixer && chmod a+x .foundation/php-cs-fixer
install-travis-lint: .check-foundation
@echo "Attempting to install travis-lint. Requires ruby gem..."
@gem install travis-lint
travis-lint: .check-foundation
@echo "Checking your .travis.yml"
@travis-lint ./.travis.yml
info-composer: .check-foundation
@echo "This is what I know about your composer."
@/usr/bin/env PATH=$$PATH:./.foundation composer about 2> /dev/null || (echo "No composer installed." && false)
install-composer: .check-foundation
@echo "Attempting to download and install composer packager."
@curl -s http://getcomposer.org/installer | php
@mv composer.phar .foundation/composer && chmod a+x .foundation/composer && exit 0
.check-composer:
@make -f Makefile info-composer > /dev/null || make -f Makefile install-composer > /dev/null || (echo "Unable to install composer. Aborting..." && false)
composer-validate: .check-foundation .check-composer
@echo "Running composer validate, be brave."
@/usr/bin/env PATH=$$PATH:./.foundation composer validate -v
composer-install: .check-foundation .check-composer
@echo "Running composer install, this will create a vendor folder and configure autoloader."
@/usr/bin/env PATH=$$PATH:./.foundation composer install -v
composer-update: .check-foundation .check-composer
@echo "Running composer update, which updates your existing installation."
@/usr/bin/env PATH=$$PATH:./.foundation composer update -v
info-pyrus: .check-foundation
@echo "This is what I know about your PEAR2_Pyrus."
.foundation/pyrus --version
install-pyrus: .check-foundation
@echo "Attempting to download and install PEAR2_Pyrus."
curl http://pear2.php.net/pyrus.phar -o .foundation/pyrus && chmod a+x .foundation/pyrus
.foundation/pyrus mypear `$(CONFIG_TOOL) vendor-folder`
.foundation/pyrus install PEAR2_Pyrus_Developer-alpha
.foundation/pyrus install PEAR2_Autoload-alpha
.foundation/pyrus install PEAR2_Templates_Savant-alpha
info-codesniff: .check-foundation
@echo "This is what I know about your PHP_CodeSniffer."
phpcs --version
@echo "The following PHP_CodeSniffer coding standard sniffs are installed."
phpcs -i
install-codesniff: .check-foundation
@echo "Attempting to download and install PHP_CodeSniffer. This will likely require sudo."
pear install --alldeps PHP_CodeSniffer
https://github.com/elblinkin/PHPUnit-CodeSniffer.git
install-psr-sniff: .check-foundation
@echo "Attempting to download and install PHP_CodeSniffer sniffs for PSR's. This will likely require sudo."
@cd `$(PACKAGES_PEAR)`/PHP/CodeSniffer/Standards && git clone https://github.com/klaussilveira/phpcs-psr PSR
@phpcs --config-set default_standard PSR
install-phpunit-sniff: .check-foundation
@echo "Attempting to download and install PHPUnit_CodeSniffer sniffs for PHPUnit standards. This will likely require sudo."
@cd `$(PACKAGES_PEAR)`/PHPUnit/ && git clone https://github.com/elblinkin/PHPUnit-CodeSniffer.git && cp -R PHPUnit-CodeSniffer/PHPUnitStandard ../PHP/CodeSniffer/Standards/PHPUnit
info-phpunit: .check-foundation
@echo "This is what I know about your PHPUnit."
@phpunit --version
install-phpunit: .check-foundation
@echo "Attempting to download and install PHPUnit. This will likely require sudo."
@pear channel-info pear.phpunit.de > /dev/null || pear channel-discover pear.phpunit.de
@pear channel-info pear.symfony-project.com > /dev/null || pear channel-discover pear.symfony-project.com
@pear install --alldeps pear.phpunit.de/PHPUnit
info-phpcpd: .check-foundation
@echo "This is what I know about your PHPcpd."
@phpcpd --version
install-phpcpd: .check-foundation
@echo "Attempting to download and install PHPcpd. This will likely require sudo."
@pear channel-info pear.phpunit.de > /dev/null || pear channel-discover pear.phpunit.de
@pear install --alldeps pear.phpunit.de/phpcpd
info-phpdcd: .check-foundation
@echo "This is what I know about your PHPdcd."
@phpdcd --version
install-phpdcd: .check-foundation
@echo "Attempting to download and install PHPdcd. This will likely require sudo."
@pear channel-info pear.phpunit.de > /dev/null || pear channel-discover pear.phpunit.de
@pear install --alldeps pear.phpunit.de/phpdcd-beta
info-phploc: .check-foundation
@echo "This is what I know about your PHPloc."
@phploc --version
install-phploc: .check-foundation
@echo "Attempting to download and install PHPloc. This will likely require sudo."
@pear channel-info pear.phpunit.de > /dev/null || pear channel-discover pear.phpunit.de
@pear install --alldeps pear.phpunit.de/phploc
install-phpcov: .check-foundation
@echo "Attempting to download and install PHPcov. This will likely require sudo."
@pear channel-info pear.phpunit.de > /dev/null || pear channel-discover pear.phpunit.de
@pear install --alldeps pear.phpunit.de/phpcov
info-skelgen:
@echo "This is what I know about your PHPUnit_SkeletonGenerator.\n"
@phpunit-skelgen --version
install-skelgen: .check-foundation
@echo "Attempting to download and install PHPUnit Skeleton Generator. This will likely require sudo."
@pear channel-info pear.phpunit.de > /dev/null || pear channel-discover pear.phpunit.de
@pear install --alldeps pear.phpunit.de/PHPUnit_SkeletonGenerator
info-test-helpers: .check-foundation
@pecl info phpunit/test_helpers|egrep 'Version|Name|Summary|Description|-'
install-test-helpers:
@if make info-test-helpers 2> /dev/null; then \
exit; \
fi; \
echo "Attempting to download and install PHPUnit Test Helpers. This will likely require sudo." \
pear channel-info pear.phpunit.de > /dev/null || pear channel-discover pear.phpunit.de; \
pecl install --alldeps phpunit/test_helpers
info-phpdoc: .check-foundation
@echo "This is what I know about your PhpDocumentor."
@echo "The command is piped through more, press spacebar to page or q to abort."
@pear info phpdoc/phpDocumentor-alpha
install-phpdoc: .check-foundation
@echo "Attempting to download and install PhpDocumentor2. This will likely require sudo."
@pear channel-info pear.phpdoc.org > /dev/null || pear channel-discover pear.phpdoc.org
@pear install --alldeps phpdoc/phpDocumentor-alpha
info-phpsh: .check-foundation
@echo "This is what I know about your phpsh."
@phpsh --version
install-phpsh: .check-foundation
@echo "Attempting to download and install phpsh."
git clone --progress -v https://github.com/facebook/phpsh.git .foundation/phpshsrc
sudo easy_install readline
cd .foundation/phpshsrc && python setup.py build && sudo python setup.py install
install-uri-template: .check-foundation
@git clone --progress -v git://github.com/ioseb/uri-template.git .foundation/uri-template
@cd .foundation/uri-template && phpize && ./configure && make && make test && make install
@echo
@echo If all went well and you saw no errors or FAILs then congratulations!
@echo all that is left is to ensure that extension=uri_template.so is in your php.ini
@echo
# Clean up utils
tabs2spaces: .check-foundation
@if test "$(file)"; then \
expand -t 4 "$(file)" > "$(file).tmp" && mv -f "$(file).tmp" "$(file)"; \
else \
find . -type f -name "*.php" -exec make tabs2spaces file="{}" \;; \
fi;
trailing-spaces: .check-foundation
@if test "$(file)"; then \
awk '{sub(/[ \t]+$$/, "")};1' "$(file)" > "$(file).tmp" && mv -f "$(file).tmp" "$(file)"; \
else \
find . -type f -name "*.php" -exec make trailing-spaces file="{}" \;; \
fi;
unix-line-ends: .check-foundation
@if test "$(file)"; then \
awk '{sub(/\r$$/,"")};1' "$(file)" > "$(file).tmp" && mv -f "$(file).tmp" "$(file)"; \
else \
find . -type f -name "*.php" -exec make unix-line-ends file="{}" \;; \
fi;
clean-whitespace: .check-foundation
@if test "$(file)"; then \
make tabs2spaces file="$(file)" > /dev/null; \
make unix-line-ends file="$(file)" > /dev/null; \
make trailing-spaces file="$(file)" > /dev/null; \
else \
make tabs2spaces > /dev/null; \
make unix-line-ends > /dev/null; \
make trailing-spaces > /dev/null; \
fi;
# Install pirum, clones the PEAR Repository, make changes there and push them.
pear-push: .check-foundation
@echo "Installing Pirum"
@sudo pear install --soft --force pear.pirum-project.org/Pirum
@echo "Cloning channel from git" `$(CONFIG_TOOL) pear-repository`
-rm -Rf .foundation/pirum
git clone --depth 1 `$(CONFIG_TOOL) pear-repository`.git .foundation/pirum
pirum add .foundation/pirum `$(CONFIG_TOOL) package-name`-`$(CONFIG_TOOL) package-version`.tgz;pirum build .foundation/pirum;
cd .foundation/pirum;git add .;git commit -m "Added " `$(CONFIG_TOOL) package-version`;git push
packagecommit:
@git add package.ini package.xml composer.json
@git commit -m "Updated package files"
# Uses other targets to complete the build
release: test package packagecommit pear pear-push tag
@echo "Release done. Pushing to GitHub"
@git push
@git push --tags
@echo "Done. " `$(CONFIG_TOOL) package-name`-`$(CONFIG_TOOL) package-version`