Add class Diversipub::SinatraApp
This commit is contained in:
parent
279ada4197
commit
6ba8ca10ae
3 changed files with 28 additions and 0 deletions
|
@ -41,6 +41,8 @@ Gem::Specification.new do |spec|
|
||||||
|
|
||||||
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename f }
|
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 'pry', '~> 0.14'
|
||||||
spec.add_development_dependency 'rake', '~> 13.0'
|
spec.add_development_dependency 'rake', '~> 13.0'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'sinatra/base'
|
||||||
|
|
||||||
require_relative 'diversipub/main'
|
require_relative 'diversipub/main'
|
||||||
|
require_relative 'diversipub/sinatra_app'
|
||||||
require_relative 'diversipub/version'
|
require_relative 'diversipub/version'
|
||||||
|
|
23
lib/diversipub/sinatra_app.rb
Normal file
23
lib/diversipub/sinatra_app.rb
Normal 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
|
Loading…
Reference in a new issue