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

質問編集履歴

3

homestead,json追加

2019/08/05 13:21

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -134,7 +134,48 @@
134
134
  end
135
135
 
136
136
  ```
137
+ ###Homestead.json
138
+ ```ここに言語を入力
139
+ {
140
+ "ip": "192.168.10.10",
141
+ "memory": 2048,
142
+ "cpus": 2,
143
+ "provider": "virtualbox",
144
+ "authorize": "~/.ssh/id_rsa.pub",
145
+ "keys": [
146
+ "~/.ssh/id_rsa"
147
+ ],
148
+ "folders": [
149
+ {
150
+ "map": "~/code",
151
+ "to": "/home/vagrant/code"
152
+ }
153
+ ],
154
+ "sites": [
155
+ {
156
+ "map": "homestead.test",
157
+ "to": "/home/vagrant/code/public"
158
+ }
159
+ ],
160
+ "databases": [
161
+ "homestead"
162
+ ],
163
+ "features": [
164
+ {
165
+ "mariadb": false
166
+ },
167
+ {
168
+ "ohmyzsh": false
169
+ },
170
+ {
171
+ "webdriver": false
172
+ }
173
+ ]
174
+ }
137
175
 
176
+ ```
177
+
178
+
138
179
  ### 試したこと
139
180
  vagrant plugin install vagrant-share --plugin-version 1.1.8
140
181
  実行後今回のエラーが表示される様になりました。

2

vagrantfile追記

2019/08/05 13:21

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -15,8 +15,126 @@
15
15
  error code: '7'.
16
16
  ```
17
17
 
18
+ ###app/homestead/resources/localized/vagrantfile
19
+ ```ここに言語を入力
20
+ # -*- mode: ruby -*-
21
+ # vi: set ft=ruby :
18
22
 
23
+ require 'json'
24
+ require 'yaml'
19
25
 
26
+ VAGRANTFILE_API_VERSION ||= "2"
27
+ confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
28
+
29
+ homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
30
+ homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
31
+ afterScriptPath = "after.sh"
32
+ customizationScriptPath = "user-customizations.sh"
33
+ aliasesPath = "aliases"
34
+
35
+ require File.expand_path(confDir + '/scripts/homestead.rb')
36
+
37
+ Vagrant.require_version '>= 2.2.4'
38
+
39
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
40
+ if File.exist? aliasesPath then
41
+ config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
42
+ config.vm.provision "shell" do |s|
43
+ s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
44
+ end
45
+ end
46
+
47
+ if File.exist? homesteadYamlPath then
48
+ settings = YAML::load(File.read(homesteadYamlPath))
49
+ elsif File.exist? homesteadJsonPath then
50
+ settings = JSON::parse(File.read(homesteadJsonPath))
51
+ else
52
+ abort "Homestead settings file not found in " + File.dirname(__FILE__)
53
+ end
54
+
55
+ Homestead.configure(config, settings)
56
+
57
+ if File.exist? afterScriptPath then
58
+ config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
59
+ end
60
+
61
+ if File.exist? customizationScriptPath then
62
+ config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
63
+ end
64
+
65
+ if Vagrant.has_plugin?('vagrant-hostsupdater')
66
+ config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
67
+ elsif Vagrant.has_plugin?('vagrant-hostmanager')
68
+ config.hostmanager.enabled = true
69
+ config.hostmanager.manage_host = true
70
+ config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
71
+ end
72
+ end
73
+
74
+ ```
75
+
76
+ ###app/homestead/vagrantfile
77
+ ```ここに言語を入力
78
+ # -*- mode: ruby -*-
79
+ # vi: set ft=ruby :
80
+
81
+ require 'json'
82
+ require 'yaml'
83
+
84
+ VAGRANTFILE_API_VERSION ||= "2"
85
+ confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
86
+
87
+ homesteadYamlPath = confDir + "/Homestead.yaml"
88
+ homesteadJsonPath = confDir + "/Homestead.json"
89
+ afterScriptPath = confDir + "/after.sh"
90
+ customizationScriptPath = confDir + "/user-customizations.sh"
91
+ aliasesPath = confDir + "/aliases"
92
+
93
+ require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
94
+
95
+ Vagrant.require_version '>= 2.2.4'
96
+
97
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
98
+ if File.exist? aliasesPath then
99
+ config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
100
+ config.vm.provision "shell" do |s|
101
+ s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
102
+ end
103
+ end
104
+
105
+ if File.exist? homesteadYamlPath then
106
+ settings = YAML::load(File.read(homesteadYamlPath))
107
+ elsif File.exist? homesteadJsonPath then
108
+ settings = JSON::parse(File.read(homesteadJsonPath))
109
+ else
110
+ abort "Homestead settings file not found in #{confDir}"
111
+ end
112
+
113
+ Homestead.configure(config, settings)
114
+
115
+ if File.exist? afterScriptPath then
116
+ config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
117
+ end
118
+
119
+ if File.exist? customizationScriptPath then
120
+ config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
121
+ end
122
+
123
+ if Vagrant.has_plugin?('vagrant-hostsupdater')
124
+ config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
125
+ elsif Vagrant.has_plugin?('vagrant-hostmanager')
126
+ config.hostmanager.enabled = true
127
+ config.hostmanager.manage_host = true
128
+ config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
129
+ end
130
+
131
+ if Vagrant.has_plugin?('vagrant-notify-forwarder')
132
+ config.notify_forwarder.enable = true
133
+ end
134
+ end
135
+
136
+ ```
137
+
20
138
  ### 試したこと
21
139
  vagrant plugin install vagrant-share --plugin-version 1.1.8
22
140
  実行後今回のエラーが表示される様になりました。

1

追記内容

2019/08/05 12:35

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -21,7 +21,36 @@
21
21
  vagrant plugin install vagrant-share --plugin-version 1.1.8
22
22
  実行後今回のエラーが表示される様になりました。
23
23
 
24
+ vagrant plugin uninstall vagrant-share実行後vagrantコマンドで下記のエラーに変わりました。
25
+ ```ここに言語を入力
26
+ nekonoMacBook-Air:homestead neko$ vagrant up
27
+ An unexpected error occurred while loading the vagrant-login
28
+ plugin. Please contact support with the following
24
- ここに問題に対して試したことを記載してください。
29
+ error code: '7'.
30
+ nekonoMacBook-Air:homestead neko$ vagrant plugin uninstall vagrant-share
31
+ Uninstalling the 'vagrant-share' plugin...
32
+ Successfully uninstalled vagrant-share-1.1.8
33
+ nekonoMacBook-Air:homestead neko$ vagrant up
34
+ /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)
35
+ from /opt/vagrant/embedded/lib/ruby/2.4.0/psych.rb:377:in `parse_stream'
36
+ from /opt/vagrant/embedded/lib/ruby/2.4.0/psych.rb:325:in `parse'
37
+ from /opt/vagrant/embedded/lib/ruby/2.4.0/psych.rb:252:in `load'
38
+ from /Users/neko/app/Homestead/Vagrantfile:29:in `block in <top (required)>'
39
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/v2/loader.rb:37:in `load'
40
+ 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'
41
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:119:in `each'
42
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:119:in `block in load'
43
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:116:in `each'
44
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/config/loader.rb:116:in `load'
45
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/vagrantfile.rb:29:in `initialize'
46
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:792:in `new'
47
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:792:in `vagrantfile'
48
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:973:in `process_configured_plugins'
49
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/environment.rb:178:in `initialize'
50
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/bin/vagrant:145:in `new'
51
+ from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/bin/vagrant:145:in `<main>'
52
+ ```
53
+  
25
54
 
26
55
  ### 補足情報(FW/ツールのバージョンなど)
27
56
  mac os