vagrant-solidus 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmVjMjg2NGI4OWM5MTVhMjJlZDk1YWExZjBkMjQ5OGQyNDJlNzlkOQ==
4
+ OGM4NTM2NWUyNzY2MDljN2RiZmNhNzIwMGJkOTYwODlhYjEzNzQzOQ==
5
5
  data.tar.gz: !binary |-
6
- MjllZDQ4ZWIxYmQxMTIwZTY4MjI2YmMxOWI1YzBhMjI4NGRmZDY3Ng==
6
+ MWJjZmNjNmM0NTlkZjhmYzk4ODcyMzZmZGVlYjdjMDM3MWIxZDJhYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWEwMmE5YTFlMmY0NWNkNjliYWI2NDIxYjIwY2NmYjA2NTQ4NjEyOGVkN2Y2
10
- MjU2MjU3N2VkNDk3MzY5MjhjMTg0ZTMxOGU1MTY2MzU1MTlmNGM0MDA1OTc0
11
- NTU4ODk5NDAxYjM2NjMxMmUyNDI1MGZkM2Q1ZWZlYzI5OGJlNWQ=
9
+ ZDg5MmFmMzY0YjkwNmZmMjZhYmVhZDQ2OTNlODhjYTRkZTljZTA4NTE4NzMw
10
+ YjdjZmZiYjRmNTgzMWI0OTIzZmViNmEzZGFhYTA0NjcwZWNmZTBhOTQyZDg5
11
+ MGM1ZTg0YTkzN2YwZWY0ZmZhMGRjZjZhNmMyOWJjY2JmMmNlODM=
12
12
  data.tar.gz: !binary |-
13
- OTk5YjY2ZTIzM2YxNjJhZTdhNDVlZWFkZDNjMGY0ZmY5OWQ5MzJmZTE3ZjE2
14
- ZDJmNDM4N2QzZWIxZWJjYTlmOWMxOTFkMDY2NDQ0ZTZjZmU3MTA4ODZkNzJl
15
- YWVjODQ5ZDUyNzNkODNhZmM1MTc4ZjdiMGJiZTgyYWVjNDc4MmE=
13
+ ZWIzMTE5MDVmNzkwZGJiYzk5NjExMWM4OWYxYzUzZjcwMDExNTBmMjBlZjdh
14
+ ZGRlMzVlMmQ2NGJlYjNhYzJjZjcyNDM0ZmZjZmM3ZWU3Yzk0YWJhODcxNGU1
15
+ YTlmZmY0Y2FjMTk3ODg5ZDI2NDQ0NDQ1YzNjM2ZmZjkzNGY2MGQ=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 2.0.0 (May 7, 2015)
2
+
3
+ - Update start messages to reflect new script names [[565ac76](https://github.com/solidusjs/vagrant-solidus/commit/565ac76e72bc1a13413ebb62d331fd172c199932)]
4
+ - Use site's node and npm versions from package.json [[a3f4c19](https://github.com/solidusjs/vagrant-solidus/commit/a3f4c19a50766623c26209012c59d219223e298c)]
5
+
6
+ BREAKING CHANGES:
7
+
8
+ - The default Node version goes from `0.10.22` to `stable`
9
+ - The default npm version goes from `1.3.14` to `^2.0.0`
10
+
1
11
  ## 1.0.0 (Jan 14, 2015)
2
12
 
3
13
  - Use npm scripts instead of grunt [[a626484](https://github.com/solidusjs/vagrant-solidus/commit/a626484dbd6a17122c4d5dd0d4afb39b62ce38ed)]
data/README.md CHANGED
@@ -90,6 +90,10 @@ In order for a site to be started by this plugin, it only needs one thing: a `pa
90
90
 
91
91
  See the [solidus-site-template's `package.json`](https://github.com/solidusjs/solidus-site-template/blob/master/root/package.json) for an example.
92
92
 
93
+ #### Node and npm versions
94
+
95
+ By default, vagrant-solidus will use Node version `stable` and npm version `^2.0.0`. To use different versions, specify them in the `package.json` [`engines` field](https://docs.npmjs.com/files/package.json#engines).
96
+
93
97
  #### Site installation steps
94
98
 
95
99
  When a site is started with `vagrant site start`, the following steps are executed:
@@ -32,12 +32,18 @@ module VagrantPlugins
32
32
  @env.ui.info('Installing dos2unix')
33
33
  execute('apt-get -y install dos2unix', sudo: true)
34
34
 
35
- @env.ui.info('Installing nvm, node.js and npm')
36
- execute('curl -s https://raw.githubusercontent.com/creationix/nvm/v0.5.1/install.sh | sh')
35
+ @env.ui.info('Installing nvm')
36
+ execute('curl -s https://raw.githubusercontent.com/creationix/nvm/v0.25.1/install.sh | sh')
37
37
  execute('source ~/.nvm/nvm.sh')
38
- execute('nvm install 0.10.22')
39
- execute('nvm use 0.10.22')
40
- execute('nvm alias default 0.10.22')
38
+
39
+ # Install a default node.js version, it will be used for grunt-init and when ssh'ing into the box
40
+ @env.ui.info('Installing node.js')
41
+ execute("nvm install #{DEFAULT_NODE_VERSION}")
42
+ execute("nvm use #{DEFAULT_NODE_VERSION}")
43
+ execute("nvm alias default #{DEFAULT_NODE_VERSION}")
44
+
45
+ @env.ui.info('Installing npm')
46
+ execute("npm install npm@'#{DEFAULT_NPM_VERSION}' -g")
41
47
 
42
48
  @env.ui.info('Installing grunt-init')
43
49
  execute('npm install grunt-init@"~0.3.1" -g')
@@ -17,7 +17,7 @@ module VagrantPlugins
17
17
 
18
18
  def execute
19
19
  with_running_vm do
20
- guest_exec(:log_all, "cd #{@site_guest_path} && #{@guest_command}")
20
+ guest_exec(:log_all, "cd #{@site_guest_path} && #{node_command} #{@guest_command}")
21
21
  end
22
22
 
23
23
  # Command's exit status
@@ -18,16 +18,16 @@ module VagrantPlugins
18
18
 
19
19
  @env.ui.info("Installing site...")
20
20
  unless @fast
21
- fail("Site could not be installed") unless install_site_dependencies && install_site_node_packages
21
+ fail("Site could not be installed") unless install_site_dependencies && install_site_node && install_site_node_packages
22
22
  end
23
- fail("Out of available ports, add more to the Vagrantfile or remove unused sites from #{SITES_CONFIGS_FILE_HOST_PATH}") unless set_site_ports
23
+ fail("Out of available ports, add more to the Vagrantfile or remove unused sites from #{SITES_CONFIGS_FILE_HOST_PATH}\nSee https://github.com/solidusjs/vagrant-solidus#adding-or-changing-the-forwarded-ports") unless set_site_ports
24
24
  fail("Site could not be installed") unless install_site_service
25
25
  install_pow_site if pow_installed?
26
26
 
27
- @env.ui.info("Compiling assets...")
28
- fail("Assets could not be compiled") unless compile_site_assets
27
+ @env.ui.info("Building site...")
28
+ fail("Site could not be built") unless build_site
29
29
 
30
- @env.ui.info("Starting dev server and assets watcher...")
30
+ @env.ui.info("Starting site server and watcher...")
31
31
  fail("Site could not be started") unless start_site_service
32
32
 
33
33
  if site_responding?
@@ -7,6 +7,8 @@ module VagrantPlugins
7
7
  SITE_TEMPLATE_GIT_TAG = "v1.0.0"
8
8
  SITE_STATUS_WATCHER_POLLING_FREQUENCY = 1
9
9
  PROVISION_ID = 20140502
10
+ DEFAULT_NODE_VERSION = 'stable'
11
+ DEFAULT_NPM_VERSION = '^2.0.0'
10
12
 
11
13
  #########################################################################
12
14
  # System Calls
@@ -92,7 +94,7 @@ module VagrantPlugins
92
94
  end
93
95
 
94
96
  def validate_site
95
- JSON.load(File.new(File.join(@site_host_path, 'package.json')))['dependencies']['solidus'] rescue false
97
+ !package['dependencies']['solidus'].empty? rescue false
96
98
  end
97
99
 
98
100
  def save_site
@@ -135,8 +137,8 @@ module VagrantPlugins
135
137
 
136
138
  # Bower packages
137
139
  if File.exists?(File.join(@site_host_path, 'bower.json'))
138
- return unless guest_exec(:log_on_error, "npm install bower -g")
139
- return unless guest_exec(:log_on_error, "cd #{@site_guest_path} && bower install")
140
+ return unless guest_exec(:log_on_error, "#{node_command} npm install bower -g")
141
+ return unless guest_exec(:log_on_error, "cd #{@site_guest_path} && #{node_command} bower install")
140
142
  end
141
143
 
142
144
  return true
@@ -146,8 +148,36 @@ module VagrantPlugins
146
148
  # Node.js
147
149
  #########################################################################
148
150
 
151
+ def install_site_node
152
+ guest_exec(:log_on_error, "nvm install #{node_version} && #{node_command} npm install npm@'#{npm_version}' -g")
153
+ end
154
+
149
155
  def install_site_node_packages
150
- guest_exec(:log_on_error, "cd #{@site_guest_path} && npm install")
156
+ guest_exec(:log_on_error, "cd #{@site_guest_path} && #{node_command} npm install")
157
+ end
158
+
159
+ def node_version
160
+ unless @node_version
161
+ @node_version = package['engines']['node'] if package['engines']
162
+ @node_version = DEFAULT_NODE_VERSION if !@node_version || @node_version.empty?
163
+ end
164
+ @node_version
165
+ end
166
+
167
+ def node_command
168
+ "nvm exec #{node_version}"
169
+ end
170
+
171
+ def npm_version
172
+ unless @npm_version
173
+ @npm_version = package['engines']['npm'] if package['engines']
174
+ @npm_version = DEFAULT_NPM_VERSION if !@npm_version || @npm_version.empty?
175
+ end
176
+ @npm_version
177
+ end
178
+
179
+ def package
180
+ @package ||= JSON.load(File.new(File.join(@site_host_path, 'package.json')))
151
181
  end
152
182
 
153
183
  #########################################################################
@@ -163,12 +193,12 @@ module VagrantPlugins
163
193
 
164
194
  conf = "start on starting #{site_service_name}
165
195
  stop on stopping #{site_service_name}
166
- #{command} npm #{site_commands_arguments} run watch #{logging}"
167
- return unless guest_exec(:log_on_error, "echo \"#{conf}\" > /etc/init/#{assets_watcher_service_name}.conf", sudo: true)
196
+ #{command} #{node_command} npm #{site_commands_arguments} run watch #{logging}"
197
+ return unless guest_exec(:log_on_error, "echo \"#{conf}\" > /etc/init/#{site_watcher_service_name}.conf", sudo: true)
168
198
 
169
199
  conf = "start on starting #{site_service_name}
170
200
  stop on stopping #{site_service_name}
171
- #{command} ./node_modules/.bin/solidus start --dev --loglevel=3 #{site_commands_arguments} #{logging}"
201
+ #{command} #{node_command} ./node_modules/.bin/solidus start --dev --loglevel=3 #{site_commands_arguments} #{logging}"
172
202
  return unless guest_exec(:log_on_error, "echo \"#{conf}\" > /etc/init/#{solidus_server_service_name}.conf", sudo: true)
173
203
 
174
204
  return true
@@ -176,12 +206,12 @@ module VagrantPlugins
176
206
 
177
207
  def uninstall_site_service
178
208
  guest_exec(nil, "rm /etc/init/#{site_service_name}.conf", sudo: true)
179
- guest_exec(nil, "rm /etc/init/#{assets_watcher_service_name}.conf", sudo: true)
209
+ guest_exec(nil, "rm /etc/init/#{site_watcher_service_name}.conf", sudo: true)
180
210
  guest_exec(nil, "rm /etc/init/#{solidus_server_service_name}.conf", sudo: true)
181
211
  end
182
212
 
183
- def compile_site_assets
184
- guest_exec(:log_on_error, "cd #{@site_guest_path} && npm #{site_commands_arguments} run build")
213
+ def build_site
214
+ guest_exec(:log_on_error, "cd #{@site_guest_path} && #{node_command} npm #{site_commands_arguments} run build")
185
215
  end
186
216
 
187
217
  def start_site_service
@@ -213,7 +243,7 @@ module VagrantPlugins
213
243
  "site-#{@site_name}"
214
244
  end
215
245
 
216
- def assets_watcher_service_name
246
+ def site_watcher_service_name
217
247
  "#{site_service_name}-assets-watcher"
218
248
  end
219
249
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Solidus
3
- VERSION = '1.0.0'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-solidus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joannic Laborde
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-14 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.4.4
97
+ rubygems_version: 2.4.6
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: This plugin provides a provisioner and a `site` command that allows Solidus