summaryrefslogtreecommitdiff
path: root/lib/leap_cli/leapfile.rb
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/leapfile.rb
parentd78643049e18749994ca39e18f02be3f3d23bd88 (diff)
added @allow_production_deploy and @platform_branch to Leapfile
Diffstat (limited to 'lib/leap_cli/leapfile.rb')
-rw-r--r--lib/leap_cli/leapfile.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb
index c24f939..06db3b4 100644
--- a/lib/leap_cli/leapfile.rb
+++ b/lib/leap_cli/leapfile.rb
@@ -16,6 +16,8 @@ module LeapCli
attr_accessor :leap_version
attr_accessor :log
attr_accessor :vagrant_network
+ attr_accessor :platform_branch
+ attr_accessor :allow_production_deploy
def initialize
@vagrant_network = '10.5.5.0/24'
@@ -26,10 +28,15 @@ module LeapCli
if directory == '/'
return nil
else
- self.provider_directory_path = directory
+ @provider_directory_path = directory
read_settings(directory + '/Leapfile')
read_settings(ENV['HOME'] + '/.leaprc')
- self.platform_directory_path = File.expand_path(self.platform_directory_path || '../leap_platform', self.provider_directory_path)
+ @platform_directory_path = File.expand_path(@platform_directory_path || '../leap_platform', @provider_directory_path)
+ if @allow_production_deploy.nil?
+ # by default, only allow production deploys from 'master' or if not a git repo
+ @allow_production_deploy = !LeapCli::Util.is_git_directory?(@provider_directory_path) ||
+ LeapCli::Util.current_git_branch(@provider_directory_path) == 'master'
+ end
return true
end
end