History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-1298
Type: Task Task
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Major Major
Assignee: Robin Shen
Reporter: esya
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Running Groovy script to create file but not able to see file

Created: 26/Jun/12 11:30 PM   Updated: 27/Jun/12 01:37 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 All   Comments   Work Log   Change History      Sort Order:
esya [27/Jun/12 01:37 AM]
Thank you very much.

I checked. All the files I downloaded are under bin because I did not create workspace directory.

Robin Shen [27/Jun/12 01:31 AM]
I just tried and below works for me:

groovy:
address = "http://xx.com/file.zip" // I am trying http since I do not find a ftp source to download)

file = new FileOutputStream(new File(configuration.workspaceDir, "download.zip")) // make sure to create file under workspace directory explicitly; otherwise, files will be created under working directory of the process, which is "<QB install dir>/bin"

new BufferedOutputStream(file) << new URL(address).openStream()

esya [27/Jun/12 12:47 AM]
Yes I am able to run this script out side and I checked the downloaded files they are exactly same.

Robin Shen [27/Jun/12 12:46 AM]
Are you able to run this script outside of QB successfully (using groovy shell or something else)? If not, it is rather a groovy problem then.

esya [27/Jun/12 12:41 AM]
Thank you this worked for me.

But still I am not able to get the files for the following script

groovy:
address = "ftp://xx.com/file.zip"

file = new FileOutputStream("download.zip")

new BufferedOutputStream(file) << new URL(address).openStream()

Robin Shen [27/Jun/12 12:26 AM]
To create an empty file, please try this:
new File(configuration.workspaceDir, "build_status.txt").text = ""

esya [27/Jun/12 12:10 AM]
Could you please let me know why I am able to get the file when the script is like this:

groovy:
new File(configuration.workspaceDir, "build_status.txt").text = build.status.name();

But I am not able to get when script is like this:

groovy:
new File(configuration.workspaceDir, "build_status.txt")

Can I create an empty file?

esya [26/Jun/12 11:54 PM]
First sorry for this simple question. I am new at QuickBuild

It is a very simple script.

groovy:
import java.io.File;
new File("build_log.txt");

The configuration runs successfully but I do not see the file.

Robin Shen [26/Jun/12 11:38 PM]
Can you please show me your script?