Class: Itsi::Server::Config::Include

Inherits:
Option
  • Object
show all
Defined in:
lib/itsi/server/config/options/include.rb

Instance Method Summary collapse

Methods included from ConfigHelpers

included, #initialize, load_and_register, #normalize_keys!

Instance Method Details

#build!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/itsi/server/config/options/include.rb', line 14

def build!
  included_file = @params
  location.instance_eval do
    @included ||= []
    @included << included_file

    if @auto_reloading
      if ENV["BUNDLE_BIN_PATH"]
        watch "#{included_file}.rb", [%w[bundle exec itsi restart]]
      else
        watch "#{included_file}.rb", [%w[itsi restart]]
      end
    end
  end

  code = IO.read("#{included_file}.rb")
  location.instance_eval(code, "#{included_file}.rb", 1)
end