Class: Pod::Command::Patch::Migrate
Instance Method Summary
collapse
#patch_file, #patches_path
Instance Method Details
#clear_patches_folder_if_empty ⇒ Object
11
12
13
14
15
|
# File 'lib/pod/command/patch/migrate.rb', line 11
def clear_patches_folder_if_empty
if Dir.empty?(patches_path)
FileUtils.remove_dir(patches_path)
end
end
|
#run ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/pod/command/patch/migrate.rb', line 17
def run
UI.puts 'Migrating patches...'
patches_dir = Pathname.new(Dir.pwd) + 'patches'
if patches_dir.directory?
patches = patches_dir.each_child.select { |c| c.to_s.end_with?('.diff') }
patches.each do |p|
if p.to_s.include?('+')
else
pod_name = p.basename('.diff').to_s
UI.puts "Renaming #{pod_name}"
pod_version = config.lockfile.version(pod_name)
new_patch_name = p.to_s.gsub('.diff', "+#{pod_version}.diff")
File.rename(p, new_patch_name)
end
end
end
end
|