Module: Terraspace::Booter
Instance Method Summary collapse
- #boot ⇒ Object
- #load_plugin_default_configs ⇒ Object
- #run_hook(env = nil) ⇒ Object
-
#run_hooks ⇒ Object
Special boot hooks run super early, even before plugins are loaded.
- #set_plugin_cache! ⇒ Object
Instance Method Details
#boot ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/terraspace/booter.rb', line 3 def boot run_hooks Dotenv.new.load! Terraspace::Bundle.require # load plugins load_plugin_default_configs Terraspace::App::Inits.run_all set_plugin_cache! end |
#load_plugin_default_configs ⇒ Object
12 13 14 15 16 17 |
# File 'lib/terraspace/booter.rb', line 12 def load_plugin_default_configs Terraspace::Plugin.config_classes.each do |klass| # IE: TerraspacePluginAws::Interfaces::Config.instance.load_project_config klass.instance.load_project_config end end |
#run_hook(env = nil) ⇒ Object
38 39 40 41 42 |
# File 'lib/terraspace/booter.rb', line 38 def run_hook(env=nil) name = env ? "boot/#{env}" : "boot" path = "#{Terraspace.root}/config/#{name}.rb" require path if File.exist?(path) end |
#run_hooks ⇒ Object
Special boot hooks run super early, even before plugins are loaded. Useful for setting env vars and other early things.
config/boot.rb
config/boot/dev.rb
33 34 35 36 |
# File 'lib/terraspace/booter.rb', line 33 def run_hooks run_hook run_hook(Terraspace.env) end |
#set_plugin_cache! ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/terraspace/booter.rb', line 19 def set_plugin_cache! plugin_cache = Terraspace.config.terraform.plugin_cache return unless plugin_cache.enabled dir = ENV['TF_PLUGIN_CACHE_DIR'] ||= plugin_cache.dir FileUtils.mkdir_p(dir) dir end |