Created
May 12, 2013 13:02
-
-
Save tsu-nera/5563491 to your computer and use it in GitHub Desktop.
指定されたディレクトリのインクルードファイルからモックファイルを自動生成するためのシェルスクリプト
This file contains hidden or 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 | |
| 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