summaryrefslogtreecommitdiff
path: root/lib/leap_cli/leapfile.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-04-27 09:58:24 -0700
committerelijah <elijah@riseup.net>2015-04-27 09:58:24 -0700
commit44de719a21c80646125063e7a5f6dafc5cfc44ae (patch)
treece59a2a113e0cb91909c8c5312b694a982a75443 /lib/leap_cli/leapfile.rb
parent1c58dd5905bdad68df4f57aa3323d95d8bd2db0a (diff)
make self.environment available to Leapfile.
Diffstat (limited to 'lib/leap_cli/leapfile.rb')
-rw-r--r--lib/leap_cli/leapfile.rb10
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}) " +