README.md in bait-0.3.0 vs README.md in bait-0.3.1

- old
+ new

@@ -7,24 +7,18 @@ Install the gem and then just run `bait` A sinatra server will start up. YAML files will be stored in ~/.bait -Hit up 0.0.0.0:8417 to see what's up. You can set your Github to notify it and it will run your tests per the bait spec. +Go to 0.0.0.0:8417 -# Backstory +You can set your Github to notify the server on that port. -https://github.com/DFTi/Scribbeo-motion already is designed in such a way that it vendors our existing iOS (completely written in Objective-C) application https://github.com/DFTi/Critique +When github notifies bait, bait will clone the project and execute ~/.bait/test.sh and record exit value and output -This gave us a Ruby(Motion) environment where UIAutomator is available using MacBacon (like rspec) +You may also test manually by inputting a clone URL within the UI -As a Ruby on Rails developer, this was invaluable... But the iOS developers we hired disliked it and did not maintain the RubyMotion stuff. - -Fast forward a year or so later and the app is complex, has no test suite, and our QA testers can barely keep up. - -Scribbeo-motion proved that this works, and so bait is a service I'm envisioning for as the first stop between Github and the rest of my continuous integration pipeline. - # Architectural Overview ``` Github POST bait:8417/ ______________________ \./ @@ -40,24 +34,30 @@ | +---+-----+--+ | | \|/ /|\ | | \|/ /|\ | | \[build]\ | | \|/ /|\ | -| \|/ /|\ | -| +------------+ | +| _____________ \|/ /|\ | +| [ your project] +------------+ | | [.bait/test.sh]------|Bait::Tester| | -| +------------+ | +| [status/output] +------------+ | | | +-----------------------------------------------+ Bait::Build -- Persistent ToyStore - Bait::Tester -- Runs your tests and updates build accordingly + Bait::Tester -- Runs your tests and persists results in Bait::Build ``` *Created with [JavE](http://www.jave.de/)* +# Datastore + +You can use any datastore you want that is supported in [Moneta](https://github.com/minad/moneta) + +By default, bait will store the data as YAML files in `~/bait` + # Functional Overview ## Github Webhook Support bait provides a Sinatra endpoint for the github push event webhook. @@ -68,16 +68,16 @@ ## .bait/test.sh In this file you will run your test suite. **Be sure to make it executable `chmod a+x .bait/test.sh`** -This file should output whatever you want to STDOUT/STDERR and return -the correct exit value. +This file should output whatever you want to STDOUT and/or STDERR and +return 0 for passing and non-zero for failure. ### Examples -#### Ruby / Rails Example (RSpec) +#### Ruby Projects ##### [project root]/.bait/test.sh ```bash #!/bin/bash bait_dir=$(dirname $0) @@ -87,11 +87,11 @@ echo "bundling" bundle install > /dev/null 2>&1 bundle exec rspec spec ``` -#### RubyMotion Example +#### RubyMotion Projects ##### [project root]/.bait/test.sh ```bash #!/bin/bash bait_dir=$(dirname $0) @@ -111,36 +111,35 @@ There is a bug in RubyMotion where the exit value isn't reported properly, that's why we are using [motion-specwrap](https://github.com/mdks/motion-specwrap) to run the tests and report the correct exit value -## Objective-C ? +#### Objective-C Projects -So you can see how bait will run any test suite via arbitrary bash -scripts upon a Github hook. +Objective-C projects are supported if you're using [Calabash](http://calaba.sh) -But how exactly will it help add a ruby test suite to an Obj-C app? +##### [project root]/.bait/test.sh +```bash +#!/bin/bash +bait_dir=$(dirname $0) +project_dir="$bait_dir/.." +cd $project_dir -Watch this spot for some examples soon +export BUNDLE_GEMFILE=$project_dir/Gemfile -The basic idea however is to bootstrap a rubymotion project in your -`test.sh` file, throw your Obj-C files into vendor/ and then setup your -Rakefile like so: +echo "bundling" +bundle install > /dev/null 2>&1 +bundle exec cucumber +``` -```ruby -Motion::Project::App.setup do |app| - app.name = 'My Wrapped Project' +#### Other Projects - %w[Tools Models Controllers Views].map{|i| app.vendor_project "vendor/SB/#{i}", :static } -end -``` +Create a file `.bait/test.sh` and `exit 0` if it passes or non-zero if +it does not pass. Output whatever you want to STDOUT or STDERR. -Now that's just a preliminary example; I will try to make this very easy -and conventional and then report my findings here. +Feel free to send pull requests with examples if you end up using bait. -# Future +# Future Goals ## Static Code Analysis -Integrate [metric-fu](http://metric-fu.rubyforge.org/) for ruby apps and [OCLint](http://oclint.org/) for objective-c apps. Report these in Redis. - - +Integrate [metric-fu](http://metric-fu.rubyforge.org/) for ruby apps and [OCLint](http://oclint.org/) for objective-c apps, JSLint and JSure for javascript.