Module: BriskBills

Defined in:
lib/brisk-bills/initializer.rb,
lib/generators/generator_base_extension.rb,
lib/generators/instance/templates/instance_boot.rb

Defined Under Namespace

Modules: GeneratorBaseExtension, Version Classes: AppBoot, Boot, Configuration, GemBoot, Initializer, VendorBoot

Class Method Summary collapse

Class Method Details

.app?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/generators/instance/templates/instance_boot.rb', line 42

def app?
  File.exist? "#{RAILS_ROOT}/lib/brisk-bills.rb"
end

.boot!Object



16
17
18
19
20
21
# File 'lib/generators/instance/templates/instance_boot.rb', line 16

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

.booted?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/generators/instance/templates/instance_boot.rb', line 23

def booted?
  defined? BriskBills::Initializer
end

.loaded_via_app?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/generators/instance/templates/instance_boot.rb', line 54

def loaded_via_app?
  pick_boot.is_a? AppBoot
end

.loaded_via_gem?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/generators/instance/templates/instance_boot.rb', line 50

def loaded_via_gem?
  pick_boot.is_a? GemBoot
end

.pick_bootObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/generators/instance/templates/instance_boot.rb', line 27

def pick_boot
  case
  when app?
    AppBoot.new
  when vendor?
    VendorBoot.new
  else
    GemBoot.new
  end
end

.preinitializeObject



46
47
48
# File 'lib/generators/instance/templates/instance_boot.rb', line 46

def preinitialize
  load preinitializer_path if File.exist? preinitializer_path
end

.preinitializer_pathObject



58
59
60
# File 'lib/generators/instance/templates/instance_boot.rb', line 58

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

.vendor?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/generators/instance/templates/instance_boot.rb', line 38

def vendor?
  File.exist? "#{RAILS_ROOT}/vendor/brisk-bills"
end