Module: HeadChef
- Defined in:
- lib/head_chef.rb,
lib/head_chef/ui.rb,
lib/head_chef/cli.rb,
lib/head_chef/version.rb,
lib/head_chef/cookbook.rb,
lib/head_chef/tasks/env.rb,
lib/head_chef/tasks/diff.rb,
lib/head_chef/tasks/list.rb,
lib/head_chef/tasks/sync.rb,
lib/head_chef/cookbook_diff.rb
Overview
@TODO: establish head_chef exit codes Create custom errors
Defined Under Namespace
Modules: UI
Classes: Cli, Cookbook, CookbookDiff, Diff, Env, List, Sync
Constant Summary
collapse
- BERKSFILE_LOCATION =
'Berksfile'.freeze
- BERKSFILE_COOKBOOK_DIR =
'.head_chef'.freeze
- VERSION =
'0.1.1'
Class Method Summary
collapse
Class Method Details
.berksfile ⇒ Object
53
54
55
|
# File 'lib/head_chef.rb', line 53
def berksfile
@berksfile ||= Berkshelf::Berksfile.from_file(BERKSFILE_LOCATION)
end
|
.chef_server ⇒ Object
32
33
34
|
# File 'lib/head_chef.rb', line 32
def chef_server
@chef_server ||= Ridley.from_chef_config()
end
|
.current_branch ⇒ Object
49
50
51
|
# File 'lib/head_chef.rb', line 49
def current_branch
master_cookbook.head.name
end
|
.master_cookbook ⇒ Object
@TODO: refactor? Is grit necessary to get current branch, is shell command sufficient? This can look up dir’s until it finds .git dir
39
40
41
42
43
44
45
46
47
|
# File 'lib/head_chef.rb', line 39
def master_cookbook
begin
@master_cookbook ||= Grit::Repo.new('.')
rescue Grit::InvalidGitRepositoryError
puts Dir.pwd
HeadChef.ui.error 'head_chef must be run in root of git repo'
Kernel.exit(1337)
end
end
|
.root ⇒ Object
24
25
26
|
# File 'lib/head_chef.rb', line 24
def root
@root ||= Pathname.new(File.expand_path('../', File.dirname(__FILE__)))
end
|
.ui ⇒ Object
28
29
30
|
# File 'lib/head_chef.rb', line 28
def ui
@ui ||= Thor::Base.shell.new
end
|