diff options
author | elijah <elijah@riseup.net> | 2016-09-01 13:22:33 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2016-09-01 13:22:33 -0700 |
commit | 5e266e1f9d22fbb78612a896f47a19be5106aee1 (patch) | |
tree | d085979f1dcfdcdab5ee8058ecf552ce4c67eae0 /lib/leap_cli | |
parent | cd809a6b69790b48344abfaa294edd8c4d4c7231 (diff) |
print friendly message if leap_platform is too old (closes #8423)
Diffstat (limited to 'lib/leap_cli')
-rw-r--r-- | lib/leap_cli/leapfile.rb | 15 | ||||
-rw-r--r-- | lib/leap_cli/util.rb | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb index 0b56b71..e526703 100644 --- a/lib/leap_cli/leapfile.rb +++ b/lib/leap_cli/leapfile.rb @@ -63,8 +63,19 @@ module LeapCli unless File.exist?(platform_definition) Util.bail! "ERROR: The file `#{platform_file}` does not exist. Please check the value of `@platform_directory_path` in `Leapfile` or `~/.leaprc`." end - require platform_class - require platform_definition + begin + require platform_class + require platform_definition + rescue LoadError + Util.log "The leap_platform at #{platform_directory_path} is not compatible with this version of leap_cli" + Util.log "You can either:" do + Util.log "Upgrade leap_platform to version " + LeapCli::COMPATIBLE_PLATFORM_VERSION.first + Util.log "Or, downgrade leap_cli to version 1.8" + end + Util.bail! + rescue StandardError => exc + Util.bail! exc.to_s + end begin Leap::Platform.validate!(LeapCli::VERSION, LeapCli::COMPATIBLE_PLATFORM_VERSION, self) rescue StandardError => exc diff --git a/lib/leap_cli/util.rb b/lib/leap_cli/util.rb index 8826d21..ae73731 100644 --- a/lib/leap_cli/util.rb +++ b/lib/leap_cli/util.rb @@ -45,7 +45,7 @@ module LeapCli if message.any? log(0, *message, &block) else - log(0, :bailing, "out", &block) + log(0, :bailing, "out", :color => :red, :style => :bold, &block) end raise SystemExit.new(exit_status || 1) end |