Skip to content

Instantly share code, notes, and snippets.

@tsu-nera
Created May 12, 2013 13:02
Show Gist options
  • Select an option

  • Save tsu-nera/5563491 to your computer and use it in GitHub Desktop.

Select an option

Save tsu-nera/5563491 to your computer and use it in GitHub Desktop.
指定されたディレクトリのインクルードファイルからモックファイルを自動生成するためのシェルスクリプト
#!/bin/bash
MOCK_DIR=mocks
# 指定されたディレクトリが存在するかチェック
if [ ! -d "$1" ]; then
echo 'error: input include directory path'; exit 1
else
# 絶対パスになおす
INCLUDE_DIR="${PWD}/$1"
fi
# mocksディレクトリが存在しない場合は作成
if [ ! -d "${MOCK_DIR}" ]; then
echo "mocks directory is not exist, make directory."
mkdir mocks
else
echo "mocks directory exist"
fi
files=$INCLUDE_DIR/*.h
# ヘッダファイルが存在しない場合は終了
if [ "${files}" == "" ]; then
echo "There is no header files"; exit 0
fi
# モックファイルを生成
for file in ${files}
do
ruby lib/cmock.rb "${file}"
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment