extend GLI::App
extend Forwardable
- #
# delegate highline methods to make them available to sub-commands
- #
@terminal = HighLine.new
def_delegator :@terminal, :ask, 'self.ask'
def_delegator :@terminal, :agree, 'self.agree'
def_delegator :@terminal, :color, 'self.color'
def_delegator :@terminal, :list, 'self.list'
- #
# make config manager available as 'manager'
- #
def self.manager
@manager ||= begin
manager = LeapCli::Config::Manager.new
end
end
- #
# make provider config available as 'provider'
- #
def self.provider
manager.provider
end
- #
+ # make leapfile available as 'leapfile'
+ def self.leapfile
+ LeapCli::leapfile
+ end
+
# info about leap command line suite
- #
program_desc LeapCli::SUMMARY
program_long_desc LeapCli::DESCRIPTION
- #
# handle --version ourselves
- #
if ARGV.grep(/--version/).any?
puts "leap #{LeapCli::VERSION}, ruby #{RUBY_VERSION}"
exit(0)
end
- #
# load commands and run
- #
commands_from('leap_cli/commands')
exit run(ARGV)
end
end
def leapfile_content(options)
- %[@platform_directory_path = "#{options[:platform]}"
+ %[## Required:
+@platform_directory_path = "#{options[:platform]}"
+@leap_version = "#{LeapCli::VERSION}"
+
+## Optional:
+# @custom_vagrant_vm_line = "config.vm.boot_mode = :gui"
]
- # leap_version = "#{LeapCli::VERSION}"
- # platform_version = ""
end
GITIGNORE_CONTENT = <<EOS
lines << %[ config.vm.box_url = "http://cloud.github.com/downloads/leapcode/minimal-debian-vagrant/leap-wheezy.box"]
lines << %[ config.vm.network :hostonly, "#{node.ip_address}", :netmask => "#{netmask}"]
lines << %[ config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]]
+ lines << %[ #{leapfile.custom_vagrant_vm_line}] if leapfile.custom_vagrant_vm_line
lines << %[ end]
end
end
class Leapfile
attr_accessor :platform_directory_path
attr_accessor :provider_directory_path
+ attr_accessor :custom_vagrant_vm_line
+ attr_accessor :leap_version
def load
directory = File.expand_path(find_in_directory_tree('Leapfile'))