Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
Use the application plugin.
Browse files Browse the repository at this point in the history
Preparing for automated releases.
  • Loading branch information
rkrisztian committed Oct 1, 2020
1 parent 83870d6 commit 64e380e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 38 deletions.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<VERSION>` 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
Expand All @@ -126,22 +136,24 @@ $ 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

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.)

Expand All @@ -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.
Expand Down
41 changes: 16 additions & 25 deletions search-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'groovy'
id 'org.unbroken-dome.test-sets' version '3.0.1'
id 'codenarc'
id 'application'
}

dependencies {
Expand All @@ -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 {
Expand Down
7 changes: 0 additions & 7 deletions search-app/etc/search_tmpl

This file was deleted.

0 comments on commit 64e380e

Please sign in to comment.