bindler 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6d59688e238982b74eda8eb7d14899b303ab60f
4
- data.tar.gz: 3cdcb581db73a6cefe4283deceadfc020395b09e
3
+ metadata.gz: 1ee682fcd6eb61c143513850d676616ce96b6d1f
4
+ data.tar.gz: f5dc7c1baef26adea185c238c76958034d37688d
5
5
  SHA512:
6
- metadata.gz: f15de7057324a5ec25bbecf277bd53bbe905432d1e961b7ef80f3b242958eae177b9cfea3ced998ac8577297c4c8a7feef22097f310923feb42c20353f88c423
7
- data.tar.gz: 4627248c78aa63ab7b15858347357cb5c08f31467a86845d5eb79d63e1148fa1b7f0c50a2a4bbd48cc57f1dc0ccd692406fac039dc537d05f75646dded595f9a
6
+ metadata.gz: dbf6923420ca24f3a20c270739e732baa1eadde4b019e0963cd9e821fd1339d7187b07b6f12c95395723448a123bd11676719e3ef4fc2f9d2babe9493bfc0e06
7
+ data.tar.gz: 75f19d62c42e6060e99c4f569d014fc2916d773a6e0903694566596b1af21d9381957da49341191083a5b088a3f6db60b668cca00f2c58b2eac539907c4f13e9
data/Gemfile.lock CHANGED
@@ -31,7 +31,7 @@ GIT
31
31
  PATH
32
32
  remote: .
33
33
  specs:
34
- bindler (0.1.2)
34
+ bindler (0.1.3)
35
35
 
36
36
  GEM
37
37
  remote: https://rubygems.org/
@@ -17,22 +17,61 @@ Vagrant::Environment.class_eval do
17
17
  alias old_hook hook
18
18
  def hook(name)
19
19
  unless @__custom_plugins_loaded
20
- bindler_debug 'Loading local plugins...'
21
- __load_local_plugins
20
+ if bindler_plugins_file
21
+ bindler_debug 'Loading local plugins...'
22
+ __load_local_plugins
23
+ else
24
+ lookup_paths = VagrantPlugins::Bindler::LocalPluginsManifestExt::PLUGINS_JSON_LOOKUP
25
+ bindler_debug "Local plugins manifest file not found, looked into #{lookup_paths.inspect}"
26
+ end
27
+
28
+ bindler_debug 'Loading plugins installed globally...'
29
+ __load_global_plugins
22
30
 
23
31
  @__custom_plugins_loaded = true
24
32
  end
25
33
  old_hook name
26
34
  end
27
35
 
28
- # This method loads plugins from a project specific `plugins.json` file
29
- def __load_local_plugins
30
- unless bindler_plugins_file
31
- lookup_paths = VagrantPlugins::Bindler::LocalPluginsManifestExt::PLUGINS_JSON_LOOKUP
32
- bindler_debug "Local plugins manifest file not found, looked into #{lookup_paths.inspect}"
33
- return
36
+ # This method loads plugins from `~/.vagrant.d/global-plugins.json` file
37
+ #
38
+ # It is basically a Copy & Paste from Vagrant::Environment#load_plugins [1]
39
+ #
40
+ # [1] https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/environment.rb#L720-L754
41
+ #
42
+ # DISCUSS: What if vagrant had a way of setting the path for the manifest file
43
+ # for the whole environment?
44
+ def __load_global_plugins
45
+ # If we're in a Bundler environment, don't load plugins. This only
46
+ # happens in plugin development environments.
47
+ if defined?(Bundler)
48
+ require 'bundler/shared_helpers'
49
+ if Bundler::SharedHelpers.in_bundle?
50
+ @logger.warn("In a bundler environment, not loading environment plugins!")
51
+ return
52
+ end
53
+ end
54
+
55
+ # Load the plugins
56
+ plugins_json_file = @home_path.join("global-plugins.json")
57
+ bindler_debug("Loading plugins from: #{plugins_json_file}")
58
+ if plugins_json_file.file?
59
+ data = JSON.parse(plugins_json_file.read)
60
+ data["installed"].each do |plugin|
61
+ bindler_info("Loading plugin from JSON: #{plugin}")
62
+ begin
63
+ Vagrant.require_plugin(plugin)
64
+ rescue Vagrant::Errors::PluginLoadError => e
65
+ @ui.error(e.message + "\n")
66
+ rescue Vagrant::Errors::PluginLoadFailed => e
67
+ @ui.error(e.message + "\n")
68
+ end
69
+ end
34
70
  end
71
+ end
35
72
 
73
+ # This method loads plugins from a project specific `plugins.json` file
74
+ def __load_local_plugins
36
75
  ARGV.each do |arg|
37
76
  if !arg.start_with?("-") && arg == 'bindler'
38
77
  bindler_debug 'bindler command detected, setting VAGRANT_NO_PLUGINS to 1'
@@ -47,6 +86,7 @@ Vagrant::Environment.class_eval do
47
86
  end
48
87
 
49
88
  # Prepend our local gem path and reset the paths that Rubygems knows about.
89
+ bindler_debug 'Tweaking GEM_HOME'
50
90
  ENV["GEM_PATH"] = "#{local_data_path.join('gems')}#{::File::PATH_SEPARATOR}#{ENV["GEM_PATH"]}"
51
91
  ::Gem.clear_paths
52
92
 
@@ -4,6 +4,10 @@ module VagrantPlugins
4
4
  def bindler_debug(msg)
5
5
  @logger.debug "[BINDLER] #{msg}"
6
6
  end
7
+
8
+ def bindler_info(msg)
9
+ @logger.info "[BINDLER] #{msg}"
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module Bindler
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-24 00:00:00.000000000 Z
11
+ date: 2013-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler