Skip to content

Commit 86f6d46

Browse files
committed
Add Homestead for this project
1 parent 4b9624f commit 86f6d46

File tree

5 files changed

+75
-0
lines changed

5 files changed

+75
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
/tags
1010
.env
1111
.idea
12+
.vagrant
1213
composer.lock

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "homestead"]
2+
path = homestead
3+
url = https://github.com/laravel/homestead.git

Homestead.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
ip: "192.168.10.10"
3+
memory: 2048
4+
cpus: 1
5+
hostname: code
6+
name: code
7+
provider: virtualbox
8+
9+
folders:
10+
- map: "."
11+
to: "/home/vagrant/code"
12+
13+
sites:
14+
- map: homestead.app
15+
to: "/home/vagrant/code/public"
16+
17+
databases:
18+
- homestead
19+
20+
# blackfire:
21+
# - id: foo
22+
# token: bar
23+
# client-id: foo
24+
# client-token: bar
25+
26+
# ports:
27+
# - send: 50000
28+
# to: 5000
29+
# - send: 7777
30+
# to: 777
31+
# protocol: udp

Vagrantfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
require 'json'
2+
require 'yaml'
3+
4+
VAGRANTFILE_API_VERSION ||= "2"
5+
6+
homesteadYamlPath = "Homestead.yaml"
7+
homesteadJsonPath = "Homestead.json"
8+
afterScriptPath = "after.sh"
9+
aliasesPath = "aliases"
10+
11+
require File.expand_path(confDir + '/scripts/homestead.rb')
12+
13+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
14+
if File.exists? aliasesPath then
15+
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
16+
end
17+
18+
if File.exists? homesteadYamlPath then
19+
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
20+
elsif File.exists? homesteadJsonPath then
21+
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
22+
end
23+
24+
if File.exists? afterScriptPath then
25+
config.vm.provision "shell", path: afterScriptPath
26+
end
27+
end

after.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
cd code
6+
7+
sudo -u vagrant -H bash -c "cp .env.testing .env; \
8+
if [ ! -f ~/.key_generated ]; then php artisan key:generate; touch ~/.key_generated; fi; \
9+
composer install; \
10+
touch storage/database.sqlite; \
11+
touch storage/testing.sqlite; \
12+
php artisan migrate; \
13+
php artisan migrate --database=sqlite_testing;"

0 commit comments

Comments
 (0)