-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rb
87 lines (73 loc) · 1.32 KB
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require 'sinatra'
require 'sinatra/base'
require 'redcarpet'
class Lessons < Sinatra::Base
latest_week = 8
is_prod = Sinatra::Base.environment =~ /prod/
configure do
set :markdown, :layout_engine => :erb
set :static, true
end
get '/' do
markdown :index
end
get '/not-yet' do
markdown :not_yet, :layout => :empty
end
get '/week/1' do
if is_prod && latest_week < 1
redirect '/not-yet'
else
markdown :one
end
end
get '/week/2' do
if is_prod && latest_week < 2
redirect '/not-yet'
else
markdown :two
end
end
get '/week/3' do
if is_prod && latest_week < 3
redirect '/not-yet'
else
markdown :three
end
end
get '/week/4' do
if is_prod && latest_week < 4
redirect '/not-yet'
else
markdown :four
end
end
get '/week/5' do
if is_prod && latest_week < 5
redirect '/not-yet'
else
markdown :five
end
end
get '/week/6' do
if is_prod && latest_week < 6
redirect '/not-yet'
else
markdown :six
end
end
get '/week/7' do
if is_prod && latest_week < 7
redirect '/not-yet'
else
markdown :seven
end
end
get '/week/8' do
if is_prod && latest_week < 8
redirect '/not-yet'
else
markdown :eight
end
end
end