|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Ant build
Author: Jochem van Dieten
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58148#315726
On Thu, Nov 20, 2008 at 11:41 AM, Dan Vega wrote:
> Well I like the ANT approach but I have 1 main issue. I know how to use the
> copy command in 3 different scenarios (single file,single file to a
> directory, copy a dir). Based on 1 input though is there a way to know if
> its a file or dir?
Conditional logic isn't Ant's strong suit. You could do something with
conditional targets like:
<target name="moveFile" depends="file">
... ${file}
</target>
<target name="moveDir" depends="dir">
...${dir}
</target>
Then you invoke the task using:
ant -Dfile=/x/y.cfm
or:
ant -Ddir=/z/
I don't think it is worth the trouble to do that. You are probably
better of using:
1. something that doesn't care whether the source is a file or a
directory (batchfile with xcopy?);
2. something tied into your source control solution.
Jochem
Author: Dan Vega
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58148#315723
Thanks for the Reply -
Well I like the ANT approach but I have 1 main issue. I know how to use the
copy command in 3 different scenarios (single file,single file to a
directory, copy a dir). Based on 1 input though is there a way to know if
its a file or dir?
*Copy a single file*
<copy file="myfile.txt" tofile="mycopy.txt"/>
*Copy a single file to a directory*
<copy file="myfile.txt" todir="../some/other/dir"/>
*Copy a directory to another directory*
<copy todir="../new/dir">
<fileset dir="src_dir"/>
</copy>
Dan
Author: Dan Vega
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58148#315721
Well I like the ANT approach but I have 1 main issue. I know how to use the
copy command in 3 different scenarios (single file,single file to a
directory, copy a dir). Based on 1 input though is there a way to know if
its a file or dir?
*Copy a single file*
<copy file="myfile.txt" tofile="mycopy.txt"/>
*Copy a single file to a directory*
<copy file="myfile.txt" todir="../some/other/dir"/>
*Copy a directory to another directory*
<copy todir="../new/dir">
<fileset dir="src_dir"/>
</copy>
Thank You
Dan Vega
danvega@gmail.com
http://www.danvega.org
On Thu, Nov 20, 2008 at 2:24 PM, Barney Boisvert
<bboisvert@gmail.com>wrote:
----- Excess quoted text cut - see Original Post for more -----
Author: Barney Boisvert
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58148#315720
rsync accepts a path spec on the command line, much like your Ant
script would. It's really 6 one way, half dozen the other. I'd
imagine your bat file would accept a single app-relative path and
construct the rsync command line based on it, exactly the way your ANt
script would accept the path as a property and construct the <copy>
task from it.
cheers,
barneyb
On Thu, Nov 20, 2008 at 11:01 AM, Dan Vega <danvega@gmail.com> wrote:
----- Excess quoted text cut - see Original Post for more -----
Author: Dan Vega
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58148#315718
Well here is the problem, our www folder has about 100 folders in it. I may
make some changes to folder x and I just want to push folder x to test &
production or just test. Should I not use ant for this? Just write bat for
this?
Thank You
Dan Vega
danvega@gmail.com
http://www.danvega.org
On Thu, Nov 20, 2008 at 1:49 PM, Barney Boisvert
<bboisvert@gmail.com>wrote:
----- Excess quoted text cut - see Original Post for more -----
Author: Barney Boisvert
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58148#315716
Ant accepts properties on the command line that can be used to
parameterize your script. Though if all you're doing is replicating
files, something like rsync and a simple shell script/BAT file might
be easier.
cheers,
barneyb
On Thu, Nov 20, 2008 at 8:45 AM, Dan Vega <danvega@gmail.com> wrote:
----- Excess quoted text cut - see Original Post for more -----
Author: Dan Vega
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58148#315701
In the current environment I am working on we have a dev/test/prod setup.
Everything needs to be done in dev but not everything in dev gets moved.
Only files that need to be reviewed get moved to test so the Test env is not
always current. I am trying to come up with a solution that allows me to
enter a file or dir and then select test/live/all to move file(s) or
directories.
For example I am using the input paramater. If I use the following build
script It works great for moving files. I also know how to work with
directories, my main question is how can I make it dynamic so if I enter a
file or folder it knows to only push that?
<?xml version="1.0" encoding="UTF-8"?>
<project default="test">
<description>.com build file</description>
<input message="Target file or directory to copy: "
addproperty="target"/>
<input message="Environment we are copying to: " addproperty="ENV"
defaultvalue="test" validargs="test,live,all"/>
<property name="dev" value="\\mydevcom" />
<property name="test" value="\\mytestcom" />
<property name="live" value="\\mylivecom" />
<target name="test">
<copy file="${target}" todir="${test}" verbose="true"/>
</target>
<target name="live">
<copy file="${target}" todir="${live}" verbose="true"/>
</target>
<target name="all" depends="test,live"/>
</project>
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||