Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ Document library files for method #1:
./configs/common/data/document_library
```

##### If you receive a very large Document Library

If you receive a very large Document Library and do not need the actual file contents, you may want to copy the file structure only. The `lec` script provides the `lec importDLStructure` command to assist with this:

```sh
lec importDLStructure <source_directory>
```

The source directory's _file structure only_ will be copied into `./configs/common/data/document_library`.

#### Deploy license files

Add a license files to `./configs/common/osgi/modules`.
Expand Down
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@ tasks.register("exportContainerData", DockerCopyFileFromContainer) {
remotePath = "/container-data"
}

tasks.register("importDocumentLibraryStructure") {
doLast {
project.fileTree(project.getProperty("sourceDir")).visit {
if (it.isDirectory()) {
return
}

File newFile = project.file("configs/common/data/document_library/${it.relativePath}")

if (!newFile.parentFile.exists()) {
newFile.parentFile.mkdirs()
}

if (!newFile.exists()) {
newFile.createNewFile()
}
}
}
}

tasks.register("shareWorkspace", Zip) {
archiveFileName = provider {
"workspace_${config.namespace}_${timestamp}.zip"
Expand Down
42 changes: 37 additions & 5 deletions scripts/cli/lec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ _printHelpAndExit() {
lec <command>

$(_bold COMMANDS:)
init [ticket] [version] Create a new Composer project
start Start a Composer project
stop Stop a Composer project
clean Stop a Composer project and remove Docker volumes
update Check for updates to Composer and lec
init [ticket] [version] Create a new Composer project
start Start a Composer project
stop Stop a Composer project
clean Stop a Composer project and remove Docker volumes
update Check for updates to Composer and lec

importDLStructure <sourceDir> Import a Document Library (file structure only, no content) into configs/common/data/document_library

$(_bold JUMP TO A PROJECT:)
lecd [project name]
Expand Down Expand Up @@ -394,6 +396,36 @@ cmd_clean() {
docker volume prune --all --filter="label=com.docker.compose.project=$(_getComposeProjectName)"
)
}
cmd_importDLStructure() {
_checkCWDProject

local sourceDir="${1}"
local targetDir="${CWD_PROJECT_ROOT}/configs/common/data/document_library"

if [[ ! -d "${sourceDir}" ]]; then
_print_error "Need a source directory to copy from"

_printHelpAndExit
fi

if [[ -d "${targetDir}" ]] && _confirm "Remove existing ${targetDir}?"; then
rm -rf "${targetDir}"
fi

_print_step "Copying file structure from ${sourceDir}"

(
cd "${CWD_PROJECT_ROOT}" || exit

if ! ./gradlew importDocumentLibraryStructure -PsourceDir="${sourceDir}" --console=plain --quiet --stacktrace; then
return 1
fi

echo ""
_print_step "File structure copied to ${targetDir}"
)

}
cmd_init() {
local ticket="${1}"
local liferay_version="${2}"
Expand Down