Sha256: 0fe6fffe70bf88c4e4274763b061ede6f8e10d24a69b3fddf9c37376d3a38a1a

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + "/../initialize")

begin
  sinatra_path = 'sinatra'
  require sinatra_path
rescue LoadError => e
  if e.message =~ /#{Regexp.escape(sinatra_path)}$/
    raise "sinatra not available. Install it with sudo gem install sinatra"
  else
    raise e
  end
end

set :sessions, true

get '/' do
  markup = <<-MARKUP
<p id="greeting">
  Whazzup!?
  <a href="/clicky_click">Click me</a>
</p>
  MARKUP
  if session['user'].nil?
    markup << <<-MARKUP
<form method="post" action="/login">
  <input type="text" id="login" name="login" />
  <input type="submit" id="submit_login" />
</form>
    MARKUP
  else
    markup << <<-MARKUP
<p id="session">Hello, #{session['user']}</p>
    MARKUP
  end

  markup
end
post '/login' do
  session['user'] = params['login']
  redirect '/'
end
get '/clicky_click' do
  "Booyah!"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spectie-0.0.4 script/selenium_webapp
spectie-0.0.3 script/selenium_webapp