An Ant task that allows for simple manipulation of Google Sites pages.
You will need Google's gdata libraries. They are well documented here.
For convenience, all required libraries are also provided in the Downloads section.
You can define the task in Ant using something like:
<taskdef name="gsite" classname="com.autobizlogic.googlesitesant.SitesTask">
<classpath>
<pathelement location="lib/googlesitesant-0.9.jar"/>
<pathelement location="lib/gdata-core-1.0.jar"/>
<pathelement location="lib/gdata-client-meta-1.0.jar"/>
<pathelement location="lib/gdata-client-1.0.jar"/>
<pathelement location="lib/gdata-media-1.0.jar"/>
<pathelement location="lib/gdata-spreadsheet-3.0.jar"/>
<pathelement location="lib/gdata-sites-meta-2.0.jar"/>
<pathelement location="lib/gdata-sites-2.0.jar"/>
<pathelement location="lib/guava-11.0.2.jar"/>
<pathelement location="lib/mail.jar"/>
<pathelement location="lib/ant.jar"/>
</classpath>
</taskdef>
Creates a new page with the given title and content.
<target name="createPage">
<gsite
action="create"
domainName="automatedbusinesslogic.com"
siteName="automated-business-logic"
userId="jdoe@acme.com"
password="secret"
pageTitle="My test subpage"
parentPageName="/my-grandparent-page/my-parent-page"
contentFileName="test.txt" />
</target>
Extra parameters:
- pageTitle: the title of the page to be created, e.g. "My new page"
- parentPageName: optional, the name of the parent page, e.g. "my-parent-page". If not
specified, the new page will be at the root of the site. This currently supports only
one level, i.e. the parent page must be a top page.
Finds the page with the given name, and replaces its content with the specified content.
<target name="runUpdateTest">
<gsite
action="update"
domainName="automatedbusinesslogic.com"
siteName="automated-business-logic"
userId="jdoe@acme.com"
password="secret"
pageName="/my-existing-page"
contentFileName="test.txt" />
</target>
Extra parameters:
- pageName: the name of an existing page, e.g. "my-existing-page"
Finds the specified page, and replaces all instances of the specified regular expression
with the specified content.
<target name="runRegexpTest">
<gsite
action="regexp"
domainName="automatedbusinesslogic.com"
siteName="automated-business-logic"
userId="jdoe@acme.com"
password="secret"
pageName="/comments/my-existing-page"
pattern="some regexp"
contentFileName="row.html" />
</target>
Extra parameters:
- pattern: a regular expression
Stores the content of the specified page in a local file. This is handy, for instance, if you want to use an existing page as a template (or whatever other purpose you might think of, really).
<target name="runRegexpTest">
<gsite
action="get"
domainName="automatedbusinesslogic.com"
siteName="automated-business-logic"
userId="jdoe@acme.com"
password="secret"
pageName="/my-parent-page/my-existing-page"
contentFileName="row.html" />
</target>