Commit 7cda0552 authored by Dieter Komendera's avatar Dieter Komendera

Merge pull request #21 from kommen/clean_paths

Add Specification#clean_paths to specify paths to remove after downloading
parents 4fefee1f 48ab7b88
......@@ -47,8 +47,14 @@ module Pod
end
end
def clean
def clean(clean_paths = [])
(@pod_root + '.git').rmtree
clean_paths.each do |pattern|
pattern = @pod_root + pattern
pattern.glob.each do |path|
path.rmtree
end
end if clean_paths
end
end
end
......
......@@ -66,6 +66,11 @@ module Pod
end
attr_reader :source_files
def clean_paths=(*patterns)
@clean_paths = patterns.flatten.map { |p| Pathname.new(p) }
end
attr_reader :clean_paths
def dependency(*name_and_version_requirements)
name, *version_requirements = name_and_version_requirements.flatten
dep = Dependency.new(name, *version_requirements)
......@@ -291,7 +296,7 @@ module Pod
def download!
downloader = Downloader.for_source(pod_destroot, @source)
downloader.download
downloader.clean if config.clean
downloader.clean(clean_paths) if config.clean
end
end
......
......@@ -31,5 +31,14 @@ describe "Pod::Downloader" do
downloader.clean
(@dir + '.git').should.not.exist
end
it "removes the clean_paths files and directories" do
downloader = Pod::Downloader.for_source(@dir,
:git => fixture('banana-lib'), :tag => 'v1.0'
)
downloader.download
downloader.clean(['README'])
(@dir + 'README').should.not.exist
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment