chef-berks 0.0.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.
@@ -0,0 +1,8 @@
1
+ require "chef/berks/version"
2
+ require "monkey_patches/chef/client"
3
+
4
+ class Chef
5
+ module Berks
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class Chef
2
+ module Berks
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,51 @@
1
+
2
+ require 'chef/client'
3
+ require 'monkey_patches/chef/config'
4
+ require 'berkshelf'
5
+ require 'berkshelf/berksfile'
6
+ require 'tmpdir'
7
+ require 'fileutils'
8
+
9
+ class Chef
10
+ class Client
11
+ def setup_run_context
12
+ if Chef::Config[:solo]
13
+ if Chef::Config[:use_berkshelf]
14
+ cookbook_collection = run_berks
15
+ else
16
+ Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::FileSystemFileVendor.new(manifest, Chef::Config[:cookbook_path]) }
17
+ cl = Chef::CookbookLoader.new(Chef::Config[:cookbook_path])
18
+ cl.load_cookbooks
19
+ cookbook_collection = Chef::CookbookCollection.new(cl)
20
+ end
21
+ run_context = Chef::RunContext.new(node, cookbook_collection, @events)
22
+ else
23
+ if Chef::Config[:use_berkshelf]
24
+ cookbook_collection = run_berks
25
+ else
26
+ Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::RemoteFileVendor.new(manifest, rest) }
27
+ cookbook_hash = sync_cookbooks
28
+ cookbook_collection = Chef::CookbookCollection.new(cookbook_hash)
29
+ end
30
+ run_context = Chef::RunContext.new(node, cookbook_collection, @events)
31
+ end
32
+ run_status.run_context = run_context
33
+
34
+ run_context.load(@run_list_expansion)
35
+ assert_cookbook_path_not_empty(run_context)
36
+ run_context
37
+ end
38
+
39
+ def run_berks
40
+ berksfile = Berkshelf::Berksfile.from_file(Chef::Config[:berksfile])
41
+ opts= {path:Chef::Config[:cookbook_path].first}
42
+ berksfile.install(opts)
43
+ Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::FileSystemFileVendor.new(manifest, Chef::Config[:cookbook_path]) }
44
+ cl = Chef::CookbookLoader.new(Chef::Config[:cookbook_path])
45
+ cl.load_cookbooks
46
+ cookbook_collection = Chef::CookbookCollection.new(cl)
47
+ cookbook_collection
48
+ end
49
+ end
50
+ end
51
+
@@ -0,0 +1,8 @@
1
+ require 'chef/config'
2
+
3
+ class Chef
4
+ class Config
5
+ berksfile platform_specific_path("/etc/chef/Berksfile")
6
+ use_berkshelf false
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef-berks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ranjib Dey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: chef
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: berkshelf
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Allows chef-client/solo to grab cookbooks on the fly using berkshelf
79
+ email:
80
+ - dey.ranjib@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - lib/monkey_patches/chef/config.rb
86
+ - lib/monkey_patches/chef/client.rb
87
+ - lib/chef/berks.rb
88
+ - lib/chef/berks/version.rb
89
+ homepage: https://github.com/ranjib/chef-berks
90
+ licenses:
91
+ - MIT
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 1.8.23
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: Allows chef-client/solo to grab cookbooks on the fly using berkshelf
114
+ test_files: []