aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-02-28 22:41:25 -0800
committerelijah <elijah@riseup.net>2013-02-28 22:41:25 -0800
commitdb6be7e8c1fc966d31fc7cba9dd728cf6d65739f (patch)
tree0447f3e9045dfcc1b4467669bda06db1f240b88a /lib/leap_cli/commands
parentd78643049e18749994ca39e18f02be3f3d23bd88 (diff)
downloadleap_cli-db6be7e8c1fc966d31fc7cba9dd728cf6d65739f.tar.gz
leap_cli-db6be7e8c1fc966d31fc7cba9dd728cf6d65739f.tar.bz2
added @allow_production_deploy and @platform_branch to Leapfile
Diffstat (limited to 'lib/leap_cli/commands')
-rw-r--r--lib/leap_cli/commands/deploy.rb14
-rw-r--r--lib/leap_cli/commands/pre.rb7
-rw-r--r--lib/leap_cli/commands/vagrant.rb2
3 files changed, 21 insertions, 2 deletions
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb
index 4cfefd7..065a111 100644
--- a/lib/leap_cli/commands/deploy.rb
+++ b/lib/leap_cli/commands/deploy.rb
@@ -20,7 +20,7 @@ module LeapCli
c.action do |global,options,args|
init_submodules
- nodes = manager.filter!(args)
+ nodes = filter_deploy_nodes(args)
if nodes.size > 1
say "Deploying to these nodes: #{nodes.keys.join(', ')}"
if !global[:yes] && !agree("Continue? ")
@@ -141,5 +141,17 @@ module LeapCli
return includes
end
+ #
+ # for safety, we allow production deploys to be turned off in the Leapfile.
+ #
+ def filter_deploy_nodes(filter)
+ nodes = manager.filter!(filter)
+ if !leapfile.allow_production_deploy
+ nodes = nodes[:production => false]
+ assert! nodes.any?, "Skipping deploy because @allow_production_deploy is disabled."
+ end
+ nodes
+ end
+
end
end
diff --git a/lib/leap_cli/commands/pre.rb b/lib/leap_cli/commands/pre.rb
index 03355bb..cb92fe2 100644
--- a/lib/leap_cli/commands/pre.rb
+++ b/lib/leap_cli/commands/pre.rb
@@ -47,6 +47,13 @@ module LeapCli
bail! { log :missing, "platform directory '#{Path.platform}'" }
end
+ if LeapCli.leapfile.platform_branch && LeapCli::Util.is_git_directory?(Path.platform)
+ branch = LeapCli::Util.current_git_branch(Path.platform)
+ if branch != LeapCli.leapfile.platform_branch
+ bail! "Wrong branch for #{Path.platform}. Was '#{branch}', should be '#{LeapCli.leapfile.platform_branch}'. Edit Leapfile to disable this check."
+ end
+ end
+
#
# set log file
#
diff --git a/lib/leap_cli/commands/vagrant.rb b/lib/leap_cli/commands/vagrant.rb
index 56e887a..3526d23 100644
--- a/lib/leap_cli/commands/vagrant.rb
+++ b/lib/leap_cli/commands/vagrant.rb
@@ -105,7 +105,7 @@ module LeapCli; module Commands
def vagrant_setup
assert_bin! 'vagrant', 'Vagrant is required for running local virtual machines. Run "sudo apt-get install vagrant".'
- unless `vagrant gem which sahara`.chars.any?
+ unless assert_run!('vagrant gem which sahara').chars.any?
log :installing, "vagrant plugin 'sahara'"
assert_run! 'vagrant gem install sahara'
end