Use Sinatra modular application

master
Guillaume Dott 2014-12-17 18:12:52 +01:00
parent 0d1dc82a7e
commit 4c6ba9c89e
1 changed files with 29 additions and 25 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env ruby
require 'sinatra'
require 'sinatra/base'
require 'sinatra/content_for'
require 'sinatra/json'
@ -9,6 +9,7 @@ require 'coffee-script'
require 'slim'
require 'sass'
class Nikoli < Sinatra::Application
GAMES = %i{akari hitori nurikabe sudoku}
set :data_folder, File.expand_path('./data')
@ -38,3 +39,6 @@ get "/data/:game/:file.json" do |game, file|
data = YAML.load_file(data_file)['data']
json Array(data).sample
end
run! if app_file == $0
end