Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cubiccompass committed Nov 10, 2013
0 parents commit c170491
Show file tree
Hide file tree
Showing 32 changed files with 1,922 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .classpath
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
14 changes: 14 additions & 0 deletions .gitignore
@@ -0,0 +1,14 @@
build.properties.dev
.settings
config/
lib/
target/
repo/
src/classes/
src/test/classes/
.env
*.launch
*.cls
*.cls-meta.xml
*.trigger
*.trigger-meta.xml
23 changes: 23 additions & 0 deletions .project
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Leap</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
79 changes: 79 additions & 0 deletions README.md
@@ -0,0 +1,79 @@
<h1>Leap: An Ant Library Plugin for Salesforce Apex Development</h1>

<h2>Project Goals</h2>
<ul>
<li>Accelerate the Apex learning and development process</li>
<li>Catalog Apex patterns and best practices in a template library</li>
<li>Enable continuous integration / Built around the Apex development lifecycle</li>
<li>Extensible and open</li>
</ul>

<h2>Overview</h2>
Leap is a Java Ant library that integrates with the Salesforce migration toolkit to help Developers with common tasks, such as generating trigger handlers and wrapper classes. The leap template library is an open source catalog of Apex best practices and examples, compiled from the Salesforce Development community, that encourages coding styles that work well on the Salesforce platform.

<h2>Usage</h2>
From the command line of any Salesforce development environment:
<pre>
~/ant leapTargetName
</pre>

<h2>List of Leap Tasks</h2>
<ul>
<li>leapsfields: Generates a class of static fields for all SObjects</li>
<li>leaptriggers: Generates triggers and Apex trigger handler class(es) for SObjects</li>
<li>leapwrappers: Generates wrapper class(es) (in development)</li>
</ul>

<h2>Getting started</h2>
<ul>
<li>Download and copy bin/ant-leap.jar into the local Ant library folder (on a Mac this is located at /usr/share/ant/lib).</li>
<li>Create build.properties and build.xml files within the root of any Salesforce development project (see example templates below).</li>
<li>Enter Salesforce development credentials into build.properties.
<li>To test, type "ant leapsfields" to run the leap task that builds a class of field names.
</ul>

<h2>Example build.properties</h2>
<pre>
# build.properties
#
# For server URL properties...
# Use 'https://login.salesforce.com' for production or developer edition.
# Use 'https://test.salesforce.com for sandbox.

# Specify the login credentials for the Salesforce development organization
sf.dev.username = developername@domain.com
sf.dev.password = password
sf.dev.url = https://login.salesforce.com

# Specify the login credentials for the Salesforce staging/test organization
sf.test.username =
sf.test.password =
sf.test.url = https://login.salesforce.com

# Specify the login credentials for the Salesforce production/packaging organization
sf.prod.username =
sf.prod.password =
sf.prod.url = https://login.salesforce.com
</pre>

<h2>Example build.xml</h2>

<pre>
&lt;project name="Project Name" default="test" basedir="." xmlns:sf="antlib:com.salesforce" xmlns:leap="antlib:org.leap"&gt;
&lt;target name="leapTaskName"&gt;
&lt;leap:leapTaskName username="${sf.dev.username}" password="${sf.dev.password}" serverurl="${sf.dev.url}" /&gt;
&lt;/target&gt;

&lt;target name="leapsfields"&gt;
&lt;leap:leapsfields username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}" /&gt;
&lt;/target&gt;

&lt;target name="leaptriggers"&gt;
&lt;leap:leaptriggers username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}" /&gt;
&lt;/target&gt;

&lt;target name="leapwrappers"&gt;
&lt;leap:leapwrappers username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}" /&gt;
&lt;/target&gt;
&lt;/project&gt;
</pre>
Binary file added bin/ant-leap.jar
Binary file not shown.
42 changes: 42 additions & 0 deletions build.properties
@@ -0,0 +1,42 @@
# build.properties
#
# For server URL properties...
# Use 'https://login.salesforce.com' for production or developer edition.
# Use 'https://test.salesforce.com for sandbox.

# Specify the login credentials for the Salesforce development organization
sf.dev.username =
sf.dev.password =
sf.dev.token =
sf.dev.url = https://login.salesforce.com

# Specify the login credentials for the Salesforce staging/test organization
sf.test.username =
sf.test.password =
sf.test.token =
sf.test.url = https://login.salesforce.com

# Specify the login credentials for the Salesforce production/packaging organization
sf.prod.username =
sf.prod.password =
sf.prod.token =
sf.prod.url = https://login.salesforce.com

# Specify the login credentials for the source Salesforce organization for metadiff task.
# The sf.dev.* params are used for destination organization. Currently these source and destination
# credentials are not used. Instead the metadiff task operates on local folders.
sf.src.username =
sf.src.password =
sf.src.token =
sf.src.url = https://login.salesforce.com

# Specify the source, destination and output folder for metadiff task
src.folder =
dest.folder =
out.folder =

#sf.pkgName = <Insert comma separated package names to be retrieved>
#sf.zipFile = <Insert path of the zipfile to be retrieved>
#sf.metadataType = CustomObject

# If your network requires an HTTP proxy, see http://ant.apache.org/manual/proxy.html for configuration.
4 changes: 4 additions & 0 deletions build.sh
@@ -0,0 +1,4 @@
#!/bin/bash
mvn package assembly:single
echo "Deploying to local ant lib folder (usr/share/ant/lib on a mac)"
sudo cp target/ant-leap-jar-with-dependencies.jar /usr/share/ant/lib
114 changes: 114 additions & 0 deletions build.xml
@@ -0,0 +1,114 @@
<project name="Leap for Salesforce example build.xml file" default="test" basedir="." xmlns:sf="antlib:com.salesforce" xmlns:leap="antlib:org.leap">

<property file="build.properties"/>
<property environment="env"/>

<macrodef name = "git">
<attribute name = "command" />
<attribute name = "dir" default = "" />
<element name = "args" optional = "true" />
<sequential>
<echo message = "git @{command}" />
<exec executable = "git" dir = "@{dir}">
<arg value = "@{command}" />
<args/>
</exec>
</sequential>
</macrodef>

<target name="leapsfields">
<leap:leapsfields username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}" />
</target>

<target name="leaptriggers">
<leap:leaptriggers username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}" />
</target>

<target name="leapwrappers">
<leap:leapwrappers username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}" />
</target>

<target name="leapmetadiff">
<leap:leapmetadiff username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}"
srcUsername="${sf.src.username}" srcPassword="${sf.src.password}" srcToken="${sf.src.token}" srcServerurl="${sf.src.url}"
srcFolder="${src.folder}" destFolder="${dest.folder}" outFolder="${out.folder}" />
</target>

<target name="pushdev">
<sf:deploy username="${sf.dev.username}" password="${sf.dev.password}" token="${sf.dev.token}" serverurl="${sf.dev.url}" deployRoot="src/">
</sf:deploy>
</target>

<target name="pushtest">
<sf:deploy username="${sf.tes.username}" password="${sf.test.password}" token="${sf.dev.token}" serverurl="${sf.test.url}" deployRoot="src/">
</sf:deploy>
</target>

<target name="pushprod">
<sf:deploy username="${sf.prod.username}" password="${sf.prod.password}" token="${sf.dev.token}" serverurl="${sf.prod.url}" deployRoot="src/">
</sf:deploy>
</target>

<!-- Test out deploy and retrieve verbs for package 'mypkg' -->
<target name="test">
<!-- Upload the contents of the "mypkg" package -->
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="mypkg"/>
<mkdir dir="retrieveOutput"/>
<!-- Retrieve the contents into another directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveOutput" packageNames="MyPkg"/>
</target>

<!-- Retrieve an unpackaged set of metadata from your org -->
<!-- The file unpackaged/package.xml lists what is to be retrieved -->
<target name="retrieveUnpackaged">
<mkdir dir="retrieveUnpackaged"/>
<!-- Retrieve the contents into another directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>
</target>

<!-- Retrieve all the items of a particular metadata type -->
<target name="bulkRetrieve">
<sf:bulkRetrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" metadataType="${sf.metadataType}" retrieveTarget="retrieveUnpackaged"/>
</target>

<!-- Retrieve metadata for all the packages specified under packageNames -->
<target name="retrievePkg">
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveOutput" packageNames="${sf.pkgName}"/>
</target>

<!-- Deploy the unpackaged set of metadata retrieved with retrieveUnpackaged -->
<target name="deployUnpackaged">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="retrieveUnpackaged"/>
</target>

<!-- Shows deploying code & running tests for code in directory -->
<target name="deployCode">
<!-- Upload the contents of the "codepkg" directory, running the tests for just 1 class -->
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="codepkg">
<runTest>SampleDeployClass</runTest>
</sf:deploy>
</target>

<!-- Shows removing code; only succeeds if done after deployCode -->
<target name="undeployCode">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="removecodepkg"/>
</target>

<!-- Shows retrieving code; only succeeds if done after deployCode -->
<target name="retrieveCode">
<!-- Retrieve the contents listed in the file codepkg/package.xml into the codepkg directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="codepkg" unpackaged="codepkg/package.xml"/>
</target>

<!-- Shows deploying code, running all tests, and running tests (1 of which fails), and logging. -->
<target name="deployCodeFailingTest">
<!-- Upload the contents of the "codepkg" package, running all tests -->
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="codepkg" runAllTests="true" logType="Debugonly"/>
</target>

<!-- Shows check only; never actually saves to the server -->
<target name="deployCodeCheckOnly">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="codepkg" checkOnly="true"/>
</target>

</project>
2 changes: 2 additions & 0 deletions d.sh
@@ -0,0 +1,2 @@
#!/bin/bash
sudo cp target/ant-leap-jar-with-dependencies.jar /usr/share/ant/lib

0 comments on commit c170491

Please sign in to comment.