Author: hqm
Date: 2007-07-19 09:06:26 -0700 (Thu, 19 Jul 2007)
New Revision: 5702
Modified:
openlaszlo/branches/legals/lps/admin/solo-deploy.jsp
openlaszlo/branches/legals/lps/admin/solo-dhtml-deploy.jsp
Log:
Change 20070719-hqm-8 by [EMAIL PROTECTED] on 2007-07-19 11:31:33 EDT
in /cygdrive/c/users/hqm/openlaszlo/legals3
for http://svn.openlaszlo.org/openlaszlo/branches/legals
Summary: don't grab .svn files in a SOLO deployment zip files
New Features:
Bugs Fixed: LPP-4281
Technical Reviewer: josh (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
this was fixed in the DHTML deploy wizard, but never got fixed in the solo
deploy script
+ use date to generate unique zipfile name, to avoid overwriting the tmp file
on the server
(copied from dhtml jsp)
Tests:
Modified: openlaszlo/branches/legals/lps/admin/solo-deploy.jsp
===================================================================
--- openlaszlo/branches/legals/lps/admin/solo-deploy.jsp 2007-07-19
06:43:30 UTC (rev 5701)
+++ openlaszlo/branches/legals/lps/admin/solo-deploy.jsp 2007-07-19
16:06:26 UTC (rev 5702)
@@ -4,6 +4,7 @@
<%@ page import="java.util.regex.*" %>
<%@ page import="java.util.zip.*" %>
<%@ page import="java.io.*" %>
+<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="org.openlaszlo.utils.FileUtils.*" %>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
@@ -35,7 +36,11 @@
// Set this to make a limit on the size of zip file that is created
int maxZipFileSize = 64000000; // 64MB max
+int warnZipFileSize = 10000000; // warn at 10MB
+boolean warned = false;
+String zipfilename = "";
+
String whatpage = request.getParameter("whatpage");
if (whatpage == null) {
whatpage = "configure";
@@ -330,7 +335,10 @@
try {
// Create the ZIP file
- String outFilename = "solo-deploy.zip";
+ SimpleDateFormat format =
+ new SimpleDateFormat("EEE_MMM_dd_yyyy_HH_mm_ss");
+ String outFilename = "solo_deploy_" + format.format(new Date()) +
".zip";
+ zipfilename = outFilename;
ZipOutputStream zout = new ZipOutputStream(new
FileOutputStream(tmpdir+"/"+outFilename));
// create a byte array from lzhistory wrapper text
@@ -357,8 +365,8 @@
in.close();
}
- // track how big the file is, check that we don't write more than some
limit
- int contentSize = 0;
+ // track how big the file is, check that we don't write more than some
limit
+ int contentSize = 0;
// Compress the app files
for (int i=0; i<appfiles.size(); i++) {
@@ -375,16 +383,31 @@
// Transfer bytes from the file to the ZIP file
int len;
while ((len = in.read(buf)) > 0) {
- contentSize += len;
+ contentSize += len;
zout.write(buf, 0, len);
}
// Complete the entry
zout.closeEntry();
in.close();
- if (contentSize > maxZipFileSize) {
- throw new IOException("file length exceeds max of "+
(maxZipFileSize/1000000) +"MB");
+ if (contentSize > maxZipFileSize) {
+ throw new IOException("file length exceeds max of "+
(maxZipFileSize/1000000) +"MB");
}
+
+ if (contentSize > warnZipFileSize && !warned) {
+
+ warned = true;
+ %>
+ <h3><font color="red">The zip file has had more than <%=
warnZipFileSize / 1000000 %>MB of content added to it, perhaps this is what you
intended, but remember that the SOLO deployment tool creates an
+archive of all files, recursively, from the directory that
+contains your specified application source file. If your application source
file
+is in a directory with other apps, this tool will create a zip that
+ contains all those apps and their assets (and
subdirectories) as well.
+</h3>
+
+
+ <% }
+
}
// Complete the ZIP file
@@ -401,7 +424,7 @@
-Click here to <a href="solo-deploy.zip">download <tt>solo-deploy.zip</tt></a>
zipfile.
+Click here to download zip-archived file <a
href="<%=zipfilename%>"><tt><%=zipfilename%></tt></a>.
<p>
In the zip file, a wrapper HTML file named <tt><%= htmlfile %></tt> has been
created
to launch your SOLO application.
@@ -505,14 +528,18 @@
<%!
// utility methods
+
public void listFiles(ArrayList fnames, File dir) {
- if (dir.isDirectory()) {
- String[] children = dir.list();
- for (int i=0; i<children.length; i++) {
- listFiles(fnames, new File(dir, children[i]));
- }
- } else {
- fnames.add(dir.getPath());
- }
+ if (dir.isDirectory()) {
+ if (!(dir.getName().startsWith(".svn"))) {
+ String[] children = dir.list();
+ for (int i=0; i<children.length; i++) {
+ listFiles(fnames, new File(dir, children[i]));
+ }
+ }
+ } else {
+ fnames.add(dir.getPath());
}
+ }
+
%>
Modified: openlaszlo/branches/legals/lps/admin/solo-dhtml-deploy.jsp
===================================================================
--- openlaszlo/branches/legals/lps/admin/solo-dhtml-deploy.jsp 2007-07-19
06:43:30 UTC (rev 5701)
+++ openlaszlo/branches/legals/lps/admin/solo-dhtml-deploy.jsp 2007-07-19
16:06:26 UTC (rev 5702)
@@ -52,7 +52,8 @@
// Set this to make a limit on the size of zip file that is created
int maxZipFileSize = 64000000; // 64MB max
-int warnZipFileSize = 6000000; // warn at 6MB
+int warnZipFileSize = 10000000; // warn at 10MB of content (before compression)
+boolean warned = false;
String zipfilename = "";
@@ -379,10 +380,10 @@
try {
// Create the ZIP file
- SimpleDateFormat format =
- new SimpleDateFormat("EEE_MMM_dd_yyyy_HH_mm_ss");
+ SimpleDateFormat format =
+ new SimpleDateFormat("EEE_MMM_dd_yyyy_HH_mm_ss");
String outFilename = "solo_deploy_" + format.format(new Date()) +
".zip";
- zipfilename = outFilename;
+ zipfilename = outFilename;
ZipOutputStream zout = new ZipOutputStream(new
FileOutputStream(tmpdir+"/"+outFilename));
// create a byte array from lzhistory wrapper text
@@ -446,8 +447,11 @@
throw new IOException("file length exceeds max of "+
(maxZipFileSize/1000000) +"MB");
}
- if (contentSize > warnZipFileSize) { %>
- <h3><font color="red">The zip file size is more than <%=
warnZipFileSize / 1000000 %>MB, perhaps this is what you intended, but remember
that the SOLO deployment tool creates an
+ if (contentSize > warnZipFileSize && !warned) {
+
+ warned = true;
+ %>
+ <h3><font color="red">The zip file has had more than <%=
warnZipFileSize / 1000000 %>MB of content added to it, perhaps this is what you
intended, but remember that the SOLO deployment tool creates an
archive of all files, recursively, from the directory that
contains your specified application source file. If your application source
file
is in a directory with other apps, this tool will create a zip that
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins