Sha256: 36f16afd3cf5e90aaec0dfbed5ce7078b8f8eb69ee54462b850268afb5bc9fee

Contents?: true

Size: 820 Bytes

Versions: 12

Compression:

Stored size: 820 Bytes

Contents

module Oddb2xml
  Backup = "#{Dir.pwd}/data/download"
  @options = {}
  
  def Oddb2xml.save_options(options)
    @options = options
  end
  
  def Oddb2xml.skip_download(file)
    dest = "#{Backup}/#{File.basename(file)}"
    return false unless @options[:skip_download]
    if File.exists?(dest)
      FileUtils.cp(dest, file, :verbose => false, :preserve => true)
      return true
    end
    false
  end
  
  def Oddb2xml.download_finished(file, remove_file = true)
    dest = "#{Backup}/#{File.basename(file)}"
    if @options[:skip_download]
      FileUtils.makedirs(Backup)
      FileUtils.cp(file, dest, :verbose => false)
    end
    begin
      File.unlink(file) if File.exists?(file) and remove_file
    rescue Errno::EACCES # Permission Denied on Windows      
    end
  end                            
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
oddb2xml-1.7.9 lib/oddb2xml/util.rb
oddb2xml-1.7.8 lib/oddb2xml/util.rb
oddb2xml-1.7.7 lib/oddb2xml/util.rb
oddb2xml-1.7.6 lib/oddb2xml/util.rb
oddb2xml-1.7.5 lib/oddb2xml/util.rb
oddb2xml-1.7.3 lib/oddb2xml/util.rb
oddb2xml-1.7.2 lib/oddb2xml/util.rb
oddb2xml-1.7.1 lib/oddb2xml/util.rb
oddb2xml-1.7.0 lib/oddb2xml/util.rb
oddb2xml-1.6.9 lib/oddb2xml/util.rb
oddb2xml-1.6.8 lib/oddb2xml/util.rb
oddb2xml-1.6.7 lib/oddb2xml/util.rb