This task works great as long as you're not logging. That's why I've
created a Swing-based task to handle getting input. If anyone's
interested, let me know and I'll send it to you.
-- Don
--- Matthew Inger <[EMAIL PROTECTED]> wrote:
> why not? what's wrong with prompting the user for input?
>
> I'll even supply the task................ (see attachment)
>
>
> Filip Cruz wrote:
>
> > Thanks, Paul
> > I'll give it a try.
> >
> > At 11:36 AM 7/26/2001 -0400, you wrote:
> >
> >> I'm doing SSH deployment using SecureCRT.
> >> SecureCRT has VCP command line utility to transfer files over SSH.
> >> One problem - you can't input password during deployment so I'm
> >> providing it
> >> in a password file.
> >>
> >> Here is an example of target:
> >>
> >> <target name="doSSH" description="Copies file to remote server
> over
> >> SSH.">
> >> <!-- Secure CRT location -->
> >> <property name="vcp.dir" value="C:\Progra~1\Secure~1.0"/>
> >> <property name="pwd.file" value="pwd"/>
> >> <property name="pwd" value="xxxxx"/>
> >>
> >> <echo message="Copying ${source.file} to ${dest.dir} at
> >> XXXX..."/>
> >> <!-- Create password file -->
> >> <echo message="${pwd}" file="${source.dir}/${pwd.file}"/>
> >> <exec dir="${source.dir}" executable="cmd">
> >> <arg line="/S /C ${vcp.dir}\vcp.exe ${source.file}
> >> [EMAIL PROTECTED]:${dest.dir} < ${pwd.file}"/>
> >> </exec>
> >> <!-- delete password file when we've done -->
> >> <delete file="${source.dir}/${pwd.file}"/>
> >> </target>
> >>
> >> Good luck,
> >>
> >> Paul Perevalov,
> >> Bridium,Inc.
> >>
> >> -----Original Message-----
> >> From: Filip Cruz [mailto:[EMAIL PROTECTED]]
> >> Sent: Thursday, July 26, 2001 11:18 AM
> >> To: [EMAIL PROTECTED]
> >> Subject: Re: Using Ant with SSH
> >>
> >>
> >> Sorry,
> >> I am trying to use Ant to deploy to our production servers through
>
> >> SSH. In
> >> brief I want to be able to deploy the files over SSH to the server
>
> >> from a
> >> task in the Ant build.xml file. I am using a Win2K client and I
> have SSH
> >> Secure Shell client and SecureCRT.
> >>
> >> Is there a way to deploy over SSH from Ant?? If so, how is it
> done?
> >
> >
> >
> >
>
>
> > /*
>
>
******************************************************************************
> * $RCSfile: Prompt.java,v $ $Revision: 1.3 $ $Date: 2001/06/15
> 20:30:57 $
>
>
******************************************************************************
> */
> import org.apache.tools.ant.BuildException;
> import org.apache.tools.ant.Project;
> import org.apache.tools.ant.Task;
> import java.io.LineNumberReader;
> import java.io.InputStreamReader;
> import java.io.IOException;
> import java.util.ArrayList;
> import java.util.List;
>
> /***
> * Task definition for the ANT task to prompt the user for
> information
> * Usage:
> *
> * Task declaration in the project:
> * <taskdef name="prompt" classname="Prompt" />
> *
> * Task calling syntax:
> * <prompt message="message" propertyname="propname"
> * [defaultvalue="value" | allowempty="true|false"]
> * >
> * [ <allow value="value" ]*
> * </prompt>
> *
> * Attributes:
> * message -> The message to display to the user
> * propertyname -> The name of the property to set with the
> received input
> * defaultValue -> The default value if the user just hits
> enter
> * allowempty -> Whether or not an empty value is allowed
> *
> * Subitems:
> * <allow value="value" /> --> allow this value to be input.
> By supplying
> * one or more of this subitem,
> you limit the
> * input to a range of specific
> allowable
> * values. Any value input that
> is not explicitly
> * allowed is rejected. (good for
> y/n questions)
> *
> * Notes:
> * 1. The defaultvalue and allowempty attributes are mutually
> exclusive,
> * and if both are specified, the defaultvalue attribute
> takes precedence.
> */
> public class Prompt extends Task
> {
> private String message;
> private String defaultValue;
> private String propertyName;
> private boolean allowEmpty;
> private List allows;
>
> /***
> * Default Constructor
> */
> public Prompt()
> {
> allows = new ArrayList();
> allowEmpty = true;
> }
>
> public void execute()
> throws BuildException
> {
> if (message == null)
> throw new BuildException("Message is missing");
> if (propertyName == null)
> throw new BuildException("PropertyName is missing");
>
> if (defaultValue != null && allows.size() > 0)
> {
> if (! allows.contains(new Allow(defaultValue)))
> throw new BuildException("Default Value is not in the
> set of allowed values.");
> }
>
> StringBuffer sb = new StringBuffer();
> sb.append(message);
> sb.append(" ");
>
> int asize = allows.size();
> if (asize > 0)
> {
> sb.append(" (");
> for (int i=0;i<asize;i++)
> {
> if (i != 0) sb.append(',');
> sb.append(allows.get(i));
> }
> sb.append(") ");
> }
>
> if (defaultValue != null)
> {
> sb.append('[');
> sb.append(defaultValue);
> sb.append(']');
> sb.append(" : ");
> }
>
> boolean done = false;
> LineNumberReader lnr = new LineNumberReader(new
> InputStreamReader(System.in));
>
> String inputValue = "";
>
> while (! done)
> {
> System.out.print(sb.toString());
>
> try
> {
> inputValue = lnr.readLine();
>
> if ((defaultValue != null) &&
> (inputValue.trim().length() == 0))
> {
> inputValue = defaultValue;
> done = true;
> }
> else if (allows.size() > 0)
> {
> if (allows.contains(new Allow(inputValue)) ||
> (defaultValue != null &&
> inputValue.trim().equals(defaultValue)))
> {
> done = true;
> }
> }
> else
> {
> done = true;
> }
> }
> catch (IOException e)
> {
> throw new BuildException(e);
> }
>
> if (defaultValue != null && inputValue.trim().length() ==
> 0)
> {
> inputValue = defaultValue;
> }
>
> if (! allowEmpty && inputValue.trim().length() == 0)
> done = false;
>
> if (! done)
> System.out.println(" Invalid value: '" + inputValue
> + "'");
> }
>
> Project p = getProject();
> p.setUserProperty(propertyName, inputValue);
> }
>
> /***
> * Sets the prompt message
> */
> public void setMessage(String message)
> {
> this.message = message;
> }
>
> /***
> * Sets the defaultValue that is used if the user just hits
> return
> */
> public void setDefaultValue(String defaultValue)
> {
> this.defaultValue = defaultValue;
> }
>
> public void setAllowEmpty(String allowEmpty)
> {
> try
> {
> this.allowEmpty =
> Boolean.valueOf(allowEmpty).booleanValue();
> }
> catch (Exception e)
> {
> this.allowEmpty = true;
> }
> }
>
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/