diff --git a/README.md b/README.md index 9c69b4b..73c0da0 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,16 @@ search for multiple patterns, Ack cannot replace text in files, and I don't care ## Installation +### From release + +Unzip/untar the release package to a directory you prefer, e.g. `~/programs/`, and rename +`~/programs/search-` to `~/programs/search`. + +Then the executable to run is `~/programs/search/bin/search`, however, please see +chapter _Usage_ about how to make the tool easier to use. + +### From source + Execute the following steps: ```text @@ -126,14 +136,16 @@ $ cd search $ gw assemble ``` +Then either you can unpack the distribution package in `search-app/build/distributions` as described +in the previous section, or you can run `gw installDist` and use `search-app/build/install/search` +as the extracted location. + Optionally, to ensure you got a working revision: ```text $ gw test integrationTest ``` -Then to make it easier to use, see next section. - ## Usage ### Usage tips @@ -141,7 +153,7 @@ Then to make it easier to use, see next section. 1. Create a configuration file at `~/.search.conf`, then put generic file path exclude patterns there. See configuration example below. -2. Optionally, create a configuration file for each project, eg. under `./!local`, and +2. *Optionally*, create a configuration file for each project, eg. under `./.local`, and put your project-specific exclude patterns in there. (Exclude everything that makes your results shown practically twice. Usually you want to exclude build directories.) @@ -155,11 +167,11 @@ Then to make it easier to use, see next section. search() { local args='' - if [ -f './!local/.search.conf' ]; then - args='-c ./!local/.search.conf' + if [ -f '.local/search.conf' ]; then + args='-c .local/search.conf' fi - ~/projects/search/search-app/build/distributions/search $args "$@" + ~/programs/search/bin/search $args "$@" } # Also add a much shorter alias because we hate typing. diff --git a/search-app/build.gradle b/search-app/build.gradle index 5b67c8e..97fa6ed 100644 --- a/search-app/build.gradle +++ b/search-app/build.gradle @@ -2,6 +2,7 @@ plugins { id 'groovy' id 'org.unbroken-dome.test-sets' version '3.0.1' id 'codenarc' + id 'application' } dependencies { @@ -10,36 +11,26 @@ dependencies { testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' } -tasks.register('fatJar', Jar) { - dependsOn 'jar' - archiveBaseName = "${project.name}-standalone" - - manifest { - attributes 'Implementation-Title': 'Search App (Standalone)', - 'Implementation-Version': archiveVersion, - 'Main-Class': 'search.Search' - } +application { + applicationName = 'search' + mainClass = 'search.Search' +} - from { - configurations.compileClasspath.collect { - it.isDirectory() ? it : zipTree(it) +distributions { + main { + contents { + from("$rootDir/README.md") { + into 'docs' + } } } - - with jar - duplicatesStrategy = DuplicatesStrategy.EXCLUDE } -tasks.register('generateSearchScript', Copy) { - from 'etc/search_tmpl' - into "${buildDir}/${distsDirName}" - rename { file -> 'search' } - expand System: System, fatJar: fatJar - fileMode = 0755 -} - -tasks.named('assemble').configure { - dependsOn 'fatJar', 'generateSearchScript' +tasks.named('jar').configure { + manifest { + attributes 'Implementation-Title': 'Search App', + 'Implementation-Version': archiveVersion + } } testSets { diff --git a/search-app/etc/search_tmpl b/search-app/etc/search_tmpl deleted file mode 100644 index 83e7dc1..0000000 --- a/search-app/etc/search_tmpl +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -if [[ \${SEARCH_DEBUG} == true ]]; then - JAVA_OPTS="\${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" -fi - -"\${JAVA_HOME}"/bin/java \${JAVA_OPTS} -jar "${fatJar.archivePath}" "\$@"