Skip to content

Commit 6282e0b

Browse files
committed
Added sourceRootFolder setting
with an explanation in README
1 parent 4656288 commit 6282e0b

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ If you don't have PyCharm you can get it from here: https://www.jetbrains.com/py
4444
<entry key="password">admin</entry>
4545
<entry key="domain">Global</entry>
4646
<!-- Simple patterns to filter when sending the driver to the server separated by semicolons (e.g. "file.xml;logs/"),
47-
on top of the patterns specified here the plugin will automatically filter the "deployment/" and ".idea/" folders and the "deployment.xml" file -->
47+
on top of the patterns specified here the plugin will automatically filter the "deployment/" and ".idea/" folders and the "deployment.xml" file -->
4848
<entry key="fileFilters">dont_upload_me.xml</entry>
49+
<!-- The folder to refer to as the project source root (if specified, the folder will be zipped
50+
and deployed instead of the whole project), defaults to the root project folder -->
51+
<entry key="sourceRootFolder">src/MyDriver/</entry>
4952
</properties>
5053
```
5154

src/com/qualisystems/pythonDriverPlugin/DriverPublisherSettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class DriverPublisherSettings {
1313
String password;
1414
String domain;
1515
String[] fileFilters;
16+
String sourceRootFolder;
1617

1718
private static final String[] DefaultFileFilters = new String[] { ".idea", "deployment", "deployment.xml" };
1819

@@ -32,6 +33,7 @@ public static DriverPublisherSettings fromProperties(Properties deploymentProper
3233
settings.username = deploymentProperties.getProperty("username", "admin");
3334
settings.password = deploymentProperties.getProperty("password", "admin");
3435
settings.domain = deploymentProperties.getProperty("domain", "Global");
36+
settings.sourceRootFolder = deploymentProperties.getProperty("sourceRootFolder", null);
3537

3638
String fileFiltersValue = deploymentProperties.getProperty("fileFilters", "");
3739

src/com/qualisystems/pythonDriverPlugin/QualiPublishDriverAction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.intellij.openapi.actionSystem.AnAction;
44
import com.intellij.openapi.actionSystem.AnActionEvent;
55
import com.intellij.openapi.actionSystem.CommonDataKeys;
6+
import com.intellij.openapi.fileEditor.FileDocumentManager;
67
import com.intellij.openapi.progress.ProgressIndicator;
78
import com.intellij.openapi.progress.ProgressManager;
89
import com.intellij.openapi.progress.Task;
@@ -28,6 +29,8 @@ public void actionPerformed(AnActionEvent anActionEvent) {
2829

2930
if (project == null) return;
3031

32+
FileDocumentManager.getInstance().saveAllDocuments();
33+
3134
final File deploymentSettingsFile = new File(project.getBasePath(), DeploymentSettingsFileName);
3235

3336
if (!deploymentSettingsFile.exists()) {
@@ -102,6 +105,9 @@ private File zipProjectFolder(String directory, DriverPublisherSettings settings
102105

103106
Path deploymentFilePath = Paths.get(directory, "deployment", settings.driverUniqueName + ".zip");
104107

108+
if (settings.sourceRootFolder != null && !settings.sourceRootFolder.isEmpty())
109+
directory = Paths.get(directory, settings.sourceRootFolder).toString();
110+
105111
zipHelper.zipDir(directory, deploymentFilePath.toString());
106112

107113
return deploymentFilePath.toFile();

src/com/qualisystems/pythonDriverPlugin/ZipHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.zip.ZipEntry;
1010
import java.util.zip.ZipOutputStream;
1111

12-
class ZipHelper {
12+
public class ZipHelper {
1313

1414
private final String[] _filters;
1515

0 commit comments

Comments
 (0)