Skip to content
RedGreen clone (colorful rake spec) for RubyMotion's Bacon with a couple styles. Includes Autotest functionality, an applescript to make your iOS sim headless, and a ported terminal color library you may use with NSLog.
Find file
Pull request Compare This branch is 1 commit behind mdks:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app
resources
spec
.gitignore
Gemfile
Gemfile.lock
Guardfile
README.md
Rakefile

README.md

rm-redgreen

RedGreen clone (colorful rake spec) for RubyMotion. The project includes a ported version of ansiterm & can auto-test using Guard.

Github Pages URL

http://mdks.github.com/rm-redgreen/

Features

  • Autotest functionality with Guard
  • A ported ansiterm.rb for terminal colors
  • 3 styles of colorized Bacon output (00-redgreen.rb)
  • nearly-headless iOS Simulator via an AppleScript in the Guardfile

Instructions

  • Copy 00-redgreen.rb into spec/
  • Load rm-ansiterm.rb in your app/
  • Run rake spec

For using Guard I have prepared a Gemfile & Guardfile

  • Add the Gemfile & Guardfile to your project
  • Run bundle install
  • Run guard
  • Red, green, refactor!

Output Styles

There are currently 3 styles, settable at the top of 00-redgreen.rb

Default style is :focused

Extras

# string.rb
class String
  def method_missing(sym, *args, &block)
    Term::ANSIColor.send(sym) { self } rescue super
  end
end
# kernel.rb
class Kernel
  def p(arg, style=nil)
    if Term.nil?
      NSLog arg
    else
      NSLog(style ? arg.send(style) : arg)
    end
  end
end

With code like the above, you can do colorful NSLog output in this way:

p "I like Cyan", :cyan
p "Sometimes this is hard to read...", :blue
p [{:oh=>"this"}, "is", :convenient].inspect, :yellow

Pull requests are appreciated!

Something went wrong with that request. Please try again.