Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

概要

  • 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

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

参考資料

http://stackoverflow.com/questions/9673629/using-ruby-guard-gem-to-monitor-c-files

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away