https://github.com/guard/guard
몇 가지 규칙에 따라 자동으로 뭔가를 해주는 프로그램.
일단 브랜치를 하나 만들고 작업 시작.
$ git fetch origin
$ git checkout -b support/guard origin/master
https://github.com/guard/guard-minitest
$ vi Gemfile
development 그룹을 찾아서 rubocop 관련 Gem 추가.
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 3.0'
# Spring speeds up development by keeping your application
# running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'guard'
gem 'guard-minitest'
end
$ bundle
$ guard init minitest
$ vi Guardfile
아직 Rails 5.0.0.beta1을 지원하지 않기 때문에 Rails 4 섹션의 주석을 전부 풀어준다.
$ guard
테스트 파일이나 구현 파일을 고칠 때마다 테스트가 자동으로 실행됨.
>
프롬프트에서 그냥 엔터 치면 모든 테스트가 다 실행된다. exit
를 입력하면 종료.
https://github.com/guard/guard-rubocop
$ vi Gemfile
development 그룹을 찾아서 Gem 추가.
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 3.0'
# Spring speeds up development by keeping your application
# running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'guard'
gem 'guard-minitest'
gem 'guard-rubocop'
end
$ bundle
$ guard init rubocop
$ guard
코드가 바뀔 때마다 코딩 표준 검사.
$ git add .
$ git commit
$ git push origin support/guard
Pull Rquest & Review 요청!
https://travis-ci.org/profile 에서 저장소 Sync 후 Switch on!
https://github.com/ahastudio/woowahan-api-demo -> https://travis-ci.org/ahastudio/woowahan-api-demo
$ git fetch origin
$ git checkout -b support/travis-ci origin/master
$ vi .travis.yml
language: ruby
rvm:
- 2.3.0
script:
- bundle exec rubocop
- bundle exec rake db:migrate RAILS_ENV=test
- bundle exec rake test
CI엔 RuboCop이 설치되지 않아 빌드가 실패한다.
$ vi Gemfile
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 3.0'
# Spring speeds up development by keeping your application
# running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'rubocop', require: false
end
만약 guard-rubocop
이 이미 추가된 상태라면, 이 작업은 불필요하다.
CI에선 vendor 디렉터리를 활용하기 때문에, RuboCop이 vendor를 검사하지 않게 해야 한다.
$ vi .rubocop.yml
Documentation:
Enabled: false
AllCops:
Exclude:
- 'Gemfile'
- 'Rakefile'
- 'Guardfile'
- 'config.ru'
- 'bin/**/*'
- 'db/**/*'
- 'config/**/*'
- 'vendor/**/*'
$ git add .
$ git commit
$ git push origin support/travis-ci
Pull Rquest & Review 요청!