質問編集履歴

1

vagrantfileが一部しか添付できてませんでしたので全体を貼り付けました

2019/12/16 01:25

投稿

majua51
majua51

スコア7

test CHANGED
File without changes
test CHANGED
@@ -78,6 +78,80 @@
78
78
 
79
79
  ```vagrantfile
80
80
 
81
+ # -*- mode: ruby -*-
82
+
83
+ # vi: set ft=ruby :
84
+
85
+
86
+
87
+ require 'json'
88
+
89
+ require 'yaml'
90
+
91
+
92
+
93
+ VAGRANTFILE_API_VERSION ||= "2"
94
+
95
+ confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
96
+
97
+
98
+
99
+ homesteadYamlPath = confDir + "/Homestead.yaml"
100
+
101
+ homesteadJsonPath = confDir + "/Homestead.json"
102
+
103
+ afterScriptPath = confDir + "/after.sh"
104
+
105
+ customizationScriptPath = confDir + "/user-customizations.sh"
106
+
107
+ aliasesPath = confDir + "/aliases"
108
+
109
+
110
+
111
+ require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
112
+
113
+
114
+
115
+ Vagrant.require_version '>= 2.2.4'
116
+
117
+
118
+
119
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
120
+
121
+ if File.exist? aliasesPath then
122
+
123
+ config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
124
+
125
+ config.vm.provision "shell" do |s|
126
+
127
+ s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
128
+
129
+ end
130
+
131
+ end
132
+
133
+
134
+
135
+ if File.exist? homesteadYamlPath then
136
+
137
+ settings = YAML::load(File.read(homesteadYamlPath))
138
+
139
+ elsif File.exist? homesteadJsonPath then
140
+
141
+ settings = JSON::parse(File.read(homesteadJsonPath))
142
+
143
+ else
144
+
145
+ abort "Homestead settings file not found in #{confDir}"
146
+
147
+ end
148
+
149
+
150
+
151
+ Homestead.configure(config, settings)
152
+
153
+
154
+
81
155
  if File.exist? afterScriptPath then
82
156
 
83
157
  config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true