lib/patchmaster/web/sinatra_app.rb in patchmaster-1.1.2 vs lib/patchmaster/web/sinatra_app.rb in patchmaster-2.0.0

- old
+ new

@@ -1,17 +1,10 @@ require 'sinatra' require 'sinatra/json' require 'singleton' # ================================================================ -# Settings -# ================================================================ - -set :run, true -set :root, File.dirname(__FILE__) - -# ================================================================ # Helper methods # ================================================================ def pm @pm ||= PM::SinatraApp.instance.pm @@ -104,22 +97,25 @@ # GUI class: run method # ================================================================ module PM -class SinatraApp +class SinatraApp < Sinatra::Base + set :run, true + set :root, File.dirname(__FILE__) + include Singleton attr_accessor :port attr_reader :pm def initialize @pm = PM::PatchMaster.instance end def run - set(:port, @port) if @port + self.class.set(:port, @port) if @port @pm.start ensure @pm.stop @pm.close_debug_file end