Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fed9cc7

Browse files
Merge pull request janhenkgerritsen#10 from Kamshak/codeception-2.1
Add Vagrant via Homestead
2 parents 4b9624f + 605fc1a commit fed9cc7

File tree

7 files changed

+87
-0
lines changed

7 files changed

+87
-0
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
/tags
1010
.env
1111
.idea
12+
.vagrant
1213
composer.lock

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
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‎

Lines changed: 31 additions & 0 deletions
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‎

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

‎after.sh‎

Lines changed: 13 additions & 0 deletions
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+
composer install -n --prefer-dist; \
9+
if [ ! -f ~/.key_generated ]; then php artisan key:generate; touch ~/.key_generated; fi; \
10+
touch storage/database.sqlite; \
11+
touch storage/testing.sqlite; \
12+
php artisan migrate; \
13+
php artisan migrate --database=sqlite_testing;"

‎homestead‎

Submodule homestead added at 69e1e46

‎readme.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
### Setup
66

7+
You can setup this sample manually or use [Vagrant](https://www.vagrantup.com/) to automatically set up a development environment for you.
8+
9+
#### Manual
710
- Clone repo
811
- Create your .env file from the example file: `cp .env.testing .env`
912
- Install composer dependencies: `composer install`
@@ -16,6 +19,13 @@
1619
- Server: run `php -S localhost:8000 -t public`
1720
- Browse to localhost:8000/posts
1821

22+
#### Vagrant
23+
- Clone repo
24+
- Cd into the cloned directory
25+
- Run vagrant up
26+
27+
To SSH into the machine to run your tests, run ```vagrant ssh```. You can access the app on the guest vm under http://192.168.10.10/.
28+
1929
### To test
2030

2131
Run Codeception, installed via Composer

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /