vagrant-librarian-chef-nochef 0.1.2 → 0.2.0

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: 412ed8f95f8e9612db5cddbafed543ae7dfc1f93
4
- data.tar.gz: 2063e27793a4cd42e6011d5862dc351ff9491a23
3
+ metadata.gz: 1ac9971af2c3bf39a8e3af7ccfb6d1cef6dc3dc9
4
+ data.tar.gz: 8c48311b40c19c9ab847c35758089cc4c4d1cec7
5
5
  SHA512:
6
- metadata.gz: b451f308082db0f91db8ca85b7a0fa8efea5faeeb3feb5dcc444f8ff1361498ada2edcd255741146a68dcdb6e62db77a5f8610f3fae3fa349985d26689488cee
7
- data.tar.gz: 329d65e274c88b47c1efb2dcfb723551d3c4cad92309011e4776bbdc3b32ba497922c2aa0c4bbc414ab7e66fb602d84d41c8436a6653c3b8dfc2513e7f9f89f2
6
+ metadata.gz: 6a1b149f9d59c4df79ac0b2ed5f5b753cd10144a05332f8147020e86cd28e109583f21ba845b40575e4ca759ae9ac0ae108d1331456ed34a870c29e694de22ac
7
+ data.tar.gz: c7cfb55dfb579f6ca37ba202d3a8aa374712d50ff4f76966e603a4c52b05c4c192938363e30418197c7c33d9baf4932477eca8b1a4d300fad5c81652443ff76e
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
@@ -51,8 +51,18 @@ Vagrant.configure("2") do |config|
51
51
  end
52
52
  ```
53
53
 
54
+ 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.
55
+
56
+ If you want to programmtically disable the plugin without uninstalling it, set the `enabled` attribute to false:
57
+
58
+ ``` ruby
59
+ config.librarian_chef.enabled = false
60
+ ```
61
+
54
62
  ## Development
55
63
 
64
+ Vagrant 1.5.0 or greater is required.
65
+
56
66
  ``` bash
57
67
  bundle
58
68
  bundle exec vagrant up
@@ -60,7 +70,7 @@ bundle exec vagrant up
60
70
 
61
71
  ## Acknowledgements
62
72
 
63
- Thank you to @thegcat and other contributors for their work on
73
+ Thank you to [@thegcat](https://github.com/thegcat) and other contributors for their work on
64
74
  [vagrant-librarian](https://github.com/thegcat/vagrant-librarian), an earlier
65
75
  version of this functionality for Vagrant 1.0.x and the original Librarian gem
66
76
  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,14 +1,22 @@
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 = UNSET_VALUE
8
15
  end
9
16
 
10
17
  def finalize!
11
18
  @cheffile_dir = "." if @cheffile_dir == UNSET_VALUE
19
+ @enabled = true if @enabled == UNSET_VALUE
12
20
  end
13
21
 
14
22
  def cheffile_path
@@ -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
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "vagrant-librarian-chef-nochef"
7
- spec.version = "0.1.2"
7
+ spec.version = "0.2.0"
8
8
  spec.authors = ["Emiliano Ticci", "Jimmy Cuadra"]
9
9
  spec.email = ["emiticci@gmail.com" "jimmy@jimmycuadra.com"]
10
10
  spec.description = %q{A Vagrant plugin to install Chef cookbooks using librarian-chef-nochef.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-librarian-chef-nochef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Ticci
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-21 00:00:00.000000000 Z
12
+ date: 2014-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: librarian-chef-nochef