Module: Lono::Core
- Extended by:
- Memoist
- Included in:
- Lono, Lono::Configset::Strategy::Helpers::Dsl
- Defined in:
- lib/lono/core.rb,
lib/lono/core/config.rb
Defined Under Namespace
Classes: Config
Constant Summary collapse
- @@root =
nil
- @@blueprint_root =
nil
Instance Method Summary collapse
- #blueprint_root ⇒ Object
- #blueprint_root=(v) ⇒ Object
- #config ⇒ Object
- #env ⇒ Object
- #lono_pro_installed? ⇒ Boolean
- #lono_pro_removal_check! ⇒ Object
- #root ⇒ Object
-
#set_aws_profile! ⇒ Object
Overrides AWS_PROFILE based on the Lono.env if set in configs/settings.yml 2-way binding.
-
#settings ⇒ Object
Do not use the Setting#data to load the profile because it can cause an infinite loop then if we decide to use Lono.env from within settings class.
Instance Method Details
#blueprint_root ⇒ Object
20 |
# File 'lib/lono/core.rb', line 20 def blueprint_root; @@blueprint_root ; end |
#blueprint_root=(v) ⇒ Object
21 |
# File 'lib/lono/core.rb', line 21 def blueprint_root=(v) ; @@blueprint_root = v ; end |
#config ⇒ Object
7 8 9 |
# File 'lib/lono/core.rb', line 7 def config Config.new end |
#env ⇒ Object
23 24 25 26 27 28 |
# File 'lib/lono/core.rb', line 23 def env # 2-way binding env = env_from_profile(ENV['AWS_PROFILE']) || 'development' env = ENV['LONO_ENV'] if ENV['LONO_ENV'] # highest precedence env end |
#lono_pro_installed? ⇒ Boolean
64 65 66 67 68 69 |
# File 'lib/lono/core.rb', line 64 def lono_pro_installed? Lono::Pro::VERSION true rescue NameError false end |
#lono_pro_removal_check! ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/lono/core.rb', line 53 def lono_pro_removal_check! if lono_pro_installed? puts "ERROR: A lono-pro gem installation has been detected.".color(:red) puts <<~EOL The lono-pro gem is now a part of lono itself. The lono-pro gem has been deprecated. Please uninstall the lono-pro gem and remove it from your Gemfile to continue. EOL exit 1 end end |
#root ⇒ Object
13 14 15 16 |
# File 'lib/lono/core.rb', line 13 def root path = @@root || ENV['LONO_ROOT'] || Dir.pwd Pathname.new(path) end |
#set_aws_profile! ⇒ Object
Overrides AWS_PROFILE based on the Lono.env if set in configs/settings.yml 2-way binding.
33 34 35 36 37 38 39 40 |
# File 'lib/lono/core.rb', line 33 def set_aws_profile! return unless settings # Only load if within lono project and there's a settings.yml data = settings[Lono.env] || {} if data["aws_profile"] # puts "Using AWS_PROFILE=#{data["aws_profile"]} from LONO_ENV=#{Lono.env} in configs/settings.yml" ENV['AWS_PROFILE'] = data["aws_profile"] end end |
#settings ⇒ Object
Do not use the Setting#data to load the profile because it can cause an infinite loop then if we decide to use Lono.env from within settings class.
44 45 46 47 48 49 50 |
# File 'lib/lono/core.rb', line 44 def settings setting = Setting.new(false) # check_lono_project to account for `lono new` settings_path = setting.lookup_project_settings_path return unless settings_path # in case outside of lono project YAML.load_file(settings_path) end |