Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual Project - Kafia #237

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ source 'https://rubygems.org'

ruby '3.0.2'

gem 'sinatra'
gem "sinatra", "~> 2.2"

group :test do
gem 'capybara'
gem 'rspec'
gem "webrick", "~> 1.7"
gem 'simplecov', require: false
gem 'simplecov-console', require: false
end
Expand Down
10 changes: 6 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GEM
public_suffix (4.0.6)
racc (1.5.2)
rack (2.2.3)
rack-protection (2.1.0)
rack-protection (2.2.0)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand Down Expand Up @@ -73,15 +73,16 @@ GEM
terminal-table
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
sinatra (2.1.0)
sinatra (2.2.0)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.1.0)
rack-protection (= 2.2.0)
tilt (~> 2.0)
terminal-table (3.0.1)
unicode-display_width (>= 1.1.1, < 3)
tilt (2.0.10)
unicode-display_width (1.6.1)
webrick (1.7.0)
xpath (3.2.0)
nokogiri (~> 1.8)

Expand All @@ -95,7 +96,8 @@ DEPENDENCIES
rubocop (= 1.20)
simplecov
simplecov-console
sinatra
sinatra (~> 2.2)
webrick (~> 1.7)

RUBY VERSION
ruby 3.0.2p107
Expand Down
18 changes: 18 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
require 'sinatra/base'

class RockPaperScissors < Sinatra::Base
get '/test' do
'test page'
end

get '/' do
"Hey Hey!"
erb(:index)
end

post '/enter-name' do
"Hey Hey!"
@name = params[:name]
erb(:names)
end

get '/names' do
p params
@name = params[:name]
erb(:names)
end

run! if app_file == $0
end
3 changes: 2 additions & 1 deletion config.ru
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
require_relative './app'
run RockPaperScissors

run RockPaperScissors
1 change: 1 addition & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1> Welcome to Rock Paper Scissors <%= @name %> </h1>
4 changes: 4 additions & 0 deletions views/names.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<form action= "/enter-name" method="post">
<input type="text" name="name">
<input type="submit" value="Submit">
</form>