diff options
author | elijah <elijah@riseup.net> | 2015-05-05 15:49:07 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-05-05 15:49:07 -0700 |
commit | 6c6b5a88f18f714924530d64486cb88c02bd7ee4 (patch) | |
tree | 3a663822de4c279da8287db04f0a42cfb2c407fb /lib/leap_cli/leapfile.rb | |
parent | 51195b20531c4dcdf6a76e6a9a8ef7a771cf76be (diff) | |
parent | 61fdf41087b480db12720df5d5beadd32992475a (diff) |
Merge branch 'develop'
Conflicts:
lib/leap_cli/commands/db.rb
lib/leap_cli/commands/vagrant.rb
Diffstat (limited to 'lib/leap_cli/leapfile.rb')
-rw-r--r-- | lib/leap_cli/leapfile.rb | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb index 8895f4d..c2bc10b 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,25 +60,26 @@ module LeapCli # # load the platform # - require "#{@platform_directory_path}/platform.rb" - if !Leap::Platform.compatible_with_cli?(LeapCli::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}." + 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 - if !Leap::Platform.version_in_range?(LeapCli::COMPATIBLE_PLATFORM_VERSION) + require "#{@platform_directory_path}/platform.rb" + 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 platform version #{LeapCli::COMPATIBLE_PLATFORM_VERSION.first} to #{LeapCli::COMPATIBLE_PLATFORM_VERSION.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 - unless @allow_production_deploy.nil? Util::log 0, :warning, "in Leapfile: @allow_production_deploy is no longer supported." end 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 +91,10 @@ module LeapCli edit_leaprc(property) end + def valid? + !!@valid + end + private # |