diff --git a/Makefile b/Makefile index f2dc11c..f289a28 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ build-terraform: @if [ -z "$(RESOURCE)" ]; then \ echo "==> Generating source code for terraform from resource list..."; \ cd $(MMROOT) && \ - jq '.[]' $(ROOT)/resources.json | xargs -I '{}' bundle exec compiler -d -p $(SPECROOT)/'{}' -e terraform -c azure -o $(TFROOT)/$(TFREPO)/; \ + sh $(ROOT)/list_resources.sh | xargs -I '{}' bundle exec compiler -d -p $(SPECROOT)/'{}' -e terraform -c azure -o $(TFROOT)/$(TFREPO)/; \ else \ echo "==> Generating source code for terraform from given name..."; \ cd $(MMROOT) && \ @@ -71,7 +71,7 @@ build-ansible: @if [ -z "$(RESOURCE)" ]; then \ echo "==> Generating source code for ansible from resource list..."; \ cd $(MMROOT) && \ - jq '.[]' $(ROOT)/resources.json | xargs -I '{}' bundle exec compiler -d -p $(SPECROOT)/'{}' -e ansible -c azure -o $(GENROOT)/$(ASREPO)/; \ + sh $(ROOT)/list_resources.sh | xargs -I '{}' bundle exec compiler -d -p $(SPECROOT)/'{}' -e ansible -c azure -o $(GENROOT)/$(ASREPO)/; \ else \ echo "==> Generating source code for ansible from given name..."; \ cd $(MMROOT) && \ diff --git a/list_resources.sh b/list_resources.sh new file mode 100644 index 0000000..a2f4d5b --- /dev/null +++ b/list_resources.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +cd `dirname $0` +for file in `ls ./specs`; do + work_dir=./specs/$file + if [ -d $work_dir ]; then + if [ -n "$(git status -s $work_dir)" ]; + then + # remove the directory prefix './specs/' + expr substr "$work_dir" 9 "${#work_dir}" + fi + fi +done