chefdepartie 0.0.5 → 0.0.6

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: a6cce015b3b98610b59d135891bb7e7273b9f625
4
- data.tar.gz: a2d809eec199079dc747e8ac2f18cd4b3d3bb68c
3
+ metadata.gz: 26e730293bec2be0202f17b109278f8b6efc1277
4
+ data.tar.gz: 422e0da3b37f7020368887e012b0fca69e52867b
5
5
  SHA512:
6
- metadata.gz: f043835243ecbf22dc13000806d27e254b262c63b4e3bc733dc97a525ccb91977c7742ad53d5f78835e9c3235758c3fea0b5a8c9a0aa9d21e2076c5b4f0fbaaa
7
- data.tar.gz: 0181eb915b23f3999860f4ecd613f5a4c3dd25cc86ebd49bae46dbf3d0c75257f4fd50c62e6a6f2681b1eb4a488c956e307cbf80ff59890b6cd039b42e1f4526
6
+ metadata.gz: 4a7079ac8b938ef935af14f6468a6c8495f302e54d6046f0a9db037794f7314f921e9d976630066b2bedf3b35804209bef2aea7a154ee9e9cde34320ee39a936
7
+ data.tar.gz: 87dba1d350ddb0828cb4b852a114375d156708aaf488c50414698fe9453d4f104de48c83830df997449450c58683cf00b9bb6b54c24679ae2731eb9f1ed5d2b6
data/lib/chefdepartie.rb CHANGED
@@ -1,61 +1,8 @@
1
- require 'chef'
2
-
3
- require_relative 'chefdepartie/server'
4
- require_relative 'chefdepartie/role'
5
- require_relative 'chefdepartie/cookbook'
6
- require_relative 'chefdepartie/databag'
7
-
8
- # Chefdepartie root namespace for core module commands
9
- module Chefdepartie
10
- def self.run(**kwargs)
11
- # Load the configuration
12
- config_file = kwargs[:config_file] || ENV['CHEFDEPARTIE_CONFIG'] || ''
13
- load_config(config_file, kwargs[:config])
14
- background = kwargs[:background]
15
-
16
- # Start the chef-zero server
17
- self.server_thread = start_server(background)
18
-
19
- # Upload everything
20
- upload_all
21
-
22
- # Notify that the chef server is ready
23
- puts 'Ready'
24
-
25
- # Join the chef server thread now that everything has been uploaded
26
- self.server_thread.join unless background
27
- end
28
-
29
- def self.stop
30
- puts 'Stopping server'
31
- server_thread.stop
32
- end
33
-
34
- private
35
-
36
- def self.server_thread=(thread)
37
- @@server_thread = thread
38
- end
39
-
40
- def self.server_thread
41
- @@server_thread
42
- end
43
-
44
- def self.upload_all
45
- Chefdepartie::Roles.upload_all
46
- Chefdepartie::Databags.upload_all
47
- Chefdepartie::Cookbooks.upload_all
48
- end
49
-
50
- def self.load_config(config_file, config)
51
- # Load config from config file if provided
52
- Chef::Config.from_file(config_file) if (!config_file.empty? && File.exist?(config_file))
53
-
54
- # Load config from hash
55
- if config && config.is_a?(Hash)
56
- config.each do |k, v|
57
- Chef::Config.send(k.to_sym, v)
58
- end
59
- end
60
- end
61
- end
1
+ $LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
2
+
3
+ require 'chefdepartie/runner'
4
+ require 'chefdepartie/server'
5
+ require 'chefdepartie/role'
6
+ require 'chefdepartie/cookbook'
7
+ require 'chefdepartie/databag'
8
+ require 'chefdepartie/cache'
@@ -0,0 +1,60 @@
1
+ require 'fileutils'
2
+ require 'chef'
3
+ require 'cityhash'
4
+ require 'chef_zero/data_store/raw_file_store'
5
+ require 'tmpdir'
6
+
7
+ module Chefdepartie
8
+ module Cache
9
+ extend self
10
+ def setup(path)
11
+ FileUtils.mkdir_p(File.join(path, 'organizations', 'chef'))
12
+ @path = File.join(path, 'cache.dat')
13
+ if File.exist?(@path) then restore else @cache = {} end
14
+ ds = ChefZero::DataStore::RawFileStore.new(File.join(path))
15
+ ChefZero::DataStore::DefaultFacade.new(ds, false, false)
16
+ end
17
+
18
+ def cache(path)
19
+ return false unless cache?
20
+ hash = File.file?(path) ? CityHash.hash128(File.read(path)) : hashdir(path)
21
+ hit = @cache[to_key(path)] == hash
22
+ unless hit
23
+ @cache[to_key(path)] = hash
24
+ dump
25
+ end
26
+ hit
27
+ end
28
+
29
+ def cache?
30
+ !@cache.nil?
31
+ end
32
+
33
+ def flush
34
+ @cache = {}
35
+ dump
36
+ end
37
+
38
+ private
39
+
40
+ def hashdir(path)
41
+ hash = ''
42
+ Dir["#{path}/**/*"].each do |path|
43
+ hash += CityHash.hash128(File.read(path)).to_s if File.file?(path)
44
+ end
45
+ CityHash.hash128(hash)
46
+ end
47
+
48
+ def restore
49
+ @cache = Marshal.load(File.binread(@path))
50
+ end
51
+
52
+ def dump
53
+ File.binwrite(@path, Marshal.dump(@cache))
54
+ end
55
+
56
+ def to_key(file)
57
+ file.gsub(/^#{File.dirname(Chef::Config[:cookbook_path])}/, '')
58
+ end
59
+ end
60
+ end
@@ -1,8 +1,10 @@
1
1
  require 'chef'
2
2
  require 'chef/cookbook/metadata'
3
3
  require 'chef/cookbook_uploader'
4
+ require "chef/cookbook/syntax_check"
4
5
  require 'librarian'
5
6
  require 'librarian/chef'
7
+ require 'fileutils'
6
8
 
7
9
  module Chefdepartie
8
10
  # Handle finding and uploading cookbooks
@@ -25,8 +27,11 @@ module Chefdepartie
25
27
  loader = Chef::CookbookLoader.new(path)
26
28
 
27
29
  books = books.collect do |name|
28
- status = :new
30
+ next if Cache.cache(File.join(path, name))
31
+ puts "Will upload #{name}"
29
32
  cookbook = loader.load_cookbook(name)
33
+ c = Chef::Cookbook::SyntaxCheck.for_cookbook(name, path)
34
+ c.ruby_files.concat(c.template_files).each { |f| c.validated(f) }
30
35
  fail "could not load cookbook #{name} " if cookbook.nil?
31
36
  cookbook
32
37
  end.compact
@@ -59,7 +64,8 @@ module Chefdepartie
59
64
 
60
65
  def self.upload_cheffile
61
66
  unless ENV['NO_LIBRARIAN']
62
- system('librarian-chef install')
67
+ FileUtils.mkdir_p('tmp/librarian/cookbooks')
68
+ system('librarian-chef install --quiet --path tmp/librarian/cookbooks')
63
69
  upload_cookbooks('tmp/librarian/cookbooks', cheffile_cookbooks.map(&:name))
64
70
  end
65
71
  end
@@ -78,6 +78,7 @@ module Chefdepartie
78
78
  files = Dir.glob(File.join(data_bag, '*.json')).flatten
79
79
 
80
80
  files.each do |item_file|
81
+ next if Cache.cache(item_file)
81
82
  raw_data = Chef::JSONCompat.from_json(IO.read(item_file))
82
83
 
83
84
  item = Chef::DataBagItem.new
@@ -7,7 +7,7 @@ module Chefdepartie
7
7
  puts 'Uploading roles'
8
8
  cookbooks = File.dirname(Chef::Config[:cookbook_path])
9
9
  roles = []
10
- Find.find(File.join(cookbooks, 'roles')) { |f| roles << f if f =~ /\.rb$/ }
10
+ Find.find(File.join(cookbooks, 'roles')) { |f| roles << f if f =~ /\.rb$/ && !Cache.cache(f) }
11
11
  upload_site_roles(roles)
12
12
  end
13
13
 
@@ -28,7 +28,6 @@ module Chefdepartie
28
28
 
29
29
  def self.role_from_file(file)
30
30
  role = Chef::Role.new
31
- puts file
32
31
  role.from_file(file)
33
32
  role
34
33
  end
@@ -0,0 +1,34 @@
1
+ require 'chef'
2
+ require 'openssl'
3
+ require 'tempfile'
4
+
5
+ module Chefdepartie
6
+ def self.run(**kwargs)
7
+ Runner.run(kwargs)
8
+ end
9
+
10
+ def self.stop
11
+ Server.stop
12
+ end
13
+
14
+ module Runner
15
+ extend self
16
+
17
+ def run(**kwargs)
18
+ # Load the configuration
19
+ Server.configure(kwargs)
20
+
21
+ # Start the chef-zero server
22
+ Server.start
23
+
24
+ # Upload everything
25
+ Server.upload_all
26
+
27
+ # Notify that the chef server is ready
28
+ puts 'Ready'
29
+
30
+ # Join the chef server thread now that everything has been uploaded
31
+ Server.join
32
+ end
33
+ end
34
+ end
@@ -1,16 +1,68 @@
1
1
  require 'chef_zero/server'
2
2
  require 'uri/generic'
3
3
 
4
- def start_server(background)
5
- port = URI(Chef::Config[:chef_server_url]).port
6
- server = ChefZero::Server.new(host: '0.0.0.0', port: port)
7
-
8
- if background
9
- server.start_background
10
- server
11
- else
12
- Thread.new do
13
- server.start
4
+ module Chefdepartie
5
+ module Server
6
+ extend self
7
+
8
+ def start
9
+ @server = ChefZero::Server.new(@opts)
10
+
11
+ if @background
12
+ @server.start_background
13
+ else
14
+ @server_thread = Thread.new do
15
+ server.start
16
+ end
17
+ end
18
+ end
19
+
20
+ def join
21
+ @server_thread.join unless @background
22
+ end
23
+
24
+ def stop
25
+ puts 'Stopping server'
26
+ @server_thread.nil? ? @server.stop : @server_thread.stop
27
+ end
28
+
29
+ def upload_all
30
+ Chefdepartie::Roles.upload_all
31
+ Chefdepartie::Databags.upload_all
32
+ Chefdepartie::Cookbooks.upload_all
33
+ end
34
+
35
+ # Load chef config from hash or file
36
+ def configure(kwargs)
37
+ config_file = kwargs[:config_file] || ENV['CHEFDEPARTIE_CONFIG'] || ''
38
+ # Load config from config file if provided
39
+ Chef::Config.from_file(config_file) if !config_file.empty? && File.exist?(config_file)
40
+
41
+ config = kwargs[:config]
42
+ # Load config from hash
43
+ if config && config.is_a?(Hash)
44
+ config[:node_name] ||= 'chef-zero'
45
+ config[:client_key] ||= fake_key
46
+ config.each do |k, v|
47
+ Chef::Config.send(k.to_sym, v)
48
+ end
49
+ end
50
+
51
+ @background = kwargs[:background]
52
+ @cache = kwargs[:cache]
53
+
54
+ port = URI(Chef::Config[:chef_server_url]).port
55
+ @opts = { host: '0.0.0.0', port: port } # , log_level: :debug }
56
+ @opts.merge!(data_store: Cache.setup(@cache)) if @cache
57
+ end
58
+
59
+ private
60
+
61
+ def fake_key
62
+ client_key = Tempfile.new('chef-zero-client')
63
+ client_key.write(OpenSSL::PKey::RSA.new(2048).to_s)
64
+ client_key.close
65
+ client_key.path
14
66
  end
15
67
  end
16
68
  end
@@ -1,4 +1,4 @@
1
1
  # Store version info
2
2
  module Chefdepartie
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chefdepartie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Hamel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2015-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -16,19 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 12.3.0
19
+ version: '12.4'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 12.4.3
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: 12.3.0
29
+ version: '12.4'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 12.4.3
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: chef-zero
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.2'
40
+ - - ">="
32
41
  - !ruby/object:Gem::Version
33
42
  version: 4.2.2
34
43
  type: :runtime
@@ -36,6 +45,9 @@ dependencies:
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '4.2'
50
+ - - ">="
39
51
  - !ruby/object:Gem::Version
40
52
  version: 4.2.2
41
53
  - !ruby/object:Gem::Dependency
@@ -53,35 +65,73 @@ dependencies:
53
65
  - !ruby/object:Gem::Version
54
66
  version: 0.0.4
55
67
  - !ruby/object:Gem::Dependency
56
- name: minitest
68
+ name: cityhash
57
69
  requirement: !ruby/object:Gem::Requirement
58
70
  requirements:
59
71
  - - "~>"
60
72
  - !ruby/object:Gem::Version
61
- version: '5.6'
62
- type: :development
73
+ version: 0.8.1
74
+ type: :runtime
63
75
  prerelease: false
64
76
  version_requirements: !ruby/object:Gem::Requirement
65
77
  requirements:
66
78
  - - "~>"
67
79
  - !ruby/object:Gem::Version
68
- version: '5.6'
80
+ version: 0.8.1
81
+ - !ruby/object:Gem::Dependency
82
+ name: rake
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - '='
86
+ - !ruby/object:Gem::Version
87
+ version: 10.4.2
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '='
93
+ - !ruby/object:Gem::Version
94
+ version: 10.4.2
95
+ - !ruby/object:Gem::Dependency
96
+ name: simplecov
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '='
100
+ - !ruby/object:Gem::Version
101
+ version: 0.10.0
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '='
107
+ - !ruby/object:Gem::Version
108
+ version: 0.10.0
109
+ - !ruby/object:Gem::Dependency
110
+ name: rspec
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '='
114
+ - !ruby/object:Gem::Version
115
+ version: 3.4.0
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - '='
121
+ - !ruby/object:Gem::Version
122
+ version: 3.4.0
69
123
  description: chefdepartie uses chef-zero to provide a local, testing chef server
70
124
  email: dale.hamel@srvthe.net
71
125
  executables: []
72
126
  extensions: []
73
127
  extra_rdoc_files: []
74
128
  files:
75
- - ".gitignore"
76
- - Gemfile
77
- - Gemfile.lock
78
- - README.md
79
- - chefdepartie.gemspec
80
- - config.rb
81
129
  - lib/chefdepartie.rb
130
+ - lib/chefdepartie/cache.rb
82
131
  - lib/chefdepartie/cookbook.rb
83
132
  - lib/chefdepartie/databag.rb
84
133
  - lib/chefdepartie/role.rb
134
+ - lib/chefdepartie/runner.rb
85
135
  - lib/chefdepartie/server.rb
86
136
  - lib/chefdepartie/version.rb
87
137
  homepage: https://rubygems.org/gems/chefdepartie
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- cookbooks
2
- *.gem
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :test do
6
- gem 'simplecov', '=0.10.0'
7
- end
data/Gemfile.lock DELETED
@@ -1,153 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- chefdepartie (0.0.5)
5
- chef (~> 12.3.0)
6
- chef-zero (~> 4.2.2)
7
- librarian-chef (~> 0.0.4)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- builder (3.2.2)
13
- chef (12.3.0)
14
- chef-zero (~> 4.1)
15
- diff-lcs (~> 1.2, >= 1.2.4)
16
- erubis (~> 2.7)
17
- ffi-yajl (>= 1.2, < 3.0)
18
- highline (~> 1.6, >= 1.6.9)
19
- mixlib-authentication (~> 1.3)
20
- mixlib-cli (~> 1.4)
21
- mixlib-config (~> 2.0)
22
- mixlib-log (~> 1.3)
23
- mixlib-shellout (>= 2.0.0.rc.0, < 3.0)
24
- net-ssh (~> 2.6)
25
- net-ssh-multi (~> 1.1)
26
- ohai (~> 8.0)
27
- plist (~> 3.1.0)
28
- pry (~> 0.9)
29
- rspec-core (~> 3.2)
30
- rspec-expectations (~> 3.2)
31
- rspec-mocks (~> 3.2)
32
- rspec_junit_formatter (~> 0.2.0)
33
- serverspec (~> 2.7)
34
- specinfra (~> 2.10)
35
- chef-config (12.5.1)
36
- mixlib-config (~> 2.0)
37
- mixlib-shellout (~> 2.0)
38
- chef-zero (4.2.3)
39
- ffi-yajl (>= 1.1, < 3.0)
40
- hashie (~> 2.0)
41
- mixlib-log (~> 1.3)
42
- rack
43
- uuidtools (~> 2.1)
44
- coderay (1.1.0)
45
- diff-lcs (1.2.5)
46
- docile (1.1.5)
47
- erubis (2.7.0)
48
- ffi (1.9.10)
49
- ffi-yajl (2.2.2)
50
- libyajl2 (~> 1.2)
51
- hashie (2.1.2)
52
- highline (1.7.8)
53
- ipaddress (0.8.0)
54
- json (1.8.2)
55
- librarian (0.1.2)
56
- highline
57
- thor (~> 0.15)
58
- librarian-chef (0.0.4)
59
- chef (>= 0.10)
60
- librarian (~> 0.1.0)
61
- minitar (>= 0.5.2)
62
- libyajl2 (1.2.0)
63
- method_source (0.8.2)
64
- mime-types (2.99)
65
- minitar (0.5.4)
66
- minitest (5.6.1)
67
- mixlib-authentication (1.3.0)
68
- mixlib-log
69
- mixlib-cli (1.5.0)
70
- mixlib-config (2.2.1)
71
- mixlib-log (1.6.0)
72
- mixlib-shellout (2.2.3)
73
- multi_json (1.11.2)
74
- net-scp (1.2.1)
75
- net-ssh (>= 2.6.5)
76
- net-ssh (2.9.2)
77
- net-ssh-gateway (1.2.0)
78
- net-ssh (>= 2.6.5)
79
- net-ssh-multi (1.2.1)
80
- net-ssh (>= 2.6.5)
81
- net-ssh-gateway (>= 1.2.0)
82
- net-telnet (0.1.1)
83
- ohai (8.7.0)
84
- chef-config (>= 12.5.0.alpha.1, < 13)
85
- ffi (~> 1.9)
86
- ffi-yajl (~> 2.2)
87
- ipaddress
88
- mime-types (~> 2.0)
89
- mixlib-cli
90
- mixlib-config (~> 2.0)
91
- mixlib-log
92
- mixlib-shellout (~> 2.0)
93
- rake (~> 10.1)
94
- systemu (~> 2.6.4)
95
- wmi-lite (~> 1.0)
96
- plist (3.1.0)
97
- pry (0.10.3)
98
- coderay (~> 1.1.0)
99
- method_source (~> 0.8.1)
100
- slop (~> 3.4)
101
- rack (1.6.4)
102
- rake (10.4.2)
103
- rspec (3.4.0)
104
- rspec-core (~> 3.4.0)
105
- rspec-expectations (~> 3.4.0)
106
- rspec-mocks (~> 3.4.0)
107
- rspec-core (3.4.1)
108
- rspec-support (~> 3.4.0)
109
- rspec-expectations (3.4.0)
110
- diff-lcs (>= 1.2.0, < 2.0)
111
- rspec-support (~> 3.4.0)
112
- rspec-its (1.2.0)
113
- rspec-core (>= 3.0.0)
114
- rspec-expectations (>= 3.0.0)
115
- rspec-mocks (3.4.0)
116
- diff-lcs (>= 1.2.0, < 2.0)
117
- rspec-support (~> 3.4.0)
118
- rspec-support (3.4.1)
119
- rspec_junit_formatter (0.2.3)
120
- builder (< 4)
121
- rspec-core (>= 2, < 4, != 2.12.0)
122
- serverspec (2.24.3)
123
- multi_json
124
- rspec (~> 3.0)
125
- rspec-its
126
- specinfra (~> 2.43)
127
- sfl (2.2)
128
- simplecov (0.10.0)
129
- docile (~> 1.1.0)
130
- json (~> 1.8)
131
- simplecov-html (~> 0.10.0)
132
- simplecov-html (0.10.0)
133
- slop (3.6.0)
134
- specinfra (2.44.3)
135
- net-scp
136
- net-ssh (~> 2.7)
137
- net-telnet
138
- sfl
139
- systemu (2.6.5)
140
- thor (0.19.1)
141
- uuidtools (2.1.5)
142
- wmi-lite (1.0.0)
143
-
144
- PLATFORMS
145
- ruby
146
-
147
- DEPENDENCIES
148
- chefdepartie!
149
- minitest (~> 5.6)
150
- simplecov (= 0.10.0)
151
-
152
- BUNDLED WITH
153
- 1.10.6
data/README.md DELETED
@@ -1,56 +0,0 @@
1
- # A quick little helper
2
-
3
- In a kitchen, a chef de partie is a line cook who helps prepare the ingredients the real chef will use.
4
-
5
- Chefdepartie is a wrapper around a chef-zero server, allowing you to easily upload all of your:
6
-
7
- * Cookbooks (site)
8
- * Librarian cookbooks
9
- * Roles
10
- * Data bags
11
-
12
- This allows you to test out all of your cookbooks together without putting them on your actual chef server.
13
-
14
- ## Chefdepartie vs chef-solo
15
-
16
- Since chef-zero provides the same interface as **a real chef server**, you can actually use knife with it!
17
-
18
- This gives you a full chef sandbox, and can be useful for things like CI or packer image provisioning.
19
-
20
- * View and edit data bags, without an internet connection
21
- * Bootstrap test nodes (vagrant images, cloud servers, etc)
22
-
23
- ## Limitations
24
-
25
- Since chefdepartie is just a wrapper around chef-zero, it runs entirely in memory and has no persistence. This makes it a useful sandbox, but it shouldn't be relied on for anything non-ephemeral.
26
-
27
- chefdepartie really doesn't work with environments. Everything is assumed to be on the default environment.
28
-
29
- # Configuration
30
-
31
- create a normal chef config file, but you only need to specify the following values:
32
-
33
- ```
34
- chef_server_url 'http://localhost:4000'
35
- client_key 'path_to_any_pemfile'
36
- encrypted_data_bag_secret 'path_to_your_real_databag_secret'
37
- cookbook_path 'path_to_your_cookbooks'
38
- node_name 'any_name'
39
- ```
40
-
41
- Then, provide this file to chefdepartie as an environment variable (yeah, this needs some tweaking)
42
-
43
-
44
- # Invocation
45
-
46
- Currently a little rough around the edges. You specify the chef config file to use, and then just run chefdepartie.
47
-
48
- ```
49
- CHEFDEPARTIE_CONFIG=~/workspace/shopify/chefdepartie/config.rb be ruby lib/chefdepartie.rb
50
- ```
51
-
52
- # To do:
53
-
54
- * Wrap launching server with something like thor
55
- * Tests to ensure all uploads are working as expected
56
- * CI for tests
data/chefdepartie.gemspec DELETED
@@ -1,25 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'chefdepartie/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'chefdepartie'
7
- spec.version = Chefdepartie::VERSION
8
- spec.summary = 'chefdepartie helps you test you cookbooks locally'
9
- spec.description = 'chefdepartie uses chef-zero to provide a local, testing chef server'
10
- spec.authors = ['Dale Hamel']
11
- spec.email = 'dale.hamel@srvthe.net'
12
- spec.files = Dir['lib/**/*']
13
- spec.homepage = 'https://rubygems.org/gems/chefdepartie'
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_runtime_dependency 'chef', '~> 12.3.0'
22
- spec.add_runtime_dependency 'chef-zero', '~> 4.2.2'
23
- spec.add_runtime_dependency 'librarian-chef', '~> 0.0.4'
24
- spec.add_development_dependency 'minitest', '~> 5.6'
25
- end
data/config.rb DELETED
@@ -1,5 +0,0 @@
1
- chef_server_url 'http://localhost:4000'
2
- client_key '/home/dale.hamel/.chef/configs/shopify/client.pem'
3
- encrypted_data_bag_secret '/home/dale.hamel/.chef/configs/shopify/encrypted_data_bag_secret'
4
- cookbook_path '/home/dale.hamel/workspace/shopify/cookbooks/cookbooks'
5
- node_name 'foo'