Class: VagrantPlugins::Solidus::SolidusBox::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-solidus/solidus-box/init.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-solidus/solidus-box/init.rb', line 5

def execute
  parse_arguments

  source_path = File.join(File.dirname(__FILE__), 'Vagrantfile')
  target_path = File.join(@env.root_path || Dir.pwd, 'Vagrantfile')

  abort if File.exists?(target_path) && @env.ui.ask("Are you sure you want to replace `#{target_path}`? [y/n] ") != 'y'
  FileUtils.copy(source_path, target_path)

  @env.ui.success("A `Vagrantfile` prepared for Solidus has been placed here:
                  #{target_path}
                  Run `vagrant site` to see all the available commands to manage your Solidus sites.".gsub(/^\s*/, ''))

  # Success, exit status 0
  0
end