Skip to content

Commit

Permalink
Adding homestead to run the site
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Nov 20, 2015
1 parent a041d37 commit 1c89314
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ composer.phar
_ide_helper.php
/public/Documentation
deploy.php
Homestead.yaml
.vagrant
28 changes: 28 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))

homesteadYamlPath = "Homestead.yaml"
homesteadJsonPath = "Homestead.json"
afterScriptPath = "after.sh"
aliasesPath = "aliases"

require File.expand_path(confDir + '/scripts/homestead.rb')

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end

if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end

if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
5 changes: 5 additions & 0 deletions after.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
34 changes: 34 additions & 0 deletions aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
alias ..="cd .."
alias ...="cd ../.."

alias h='cd ~'
alias cl='clear'
alias c='composer'
alias art='php artisan'

alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'

function serve() {
if [[ "$1" && "$2" ]]
then
sudo dos2unix /vagrant/scripts/serve.sh
sudo bash /vagrant/scripts/serve.sh "$1" "$2" 80
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve domain path"
fi
}

function serve-hhvm() {
if [[ "$1" && "$2" ]]
then
sudo dos2unix /vagrant/scripts/serve-hhvm.sh
sudo bash /vagrant/scripts/serve-hhvm.sh "$1" "$2" 80
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-hhvm domain path"
fi
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"behat/mink-extension": "~2.0@dev",
"laracasts/behat-laravel-extension": "dev-master",
"deployer/deployer": "~3.0",
"deployphp/recipes": "~3.0"
"deployphp/recipes": "~3.0",
"laravel/homestead": "^2.1"
},
"repositories": [
{
Expand Down
Loading

0 comments on commit 1c89314

Please sign in to comment.