aboutsummaryrefslogtreecommitdiff
path: root/interfaces/http
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-03-02 19:38:59 +0100
committerJohn Ankarström <john@ankarstrom.se>2021-03-02 19:38:59 +0100
commit1c956e662bb2072fa6e769ec5599dfab6db2c829 (patch)
tree2a964b3bec40a7897eaf4adeaf183c1298edaac1 /interfaces/http
parentc8e09cc8ec756014268405470fdc45db6e0acb95 (diff)
downloadcomb-1c956e662bb2072fa6e769ec5599dfab6db2c829.tar.gz
Load models and sub-interfaces manually instead
I realized that this is more flexible, as it allows the user to comment out whatever models/sub-interfaces they don't want to use. Adding a new model or sub-interface requires a tiny bit more work, but I think it's worth it.
Diffstat (limited to 'interfaces/http')
-rw-r--r--interfaces/http/http.rb8
-rw-r--r--interfaces/http/web/web.rb2
2 files changed, 4 insertions, 6 deletions
diff --git a/interfaces/http/http.rb b/interfaces/http/http.rb
index 5c9eca4..8947890 100644
--- a/interfaces/http/http.rb
+++ b/interfaces/http/http.rb
@@ -1,13 +1,11 @@
require 'sinatra/base'
require_relative '../ruby/ruby'
-Dir.glob('*/*.rb', base: __dir__).grep(/^(.*)\/\1\.rb$/).each do |f|
- require_relative f
-end
-
$config = Config.first
class HTTPInterface < Sinatra::Base
- use WebInterface
+ require_relative 'web/web'; use WebInterface
+ # require_relative 'admin/admin'; use AdminInterface
+ # require_relative 'rss/rss'; use RSSInterface
run! if app_file == $0
end
diff --git a/interfaces/http/web/web.rb b/interfaces/http/web/web.rb
index 8ae8afd..ca04ecc 100644
--- a/interfaces/http/web/web.rb
+++ b/interfaces/http/web/web.rb
@@ -3,4 +3,4 @@ class WebInterface < Sinatra::Base
@posts = Post.all
erb :index
end
-end \ No newline at end of file
+end