This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
declare -r apacheMavenDownloadUrl="http://apache.cbox.biz/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" | |
declare -r directoryName="mvn/" | |
if [[ $apacheMavenDownloadUrl =~ ([^/]+)\-bin\.tar\.gz$ ]] | |
then | |
declare -r resultFileName=$BASH_REMATCH | |
declare -r resultDirectoryName=${BASH_REMATCH[1]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A little practice with sed from Georgi Naumov | |
stringToAppend="# we want to add this string\n" | |
filePath="apache2.conf" | |
# This will add bellow commend before the first occurence | |
# of LogFormat | |
# -r extended regular expression | |
# -i - in place |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
georginaumov@georgi:~/Documents/hello$ sbt | |
[info] Loading project definition from /home/georginaumov/Documents/hello/project | |
[info] Set current project to hello (in build file:/home/georginaumov/Documents/hello/) | |
> baseDirectory | |
[info] /home/georginaumov/Documents/hello | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> inspect baseDirectory | |
[info] Setting: java.io.File = /home/georginaumov/Documents/hello | |
[info] Description: | |
[info] The base directory. Depending on the scope, this is the base directory for the build, project, configuration, or task. | |
[info] Provided by: | |
[info] {file:/home/georginaumov/Documents/hello/}root/*:baseDirectory | |
[info] Defined at: | |
[info] (sbt.Defaults) Defaults.scala:177 | |
[info] Dependencies: | |
[info] *:thisProject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printBaseDirectory <<= streams map Tasks.printBaseDirectory(baseDirectory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def printBaseDirectory(baseDir: sbt.File)(streams: TaskStreams): Unit = { | |
streams.log.info("Here I want to print value of baseDirectory") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: type mismatch; | |
[error] Type error in expression | |
found : sbt.SettingKey[java.io.File] | |
required: sbt.File | |
(which expands to) java.io.File |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printBaseDirectory <<= streams map Tasks.printBaseDirectory(baseDirectory.value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt.Keys.TaskStreams | |
import sbt._ | |
object Tasks { | |
def printBaseDirectory(streams: TaskStreams, dir: File): Unit = { | |
streams.log.info(dir.getAbsolutePath) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy val printBaseDirectory: TaskKey[Unit] = TaskKey[Unit]("printBaseDirectory", "Print baseDirectory for the project", KeyRanks.ATask) | |
printBaseDirectory <<= (streams, baseDirectory) map Tasks.printBaseDirectory |
OlderNewer