aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-10-09 12:19:40 -0700
committerelijah <elijah@riseup.net>2014-10-09 12:19:40 -0700
commitdc30308c8ff4b5cdfcb078b2100a74ce170313a3 (patch)
tree4d91c6c6beefb8deff15b3f44a007b2bc420c5fb /lib
parent516a074a33f5ffcb445dfbeaf4c88e3b09af97c4 (diff)
downloadleap_cli-dc30308c8ff4b5cdfcb078b2100a74ce170313a3.tar.gz
leap_cli-dc30308c8ff4b5cdfcb078b2100a74ce170313a3.tar.bz2
make platform constraints optional (ask the user if they really want to do it).
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/commands/deploy.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb
index b78f130..b4e3779 100644
--- a/lib/leap_cli/commands/deploy.rb
+++ b/lib/leap_cli/commands/deploy.rb
@@ -110,30 +110,34 @@ module LeapCli
# check version
if provider.platform['version']
if !Leap::Platform.version_in_range?(provider.platform.version)
- bail!("The platform is pinned to a version range of '#{provider.platform.version}' "+
+ say("The platform is pinned to a version range of '#{provider.platform.version}' "+
"by the `platform.version` property in #{provider_json}, but the platform "+
"(#{Path.platform}) has version #{Leap::Platform.version}.")
+ quit!("OK. Bye.") unless agree("Do you really want to deploy from the wrong version? ")
end
end
# check branch
if provider.platform['branch']
if !is_git_directory?(Path.platform)
- bail!("The platform is pinned to a particular branch by the `platform.branch` property "+
+ say("The platform is pinned to a particular branch by the `platform.branch` property "+
"in #{provider_json}, but the platform directory (#{Path.platform}) is not a git repository.")
+ quit!("OK. Bye.") unless agree("Do you really want to deploy anyway? ")
end
unless provider.platform.branch == current_git_branch(Path.platform)
- bail!("The platform is pinned to branch '#{provider.platform.branch}' by the `platform.branch` property "+
+ say("The platform is pinned to branch '#{provider.platform.branch}' by the `platform.branch` property "+
"in #{provider_json}, but the current branch is '#{current_git_branch(Path.platform)}' " +
"(for directory '#{Path.platform}')")
+ quit!("OK. Bye.") unless agree("Do you really want to deploy from the wrong branch? ")
end
end
# check commit
if provider.platform['commit']
if !is_git_directory?(Path.platform)
- bail!("The platform is pinned to a particular commit range by the `platform.commit` property "+
+ say("The platform is pinned to a particular commit range by the `platform.commit` property "+
"in #{provider_json}, but the platform directory (#{Path.platform}) is not a git repository.")
+ quit!("OK. Bye.") unless agree("Do you really want to deploy anyway? ")
end
current_commit = current_git_commit(Path.platform)
Dir.chdir(Path.platform) do
@@ -144,9 +148,10 @@ module LeapCli
commit_range = commit_range.split("\n")
if !commit_range.include?(current_commit) &&
provider.platform.commit.split('..').first != current_commit
- bail!("The platform is pinned via the `platform.commit` property in #{provider_json} " +
+ say("The platform is pinned via the `platform.commit` property in #{provider_json} " +
"to a commit in the range #{provider.platform.commit}, but the current HEAD " +
"(#{current_commit}) is not in that range.")
+ quit!("OK. Bye.") unless agree("Do you really want to deploy from the wrong commit? ")
end
end
end