Module: Rails

Defined in:
lib/branston/config/boot.rb

Defined Under Namespace

Classes: Boot, GemBoot, VendorBoot

Class Method Summary collapse

Class Method Details

.boot!Object



8
9
10
11
12
13
# File 'lib/branston/config/boot.rb', line 8

def boot!
  unless booted?
    preinitialize
    pick_boot.run
  end
end

.booted?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/branston/config/boot.rb', line 15

def booted?
  defined? Rails::Initializer
end

.pick_bootObject



19
20
21
# File 'lib/branston/config/boot.rb', line 19

def pick_boot
  (vendor_rails? ? VendorBoot : GemBoot).new
end

.preinitializeObject



27
28
29
# File 'lib/branston/config/boot.rb', line 27

def preinitialize
  load(preinitializer_path) if File.exist?(preinitializer_path)
end

.preinitializer_pathObject



31
32
33
# File 'lib/branston/config/boot.rb', line 31

def preinitializer_path
  "#{RAILS_ROOT}/config/preinitializer.rb"
end

.vendor_rails?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/branston/config/boot.rb', line 23

def vendor_rails?
  File.exist?("#{RAILS_ROOT}/vendor/rails")
end