vagrant-librarian-chef 0.1.5 → 0.2.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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd194654aa63d2d223372cc48499cf1a5ba3fe85
4
- data.tar.gz: 53983efc8afe7cd82a5d898a2595d9de7ca20d75
3
+ metadata.gz: d85e969ea6c572d3998707160e2451d9bb25f89a
4
+ data.tar.gz: dee9cf6039ca1c83c82a4326269ce233f9f85098
5
5
  SHA512:
6
- metadata.gz: 6a8ae098b8d6c131266e73e1ae181604b10101ee531c9bd734b06582506107b4303900d4eccb8d2b203ff689e29d10a3f7ca40831212218c9c65710397d9edcf
7
- data.tar.gz: 605e437728983abc0ceece58e3fbab17feb206075d75897676a63e1a7b82a3c6fb79d82e9317d45e7da818a602af6d96abfdd32c3fea39f23cccd83e91f247dd
6
+ metadata.gz: 336c317116a84b93ecacc9fc674e900fb17ad35b05891d194f5f12384e2a6ecd05822763c02fd0099c0793fafb18cb238dd53ec07202fa2045e47ff3ccd5c130
7
+ data.tar.gz: 8c76081a01c978ada29680fe8f60e0b5199c185cb48f40bd344dd458089a7c289ee5b12dd027514ee59c6f83e5319a88767116ad6756e30d7eb8bd6f86507b62
data/Gemfile CHANGED
@@ -4,5 +4,8 @@ gemspec
4
4
 
5
5
  group :development do
6
6
  gem "vagrant", github: "mitchellh/vagrant"
7
- gem "vagrant-vmware-fusion"
7
+ end
8
+
9
+ group :plugins do
10
+ gem "vagrant-omnibus"
8
11
  end
data/README.md CHANGED
@@ -38,8 +38,18 @@ Vagrant.configure("2") do |config|
38
38
  end
39
39
  ```
40
40
 
41
+ Librarian-Chef can be configured normally via configuration file at `.librarian/chef/config`. Again, if you change the path where cookbooks are installed by Librarian-Chef, make sure your Vagrantfile is updated to tell Vagrant's Chef provisioner where to look for them via the `cookbooks_path` attribute.
42
+
43
+ If you want to programmtically disable the plugin without uninstalling it, set the `enabled` attribute to false:
44
+
45
+ ``` ruby
46
+ config.librarian_chef.enabled = false
47
+ ```
48
+
41
49
  ## Development
42
50
 
51
+ Vagrant 1.5.0 or greater is required.
52
+
43
53
  ``` bash
44
54
  bundle
45
55
  bundle exec vagrant up
@@ -47,7 +57,7 @@ bundle exec vagrant up
47
57
 
48
58
  ## Acknowledgements
49
59
 
50
- Thank you to @thegcat and other contributors for their work on
60
+ Thank you to [@thegcat](https://github.com/thegcat) and other contributors for their work on
51
61
  [vagrant-librarian](https://github.com/thegcat/vagrant-librarian), an earlier
52
62
  version of this functionality for Vagrant 1.0.x and the original Librarian gem
53
63
  with integrated Librarian-Chef.
@@ -2,20 +2,12 @@
2
2
  # -*- mode: ruby -*-
3
3
  # vi: set ft=ruby :
4
4
 
5
- require "vagrant-vmware-fusion"
5
+ require "vagrant-librarian-chef"
6
6
 
7
7
  Vagrant.configure("2") do |config|
8
- config.vm.box = "precise64"
9
- config.vm.box_url = "http://files.vagrantup.com/precise64.box"
8
+ config.vm.box = "chef/ubuntu-14.04"
10
9
 
11
- # To develop against the VMware Fusion provider, you must set an environment variable
12
- # pointing to the officially installed Vagrant. You must also be running the same version
13
- # of Ruby.
14
- #
15
- # $ VAGRANT_INSTALLER_EMBEDDED_DIR=/Applications/Vagrant/embedded bundle exec vagrant
16
- config.vm.provider :vmware_fusion do |v, override|
17
- override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
18
- end
10
+ config.omnibus.chef_version = :latest
19
11
 
20
12
  config.vm.provision :chef_solo do |chef|
21
13
  chef.cookbooks_path = "cookbooks"
@@ -12,8 +12,36 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- config = env[:machine].config.librarian_chef
15
+ if librarian_chef_enabled?(env)
16
+ resolve_and_install_cookbooks(env)
17
+ else
18
+ env[:ui].info "Librarian-Chef is disabled for this machine."
19
+ end
20
+ @app.call(env)
21
+ end
22
+
23
+ def get_project_path(env, config)
24
+ # look for a Cheffile in the configured cheffile_dir
25
+ if FileTest.exist? File.join(env[:root_path], config.cheffile_path)
26
+ return File.join(env[:root_path], config.cheffile_dir)
27
+ elsif FileTest.exist? File.expand_path(config.cheffile_path)
28
+ return File.expand_path(config.cheffile_dir)
29
+ end
30
+ end
16
31
 
32
+ # Determine if the Librarian-chef plugin should be run for the given environment
33
+ #
34
+ # @param [Vagrant::Environment] env
35
+ #
36
+ # @return [Boolean]
37
+ def librarian_chef_enabled?(env)
38
+ env[:machine].config.librarian_chef.enabled
39
+ end
40
+
41
+ private
42
+
43
+ def resolve_and_install_cookbooks(env)
44
+ config = env[:machine].config.librarian_chef
17
45
  project_path = get_project_path(env, config)
18
46
  if project_path
19
47
  env[:ui].info "Installing Chef cookbooks with Librarian-Chef..."
@@ -26,16 +54,6 @@ module VagrantPlugins
26
54
  else
27
55
  env[:ui].info "Couldn't find Cheffile at #{config.cheffile_path}."
28
56
  end
29
- @app.call(env)
30
- end
31
-
32
- def get_project_path(env, config)
33
- # look for a Cheffile in the configured cheffile_dir
34
- if FileTest.exist? File.join(env[:root_path], config.cheffile_path)
35
- return File.join(env[:root_path], config.cheffile_dir)
36
- elsif FileTest.exist? File.expand_path(config.cheffile_path)
37
- return File.expand_path(config.cheffile_dir)
38
- end
39
57
  end
40
58
  end
41
59
  end
@@ -1,10 +1,17 @@
1
1
  module VagrantPlugins
2
2
  module LibrarianChef
3
3
  class Config < Vagrant.plugin(2, :config)
4
+ # The path to the directory containing the Cheffile.
5
+ # @return [String] The path.
4
6
  attr_accessor :cheffile_dir
5
7
 
8
+ # Whether or not the plugin is enabled. If disabled, it will have no effect.
9
+ # @return [Boolean] The value of the enabled flag.
10
+ attr_accessor :enabled
11
+
6
12
  def initialize
7
13
  @cheffile_dir = UNSET_VALUE
14
+ @enabled = true
8
15
  end
9
16
 
10
17
  def finalize!
@@ -10,9 +10,9 @@ module VagrantPlugins
10
10
  module LibrarianChef
11
11
  class Plugin < Vagrant.plugin("2")
12
12
  name "vagrant-librarian-chef"
13
- description <<-DESC
14
- A Vagrant plugin to install Chef cookbooks using Librarian-Chef.
15
- DESC
13
+
14
+ description "A Vagrant plugin to install Chef cookbooks using Librarian-Chef."
15
+
16
16
  action_hook "librarian_chef" do |hook|
17
17
  hook.before Vagrant::Action::Builtin::Provision, Action::Install
18
18
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module LibrarianChef
3
- VERSION = "0.1.5"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-librarian-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Cuadra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-11 00:00:00.000000000 Z
11
+ date: 2014-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: librarian-chef