firefox_zip 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/example/example.rb +1 -1
- data/example/{hello.zip → package.zip} +0 -0
- data/lib/firefox_zip/files/project.rb +11 -18
- data/lib/firefox_zip/version.rb +1 -1
- data/spec/firefox_zip/files/project_spec.rb +1 -1
- data/spec/firefox_zip/parses/manifest_spec.rb +1 -1
- data/spec/firefox_zip_spec.rb +2 -2
- data/spec/test_files/manifest.webapp +1 -1
- data/spec/test_files/{hello.zip → package.zip} +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 528aef293150b87023a6d499cd08a33f7e67c9c6
|
4
|
+
data.tar.gz: 9e3c271a67b3205e196b1f3895f54c0bc6389f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb52e59cd61ef65165a35b554530d1fd21cc3ab44d4b410ca37e4fa849864ef887f577aa2b4080af16c58e80c23dbba07300eeb01223cf3ae738b4d6eb3b587
|
7
|
+
data.tar.gz: 3e63ba9ff1a46b6d39d257a81c252ad123653c3a4f27422870a7470555436ea7e6821d307e23faea36eb6c112d6eeb13edd0616d3a12c29f9feedfd3e926b528
|
data/Gemfile.lock
CHANGED
data/example/example.rb
CHANGED
Binary file
|
@@ -14,25 +14,18 @@ module FirefoxZip
|
|
14
14
|
@size = File.size(@zip_file_path)
|
15
15
|
|
16
16
|
Dir.mktmpdir do |dir|
|
17
|
-
project_dir_name = get_root_dir_name(@zip_file_path)
|
18
17
|
make_zip_files(@zip_file_path, dir)
|
19
18
|
|
20
|
-
manifest_file = get_manifest_file(dir
|
19
|
+
manifest_file = get_manifest_file(dir)
|
21
20
|
@manifest_data = FirefoxZip::Parses::Manifest.new(manifest_file.read)
|
22
21
|
manifest_file.close
|
23
|
-
@icons = get_icons_file(@manifest_data, dir
|
24
|
-
@icon = get_icon_file(@manifest_data, dir
|
22
|
+
@icons = get_icons_file(@manifest_data, dir)
|
23
|
+
@icon = get_icon_file(@manifest_data, dir)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
27
|
private
|
29
28
|
|
30
|
-
def get_root_dir_name(file_path)
|
31
|
-
Zip::File.open(file_path) do |zip_file|
|
32
|
-
return zip_file.first.name
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
29
|
def make_zip_files(file_path, dir)
|
37
30
|
Zip::File.open(file_path) do |zip_file|
|
38
31
|
zip_file.each do |entry|
|
@@ -55,15 +48,15 @@ module FirefoxZip
|
|
55
48
|
entry_name.match(/.+\/$/) != nil
|
56
49
|
end
|
57
50
|
|
58
|
-
def get_manifest_file(dir
|
59
|
-
File.open("#{dir}/#{
|
51
|
+
def get_manifest_file(dir)
|
52
|
+
File.open("#{dir}/#{MANIFEST_FILE_NAME}", 'r')
|
60
53
|
end
|
61
54
|
|
62
|
-
def get_icon_file(manifest_data, dir
|
63
|
-
get_file(dir,
|
55
|
+
def get_icon_file(manifest_data, dir)
|
56
|
+
get_file(dir, manifest_data.icon)
|
64
57
|
end
|
65
58
|
|
66
|
-
def get_icons_file(manifest_data, dir
|
59
|
+
def get_icons_file(manifest_data, dir)
|
67
60
|
icons = manifest_data.icons
|
68
61
|
|
69
62
|
icons_file = []
|
@@ -74,15 +67,15 @@ module FirefoxZip
|
|
74
67
|
|
75
68
|
icons_file.push({
|
76
69
|
:size => icon_size,
|
77
|
-
:file => get_file(dir,
|
70
|
+
:file => get_file(dir, icon_file_name)
|
78
71
|
})
|
79
72
|
end
|
80
73
|
|
81
74
|
icons_file
|
82
75
|
end
|
83
76
|
|
84
|
-
def get_file(dir,
|
85
|
-
File.open("#{dir}/#{
|
77
|
+
def get_file(dir, target_file_name)
|
78
|
+
File.open("#{dir}/#{target_file_name}", 'r')
|
86
79
|
end
|
87
80
|
end
|
88
81
|
end
|
data/lib/firefox_zip/version.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe FirefoxZip::Files::Project do
|
4
4
|
context 'initialize' do
|
5
5
|
before do
|
6
|
-
@project = FirefoxZip::Files::Project.new(File.expand_path('../../../test_files/
|
6
|
+
@project = FirefoxZip::Files::Project.new(File.expand_path('../../../test_files/package.zip', __FILE__))
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'get manifest data' do
|
data/spec/firefox_zip_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe FirefoxZip do
|
4
4
|
context 'self.analyze' do
|
5
5
|
before do
|
6
|
-
@app = FirefoxZip.analyze(File.expand_path('../test_files/
|
6
|
+
@app = FirefoxZip.analyze(File.expand_path('../test_files/package.zip', __FILE__))
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'get name' do
|
@@ -27,7 +27,7 @@ describe FirefoxZip do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'get type' do
|
30
|
-
expect(@app.type).to eq '
|
30
|
+
expect(@app.type).to eq 'web'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'get permissions' do
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firefox_zip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- henteko
|
@@ -65,7 +65,7 @@ files:
|
|
65
65
|
- README.md
|
66
66
|
- Rakefile
|
67
67
|
- example/example.rb
|
68
|
-
- example/
|
68
|
+
- example/package.zip
|
69
69
|
- firefox_zip.gemspec
|
70
70
|
- lib/firefox_zip.rb
|
71
71
|
- lib/firefox_zip/files/project.rb
|
@@ -75,8 +75,8 @@ files:
|
|
75
75
|
- spec/firefox_zip/parses/manifest_spec.rb
|
76
76
|
- spec/firefox_zip_spec.rb
|
77
77
|
- spec/spec_helper.rb
|
78
|
-
- spec/test_files/hello.zip
|
79
78
|
- spec/test_files/manifest.webapp
|
79
|
+
- spec/test_files/package.zip
|
80
80
|
homepage: https://github.com/henteko/firefox_zip
|
81
81
|
licenses:
|
82
82
|
- MIT
|
@@ -106,5 +106,5 @@ test_files:
|
|
106
106
|
- spec/firefox_zip/parses/manifest_spec.rb
|
107
107
|
- spec/firefox_zip_spec.rb
|
108
108
|
- spec/spec_helper.rb
|
109
|
-
- spec/test_files/hello.zip
|
110
109
|
- spec/test_files/manifest.webapp
|
110
|
+
- spec/test_files/package.zip
|