Sha256: a43a06e4596990c8682ef07b633d2bc54f243a1c89a37b7711993f469bb911b9
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
$:.unshift(File.join(File.dirname(__FILE__))) require 'sinatra' require 'haml' require 'rdiscount' configure do set :haml, { :ugly=>true } end before do @features = Wally::ListsFeatures.features end get '/?' do @features = Wally::ListsFeatures.features haml :index end get '/features/:feature/?' do |feature| features = Wally::ListsFeatures.features features.each do |feature_hash| @feature = feature_hash if feature_hash["id"] == feature end get_scenario_urls haml :feature end get '/search/?' do if params[:q] @search_results = Wally::SearchFeatures.new.find(:query => params[:q]) end haml :search end get '/features/:feature/scenario/:scenario/?' do |feature_id, scenario_id| Wally::ListsFeatures.features.each do |feature| if feature["id"] == feature_id feature["elements"].each do |element| if element["type"] == "background" @background = element end if element["type"] == "scenario" && element["id"] == "#{feature_id};#{scenario_id}" @scenario = element end end end end haml :scenario end def get_scenario_urls @scenario_urls = {} return unless @feature if @feature["elements"] @feature["elements"].each do |element| if element["type"] == "scenario" url = "/features/#{element["id"].gsub(";", "/scenario/")}" @scenario_urls[element["name"]] = url end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wally-0.0.2 | lib/wally/application.rb |
wally-0.0.1 | lib/wally/application.rb |