Class: Chef::ChefFS::Knife
Instance Attribute Summary
Attributes inherited from Knife
#name_args, #ui
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Knife
#api_key, #apply_computed_config, category, common_name, #config_file_settings, #configure_chef, #create_object, #delete_object, deps, #format_rest_error, guess_category, #highlight_config_error, #humanize_exception, #humanize_http_exception, inherited, #initialize, list_commands, load_commands, load_deps, #locate_config_file, #merge_configs, msg, #noauth_rest, #parse_options, #read_config_file, reset_subcommands!, #rest, run, #run_with_pretty_exceptions, #server_url, #show_usage, snake_case_name, subcommand_category, subcommand_class_from, subcommand_loader, subcommands, subcommands_by_category, ui, unnamed?, use_separate_defaults?, #username
#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string, #snake_case_basename
#enforce_path_sanity
Constructor Details
This class inherits a constructor from Chef::Knife
Class Method Details
.common_options ⇒ Object
28
29
30
31
32
33
|
# File 'lib/chef/chef_fs/knife.rb', line 28
def self.common_options
option :repo_mode,
:long => '--repo-mode MODE',
:default => "default",
:description => "Specifies the local repository layout. Values: default or full"
end
|
Instance Method Details
#base_path ⇒ Object
35
36
37
38
39
40
|
# File 'lib/chef/chef_fs/knife.rb', line 35
def base_path
@base_path ||= begin
relative_to_base = Chef::ChefFS::PathUtils::relative_to(File.expand_path(Dir.pwd), chef_repo)
relative_to_base == '.' ? '/' : "/#{relative_to_base}"
end
end
|
#chef_repo ⇒ Object
46
47
48
|
# File 'lib/chef/chef_fs/knife.rb', line 46
def chef_repo
@chef_repo ||= File.expand_path(File.join(Chef::Config.cookbook_path, ".."))
end
|
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/chef/chef_fs/knife.rb', line 50
def format_path(path)
if path[0,base_path.length] == base_path
if path == base_path
return "."
elsif path[base_path.length] == "/"
return path[base_path.length + 1, path.length - base_path.length - 1]
elsif base_path == "/" && path[0] == "/"
return path[1, path.length - 1]
end
end
path
end
|
#pattern_args ⇒ Object
67
68
69
|
# File 'lib/chef/chef_fs/knife.rb', line 67
def pattern_args
@pattern_args ||= pattern_args_from(name_args)
end
|
#pattern_args_from(args) ⇒ Object
71
72
73
|
# File 'lib/chef/chef_fs/knife.rb', line 71
def pattern_args_from(args)
args.map { |arg| Chef::ChefFS::FilePattern::relative_to(base_path, arg) }.to_a
end
|