Class: FirefoxZip::Files::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/firefox_zip/files/project.rb

Constant Summary collapse

MANIFEST_FILE_NAME =
'manifest.webapp'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zip_file_path) ⇒ Project

Returns a new instance of Project.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/firefox_zip/files/project.rb', line 10

def initialize(zip_file_path)
  return raise 'not zip file' unless File.exists? zip_file_path

  @zip_file_path = zip_file_path
  @size = File.size(@zip_file_path)

  Dir.mktmpdir do |dir|
    project_dir_name = get_root_dir_name(@zip_file_path)
    make_zip_files(@zip_file_path, dir)
    
    manifest_file = get_manifest_file(dir, project_dir_name)
    @manifest_data = FirefoxZip::Parses::Manifest.new(manifest_file.read)
    manifest_file.close
    @icons = get_icons_file(@manifest_data, dir, project_dir_name)
    @icon = get_icon_file(@manifest_data, dir, project_dir_name)
  end
end

Instance Attribute Details

#iconObject (readonly)

Returns the value of attribute icon.



7
8
9
# File 'lib/firefox_zip/files/project.rb', line 7

def icon
  @icon
end

#iconsObject (readonly)

Returns the value of attribute icons.



7
8
9
# File 'lib/firefox_zip/files/project.rb', line 7

def icons
  @icons
end

#manifest_dataObject (readonly)

Returns the value of attribute manifest_data.



7
8
9
# File 'lib/firefox_zip/files/project.rb', line 7

def manifest_data
  @manifest_data
end

#sizeObject (readonly)

Returns the value of attribute size.



7
8
9
# File 'lib/firefox_zip/files/project.rb', line 7

def size
  @size
end