lib/lono/core.rb in lono-6.1.11 vs lib/lono/core.rb in lono-7.0.0

- old
+ new

@@ -37,27 +37,10 @@ # puts "Using AWS_PROFILE=#{data["aws_profile"]} from LONO_ENV=#{Lono.env} in configs/settings.yml" ENV['AWS_PROFILE'] = data["aws_profile"] end end - # Precedence (highest to lowest) - # 1. LONO_SUFFIX - # 2. .current/lono - # 3. config/settings.yml - def suffix - suffix = ENV['LONO_SUFFIX'] # highest precedence - suffix ||= Cfn::Current.suffix - unless suffix - settings = Setting.new.data - suffix ||= settings["stack_name_suffix"] # lowest precedence - end - - return if suffix&.empty? - suffix - end - memoize :suffix - # 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. def settings setting = Setting.new(false) # check_lono_project to account for `lono new` settings_path = setting.lookup_project_settings_path @@ -65,12 +48,25 @@ YAML.load_file(settings_path) end memoize :settings - def pro_version - installed = Gem::Specification.detect { |spec| spec.name == 'lono-pro' } - installed ? Lono::Pro::VERSION : "not installed" + 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 + + def lono_pro_installed? + Lono::Pro::VERSION + true + rescue NameError + false end private def env_from_profile(aws_profile) return unless settings