Module: Redcar::XulrunnerWin

Defined in:
lib/redcar-xulrunner-win.rb

Class Method Summary collapse

Class Method Details

.ensure_unpackedObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/redcar-xulrunner-win.rb', line 6

def self.ensure_unpacked
  return if File.exist?(path)
  
  print "unzipping #{path}..."; $stdout.flush
  Dir.chdir(vendor_dir) do
    Zip::ZipFile.open(zip_path) do |zipfile|
      zipfile.entries.each do |entry|
        FileUtils.mkdir_p(File.dirname(entry.name))
        begin
          entry.extract
        rescue Zip::ZipDestinationFileExistsError
        end
      end
    end
  end
end

.pathObject



32
33
34
# File 'lib/redcar-xulrunner-win.rb', line 32

def self.path
  File.expand_path("../../vendor/xulrunner", __FILE__)
end

.vendor_dirObject



23
24
25
# File 'lib/redcar-xulrunner-win.rb', line 23

def self.vendor_dir
  File.dirname(zip_path)
end

.zip_pathObject



27
28
29
30
# File 'lib/redcar-xulrunner-win.rb', line 27

def self.zip_path
  glob = File.expand_path("../../vendor/xulrunner-*.zip", __FILE__)
  Dir[glob].first
end