aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interfaces/http/http.rb5
-rw-r--r--interfaces/ruby/ruby.rb9
2 files changed, 8 insertions, 6 deletions
diff --git a/interfaces/http/http.rb b/interfaces/http/http.rb
index 0a8457c..5c9eca4 100644
--- a/interfaces/http/http.rb
+++ b/interfaces/http/http.rb
@@ -1,6 +1,9 @@
require 'sinatra/base'
require_relative '../ruby/ruby'
-require_relative 'web/web'
+
+Dir.glob('*/*.rb', base: __dir__).grep(/^(.*)\/\1\.rb$/).each do |f|
+ require_relative f
+end
$config = Config.first
diff --git a/interfaces/ruby/ruby.rb b/interfaces/ruby/ruby.rb
index 4c18111..ffd6d6a 100644
--- a/interfaces/ruby/ruby.rb
+++ b/interfaces/ruby/ruby.rb
@@ -2,10 +2,9 @@ require 'active_record'
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
- database: 'db.sqlite3'
+ database: "#{__dir__}/../../db.sqlite3"
)
-require_relative 'models/config'
-require_relative 'models/comment'
-require_relative 'models/post'
-require_relative 'models/tag'
+Dir.glob('models/*.rb', base: __dir__).each do |f|
+ require_relative f
+end