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

Commit

Permalink
Merge branch 'hotfix-0.0.1'
Browse files Browse the repository at this point in the history
Fixes Bug reported in Issue #1
See #1 for more
details on the Bug.
  • Loading branch information
GochoMugo committed Jan 10, 2015
2 parents 31a4745 + 70c06d6 commit b62bbe4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Setting the environment variable `GRUNT_INSTALL_NO_COLOR` will

```bash
⇒ grunt-install --help
grunt-install 0.0.0
grunt-install 0.0.1

Usage: grunt-install [install_options] <URI> <template_name>

Expand Down
19 changes: 15 additions & 4 deletions grunt-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


# Version Number
GRUNT_INSTALL_VERSION="0.0.0"
GRUNT_INSTALL_VERSION="0.0.1"


# Template Directory
Expand All @@ -23,10 +23,15 @@ GRUNT_COLOR_WHITE="\033[1;37m"


# Script Variables
GRUNT_ME=$0 # useful for invoking this same script from within it
GRUNT_INSTALL_FORCE=false
GRUNT_INSTALL_SILENT=false


# Test-specific variables
[ ${GRUNT_INSTALL_UNIT_TEST} ] && GRUNT_ME="$BATS_TEST_DIRNAME/../grunt-install.sh"


# installs from Github
#
# ${1} github shorthand e.g. GochoMugo/grunt-install
Expand Down Expand Up @@ -121,15 +126,21 @@ grunt_install() {

# updates grunt templates
grunt_update_templates() {
local update_success=0
for template in ${GRUNT_TEMPLATE_DIRECTORY}/*/ ; do
if [ -r ${template}/.grunt-install.config ] ; then
template_name=$(basename ${template})
source ${template}/.grunt-install.config
./grunt-install.sh ${GRUNT_TEMPLATE_UPDATE} ${template_name} --force --silent \
&& grunt_log "updated: ${template_name}" 1 \
|| grunt_log "failed to update: ${template_name}" 2
${GRUNT_ME} ${GRUNT_TEMPLATE_UPDATE} ${template_name} --force --silent
if [ $? -eq 0 ] ; then
grunt_log "updated: ${template_name}" 1
else
grunt_log "failed to update: ${template_name}" 2
update_success=1
fi
fi
done
return ${update_success}
}


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grunt-install",
"version": "0.0.0",
"version": "0.0.1",
"description": "Simple Bash script for Grunt template installation",
"directories": {
"test": "test"
Expand Down
12 changes: 12 additions & 0 deletions test/test.grunt-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ make_fake_template() {
grunt_log "Wont show up on console" 0 > _TEST_grunt_log_file
[ $(grep -c -E "*" _TEST_grunt_log_file) -eq 0 ]
}


# refer to issue #1 (https://github.com/GochoMugo/grunt-install/issues/1)
@test "grunt_update_templates: updates templates regardless of working directory" {
mkdir _TEST_grunt_update_cwd
cd _TEST_grunt_update_cwd
grunt_update_templates > log
[ $(grep -c -E "failed to update" log) -eq 0 ]
exit_code=$?
cd -
return $?
}

0 comments on commit b62bbe4

Please sign in to comment.