Module: Redcar::XulrunnerWin

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

Class Method Summary collapse

Class Method Details

.ensure_unpackedObject



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

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



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

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

.vendor_dirObject



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

def self.vendor_dir
  File.dirname(zip_path)
end

.zip_pathObject



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

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