class FlashKick::VagrantGenerator

Public Instance Methods

backup_files() click to toggle source
# File lib/generators/flash_kick/vagrant_generator.rb, line 47
def backup_files
  FileUtils.mv 'config/database.yml', 'config/database.yml.bak'
end
copy_files() click to toggle source
# File lib/generators/flash_kick/vagrant_generator.rb, line 39
def copy_files
  copy_file 'ansible_templates/playbooks/_vagrant.yml', 'config/ansible/playbooks/vagrant.yml'
end
copy_templates() click to toggle source
# File lib/generators/flash_kick/vagrant_generator.rb, line 51
def copy_templates
  template '_database.yml', 'config/database.yml'
  template '_Vagrantfile', 'Vagrantfile'
end
modify_files() click to toggle source
# File lib/generators/flash_kick/vagrant_generator.rb, line 43
def modify_files
  append_file '.gitignore', "\n.vagrant/"
end
prompt_user() click to toggle source
# File lib/generators/flash_kick/vagrant_generator.rb, line 19
def prompt_user
  if FlashKick::VariableStore.variables['use_vagrant'] == true
    question :string do
      {
        vagrant_memory: 'How many Megabytes of memory would you like to allocate to your VM? [enter for default]',
        default: '2'
      }
    end
    question :string do
      {
        vagrant_cpus: 'How many CPUs would you like to allocated? [enter for default]',
        default: '1'
      }
    end
  else
    puts 'Skipping Vagrant'
    exit
  end
end
use_vagrant() click to toggle source
# File lib/generators/flash_kick/vagrant_generator.rb, line 10
def use_vagrant
  question :boolean do
    {
      use_vagrant: 'Would you like to use Vagrant with your project?',
      default: 'No'
    }
  end
end