Template of a custom feed generator service for the Bluesky network in Ruby
1require 'blue_factory'
2require 'sinatra/activerecord'
3
4if defined?(RubyVM::YJIT) && RubyVM::YJIT.respond_to?(:enabled?)
5 if !RubyVM::YJIT.enabled?
6 if RubyVM::YJIT.respond_to?(:enable)
7 # Ruby 3.3+
8 RubyVM::YJIT.enable
9 else
10 # Ruby 3.2
11 puts "-" * 106
12 puts "Note: YJIT is not enabled. To improve performance, enable it by adding an ENV var RUBYOPT=\"--enable-yjit\"."
13 puts "-" * 106
14 end
15 end
16else
17 puts "-" * 112
18 puts "Note: YJIT is not enabled. To improve performance, it's recommended to " +
19 ((RUBY_VERSION.to_f >= 3.2) ? "install Ruby with YJIT support turned on." : "update to a newer Ruby with YJIT support.")
20 puts "-" * 112
21end
22
23ar_logger = ActiveRecord::Base.logger
24ActiveRecord::Base.logger = nil
25ActiveRecord::Base.connection.execute "PRAGMA journal_mode = WAL"
26ActiveRecord::Base.logger = ar_logger