質問編集履歴

3

homestead,json追加

2019/08/05 13:21

投稿

Ms.yy
Ms.yy

スコア83

test CHANGED
File without changes
test CHANGED
@@ -270,6 +270,88 @@
270
270
 
271
271
  ```
272
272
 
273
+ ###Homestead.json
274
+
275
+ ```ここに言語を入力
276
+
277
+ {
278
+
279
+ "ip": "192.168.10.10",
280
+
281
+ "memory": 2048,
282
+
283
+ "cpus": 2,
284
+
285
+ "provider": "virtualbox",
286
+
287
+ "authorize": "~/.ssh/id_rsa.pub",
288
+
289
+ "keys": [
290
+
291
+ "~/.ssh/id_rsa"
292
+
293
+ ],
294
+
295
+ "folders": [
296
+
297
+ {
298
+
299
+ "map": "~/code",
300
+
301
+ "to": "/home/vagrant/code"
302
+
303
+ }
304
+
305
+ ],
306
+
307
+ "sites": [
308
+
309
+ {
310
+
311
+ "map": "homestead.test",
312
+
313
+ "to": "/home/vagrant/code/public"
314
+
315
+ }
316
+
317
+ ],
318
+
319
+ "databases": [
320
+
321
+ "homestead"
322
+
323
+ ],
324
+
325
+ "features": [
326
+
327
+ {
328
+
329
+ "mariadb": false
330
+
331
+ },
332
+
333
+ {
334
+
335
+ "ohmyzsh": false
336
+
337
+ },
338
+
339
+ {
340
+
341
+ "webdriver": false
342
+
343
+ }
344
+
345
+ ]
346
+
347
+ }
348
+
349
+
350
+
351
+ ```
352
+
353
+
354
+
273
355
 
274
356
 
275
357
  ### 試したこと

2

vagrantfile追記

2019/08/05 13:21

投稿

Ms.yy
Ms.yy

スコア83

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,243 @@
32
32
 
33
33
 
34
34
 
35
-
35
+ ###app/homestead/resources/localized/vagrantfile
36
+
37
+ ```ここに言語を入力
38
+
39
+ # -*- mode: ruby -*-
40
+
41
+ # vi: set ft=ruby :
42
+
43
+
44
+
45
+ require 'json'
46
+
47
+ require 'yaml'
48
+
49
+
50
+
51
+ VAGRANTFILE_API_VERSION ||= "2"
52
+
53
+ confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
54
+
55
+
56
+
57
+ homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
58
+
59
+ homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
60
+
61
+ afterScriptPath = "after.sh"
62
+
63
+ customizationScriptPath = "user-customizations.sh"
64
+
65
+ aliasesPath = "aliases"
66
+
67
+
68
+
69
+ require File.expand_path(confDir + '/scripts/homestead.rb')
70
+
71
+
72
+
73
+ Vagrant.require_version '>= 2.2.4'
74
+
75
+
76
+
77
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
78
+
79
+ if File.exist? aliasesPath then
80
+
81
+ config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
82
+
83
+ config.vm.provision "shell" do |s|
84
+
85
+ s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
86
+
87
+ end
88
+
89
+ end
90
+
91
+
92
+
93
+ if File.exist? homesteadYamlPath then
94
+
95
+ settings = YAML::load(File.read(homesteadYamlPath))
96
+
97
+ elsif File.exist? homesteadJsonPath then
98
+
99
+ settings = JSON::parse(File.read(homesteadJsonPath))
100
+
101
+ else
102
+
103
+ abort "Homestead settings file not found in " + File.dirname(__FILE__)
104
+
105
+ end
106
+
107
+
108
+
109
+ Homestead.configure(config, settings)
110
+
111
+
112
+
113
+ if File.exist? afterScriptPath then
114
+
115
+ config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
116
+
117
+ end
118
+
119
+
120
+
121
+ if File.exist? customizationScriptPath then
122
+
123
+ config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
124
+
125
+ end
126
+
127
+
128
+
129
+ if Vagrant.has_plugin?('vagrant-hostsupdater')
130
+
131
+ config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
132
+
133
+ elsif Vagrant.has_plugin?('vagrant-hostmanager')
134
+
135
+ config.hostmanager.enabled = true
136
+
137
+ config.hostmanager.manage_host = true
138
+
139
+ config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
140
+
141
+ end
142
+
143
+ end
144
+
145
+
146
+
147
+ ```
148
+
149
+
150
+
151
+ ###app/homestead/vagrantfile
152
+
153
+ ```ここに言語を入力
154
+
155
+ # -*- mode: ruby -*-
156
+
157
+ # vi: set ft=ruby :
158
+
159
+
160
+
161
+ require 'json'
162
+
163
+ require 'yaml'
164
+
165
+
166
+
167
+ VAGRANTFILE_API_VERSION ||= "2"
168
+
169
+ confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
170
+
171
+
172
+
173
+ homesteadYamlPath = confDir + "/Homestead.yaml"
174
+
175
+ homesteadJsonPath = confDir + "/Homestead.json"
176
+
177
+ afterScriptPath = confDir + "/after.sh"
178
+
179
+ customizationScriptPath = confDir + "/user-customizations.sh"
180
+
181
+ aliasesPath = confDir + "/aliases"
182
+
183
+
184
+
185
+ require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
186
+
187
+
188
+
189
+ Vagrant.require_version '>= 2.2.4'
190
+
191
+
192
+
193
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
194
+
195
+ if File.exist? aliasesPath then
196
+
197
+ config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
198
+
199
+ config.vm.provision "shell" do |s|
200
+
201
+ s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
202
+
203
+ end
204
+
205
+ end
206
+
207
+
208
+
209
+ if File.exist? homesteadYamlPath then
210
+
211
+ settings = YAML::load(File.read(homesteadYamlPath))
212
+
213
+ elsif File.exist? homesteadJsonPath then
214
+
215
+ settings = JSON::parse(File.read(homesteadJsonPath))
216
+
217
+ else
218
+
219
+ abort "Homestead settings file not found in #{confDir}"
220
+
221
+ end
222
+
223
+
224
+
225
+ Homestead.configure(config, settings)
226
+
227
+
228
+
229
+ if File.exist? afterScriptPath then
230
+
231
+ config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
232
+
233
+ end
234
+
235
+
236
+
237
+ if File.exist? customizationScriptPath then
238
+
239
+ config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
240
+
241
+ end
242
+
243
+
244
+
245
+ if Vagrant.has_plugin?('vagrant-hostsupdater')
246
+
247
+ config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
248
+
249
+ elsif Vagrant.has_plugin?('vagrant-hostmanager')
250
+
251
+ config.hostmanager.enabled = true
252
+
253
+ config.hostmanager.manage_host = true
254
+
255
+ config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
256
+
257
+ end
258
+
259
+
260
+
261
+ if Vagrant.has_plugin?('vagrant-notify-forwarder')
262
+
263
+ config.notify_forwarder.enable = true
264
+
265
+ end
266
+
267
+ end
268
+
269
+
270
+
271
+ ```
36
272
 
37
273
 
38
274
 

1

追記内容

2019/08/05 12:35

投稿

Ms.yy
Ms.yy

スコア83

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,65 @@
44
44
 
45
45
 
46
46
 
47
+ vagrant plugin uninstall vagrant-share実行後vagrantコマンドで下記のエラーに変わりました。
48
+
49
+ ```ここに言語を入力
50
+
51
+ nekonoMacBook-Air:homestead neko$ vagrant up
52
+
53
+ An unexpected error occurred while loading the vagrant-login
54
+
55
+ plugin. Please contact support with the following
56
+
47
- ここに問題に対して試したことを記載してください。
57
+ error code: '7'.
58
+
59
+ nekonoMacBook-Air:homestead neko$ vagrant plugin uninstall vagrant-share
60
+
61
+ Uninstalling the 'vagrant-share' plugin...
62
+
63
+ Successfully uninstalled vagrant-share-1.1.8
64
+
65
+ nekonoMacBook-Air:homestead neko$ vagrant up
66
+
67
+ /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)
68
+
69
+ from /opt/vagrant/embedded/lib/ruby/2.4.0/psych.rb:377:in `parse_stream'
70
+
71
+ from /opt/vagrant/embedded/lib/ruby/2.4.0/psych.rb:325:in `parse'
72
+
73
+ from /opt/vagrant/embedded/lib/ruby/2.4.0/psych.rb:252:in `load'
74
+
75
+ from /Users/neko/app/Homestead/Vagrantfile:29:in `block in <top (required)>'
76
+
77
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/v2/loader.rb:37:in `load'
78
+
79
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:126:in `block (2 levels) in load'
80
+
81
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:119:in `each'
82
+
83
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:119:in `block in load'
84
+
85
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:116:in `each'
86
+
87
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:116:in `load'
88
+
89
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/vagrantfile.rb:29:in `initialize'
90
+
91
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:792:in `new'
92
+
93
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:792:in `vagrantfile'
94
+
95
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:973:in `process_configured_plugins'
96
+
97
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:178:in `initialize'
98
+
99
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/bin/vagrant:145:in `new'
100
+
101
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/bin/vagrant:145:in `<main>'
102
+
103
+ ```
104
+
105
+  
48
106
 
49
107
 
50
108