House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Ant build

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dan Vega
11/20/2008 11:52 AM

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>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Barney Boisvert
11/20/2008 01:56 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dan Vega
11/20/2008 02:08 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Barney Boisvert
11/20/2008 02:31 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dan Vega
11/20/2008 02:48 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dan Vega
11/20/2008 02:52 PM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jochem van Dieten
11/20/2008 03:33 PM

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


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

March 21, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   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