diff --git a/backend/generator.js b/backend/generator.js
index 3bbe26f3..2b43d054 100644
--- a/backend/generator.js
+++ b/backend/generator.js
@@ -16,6 +16,10 @@ exports.executeScript = function (socket, formData) {
var debug = formData.debug;
var uniqueId = uuidV4();
var webUI = "true";
+ var subProject = ""
+ if (formData.subProject != undefined) {
+ subProject = formData.subProject.join(",")
+ }
var donePercent = 0;
@@ -25,7 +29,8 @@ exports.executeScript = function (socket, formData) {
"-m", email,
"-d", debug,
"-u", uniqueId,
- "-w", webUI
+ "-w", webUI,
+ "-s", subProject
];
var process = spawn("./generate.sh", args);
diff --git a/generate.sh b/generate.sh
index 66c0e734..c16580cf 100755
--- a/generate.sh
+++ b/generate.sh
@@ -14,6 +14,18 @@ do
esac
done
+if [ -z "$ON_HEROKU" ]; then
+ # Create an isolated Python environment
+ echo -e "Creating an isolated Python environment\n"
+ virtualenv -q --python=python $HOME/yaydocvenv
+ source $HOME/yaydocvenv/bin/activate
+ echo -e "Python environment created successfully!\n"
+
+ # Install packages required for documentation generation
+ echo -e "Installing packages required for documentation generation\n"
+ pip install -q -r $BASE/requirements.txt
+ echo -e "Installation successful\n"
+fi
# Ensures that BASE has contents of yaydoc repository
# and change current directory to git repository.
if [ "${WEBUI:-false}" == "true" ]; then
@@ -40,18 +52,6 @@ REPONAME=(${URL_SPLIT[3]//./ })
ROOT_DIR=$(pwd)
-if [ -z "$ON_HEROKU" ]; then
- # Create an isolated Python environment
- echo -e "Creating an isolated Python environment\n"
- virtualenv -q --python=python $HOME/yaydocvenv
- source $HOME/yaydocvenv/bin/activate
- echo -e "Python environment created successfully!\n"
-
- # Install packages required for documentation generation
- echo -e "Installing packages required for documentation generation\n"
- pip install -q -r $BASE/requirements.txt
- echo -e "Installation successful\n"
-fi
# Setting environment variables
ENVVARS="$(python ${BASE}/modules/scripts/config.py "${USERNAME}" "${REPONAME}")"
diff --git a/public/scripts/form.js b/public/scripts/form.js
index 5492a8d5..60994068 100644
--- a/public/scripts/form.js
+++ b/public/scripts/form.js
@@ -10,6 +10,7 @@ $(function () {
if (validation.isValid(formData)) {
socket.emit('execute', formData);
$(this).attr("disabled", "none");
+ $("#subProject").attr("disabled", "none");
} else {
$('.notification').append($('
')).text(validation.getMessages());
$('#notification-container').css("visibility", "visible");
@@ -72,7 +73,18 @@ function getData() {
if (field.name === "git_url") { data.gitUrl = field.value.trim(); }
if (field.name === "doc_theme") { data.docTheme = field.value.trim(); }
if (field.name === "debug" ) { data.debug = field.value; }
+ if (field.name === "subproject_url[]") {
+ if (data.subProject == undefined) {
+ data.subProject = [field.value];
+ } else {
+ data.subProject.push(field.value);
+ }
+ }
});
return data;
}
+
+function addSubProject() {
+ $("#subproject").append(``)
+}
diff --git a/public/scripts/validation.js b/public/scripts/validation.js
index 98aaffe1..c2c83411 100644
--- a/public/scripts/validation.js
+++ b/public/scripts/validation.js
@@ -26,6 +26,15 @@
}
}
+ if (formData.subProject != undefined) {
+ for (var i = 0; i < formData.subProject.length; i++) {
+ regex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
+ if(!regex.test(formData.subProject[i])) {
+ messages.push("Invalid URL");
+ valid = false;
+ }
+ }
+ }
return valid;
},
diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css
index b93593d4..72d269cf 100644
--- a/public/stylesheets/style.css
+++ b/public/stylesheets/style.css
@@ -22,6 +22,10 @@ a {
text-align: left;
}
+#subProject_url{
+ margin-bottom: 8px;
+}
+
#messages li {
margin-bottom: 5px;
}
@@ -38,6 +42,11 @@ a {
margin-bottom: 20px;
}
+#subProject {
+ margin-bottom: 20px;
+ margin-left: 10px;
+}
+
#btnDownload {
display: none;
width: -moz-fit-content;
diff --git a/views/index.jade b/views/index.jade
index 6b3f9e42..93011051 100644
--- a/views/index.jade
+++ b/views/index.jade
@@ -16,6 +16,7 @@ block content
.form-group
label.control-label(for='git_url') GITURL:
select#git_url.form-control(type='text', placeholder='Enter URL of Github Repository', name='git_url')
+ .div#subproject
.form-group
label.control-label(for='doc_theme') Doc Theme:
select#doc_theme.form-control(name='doc_theme')
@@ -42,6 +43,7 @@ block content
input#debug(type='checkbox', value='true', name='debug', checked=false)
.form-group#buttons
button.btn.btn-default(type='button' id='btnGenerate') Generate Docs
+ button.btn.btn-default(type='button' id='subProject' onclick="addSubProject()") Add Sub Project
.row
a.btn.btn-default(id='btnDownload') Download
a.btn.btn-default(id='btnPreview' target='_blank') Preview