Sha256: c5d1c5092f3c15acc022b5604d0ef32cb93e0b446bdae4a79559da145cbba7c2
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
$:.unshift(File.join(File.dirname(__FILE__))) require 'sinatra' require 'haml' require 'rdiscount' configure do set :haml, { :ugly=>true } end def features_path ARGV.first || "features" end def lists_features Wally::ListsFeatures.new(features_path) end before do #probably remove this if not needed @features = lists_features.features end get '/?' do @features = lists_features.features haml :index end get '/features/:feature/?' do |feature| features = lists_features.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(lists_features).find(:query => params[:q]) end haml :search end get '/features/:feature/scenario/:scenario/?' do |feature_id, scenario_id| lists_features.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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wally-0.0.3 | lib/wally/application.rb |