开发者

Buildr - exclude directory from resources

In Buildr you can exclude all files in a directory by doing the following:

resources.exclude 'scratch/*'

Is it possible to exclude the directory as well? The Buildr documentation mentions:

The filter always excludes 开发者_StackOverflowthe CVS and .svn directories, and all files ending with .bak or ~, so no need to worry about these.

My company uses Dimensions as its source control, it creates a .metadata folder in every directory much like subversion does with the .svn folder.


These exclusions are actually inherited from Rake (rake/file_list.rb)

module Rake
  ...
  class FileList
    ...

    DEFAULT_IGNORE_PATTERNS = [
      /(^|[\/\\])CVS([\/\\]|$)/,
      /(^|[\/\\])\.svn([\/\\]|$)/,
      /\.bak$/,
      /~$/
    ]

    ...
  end
end

so it's possible to monkey-patch the defaults, if that's what you want.

Alternatively, you can also add exclusions directly on a FileList by passing a block and calling the exclude method,

pkg_files = FileList.new('lib/**/*') do |fl|
  fl.exclude(/\bCVS\b/)
end

Since Buildr filters (http://buildr.apache.org/rdoc/classes/Buildr/Filter.html) expose their underlying FileList, you can simply do:

resources.sources do |fl|
  fl.exclude(/\.metadata/)
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜