Class: Ahoy::VagrantGenerator
- Inherits:
-
Generator::Base
- Object
- Rails::Generators::Base
- Generator::Base
- Ahoy::VagrantGenerator
- Defined in:
- lib/generators/ahoy/vagrant_generator.rb
Instance Method Summary collapse
- #backup_files ⇒ Object
- #copy_files ⇒ Object
- #copy_templates ⇒ Object
- #prompt_user ⇒ Object
- #use_vagrant ⇒ Object
Methods inherited from Generator::Base
Instance Method Details
#backup_files ⇒ Object
43 44 45 |
# File 'lib/generators/ahoy/vagrant_generator.rb', line 43 def backup_files FileUtils.mv 'config/database.yml', 'config/database.yml.bak' end |
#copy_files ⇒ Object
39 40 41 |
# File 'lib/generators/ahoy/vagrant_generator.rb', line 39 def copy_files copy_file 'ansible_templates/playbooks/_vagrant.yml', 'config/ansible/playbooks/vagrant.yml' end |
#copy_templates ⇒ Object
47 48 49 50 |
# File 'lib/generators/ahoy/vagrant_generator.rb', line 47 def copy_templates template '_database.yml', 'config/database.yml' template '_Vagrantfile', 'Vagrantfile' end |
#prompt_user ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/generators/ahoy/vagrant_generator.rb', line 19 def prompt_user if Ahoy::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 ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/generators/ahoy/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 |