Module: Builderator::Util::Cookbook
- Defined in:
- lib/builderator/util/cookbook.rb
Defined Under Namespace
Classes: Metadata
Constant Summary collapse
- DEFAULT_VENDOR =
Util.working_dir('vendor/chef/cookbooks')
- EXCLUDED_VCS_FILES =
Don’t vendor VCS files. Reference GNU tar –exclude-vcs: www.gnu.org/software/tar/manual/html_section/tar_49.html Boosted from github.com/berkshelf/berkshelf/blob/master/lib/berkshelf/berksfile.rb
[ '.arch-ids', '{arch}', '.bzr', '.bzrignore', '.bzrtags', 'CVS', '.cvsignore', '_darcs', '.git', '.hg', '.hgignore', '.hgrags', 'RCS', 'SCCS', '.svn', '**/.git', '.temp'].freeze
Class Method Summary collapse
- .archive_path(metadata, file) ⇒ Object
- .berksfile ⇒ Object
- .metadata ⇒ Object
- .path(arg = nil) ⇒ Object
Class Method Details
.archive_path(metadata, file) ⇒ Object
63 64 65 |
# File 'lib/builderator/util/cookbook.rb', line 63 def archive_path(, file) Pathname.new(.name).join(Pathname.new(file).relative_path_from(path)) end |
.berksfile ⇒ Object
67 68 69 |
# File 'lib/builderator/util/cookbook.rb', line 67 def berksfile path.join('Berksfile') end |
.metadata ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/builderator/util/cookbook.rb', line 71 def Metadata.new.tap do |c| if path.join('metadata.rb').exist? c.from_file(path.join('metadata.rb').to_s) elsif path.join('metadata.json').exist? c.from_json(path.join('metadata.json').read) else fail IOError, 'Unable to read metadata.rb or metadata.json!' end end end |
.path(arg = nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/builderator/util/cookbook.rb', line 52 def path(arg = nil) ## Set an explicit path to a cookbook return @path = Pathname.new(arg) unless arg.nil? return @path unless @path.nil? ## Check for an embedded cookbook? ('./cookbook') return @path = Util.working_dir('cookbook') if Util.working_dir('cookbook').exist? @path = Util.working_dir end |