summaryrefslogtreecommitdiff
path: root/vendor/guzzle/guzzle/phing/imports/deploy.xml
blob: 109e5ec4f4d7e86fe7c0b6f70c4fbaa38836241d (plain)
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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="../../" default="deploy">

    <property name="git.status" value=""/>
    <property name="git.currentbranch" value=""/>
    <target name="check-git-branch-status">
        <exec command="git status -s -b" outputProperty="git.currentbranch" />
        <echo msg="${git.currentbranch}"/>
        <if>
            <contains string="${git.currentbranch}" substring="${head}"/>
            <then>
                <echo>On branch ${head}</echo>
            </then>
            <else>
                <fail message="-Dhead=${head} arg did not match ${git.currentbranch}"/>
            </else>
        </if>
        <exec command="git status -s" outputProperty="git.status" />
        <if>
            <equals arg1="${git.status}" arg2="" trim="true"/>
            <then>
                <echo>working directory clean</echo>
            </then>
            <else>
                <echo>${git.status}</echo>
                <fail message="Working directory isn't clean." />
            </else>
        </if>
    </target>

    <property name="version.changelog" value=""/>
    <property name="version.version" value=""/>
    <target name="check-changelog-version">
        <exec executable="fgrep" outputProperty="version.changelog">
            <arg value="${new.version} ("/>
            <arg value="${project.basedir}/CHANGELOG.md"/>
        </exec>
        <if>
            <equals arg1="${version.changelog}" arg2="" trim="true"/>
            <then>
                <fail message="${new.version} not mentioned in CHANGELOG"/>
            </then>
        </if>

        <exec executable="fgrep" outputProperty="version.version">
            <arg value="const VERSION = '${new.version}'"/>
            <arg value="${project.basedir}/src/Guzzle/Common/Version.php"/>
        </exec>
        <if>
            <equals arg1="${version.version}" arg2="" trim="true"/>
            <then>
                <fail message="${new.version} not mentioned in Guzzle\Common\Version"/>
            </then>
        </if>

        <echo>ChangeLog Match: ${version.changelog}</echo>
        <echo>Guzzle\Common\Version Match: ${version.version}</echo>
    </target>

    <target name="help" description="HELP AND REMINDERS about what you can do with this project">
        <echo>releasing: phing -Dnew.version=3.0.x -Dhead=master release</echo>
        <echo>--</echo>
        <exec command="phing -l" passthru="true"/>
    </target>

    <target name="release" depends="check-changelog-version,check-git-branch-status"
            description="tag, subtree split, package, deploy: Use: phing -Dnew.version=[TAG] -Dhead=[BRANCH] release">
        <if>
            <isset property="new.version" />
            <then>
                <if>
                    <contains string="${new.version}" substring="v" casesensitive="false" />
                    <then>
                        <fail message="Please specify version as [0-9].[0-9].[0-9]. (I'll add v for you.)"/>
                    </then>
                    <else>

                        <echo>BEGINNING RELEASE FOR ${new.version}</echo>

                        <!-- checkout the specified branch -->
                        <!-- <gitcheckout repository="${repo.dir}" branchname="${head}" gitPath="${cmd.git}" /> -->
                        <!-- Ensure that the tag exists -->
                        <!-- push the tag up so subsplit will get it -->
                        <!--gitpush repository="${repo.dir}" tags="true" gitPath="${cmd.git}" /-->

                        <!-- now do the subsplits -->
                        <guzzlesubsplit
                                repository="${repo.dir}"
                                remote="${guzzle.remote}"
                                heads="${head}"
                                tags="v${new.version}"
                                base="src"
                                subIndicatorFile="composer.json"
                                gitPath="${cmd.git}" />

                        <!-- Copy .md files into the PEAR package -->
                        <copy file="${repo.dir}/LICENSE" tofile=".subsplit/src/Guzzle/LICENSE.md" />
                        <copy file="${repo.dir}/README.md" tofile=".subsplit/src/Guzzle/README.md" />
                        <copy file="${repo.dir}/CHANGELOG.md" tofile=".subsplit/src/Guzzle/CHANGELOG.md" />

                        <!-- and now the pear packages -->
                        <guzzlepear
                                version="${new.version}"
                                makephar="true"
                                />
                    </else>

                </if>
            </then>

            <else>
                <echo>Tip: to create a new release, do: phing -Dnew.version=[TAG] -Dhead=[BRANCH] release</echo>
            </else>

        </if>
    </target>

    <target name="pear-channel">
        <guzzlepear version="${new.version}" deploy="true" makephar="true" />
    </target>

    <target name="package-phar" description="Create a phar with an autoloader">
        <pharpackage
                destfile="${dir.output}/guzzle.phar"
                basedir="${project.basedir}/.subsplit"
                stub="phar-stub.php"
                signature="md5">
            <fileset dir="${project.basedir}/.subsplit">
                <include name="src/**/*.php" />
                <include name="src/**/*.pem" />
                <include name="vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php" />
                <include name="vendor/symfony/event-dispatcher/**/*.php" />
                <include name="vendor/doctrine/common/lib/Doctrine/Common/Cache/*.php" />
                <include name="vendor/monolog/monolog/src/**/*.php" />
            </fileset>
            <metadata>
                <element name="author" value="Michael Dowling" />
            </metadata>
        </pharpackage>
    </target>

</project>