From c7d5c2798f47ed0a06f0ef57908c556580f72f9c Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 2 Feb 2015 16:41:12 -0800 Subject: more verbose --version (closes #4428) --- lib/leap_cli/leapfile.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/leap_cli/leapfile.rb') diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb index 8895f4d..7aaf10f 100644 --- a/lib/leap_cli/leapfile.rb +++ b/lib/leap_cli/leapfile.rb @@ -72,7 +72,8 @@ module LeapCli unless @platform_branch.nil? Util::log 0, :warning, "in Leapfile: @platform_branch is no longer supported." end - return true + @valid = true + return @valid end end @@ -84,6 +85,10 @@ module LeapCli edit_leaprc(property) end + def valid? + !!@valid + end + private # -- cgit v1.2.3 From 44de719a21c80646125063e7a5f6dafc5cfc44ae Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 27 Apr 2015 09:58:24 -0700 Subject: make self.environment available to Leapfile. --- lib/leap_cli/leapfile.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/leap_cli/leapfile.rb') diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb index 7aaf10f..1bb2fa0 100644 --- a/lib/leap_cli/leapfile.rb +++ b/lib/leap_cli/leapfile.rb @@ -47,6 +47,12 @@ module LeapCli # set up paths # @provider_directory_path = directory + begin + # load leaprc first, so that we can potentially access which environment is pinned in Leapfile + # but also load leaprc last, so that it can override what is set in Leapfile. + read_settings(leaprc_path) + rescue StandardError + end read_settings(directory + '/Leapfile') read_settings(leaprc_path) @platform_directory_path = File.expand_path(@platform_directory_path || '../leap_platform', @provider_directory_path) @@ -54,6 +60,10 @@ module LeapCli # # load the platform # + platform_file = "#{@platform_directory_path}/platform.rb" + unless File.exists?(platform_file) + 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_directory_path}/platform.rb" if !Leap::Platform.compatible_with_cli?(LeapCli::VERSION) Util.bail! "This leap command (v#{LeapCli::VERSION}) " + -- cgit v1.2.3 From 59c931ae3c2c0b6783cecbba965179b5985d0b2b Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 28 Apr 2015 11:03:47 -0700 Subject: better platform version incompatibility message (closes #6855) --- lib/leap_cli/leapfile.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'lib/leap_cli/leapfile.rb') diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb index 1bb2fa0..c2bc10b 100644 --- a/lib/leap_cli/leapfile.rb +++ b/lib/leap_cli/leapfile.rb @@ -65,17 +65,13 @@ module LeapCli 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_directory_path}/platform.rb" - if !Leap::Platform.compatible_with_cli?(LeapCli::VERSION) + if !Leap::Platform.compatible_with_cli?(LeapCli::VERSION) || + !Leap::Platform.version_in_range?(LeapCli::COMPATIBLE_PLATFORM_VERSION) Util.bail! "This leap command (v#{LeapCli::VERSION}) " + - "is not compatible with the platform #{@platform_directory_path} (v#{Leap::Platform.version}). " + - "You need leap command #{Leap::Platform.compatible_cli.first} to #{Leap::Platform.compatible_cli.last}." + "is not compatible with the platform #{@platform_directory_path} (v#{Leap::Platform.version}).\n " + + "You need either leap command #{Leap::Platform.compatible_cli.first} to #{Leap::Platform.compatible_cli.last} or " + + "platform version #{LeapCli::COMPATIBLE_PLATFORM_VERSION.first} to #{LeapCli::COMPATIBLE_PLATFORM_VERSION.last}" end - if !Leap::Platform.version_in_range?(LeapCli::COMPATIBLE_PLATFORM_VERSION) - Util.bail! "This leap command (v#{LeapCli::VERSION}) " + - "is not compatible with the platform #{@platform_directory_path} (v#{Leap::Platform.version}). " + - "You need platform version #{LeapCli::COMPATIBLE_PLATFORM_VERSION.first} to #{LeapCli::COMPATIBLE_PLATFORM_VERSION.last}." - end - unless @allow_production_deploy.nil? Util::log 0, :warning, "in Leapfile: @allow_production_deploy is no longer supported." end -- cgit v1.2.3