Re: [NAnt-users] Input prompting ...

2009-11-03 Thread Bob Archer
The only thing I could think would be to exec a bat file that prompts for a 
value and writes it to a text file or something. I pretty much think nant is 
designed for non-attended use.

BOb


From: Parrish, Ken [mailto:kparr...@gomez.com]
Sent: Tuesday, November 03, 2009 9:34 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Input prompting ...

Nant Users,

Is there a task that can be used to prompt a user for input of a property?  I'd 
like to design some tasks which will prompt the user for input of a property if 
the property was not specified on the command line.  I looked in both Nant and 
NantContrib and didn't see anything.  Am I missing something?

Ken Parrish
Gomez, Inc.
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


Re: [NAnt-users] Input prompting ...

2009-11-03 Thread Torben Rohde
I once did the bat-file-method as Bob suggests, but I also wrapped it in a
VB script (not the ultimate best-practice but it worked :-)

Here's my code for inspiration if you decide to take that route:

.vbs file:

   dim newline : newline = Chr(13)  Chr(10)

   dim strApplicationMetaname
   strApplicationMetaname = 


   '--- Main program run ---

  strApplicationMetaname = GetApplicationMetanameFromUser

  If strApplicationMetaname =  Or IsNull(strApplicationMetaname) Then
MsgBox No application name specified - aborting build  +
   strApplicationMetaname, vbOKOnly + vbExclamation, No application name
   specified
  Else
Call CallBuild(strApplicationMetaname)
  End If


   '--- Misc ---

  Function GetApplicationMetanameFromUser()

dim userInput
userInput = InputBox(Enter the name of the application
   instance you wish to build (e.g. MyCompany) + newline + (this will
   determine names of services etc. - e.g. if you enter MyCompany, the
   merger will be named MergerMyCompany), Enter application metaname)
GetApplicationMetanameFromUser = userInput

  End Function


  Function CallBuild(strApplicationMetanameParm)

dim objWSHShell
Set objWSHShell = WScript.CreateObject(WScript.Shell)
objWSHShell.CurrentDirectory = .\merger\
Call objWSHShell.Run(build_and_deploy.bat  +
   strApplicationMetanameParm +  v1_2_3, 1, true)

  End Function

.bat file called by VB script:

   @ECHO OFF
   IF %1 ==  GOTO NoNameSpecified
   IF %2 ==  GOTO NoVersionSpecified

   nant /f:builds/merger_build_and_deploy.nant.build -D:MergerName=%1
   -D:MergerVersion=%2

   GOTO EndProgram


   :NoNameSpecified
   ECHO ---
   ECHO This bat file can not be run directly. (name not set)
   ECHO Use the corresponding VBScript merger_build_and_deploy.vbs
   instead
   ECHO ---
   GOTO EndProgram

   :NoVersionSpecified
   ECHO ---
   ECHO This bat file can not be run directly. (version not set)
   ECHO Use the corresponding VBScript merger_build_and_deploy.vbs
   instead
   ECHO ---
   GOTO EndProgram

   :NoNameSpecified


   :EndProgram
   pause

Torben Rohde
Subsero A/S



   
 Bob Archer
 bob.arc...@amsi. 
 com  Til 
   Parrish, Ken  
 03-11-2009 15:49  kparr...@gomez.com,   
   nant-users@lists.sourceforge.net  
   nant-users@lists.sourceforge.net  
cc 
   
  Emne 
   Re: [NAnt-users] Input prompting
   ... 
   
   
   
   
   
   




The only thing I could think would be to exec a bat file that prompts for a
value and writes it to a text file or something. I pretty much think nant
is designed for non-attended use.

BOb


From: Parrish, Ken [mailto:kparr...@gomez.com]
Sent: Tuesday, November 03, 2009 9:34 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Input prompting ...

Nant Users,

Is there a task that can be used to prompt a user for input of a property?
I’d like to design some tasks which will prompt the user for input of a
property if the property was not specified on the command line.  I looked
in both Nant and NantContrib and didn’t see anything.  Am I missing
something?

Ken Parrish
Gomez, Inc.
--

Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Re: [NAnt-users] Input prompting ...

2009-11-03 Thread Michael Pento
Good Afternoon Folks,

 

I was just playing around with this and I was able to do it with a C#
script function in a target:

 

target name=getUserInput

script language=C# prefix=build

code![CDATA[

[Function(getInput)]

public static string getInput()

{

Console.WriteLine(Enter a string:
);

string s = Console.ReadLine();

 


return s.ToString();

}

]]/code

/script



property name=_str value=${build::getInput()} /

echo message= Input String: ${_str} /

/target

 

Executing this on my machine produces the following output:

 

C:\nant -f:test.build getUserInput

NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)

Copyright (C) 2001-2007 Gerry Shaw

http://nant.sourceforge.net

 

Buildfile: file:///C:/test.build

Target framework: Microsoft .NET Framework 3.5

Target(s) specified: getUserInput

 

[loadtasks] Scanning assembly NAnt.Contrib.Tasks for extensions.

[loadtasks] Scanning assembly broloco.NAntTasks for extensions.

   [script] Scanning assembly cb5myvqk for extensions.

 

getUserInput:

 

   [script] Scanning assembly vohtvvkh for extensions.

Enter a string:

This is a test string!!

 [echo]  Input String: This is a test string!!

 

BUILD SUCCEEDED

 

Total time: 8.4 seconds.

 

This stores the input into a property and you can do whatever you like
with it after that.

 

I hope this helps,

Mike

 



From: Parrish, Ken [mailto:kparr...@gomez.com] 
Sent: Tuesday, November 03, 2009 9:34 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Input prompting ...

 

Nant Users,

 

Is there a task that can be used to prompt a user for input of a
property?  I'd like to design some tasks which will prompt the user for
input of a property if the property was not specified on the command
line.  I looked in both Nant and NantContrib and didn't see anything.
Am I missing something?

 

Ken Parrish

Gomez, Inc.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


Re: [NAnt-users] Input prompting ...

2009-11-03 Thread Parrish, Ken
Mike,

This looks like it will work just fine.  I have a custom Nant extensions 
project and will add this in that DLL.

Thanks,

Ken Parrish
Gomez, Inc.

From: Michael Pento [mailto:mpe...@metratech.com] 
Sent: Tuesday, November 03, 2009 12:52 PM
To: Parrish, Ken; nant-users@lists.sourceforge.net
Subject: RE: [NAnt-users] Input prompting ...

Good Afternoon Folks,

I was just playing around with this and I was able to do it with a C# script 
function in a target:

target name=getUserInput
   script language=C# prefix=build
    code![CDATA[
        [Function(getInput)]
    public static string getInput()
    {
        Console.WriteLine(Enter a string: );
    string s = Console.ReadLine();
   
 
    return s.ToString();
    }
    ]]/code
    /script
    
    property name=_str value=${build::getInput()} /
    echo message= Input String: ${_str} /
/target

Executing this on my machine produces the following output:

C:\nant -f:test.build getUserInput
NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
Copyright (C) 2001-2007 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///C:/test.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: getUserInput

[loadtasks] Scanning assembly NAnt.Contrib.Tasks for extensions.
[loadtasks] Scanning assembly broloco.NAntTasks for extensions.
   [script] Scanning assembly cb5myvqk for extensions.

getUserInput:

   [script] Scanning assembly vohtvvkh for extensions.
Enter a string:
This is a test string!!
 [echo]  Input String: This is a test string!!

BUILD SUCCEEDED

Total time: 8.4 seconds.

This stores the input into a property and you can do whatever you like with it 
after that.

I hope this helps,
Mike


From: Parrish, Ken [mailto:kparr...@gomez.com] 
Sent: Tuesday, November 03, 2009 9:34 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Input prompting ...

Nant Users,

Is there a task that can be used to prompt a user for input of a property?  I'd 
like to design some tasks which will prompt the user for input of a property if 
the property was not specified on the command line.  I looked in both Nant and 
NantContrib and didn't see anything.  Am I missing something?

Ken Parrish
Gomez, Inc.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users