use of org.rstudio.studio.client.rsconnect.model.RSConnectPublishSource in project rstudio by rstudio.
the class RSConnect method publishAsCode.
private void publishAsCode(RSConnectActionEvent event, String websiteDir, boolean isShiny) {
RSConnectPublishSource source = null;
if (event.getContentType() == CONTENT_TYPE_APP || event.getContentType() == CONTENT_TYPE_APP_SINGLE) {
if (StringUtil.getExtension(event.getPath()).equalsIgnoreCase("r")) {
FileSystemItem rFile = FileSystemItem.createFile(event.getPath());
// use the directory for the deployment record when publishing
// directory-based apps; use the file itself when publishing
// single-file apps
source = new RSConnectPublishSource(rFile.getParentPathString(), event.getContentType() == CONTENT_TYPE_APP ? rFile.getParentPathString() : rFile.getName());
} else {
source = new RSConnectPublishSource(event.getPath(), event.getPath());
}
} else {
source = new RSConnectPublishSource(event.getPath(), websiteDir, false, false, isShiny, null, event.getContentType());
}
publishAsFiles(event, source);
}
use of org.rstudio.studio.client.rsconnect.model.RSConnectPublishSource in project rstudio by rstudio.
the class RSConnect method deployToRSConnect.
private void deployToRSConnect(String sourceFile, String deployDir, String deployFile, String websiteDir, String description, JsArrayString deployFiles, JsArrayString additionalFiles, JsArrayString ignoredFiles, boolean isSelfContained, boolean isShiny, boolean asMultiple, boolean asStatic, boolean launch, JavaScriptObject jsoRecord) {
// front if we can
if (Desktop.isDesktop())
Desktop.getFrame().bringMainFrameToFront();
else
WindowEx.get().focus();
ArrayList<String> deployFilesList = JsArrayUtil.fromJsArrayString(deployFiles);
ArrayList<String> additionalFilesList = JsArrayUtil.fromJsArrayString(additionalFiles);
ArrayList<String> ignoredFilesList = JsArrayUtil.fromJsArrayString(ignoredFiles);
RSConnectDeploymentRecord record = jsoRecord.cast();
events_.fireEvent(new RSConnectDeployInitiatedEvent(new RSConnectPublishSource(sourceFile, deployDir, deployFile, websiteDir, isSelfContained, asStatic, isShiny, description), new RSConnectPublishSettings(deployFilesList, additionalFilesList, ignoredFilesList, asMultiple, asStatic), launch, record));
}
use of org.rstudio.studio.client.rsconnect.model.RSConnectPublishSource in project rstudio by rstudio.
the class RSConnect method publishAsStatic.
private void publishAsStatic(RSConnectPublishInput input) {
RSConnectPublishSource source = null;
if (input.getContentType() == RSConnect.CONTENT_TYPE_DOCUMENT || input.getContentType() == RSConnect.CONTENT_TYPE_WEBSITE) {
source = new RSConnectPublishSource(input.getOriginatingEvent().getFromPreview(), input.getWebsiteDir(), input.isSelfContained(), true, input.isShiny(), input.getDescription());
} else {
source = new RSConnectPublishSource(input.getOriginatingEvent().getHtmlFile(), input.getWebsiteDir(), input.isSelfContained(), true, input.isShiny(), input.getDescription(), input.getContentType());
}
publishAsFiles(input.getOriginatingEvent(), source);
}
use of org.rstudio.studio.client.rsconnect.model.RSConnectPublishSource in project rstudio by rstudio.
the class RSConnect method showPublishUI.
private void showPublishUI(final RSConnectActionEvent event) {
final RSConnectPublishInput input = new RSConnectPublishInput(event);
// set these inside the wizard input so we don't need to pass around
// session/prefs
input.setConnectUIEnabled(pUiPrefs_.get().enableRStudioConnect().getGlobalValue());
input.setExternalUIEnabled(session_.getSessionInfo().getAllowExternalPublish());
input.setDescription(event.getDescription());
if (event.getFromPrevious() != null) {
switch(event.getContentType()) {
case CONTENT_TYPE_APP:
case CONTENT_TYPE_APP_SINGLE:
publishAsCode(event, null, true);
break;
case CONTENT_TYPE_PRES:
case CONTENT_TYPE_PLOT:
case CONTENT_TYPE_HTML:
case CONTENT_TYPE_DOCUMENT:
case CONTENT_TYPE_WEBSITE:
if (event.getFromPrevious().getServer().equals("rpubs.com")) {
publishAsRPubs(event);
} else {
fillInputFromDoc(input, event.getPath(), new CommandWithArg<RSConnectPublishInput>() {
@Override
public void execute(RSConnectPublishInput arg) {
if (arg == null)
return;
if (event.getFromPrevious().getAsStatic())
publishAsFiles(event, new RSConnectPublishSource(event.getPath(), event.getHtmlFile(), arg.getWebsiteDir(), arg.isSelfContained(), true, arg.isShiny(), arg.getDescription(), event.getContentType()));
else
publishAsCode(event, arg.getWebsiteDir(), arg.isShiny());
}
});
}
break;
}
} else {
// plots and HTML are implicitly self-contained
if (event.getContentType() == CONTENT_TYPE_PLOT || event.getContentType() == CONTENT_TYPE_HTML || event.getContentType() == CONTENT_TYPE_PRES) {
input.setIsSelfContained(true);
}
// if R Markdown, get info on what we're publishing from the server
if (event.getFromPreview() != null) {
input.setSourceRmd(FileSystemItem.createFile(event.getFromPreview().getSourceFile()));
fillInputFromDoc(input, event.getFromPreview().getSourceFile(), new CommandWithArg<RSConnectPublishInput>() {
@Override
public void execute(RSConnectPublishInput arg) {
showPublishUI(arg);
}
});
} else {
showPublishUI(input);
}
}
}
Aggregations