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(+) 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