Class: LeapCli::Leapfile
- Inherits:
-
Object
- Object
- LeapCli::Leapfile
- Defined in:
- lib/leap_cli/leapfile.rb
Instance Attribute Summary collapse
-
#allow_production_deploy ⇒ Object
Returns the value of attribute allow_production_deploy.
-
#custom_vagrant_vm_line ⇒ Object
Returns the value of attribute custom_vagrant_vm_line.
-
#leap_version ⇒ Object
Returns the value of attribute leap_version.
-
#log ⇒ Object
Returns the value of attribute log.
-
#platform_branch ⇒ Object
Returns the value of attribute platform_branch.
-
#platform_directory_path ⇒ Object
Returns the value of attribute platform_directory_path.
-
#provider_directory_path ⇒ Object
Returns the value of attribute provider_directory_path.
-
#vagrant_network ⇒ Object
Returns the value of attribute vagrant_network.
Instance Method Summary collapse
-
#initialize ⇒ Leapfile
constructor
A new instance of Leapfile.
- #load(search_directory = nil) ⇒ Object
Constructor Details
#initialize ⇒ Leapfile
Returns a new instance of Leapfile.
22 23 24 |
# File 'lib/leap_cli/leapfile.rb', line 22 def initialize @vagrant_network = '10.5.5.0/24' end |
Instance Attribute Details
#allow_production_deploy ⇒ Object
Returns the value of attribute allow_production_deploy.
20 21 22 |
# File 'lib/leap_cli/leapfile.rb', line 20 def allow_production_deploy @allow_production_deploy end |
#custom_vagrant_vm_line ⇒ Object
Returns the value of attribute custom_vagrant_vm_line.
15 16 17 |
# File 'lib/leap_cli/leapfile.rb', line 15 def custom_vagrant_vm_line @custom_vagrant_vm_line end |
#leap_version ⇒ Object
Returns the value of attribute leap_version.
16 17 18 |
# File 'lib/leap_cli/leapfile.rb', line 16 def leap_version @leap_version end |
#log ⇒ Object
Returns the value of attribute log.
17 18 19 |
# File 'lib/leap_cli/leapfile.rb', line 17 def log @log end |
#platform_branch ⇒ Object
Returns the value of attribute platform_branch.
19 20 21 |
# File 'lib/leap_cli/leapfile.rb', line 19 def platform_branch @platform_branch end |
#platform_directory_path ⇒ Object
Returns the value of attribute platform_directory_path.
13 14 15 |
# File 'lib/leap_cli/leapfile.rb', line 13 def platform_directory_path @platform_directory_path end |
#provider_directory_path ⇒ Object
Returns the value of attribute provider_directory_path.
14 15 16 |
# File 'lib/leap_cli/leapfile.rb', line 14 def provider_directory_path @provider_directory_path end |
#vagrant_network ⇒ Object
Returns the value of attribute vagrant_network.
18 19 20 |
# File 'lib/leap_cli/leapfile.rb', line 18 def vagrant_network @vagrant_network end |
Instance Method Details
#load(search_directory = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/leap_cli/leapfile.rb', line 26 def load(search_directory=nil) directory = File.(find_in_directory_tree('Leapfile', search_directory)) if directory == '/' return nil else # # set up paths # @provider_directory_path = directory read_settings(directory + '/Leapfile') read_settings(ENV['HOME'] + '/.leaprc') @platform_directory_path = File.(@platform_directory_path || '../leap_platform', @provider_directory_path) # # 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}." end if !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}." end # # set defaults # 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 |