lib/mnogootex/job/porter.rb in mnogootex-1.1.0 vs lib/mnogootex/job/porter.rb in mnogootex-2.0.0
- old
+ new
@@ -31,14 +31,24 @@
def provide
target_dir.mkpath
providable_files = @source_path.dirname.children
providable_files.reject!(&@work_path.method(:==))
FileUtils.cp_r providable_files, target_dir
- target_dir.join('.mnogootex.yml').tap { |p| p.delete if p.file? }
- target_dir.join('.mnogootex.src').make_symlink(@source_path)
+ remove_configuration(target_dir)
+ create_link_to_source(target_dir)
end
private
+
+ def remove_configuration(folder_path)
+ path = folder_path.join('.mnogootexrc')
+ path.delete if path.file?
+ end
+
+ def create_link_to_source(folder_path)
+ path = folder_path.join('.mnogootex.src')
+ path.make_symlink(@source_path) unless path.symlink?
+ end
def calc_work_path(path)
return Pathname.new(path) unless path.nil?
Pathname.new(Dir.tmpdir).join('mnogootex', source_id)