Skip to content

Commit

Permalink
add some mysql tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
rouffj committed Oct 7, 2011
1 parent 6d6e308 commit 41bfb36
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
12 changes: 11 additions & 1 deletion examples/ex1-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@
<property name="deps.manager" value="macports" />
<import file="${project.basedir}/../base-build.xml" />
<import file="${project.basedir}/../sf2-build.xml" />
<import file="${project.basedir}/../sphinx-build.xml" />
<import file="${project.basedir}/../mysql-build.xml" />
<target name="db:create" description="sdfsdf">
<echo msg="sdsdf ${phing.file.base}" />
</target>

<property name="mysql.user" value="root" />
<property name="mysql.passwd" value="root" />

<target name="depends" description="Check packages">
<checkdepends type="deb" packages="git-core libexpat1-dev libcurl4-openssl-dev apache2 mysql-server libmysqld-dev php5 php5-curl php5-mysql php5-intl php5-sqlite" />
<checkdepends type="macports" packages="git-core php5 apache2 php5-iconv php5-intl4 php5-sqlite sqlite3" />
<checkdepends type="gem" packages="rails github islamr" />
<checkdepends type="pip" packages="Sphinx" />
</target>

<target name="db:backup" description="Check packages">
<phingcall target="mysql.db:backup">
<property name="dir" value="/tmp/mysql-backups" />
<property name="databases" value="rr salatv2" />
</phingcall>
</target>
</project>
19 changes: 19 additions & 0 deletions mysql-build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>

<project name="mysql" description="Handle mysql tasks" default="">
<target name="db:backup"
description="Make MySQL backup for ${databases} in ${dir}.">
<property name="options" value=""/>
<mkdir dir="${dir}" />
<tstamp />
<exec command="mysqldump -u${mysql.user} -p${mysql.passwd} ${options} --databases ${databases} &gt; ${dir}/backup-${DSTAMP}.sql"/>
</target>
<target name="db:user:add"
description="Add a new MySQL ${user} identified with ${passwd}.">
<exec command="echo &quot;CREATE USER '${user}'@'localhost' IDENTIFIED BY '${passwd}';&quot;| mysql -u${mysql.user} -p${mysql.passwd}"/>
</target>
<target name="db:user:remove"
description="Remove MySQL ${user} identified with ${passwd}.">
<exec command="echo &quot;DROP USER '${user}'@'localhost';&quot;| mysql -u${mysql.user} -p${mysql.passwd}"/>
</target>
</project>

0 comments on commit 41bfb36

Please sign in to comment.