Add class Diversipub::SinatraApp

This commit is contained in:
Alex Kotov 2023-05-02 17:19:55 +04:00
parent 279ada4197
commit 6ba8ca10ae
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 28 additions and 0 deletions

View file

@ -41,6 +41,8 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename f }
spec.add_runtime_dependency 'sinatra', '~> 3.0', '>= 3.0.6'
spec.add_development_dependency 'pry', '~> 0.14'
spec.add_development_dependency 'rake', '~> 13.0'
end

View file

@ -1,4 +1,7 @@
# frozen_string_literal: true
require 'sinatra/base'
require_relative 'diversipub/main'
require_relative 'diversipub/sinatra_app'
require_relative 'diversipub/version'

View file

@ -0,0 +1,23 @@
# frozen_string_literal: true
module Diversipub
##
# Sinatra web application.
#
class SinatraApp < Sinatra::Base
set :environment, :production
set :root, File.expand_path('../..', __dir__).freeze
set :views, nil
set :public_folder, nil
def initialize(main)
super()
@main = main
end
class << self
# Disable default Sinatra servers & middleware.
alias new new!
end
end
end