lib/vagrant-invade/action/config.rb in vagrant-invade-0.2.0 vs lib/vagrant-invade/action/config.rb in vagrant-invade-0.3.0
- old
+ new
@@ -13,12 +13,12 @@
end
def call(env)
root_path = @env[:root_path]
config_file_path = "#{root_path}/invade.yml"
- template_file_path = config_file_path + '.dist'
- default_config_file_path = Dir.pwd + '/invade.yml.dist'
+ template_file_path = "#{config_file_path}.dist"
+ default_config_file_path = "#{File.expand_path('../../../../', __FILE__)}/invade.yml.dist"
# Returns with invade in environment if Invade Configuration file already exists
if File.exist?(config_file_path)
@logger.debug 'Config file found. Proceed.'
@env[:ui].info "[Invade] Using Plugin vagrant-invade-#{VagrantPlugins::Invade::VERSION} to setup Vagrant!"
@@ -39,13 +39,13 @@
@env[:ui].warn "\tTo: \"#{config_file_path}\""
sleep 2
@env[:ui].warn '[Invade] Restarting vagrant...'
sleep 3
if !Vagrant.in_installer? && !Vagrant.very_quiet?
- Kernel.exec('bundle exec vagrant up')
+ Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
else
- Kernel.exec('vagrant up')
+ Kernel.exec('vagrant up') if @env[:invade_command]
end
rescue
# If not found default invade configuration file will be copied.
FileUtils.cp(default_config_file_path, config_file_path)
@logger.info 'Template file could not be found. Copied default invade configuration file.'
@@ -55,12 +55,12 @@
@env[:ui].warn "\tTo: \"#{config_file_path}\""
sleep 2
@env[:ui].warn '[Invade] Restarting vagrant...'
sleep 3
if !Vagrant.in_installer? && !Vagrant.very_quiet?
- Kernel.exec('bundle exec vagrant up')
+ Kernel.exec('bundle exec vagrant up') if @env[:invade_command]
else
- Kernel.exec('vagrant up')
+ Kernel.exec('vagrant up') if @env[:invade_command]
end
end
end
@app.call(env)