diff options
author | elijah <elijah@riseup.net> | 2015-04-27 09:58:24 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-04-27 09:58:24 -0700 |
commit | 44de719a21c80646125063e7a5f6dafc5cfc44ae (patch) | |
tree | ce59a2a113e0cb91909c8c5312b694a982a75443 | |
parent | 1c58dd5905bdad68df4f57aa3323d95d8bd2db0a (diff) |
make self.environment available to Leapfile.
-rw-r--r-- | lib/leap_cli/leapfile.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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}) " + |