vagrant/website/docs/source/v2/push/local-exec.html.md

56 lines
1.2 KiB
Markdown
Raw Normal View History

2014-11-14 20:51:40 +00:00
---
page_title: "Vagrant Push - Local Exec Strategy"
sidebar_current: "push-local-exec"
description: |-
2014-11-14 20:53:47 +00:00
The Vagrant Push Local Exec strategy pushes your application's code using a
user-defined script.
2014-11-14 20:51:40 +00:00
---
# Vagrant Push
## Local Exec Strategy
The Vagrant Push Local Exec strategy allows the user to invoke an arbitrary
shell command or script as part of a push.
<div class="alert alert-warn">
<p>
<strong>Warning:</strong> The Vagrant Push Local Exec strategy does not
perform any validation on the correctness of the shell script.
</p>
</div>
The Vagrant Push Local Exec strategy supports the following configuration
options:
- `command` - The command to execute (as a string).
### Usage
The Vagrant Push Local Exec strategy is defined in the `Vagrantfile` using the
`local-exec` key:
```ruby
config.push.define "local-exec" do |push|
push.command = <<-SCRIPT
scp . /var/www/website
SCRIPT
end
```
2014-11-14 20:55:14 +00:00
For more complicated scripts, you may store them in a separate file and read
them from the `Vagrantfile` like so:
```ruby
config.push.define "local-exec" do |push|
push.command = File.read("my-script.sh")
end
```
2014-11-14 20:51:40 +00:00
And then invoke the push with Vagrant:
```shell
$ vagrant push
```