Skip to content

Commit

Permalink
avoid wildcard
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Aug 28, 2015
1 parent 95d3e6c commit 744d905
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
6 changes: 1 addition & 5 deletions cookbooks/ec2-ami-tools/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ function install()

# Move Folder

local -r currentPath="$(pwd)"

cd "${unzipFolder}"
find '.' -maxdepth 1 -not -name '.' -exec mv '{}' "${EC2_AMI_TOOLS_INSTALL_FOLDER}" \;
cd "${currentPath}"
moveFolderContent "${unzipFolder}" "${EC2_AMI_TOOLS_INSTALL_FOLDER}"
symlinkLocalBin "${EC2_AMI_TOOLS_INSTALL_FOLDER}/bin"
rm -f -r "${unzipFolder}"

Expand Down
6 changes: 1 addition & 5 deletions cookbooks/ec2-api-tools/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ function install()

# Move Folder

local -r currentPath="$(pwd)"

cd "${unzipFolder}"
find '.' -maxdepth 1 -not -name '.' -exec mv '{}' "${EC2_API_TOOLS_INSTALL_FOLDER}" \;
cd "${currentPath}"
moveFolderContent "${unzipFolder}" "${EC2_API_TOOLS_INSTALL_FOLDER}"
rm -f -r "${unzipFolder}"

# Config Profile
Expand Down
6 changes: 1 addition & 5 deletions cookbooks/go-cd/recipes/install-agent.bash
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ function install()

# Move Folder

local -r currentPath="$(pwd)"

cd "${unzipFolder}"
find '.' -maxdepth 1 -not -name '.' -exec mv '{}' "${GO_CD_AGENT_INSTALL_FOLDER}" \;
cd "${currentPath}"
moveFolderContent "${unzipFolder}" "${GO_CD_AGENT_INSTALL_FOLDER}"

# Finalize

Expand Down
6 changes: 1 addition & 5 deletions cookbooks/go-cd/recipes/install-server.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ function install()

# Move Folder

local -r currentPath="$(pwd)"

cd "${unzipFolder}"
find '.' -maxdepth 1 -not -name '.' -exec mv '{}' "${GO_CD_SERVER_INSTALL_FOLDER}" \;
cd "${currentPath}"
moveFolderContent "${unzipFolder}" "${GO_CD_SERVER_INSTALL_FOLDER}"

# Finalize

Expand Down
6 changes: 1 addition & 5 deletions cookbooks/groovy/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ function install()

# Move Folder

local -r currentPath="$(pwd)"

cd "${unzipFolder}"
find '.' -maxdepth 1 -not -name '.' -exec mv '{}' "${GROOVY_INSTALL_FOLDER}" \;
cd "${currentPath}"
moveFolderContent "${unzipFolder}" "${GROOVY_INSTALL_FOLDER}"
rm -f -r "${unzipFolder}"

# Config Lib
Expand Down
8 changes: 5 additions & 3 deletions cookbooks/shell-check/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ function installDependencies()

function install()
{
local -r userHomeFolderPath="$(getCurrentUserHomeFolder)"

# Clean Up

rm -f -r ~/.cabal ~/.ghc
rm -f -r "${userHomeFolderPath}/.cabal" "${userHomeFolderPath}/.ghc"
initializeFolder "${CABAL_INSTALL_FOLDER}"

# Install

cabal update
cabal install 'shellcheck'

mv ~/.cabal/* "${CABAL_INSTALL_FOLDER}"
rm -f -r ~/.cabal ~/.ghc
moveFolderContent "${userHomeFolderPath}/.cabal" "${CABAL_INSTALL_FOLDER}"
rm -f -r "${userHomeFolderPath}/.cabal" "${userHomeFolderPath}/.ghc"
ln -f -s "${CABAL_INSTALL_FOLDER}/bin/shellcheck" '/usr/local/bin/shellcheck'

# Config Profile
Expand Down
15 changes: 15 additions & 0 deletions libraries/util.bash
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ function isValidJSONFile()
isValidJSONContent "$(cat "${file}")"
}

function moveFolderContent()
{
local -r sourceFolder="${1}"
local -r destinationFolder="${2}"

checkExistFolder "${sourceFolder}"
checkExistFolder "${destinationFolder}"

local -r currentPath="$(pwd)"

cd "${sourceFolder}"
find '.' -maxdepth 1 -not -name '.' -exec mv '{}' "${destinationFolder}" \;
cd "${currentPath}"
}

function symlinkLocalBin()
{
local -r sourceBinFolder="${1}"
Expand Down

0 comments on commit 744d905

Please sign in to comment.