Skip to content

Commit ebd91e7

Browse files
committed
Merge pull request #17 from VSEphpbb/composer-build
Use composer and build script
2 parents 4d07b7e + 859dfc9 commit ebd91e7

6 files changed

Lines changed: 655 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/vendor

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## Installation
44

5-
Copy the extension to `phpBB/ext/phpbb/skeleton`
5+
To install the source code from this repository, clone this extension repository to `phpBB/ext/phpbb/skeleton`:
6+
7+
$ git clone https://github.com/phpbb-extensions/phpbb-ext-skeleton.git
8+
$ php composer.phar install
69

710
Go to "ACP" > "Customise" > "Extensions" and enable the "phpBB Skeleton Extension" extension.
811

@@ -21,7 +24,7 @@ The `.zip` is then offered as a download. Additionally it can be found at
2124
In order to create an extension, you need to open the console of your server.
2225
Then run the following command in your phpBB root (next to config.php):
2326

24-
./bin/phpbbcli.php extension:create
27+
$ ./bin/phpbbcli.php extension:create
2528

2629
Afterwards copy your extension from `store/tmp-ext/` into the `ext/` folder
2730

build.xml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="Skeleton Extension Builder" description="Builds an extension.zip from a git repository" default="all">
3+
<property name="vendor-name" value="phpbb" />
4+
<property name="extension-name" value="skeleton" />
5+
<!--
6+
Only set this to "true" if you have dependencies in the composer.json,
7+
otherwise use "false".
8+
-->
9+
<property name="has-dependencies" value="true" />
10+
11+
<target name="clean-package">
12+
<!--
13+
Remove some unnecessary files/directories
14+
${dir}/ is the folder of your extension, e.g. ext/nickvergessen/newspage/
15+
-->
16+
<delete dir="${dir}/tests" />
17+
<delete dir="${dir}/travis" />
18+
19+
<delete file="${dir}/.gitignore" />
20+
<delete file="${dir}/.travis.yml" />
21+
<delete file="${dir}/build.xml" />
22+
<delete file="${dir}/composer.lock" />
23+
<delete file="${dir}/composer.phar" />
24+
<delete file="${dir}/phpunit.xml.dist" />
25+
<delete file="${dir}/README.md" />
26+
</target>
27+
28+
<!--
29+
TODO: DO NOT EDIT BELOW THIS LINE!!!!
30+
-->
31+
32+
<property name="version" value="HEAD" override="true" />
33+
<property name="build-directory" value="build" override="true" />
34+
<property name="package-directory" value="${build-directory}/package/${vendor-name}/${extension-name}" />
35+
36+
<!-- These are the main targets which you will probably want to use -->
37+
<target name="all" depends="prepare-structure,package" />
38+
39+
<!--
40+
Clean up the build directory
41+
-->
42+
<target name="clean">
43+
<delete dir="${build-directory}" />
44+
</target>
45+
46+
<!--
47+
Recreate the necessary folders
48+
-->
49+
<target name="prepare-structure" depends="clean">
50+
<mkdir dir="${build-directory}" />
51+
<mkdir dir="${build-directory}/checkout" />
52+
<mkdir dir="${build-directory}/package" />
53+
<mkdir dir="${build-directory}/package/${vendor-name}" />
54+
<mkdir dir="${build-directory}/package/${vendor-name}/${extension-name}" />
55+
<mkdir dir="${build-directory}/upload" />
56+
</target>
57+
58+
<!--
59+
The real packaging
60+
-->
61+
<target name="package">
62+
<echo msg="Extracting ${version}" />
63+
64+
<phingcall target="git-checkout">
65+
<property name="archive-version" value="${version}" />
66+
</phingcall>
67+
68+
<if>
69+
<equals arg1="${has-dependencies}" arg2="1" />
70+
<then>
71+
<exec dir="${package-directory}" command="php composer.phar install --no-dev"
72+
checkreturn="true" />
73+
</then>
74+
</if>
75+
76+
<phingcall target="clean-package">
77+
<property name="dir" value="${package-directory}" />
78+
</phingcall>
79+
80+
<!-- Try setting the package version property from composer.json -->
81+
<exec dir="${package-directory}"
82+
command='php -r "\$j = json_decode(file_get_contents(\"composer.json\")); echo (isset(\$j->version) ? \$j->version : \"${version}\");"'
83+
checkreturn="true"
84+
outputProperty='package-version' />
85+
86+
<phingcall target="wrap-package">
87+
<property name="destination-filename" value="${build-directory}/upload/${vendor-name}_${extension-name}_${package-version}" />
88+
</phingcall>
89+
</target>
90+
91+
<!--
92+
Checkout a given version and install/clean the dependencies
93+
-->
94+
<target name="git-checkout">
95+
<echo msg="Getting archive for ${archive-version}" />
96+
97+
<exec command="git archive ${archive-version} --format zip --output ${build-directory}/checkout/${archive-version}.zip"
98+
checkreturn="true" />
99+
<unzip file="${build-directory}/checkout/${archive-version}.zip" todir="${package-directory}" />
100+
</target>
101+
102+
<!--
103+
Create the zip and tar ball
104+
-->
105+
<target name="wrap-package">
106+
<echo msg="Creating archives (${vendor-name}/${extension-name} ${version})" />
107+
<zip basedir="${build-directory}/package/" destfile="${destination-filename}.zip" />
108+
</target>
109+
</project>

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
"role": "Lead Developer"
1414
}],
1515
"require": {
16-
"php": ">=5.3.3"
16+
"php": ">=5.3.3",
17+
"symfony/finder": "2.8.*"
1718
},
1819
"require-dev": {
20+
"phing/phing": "2.4.*",
1921
"phpbb/epv": "dev-master"
2022
},
2123
"extra": {

0 commit comments

Comments
 (0)