Sha256: fd73d2fa5e4eb8ad7bf2d1329b30c53c9037d87d685fe7c321925f78e9ac1f4a
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
$:.unshift(File.join(File.dirname(__FILE__))) require 'sinatra' require 'haml' require 'rdiscount' configure do set :haml, { :ugly=>true } end before do features_path = ARGV.first || "features" @lists_features = Wally::ListsFeatures.new(features_path) @features = @lists_features.features @tag_count = Wally::CountsTags.new(@lists_features).count_tags @excessive_wip_tags = @tag_count["@wip"] >= 10 @scenario_count = @features.to_s.scan(/scenario/).length end get '/?' do haml :index end get '/features/:feature/?' do |feature| @features.each do |feature_hash| @feature = feature_hash if feature_hash["id"] == feature end 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| @features.each do |feature| if feature["id"] == feature_id @feature = feature feature["elements"].each do |element| if element["type"] == "background" @background = element end if (element["type"] == "scenario" || element["type"] == "scenario_outline") && element["id"] == "#{feature_id};#{scenario_id}" @scenario = element end end end end haml :scenario end def get_scenario_url(scenario) url = "/features/#{scenario["id"].gsub(";", "/scenario/")}" end def get_sorted_scenarios(feature) scenarios = [] if feature["elements"] feature["elements"].each do |element| if element["type"] == "scenario" || element["type"] == "scenario_outline" scenarios << element end end end scenarios.sort! { |a, b| a["name"] <=> b["name"] } scenarios end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wally-0.0.19 | lib/wally/application.rb |