vagrant-cookbook-fetcher 0.1.0 → 0.2.1

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.
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  vagrant-cookbook-fetcher
2
2
  ========================
3
3
 
4
+ DEPRECATED - you should really use something like vagrant-berkshelf. This thing came from a darker time.
5
+
4
6
  A Vagrant plugin to automatically fetch cookbooks, roles, and such whenever you run vagrant provision, up or start.
5
7
 
6
8
  ## Compatibility
7
9
 
8
10
  For vagrant 1.0.x, use vagrant-cookbook-fetcher 0.0.x .
9
11
  For vagrant 1.1.x, use vagrant-cookbook-fetcher 0.1.x . It may or may not work.
10
- For vagrant 1.2.x, use vagrant-cookbook-fetcher 0.1.x .
12
+ For vagrant 1.2.x+, use vagrant-cookbook-fetcher 0.1.+ .
11
13
 
12
14
  ## Behavior
13
15
 
@@ -43,11 +45,11 @@ In addition, a new command is added, 'vagrant checkout', which simply runs the c
43
45
  git,https://github.com/opscode-cookbooks/php.git,opscode-php/cookbooks/php,master,NONE
44
46
 
45
47
  The fields are: VCS,repo address, directory name, branch, credentials
46
- * VCS may be either 'git' or 'svn' (TODO).
48
+ * VCS may be either 'git' or nothing else, too bad.
47
49
  * repo address is the identifier of the repository from which to obtain the checkout.
48
50
  * directory name is the path under <vagrant-root>/checkouts to clone/checkout into. It may contain slashes.
49
51
  * branch is the name of the git branch. Leave blank for svn (use repo address for svn branching)
50
- * (this feature is TODO) credentials is the method to authenticate to the repo server. NONE means use no authentication. AGENT means to rely on a running ssh-agent to provide credentials. All other values are taken to specify the location of a SSH private key, relative to <vagrant-root>, that should be used with a GIT_SSH wrapper.
52
+ * credentials column is unused. Zing!
51
53
 
52
54
  ## Configuration
53
55
 
@@ -65,11 +67,11 @@ Default: false
65
67
 
66
68
  If true, no checkout will be be run. This can be useful if you're provisioning frequently and making local changes to your recipes; if you use git rebase, your build will break whenever you have a local change and an incoming change at the same time.
67
69
 
68
- Even if the fetch is disabled, this plugin will still try to tell chef-solo about your cookbook, role, and data_bag paths, unless you override them.
70
+ If vagrant-berkshelf is detected, this plugin will disable itself, as you should be using vagrant-berkshelf anyway.
69
71
 
70
72
  ## TODO
71
73
 
72
- * Add svn support
73
- * Actually respect the credentials column
74
- * Make checkout list format less awful, add headers
75
- * support chef, not just chef-solo
74
+ * Move everyone over to vagrant-berkshelf or PolicyFiles or something.
75
+
76
+
77
+
@@ -10,31 +10,35 @@ module VagrantPlugins
10
10
  # there has got to be a better way
11
11
  provisioners_list = env[:machine].config.vm.provisioners
12
12
  chef_solo = provisioners_list.find { |p| p.name === :chef_solo }
13
+ vcf_config = env[:machine].config.cookbook_fetcher
13
14
 
14
15
  if chef_solo then
15
- solo_cfg = chef_solo.config
16
16
 
17
- Dir.chdir(env[:root_path]) do
18
- # In Vagrant 1.2.x+, these are all arrays
19
- solo_cfg.roles_path.push [:host, "combined/roles"]
20
- solo_cfg.data_bags_path.push [:host, "combined/data_bags"]
17
+ unless vcf_config.disable then
18
+ solo_cfg = chef_solo.config
19
+
20
+ Dir.chdir(env[:root_path]) do
21
+ # In Vagrant 1.2.x+, these are all arrays
22
+ solo_cfg.roles_path.push [:host, "combined/roles"]
23
+ solo_cfg.data_bags_path.push [:host, "combined/data_bags"]
24
+
25
+ # The first time we fetch cookbooks, we store the cookbook order in a file.
26
+ unless File.exists?(".cookbook-order") then
27
+ env[:ui].error "Cookbook Fetcher checkout could find not a .cookbook-order file. You need to run provision with checkout enabled at least once (or else disable cookbook fetcher)."
28
+ return
29
+ end
30
+
31
+ # For cookbook path, Vagrant defaults to this:
32
+ # [[:host, "cookbooks"], [:vm, "cookbooks"]]
33
+ # But we're overriding that.
34
+ solo_cfg.cookbooks_path = []
35
+
36
+ # Read from filesystem
37
+ IO.readlines(".cookbook-order").each do |line|
38
+ solo_cfg.cookbooks_path.push [ :host, line.chomp ]
39
+ end
21
40
 
22
- # The first time we fetch cookbooks, we store the cookbook order in a file.
23
- unless File.exists?(".cookbook-order") then
24
- env[:ui].error "Cookbook Fetcher checkout could find not a .cookbook-order file. You need to run provision with checkout enabled at least once (or else disable cookbook fetcher)."
25
- return
26
41
  end
27
-
28
- # For cookbook path, Vagrant defaults to this:
29
- # [[:host, "cookbooks"], [:vm, "cookbooks"]]
30
- # But we're overriding that.
31
- solo_cfg.cookbooks_path = []
32
-
33
- # Read from filesystem
34
- IO.readlines(".cookbook-order").each do |line|
35
- solo_cfg.cookbooks_path.push [ :host, line.chomp ]
36
- end
37
-
38
42
  end
39
43
  end
40
44
 
@@ -1,13 +1,21 @@
1
1
  require_relative 'guts'
2
+
2
3
  module VagrantPlugins
3
4
  module CookbookFetcher
4
5
  class CheckoutCommand < Vagrant.plugin("2", "command")
5
6
  def execute
6
- CookbookFetcher.perform_fetch(
7
- :url => @env.config_global.cookbook_fetcher.url,
8
- :logger => @env.ui,
9
- :path => @env.root_path
10
- )
7
+
8
+ # Oddly, under vagrant ~ 1.4.1, @argv is ['--'].
9
+ # Disappearred by 1.7.2
10
+ scrubbed_args = @argv.reject {|e| e == '--' }
11
+ with_target_vms(scrubbed_args) do |machine|
12
+
13
+ CookbookFetcher.perform_fetch(
14
+ :url => machine.config.cookbook_fetcher.url,
15
+ :logger => @env.ui,
16
+ :path => @env.root_path
17
+ )
18
+ end
11
19
  end
12
20
  end
13
21
  end
@@ -11,15 +11,21 @@ module VagrantPlugins
11
11
  end
12
12
 
13
13
  def finalize!
14
- @disable = false if @disable == UNSET_VALUE
14
+ if Vagrant.has_plugin?('vagrant-berkshelf')
15
+ # TODO: would ideally detect whether berkshelf is actually enabled
16
+ # TODO: this ui call seems to alkways get swallowed
17
+ ui.info('vagrant-berkshelf detected, disabling vagrant-cookbook-fetcher')
18
+ @disable = true
19
+ else
20
+ @disable = false if @disable == UNSET_VALUE
21
+ end
15
22
  end
16
23
 
17
24
  def validate(machine)
18
25
  errors = []
19
- unless @disable then
20
- if @url == UNSET_VALUE
21
- errors << "vagrant-cookbook-fetcher plugin requires a config parameter, 'url', which is missing."
22
- end
26
+ if @url == UNSET_VALUE
27
+ # Disable vagrant cookbook fetcher if we don't specify a URL
28
+ @disable = true
23
29
  end
24
30
 
25
31
  { 'Cookbook Fetcher' => errors }
@@ -8,10 +8,10 @@ module VagrantPlugins
8
8
  Config
9
9
  end
10
10
 
11
- # We want to act on 'up' and 'provision'
12
11
  [
13
12
  :machine_action_up,
14
- :machine_action_provision
13
+ :machine_action_provision,
14
+ :machine_action_reload,
15
15
  ].each do |chain|
16
16
 
17
17
  # This hook performs the actual fetch
@@ -1,7 +1,7 @@
1
1
  module VagrantPlugins
2
2
  module CookbookFetcher
3
3
  NAME = "vagrant-cookbook-fetcher"
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.1"
5
5
  AUTHOR = "Clinton Wolfe"
6
6
  AUTHOR_EMAIL = "clintoncwolfe [at] gmail [dot] com"
7
7
  SUMMARY = "Fetch your Chef cookbooks whenever you provision"
@@ -1,6 +1,5 @@
1
-
2
- require "vagrant-cookbook-fetcher/version"
3
- require "vagrant-cookbook-fetcher/plugin"
1
+ require_relative "vagrant-cookbook-fetcher/version"
2
+ require_relative "vagrant-cookbook-fetcher/plugin"
4
3
 
5
4
  module VagrantPlugins
6
5
  module CookbookFetcher
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-cookbook-fetcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-02 00:00:00.000000000 Z
12
+ date: 2015-01-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Fetch your Chef cookbooks whenever you provision
15
15
  email: clintoncwolfe [at] gmail [dot] com
@@ -18,14 +18,13 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
- - lib/vagrant-cookbook-fetcher/guts.rb
22
- - lib/vagrant-cookbook-fetcher/command.rb
23
- - lib/vagrant-cookbook-fetcher/action.rb
24
- - lib/vagrant-cookbook-fetcher/action_fetch_cookbooks.rb
25
21
  - lib/vagrant-cookbook-fetcher/config.rb
26
- - lib/vagrant-cookbook-fetcher/plugin.rb
22
+ - lib/vagrant-cookbook-fetcher/action_fetch_cookbooks.rb
23
+ - lib/vagrant-cookbook-fetcher/command.rb
27
24
  - lib/vagrant-cookbook-fetcher/version.rb
25
+ - lib/vagrant-cookbook-fetcher/guts.rb
28
26
  - lib/vagrant-cookbook-fetcher/action_set_chef_paths.rb
27
+ - lib/vagrant-cookbook-fetcher/plugin.rb
29
28
  - lib/vagrant-cookbook-fetcher.rb
30
29
  homepage: http://github.com/clintoncwolfe/vagrant-cookbook-fetcher
31
30
  licenses: []
@@ -47,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
46
  version: '0'
48
47
  requirements: []
49
48
  rubyforge_project: vagrant-cookbook-fetcher
50
- rubygems_version: 1.8.24
49
+ rubygems_version: 1.8.23
51
50
  signing_key:
52
51
  specification_version: 3
53
52
  summary: Whenever you run start, up, or provision, this plugin will dynamically fetch
@@ -1,28 +0,0 @@
1
- require "vagrant/action/builder"
2
-
3
- module VagrantPlugins
4
- module CookbookFetcher
5
- module Action
6
- include Vagrant::Action::Builtin
7
-
8
- autoload :DetectCheckoutDisabled, File.expand_path("../action/detect_checkout_disabled", __FILE__)
9
- autoload :FetchCookbooks, File.expand_path("../action/fetch_cookbooks", __FILE__)
10
- autoload :UpdateLinks, File.expand_path("../action/update_links", __FILE__)
11
- autoload :ConfigureChef, File.expand_path("../action/configure_chef", __FILE__)
12
-
13
- def self.run_checkout
14
- @run_checkout ||= ::Vagrant::Action::Builder.new.tap do |b|
15
- b.use ConfigValidate
16
- b.use Call, DetectCheckoutDisabled do |env1, b2|
17
- if env1[:checkout_disabled]
18
- b2.use FetchCookbooks
19
- b2.use UpdateLinks
20
- end
21
- end
22
- b.use ConfigureChef
23
- end
24
- end
25
-
26
- end
27
- end
28
- end