MIFOSX-1758 Make the dist ZIP include the community-app in apps/ via Git submodule

Root build.sh, for both back-end and front-end
Added -Penv=dev to incl. MariaDBj4
Include apps/**/* in ZIP, fixed UI URL in launcher, some doc
Set submodule Git rev to one that actually exists on remote
Don't use 'git submodule update --remote' but foreach ..
build-cloudbees.sh makes npm available
Better logging, and trying dev and prod dist UI
This commit is contained in:
Michael Vorburger
2015-03-17 23:22:43 +01:00
parent f440f294ad
commit ac75cc9ba6
8 changed files with 102 additions and 14 deletions
+4
View File
@@ -0,0 +1,4 @@
[submodule "apps/community-app"]
path = apps/community-app
url = https://github.com/openMF/community-app.git
branch = develop
+14
View File
@@ -3,6 +3,20 @@ Mifos Platform Apps
Community created apps built on top of mifosplatform are stored in source control repository @ https://github.com/openMF/
To get the Git sub modules from here, use "--recursive" in your original git clone, or, if already cloned, do:
git submodule update --init --recursive; git submodule status
Later to update both this main repo but also get the latest from the submodule(s), do:
git pull; git submodule update --remote
Here is how a new Git submodule can (was originally) added here:
git submodule add -b develop https://github.com/openMF/community-app.git
git submodule init
The Community App (AngularJS-based)
===============
https://github.com/openMF/community-app
Submodule apps/community-app added at e4cf52eb74
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
# https://developer.cloudbees.com/bin/view/DEV/Node+Builds
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.11.12 . ./use-node
./build.sh
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Exit the script if any command returns a non-true return value (http://www.davidpashley.com/articles/writing-robust-shell-scripts/)
set -e
git --version
# TODO UNCOMMENT THIS once https://github.com/openMF/mifosx/pull/1291 is merged!
# git pull
# This does NOT get the most recent revision from the submodule repository.
# Instead, it only gets the revision of the submodule that is recorded in the revision of the main repository.
## NOT git submodule update --remote
# The following is very important, because even if the main (API) repo is latest,
# the sub-module initially will be a fixed old rev. and only this grabs real latest:
git submodule foreach 'git checkout develop && git pull --ff-only origin develop'
cd apps/community-app
./build.sh
cd ../../mifosng-provider/
./gradlew -Penv=dev clean dist
+1 -1
View File
@@ -78,7 +78,7 @@ task dist(type:Zip){
}
from('../apps') {
fileMode = 0755
include '*.md'
include '**/*'
into('apps')
}
from('src/main/pentahoReports/') {
+8 -1
View File
@@ -11,7 +11,7 @@ along with all the other source files inside a (sub-folder of) the "apps" folder
directory from where runmifosx.bat/.sh is launched. The web UI front-end is then accessible
under mifosng-provider/apps - for example:
https://localhost:8443/mifosng-provider/apps/community-app/index.html
https://localhost:8443/mifosng-provider/apps/community-app/dist/community-app/index.html?baseApiUrl=https://localhost:8443&tenantIdentifier=default#/home
We hope you'll have an amazing experience working with MifosX!
@@ -21,3 +21,10 @@ the Mifos X distribution ZIP package will (currently) have to be built using
the Gradle 'dev' environment profile - e.g. using this command:
./gradlew -Penv=dev clean war dist
We now also have a script which convenently prepares both the
UI front-end and the API back-end together into a ZIP:
git clone --recursive https://github.com/openMF/mifosx/
git submodule update --init --recursive; git submodule status
./build.sh
@@ -5,19 +5,21 @@
*/
package org.mifosplatform;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import org.mifosplatform.infrastructure.core.boot.AbstractApplicationConfiguration;
import org.mifosplatform.infrastructure.core.boot.ApplicationExitUtil;
import org.mifosplatform.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration;
import org.mifosplatform.infrastructure.core.boot.db.MariaDB4jDataSourceConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.Resource;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
/**
* Mifos main() application which launches Mifos X in an embedded Tomcat HTTP
* server (using Spring Boot), as well as an embedded database (using
@@ -32,26 +34,59 @@ import java.net.URI;
* @see ServerApplication for the same without the embedded MariaDB4j database
*/
public class ServerWithMariaDB4jApplication {
private final static Logger logger = LoggerFactory.getLogger(ServerWithMariaDB4jApplication.class);
@Import({ MariaDB4jDataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
public static class Configuration extends AbstractApplicationConfiguration { }
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
if (Desktop.isDesktopSupported()) {
Resource resource = ctx.getResource("file:" + System.getProperty("user.dir") +
if (!Desktop.isDesktopSupported()) {
logger.info("Not going to open UI homepage in local web browser, because !Desktop.isDesktopSupported()");
} else {
// apps/community-app/dist/community-app/index.html
Resource distResource = ctx.getResource("file:" + System.getProperty("user.dir") +
System.getProperty("file.separator") + "apps" +
System.getProperty("file.separator") + "community-app" +
System.getProperty("file.separator") + "dist" +
System.getProperty("file.separator") + "community-app" +
System.getProperty("file.separator") + "index.html");
if (resource.exists()) {
try {
Desktop.getDesktop().browse(URI.create("https://localhost:8443/mifosng-provider" +
"/apps/community-app/index.html?baseApiUrl=https://localhost:8443" +
"&tenantIdentifier=default#/"));
} catch (IOException e) {}
URI distURI = URI.create("https://localhost:8443/mifosng-provider" +
"/apps/community-app/dist/community-app/index.html?baseApiUrl=https://localhost:8443" +
"&tenantIdentifier=default#/");
// apps/community-app/app/index.html
Resource devResource = ctx.getResource("file:" + System.getProperty("user.dir") +
System.getProperty("file.separator") + "apps" +
System.getProperty("file.separator") + "community-app" +
System.getProperty("file.separator") + "app" +
System.getProperty("file.separator") + "index.html");
URI devURI = URI.create("https://localhost:8443/mifosng-provider" +
"/apps/community-app/app/index.html?baseApiUrl=https://localhost:8443" +
"&tenantIdentifier=default#/");
if (distResource.exists()) {
openWebBrowser(distURI);
} else if (devResource.exists()) {
openWebBrowser(devURI);
} else {
logger.error("Cannot open Mifos X UI in browser; not found: " + distResource.toString());
}
}
// TODO Tray Icon stuff; dig out my very own old @see https://github.com/mifos/head/tree/hudsonBuild-MIFOS-5157_Launch4j-EXE_NewDist-squash1/server-jetty/src/main/java/org/mifos/server/tray
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
}
private static void openWebBrowser(URI uri) {
try {
logger.info("Opening Mifos X UI in browser: " + uri.toString());
Desktop.getDesktop().browse(uri);
} catch (IOException e) {
logger.error("IOException when opening Mifos X UI in browser: " + uri.toString(), e);
}
}
}