LoginSignup
10
10

More than 5 years have passed since last update.

RubyMotion で Guard を使って自動的にテストを実行する方法

Last updated at Posted at 2013-07-16

実行結果に色をつけて、さらに Teminal notifier でデスクトップ通知もします。

bundler を使っている前提で。

gem 'guard-motion'
gem 'terminal-notifier-guard'

で、インストール

$ bundle install

Rakefile に以下のように書いてください。

# snip...
require 'bundler/setup'  # この行と
Bundler.require :default # この行を追加

Motion::Project::App.setup do |app|
# snip...

Guard の設定をします。

$ guard init motion

Guardfile を編集します。

guard 'motion', env: {output: 'colorized'} do # この一行を変更している
  watch(%r{^spec/.+_spec\.rb$})

  # RubyMotion App example
  watch(%r{^app/(.+)\.rb$})     { |m| "spec/#{m[1]}_spec.rb" }

  # RubyMotion gem example
  watch(%r{^lib/[^/]+/(.+)\.rb$})     { |m| "spec/#{m[1]}_spec.rb" }
end

実行します。

$ guard start

以上。

追記

Rakefile について追記しました。
katsuyoshi さん、補足ありがとうございます。

10
10
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
10
10