Merge pull request #7132 from Bo98/patch-dir
patch: add support for changing directory
This commit is contained in:
commit
cb99abe230
@ -135,7 +135,7 @@ class ExternalPatch
|
|||||||
end
|
end
|
||||||
|
|
||||||
def apply
|
def apply
|
||||||
dir = Pathname.pwd
|
base_dir = Pathname.pwd
|
||||||
resource.unpack do
|
resource.unpack do
|
||||||
patch_dir = Pathname.pwd
|
patch_dir = Pathname.pwd
|
||||||
if patch_files.empty?
|
if patch_files.empty?
|
||||||
@ -149,6 +149,8 @@ class ExternalPatch
|
|||||||
|
|
||||||
patch_files << children.first.basename
|
patch_files << children.first.basename
|
||||||
end
|
end
|
||||||
|
dir = base_dir
|
||||||
|
dir /= resource.directory if resource.directory.present?
|
||||||
dir.cd do
|
dir.cd do
|
||||||
patch_files.each do |patch_file|
|
patch_files.each do |patch_file|
|
||||||
ohai "Applying #{patch_file}"
|
ohai "Applying #{patch_file}"
|
||||||
|
@ -198,6 +198,7 @@ class Resource
|
|||||||
|
|
||||||
def initialize(&block)
|
def initialize(&block)
|
||||||
@patch_files = []
|
@patch_files = []
|
||||||
|
@directory = nil
|
||||||
super "patch", &block
|
super "patch", &block
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -206,6 +207,12 @@ class Resource
|
|||||||
@patch_files.concat(paths)
|
@patch_files.concat(paths)
|
||||||
@patch_files.uniq!
|
@patch_files.uniq!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def directory(val = nil)
|
||||||
|
return @directory if val.nil?
|
||||||
|
|
||||||
|
@directory = val
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user