3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Cプログラムをguardを使って開発する

Last updated at Posted at 2013-12-13

概要

  • Cのプログラムを作成する際に、guardを使用してファイルの変更を検知して、ビルド、テスト実行を繰り返す。

利点

  • ファイルの変更を検知した時点でビルドとテストが行われるので、コンパイルエラーやテストが落ちたことがすぐわかる

構築手順

rubyの環境は作成済みとします

  1. Gemfileを作成
source 'https://rubygems.org'
gem 'guard'
gem 'guard-shell'

2.インストール

bundle install

3.Guardfile作成

bundle exec guard init

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

# Add files and commands to this file, like the example:
#   watch(%r{file/path}) { `command(s)` }
#
guard 'shell' do
  watch(/(.*).txt/) {|m| `tail #{m[0]}` }
end

guard 'shell' do 
  watch(%r{^.+\.(h|c)$}) do 
    `make test` 
  end 
end

4.Guardを起動します。

bundle exec guard

これでファイルの変更を検知してビルドやテストが実行されます。

参考資料

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?