Skip to content

Instantly share code, notes, and snippets.

@svenfuchs
Created July 27, 2009 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save svenfuchs/156524 to your computer and use it in GitHub Desktop.
Save svenfuchs/156524 to your computer and use it in GitHub Desktop.
# Ummm ... well. Just some pseudo code I guess. Fork + complete as needed.
#
# Dependencies: Kombucha culture is expected to be installed in ~/kitchen
# If you don't have one you can easily obtain one from the internet.
rails kombucha -m ~/homemade.rb
# ~/homemade.rb
system %(
curl -O http://tea.com/jp/green/bancha.tar
tar xvf bancha.tar; cd bancha
configure; make; install # tea should be installed in ~/kitchen/ now
)
# tea_controller.rb
require 'kombucha'
def create # FIXME extract domain logic to model, fire off a background-job
tea = Tea.new(:kind => 'bancha', :amount => 3.ltrs)
tea += Sugar.new(:amount => 375.gramms)
sleep(30.minutes) while tea.hot?
# FIXME could extract this to a Thread, we can do that while waiting for the tea to cool down
recent_build = Kombucha.recent_build.extract(:amount => 10.percent)
culture = Kombucha.singleton
Water.new(:temperature => :lukewarm).wash(culture)
bowl = Bowl.find(:conditions => { :state => :empty })
Water.new(:temperature => :hot).wash(bowl)
bowl << tea << recent_build << culture
bowl.save!
flash[:notice] = 'Your kombucha has been set up. Please wait 7-14 days before consuming.'
redirect_to bowl_path(bowl)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment