teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

内容追記

2019/08/05 11:09

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -34,8 +34,69 @@
34
34
  ```
35
35
 
36
36
 
37
+ ###vagrantfile
38
+ ```ここに言語を入力
39
+ # -*- mode: ruby -*-
40
+ # vi: set ft=ruby :
37
41
 
42
+ require 'json'
43
+ require 'yaml'
38
44
 
45
+ VAGRANTFILE_API_VERSION ||= "2"
46
+ confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
47
+
48
+ homesteadYamlPath = confDir + "/Homestead.yaml"
49
+ homesteadJsonPath = confDir + "/Homestead.json"
50
+ afterScriptPath = confDir + "/after.sh"
51
+ customizationScriptPath = confDir + "/user-customizations.sh"
52
+ aliasesPath = confDir + "/aliases"
53
+
54
+ require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
55
+
56
+ Vagrant.require_version '>= 2.2.4'
57
+
58
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
59
+ if File.exist? aliasesPath then
60
+ config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
61
+ config.vm.provision "shell" do |s|
62
+ s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
63
+ end
64
+ end
65
+
66
+ if File.exist? homesteadYamlPath then
67
+ settings = YAML::load(File.read(homesteadYamlPath))
68
+ elsif File.exist? homesteadJsonPath then
69
+ settings = JSON::parse(File.read(homesteadJsonPath))
70
+ else
71
+ abort "Homestead settings file not found in #{confDir}"
72
+ end
73
+
74
+ Homestead.configure(config, settings)
75
+
76
+ if File.exist? afterScriptPath then
77
+ config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
78
+ end
79
+
80
+ if File.exist? customizationScriptPath then
81
+ config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
82
+ end
83
+
84
+ if Vagrant.has_plugin?('vagrant-hostsupdater')
85
+ config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
86
+ elsif Vagrant.has_plugin?('vagrant-hostmanager')
87
+ config.hostmanager.enabled = true
88
+ config.hostmanager.manage_host = true
89
+ config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
90
+ end
91
+
92
+ if Vagrant.has_plugin?('vagrant-notify-forwarder')
93
+ config.notify_forwarder.enable = true
94
+ end
95
+ end
96
+
97
+ ```
98
+
99
+
39
100
  ### 補足情報(FW/ツールのバージョンなど)
40
101
 
41
102
  mac os

2

エラー編集

2019/08/05 11:09

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -8,7 +8,8 @@
8
8
  などのvagrantコマンドを実行すると同じエラーが出てしまいます。
9
9
 
10
10
  ### 発生している問題・エラーメッセージ
11
-
11
+ 下記はdestroyコマンドを実行した場合の例です。
12
+ ※他のvagrantコマンドを使っても同じエラーとなります。
12
13
  ```
13
14
  nekonoMacBook-Air:homestead neko$ vagrant destroy
14
15
  /opt/vagrant/embedded/lib/ruby/2.4.0/psych.rb:377:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 3 column 1 (Psych::SyntaxError)

1

タイトル変更

2019/08/04 22:47

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
@@ -1,1 +1,1 @@
1
- laravelでvagrantを実行するとエラー(Psych::SyntaxError)となる
1
+ laravelでvagrantコマンドを実行するとエラー(Psych::SyntaxError)となる
body CHANGED
File without changes