Method: FalkorLib::Bootstrap.vagrant
- Defined in:
- lib/falkorlib/bootstrap/vagrant.rb
.vagrant(dir = Dir.pwd, options = {}) ⇒ Object
vagrant ###### Initialize Vagrant in the current directory Supported options:
* :force [boolean] force overwritting
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 |
# File 'lib/falkorlib/bootstrap/vagrant.rb', line 28 def vagrant(dir = Dir.pwd, = {}) info "Initialize Vagrant (see https://www.vagrantup.com/)" path = normalized_path(dir) use_git = FalkorLib::Git.init?(path) rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path templatedir = File.join( FalkorLib.templates, 'vagrant') config = FalkorLib::Config::Bootstrap::DEFAULTS[:vagrant].clone if [:os] config[:os] = [:os] else config[:os] = select_from(config[:boxes].keys, "Select OS to configure within your vagrant boxes by default", (config[:boxes].keys.find_index(config[:os]) + 1)) end [ :ram, :vcpus, :domain, :range ].each do |k| config[k.to_sym] = ask("\tDefault #{k.capitalize}:", config[k.to_sym]) end puts config.to_yaml FalkorLib::GitFlow.start('feature', 'vagrant', rootdir) if (use_git && FalkorLib::GitFlow.init?(rootdir)) init_from_template(templatedir, rootdir, config, :no_interaction => true, :no_commit => true) [ 'bootstrap.sh', 'config.yaml.sample' ].each do |f| FalkorLib::Git.add(File.join(rootdir, 'vagrant', "#{f}")) if use_git end Dir.chdir( rootdir ) do run %(git ignore '.vagrant/' ) # run %(ln -s README.md index.md ) # run %(ln -s README.md contributing/index.md ) # run %(ln -s README.md setup/index.md ) end FalkorLib::Git.add(File.join(rootdir, '.gitignore')) if use_git #exit_status.to_i end |