extensionator 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/extensionator.gemspec +1 -1
- data/lib/extensionator.rb +4 -0
- data/lib/extensionator/cli.rb +5 -1
- data/lib/extensionator/creator.rb +22 -4
- data/lib/extensionator/manifest.rb +5 -0
- data/lib/extensionator/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 932da97eea38c1207d1288f3a32a98e32ebf6a0b
|
4
|
+
data.tar.gz: cbb0a86e76854a7e4c1098c96a85c062b5deaa2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a270feae97929d993953c8c661ce61d84405d94d77f23ce281fb69e3c18a95a62d95b73a4b211f281917f46fccc1a294735ded32b8e4ee56794c2a18b48860
|
7
|
+
data.tar.gz: 646ab147c2deefa856dd17154dc2ae1a3aae98f308ac9077682c6274b1767e2243c02de2f16e2bee65366ff537070e2ec140c53fe4f99596e1083cdc42bbfb44
|
data/README.md
CHANGED
@@ -35,9 +35,9 @@ Useful options!
|
|
35
35
|
|
36
36
|
* `-e` `--exclude`. Specify a regex of things to exclude. Matches on the whole path. `-e "\.md$"
|
37
37
|
|
38
|
-
* `-f` `--format`. "zip" or "crx". Zip is what the Chrome store has you upload, since it does its own signing. You won't need the `-i` option unless you do something weird with the other options.
|
38
|
+
* `-f` `--format`. "zip" or "crx". Zip is what the Chrome store has you upload, since it does its own signing. You won't need the `-i` option unless you do something weird with the other options. Dir is useful for using the inject_key option with.
|
39
39
|
|
40
|
-
* `--inject-key`. If you have an extension in the store, you know you can't have a "key" property in your manifest file. But if you do local
|
40
|
+
* `--inject-key`. If you have an extension in the store, you know you can't have a "key" property in your manifest file. But if you do local unpacked development and want to keep your extension ID the same, you need that property in there. This is because Google hates you and wants to make your life hard. Fortunately, Extensionator can take your pem file, generate the public key, and put it in the manifest file before writing the extension. Yay!
|
41
41
|
|
42
42
|
* `--inject-version`. Use this to override the "version" property in your manifest.
|
43
43
|
|
@@ -48,9 +48,9 @@ Here's the whole shebang:
|
|
48
48
|
usage: bin/extensionator [options]
|
49
49
|
-d, --directory Directory containing the extension. (Default: .)
|
50
50
|
-i, --identity Location of the pem file to sign with.
|
51
|
-
-o, --output Location of the output file. (Default: 'extension.
|
51
|
+
-o, --output Location of the output file. (Default: 'extension[.zip|.crx|]')
|
52
52
|
-e, --exclude Regular expression for filenames to exclude. (Default: .crx$)
|
53
|
-
-f, --format Type of file to produce, either zip
|
53
|
+
-f, --format Type of file to produce, either zip, directory crx. (Default: crx)
|
54
54
|
--inject-version Inject a version number into the manifest file. (Default: none)
|
55
55
|
--inject-key Inject a key parameter into the manifest file. (Default: no)
|
56
56
|
--skip-validation Don't try to validate this extension. Currently just checks that the manifest is parsable. (Default: no)
|
@@ -73,10 +73,17 @@ Or to create a zip:
|
|
73
73
|
Extensionator.zip("directory/with/extension", "output_file.zip")
|
74
74
|
```
|
75
75
|
|
76
|
-
|
76
|
+
Or a directory:
|
77
|
+
|
78
|
+
```
|
79
|
+
Extensionator.dir("directory/with/extension", "output_dir")
|
80
|
+
```
|
81
|
+
|
82
|
+
Options go at the end of any method call, and just look just like the CLI ones, but as Ruby symbols:
|
77
83
|
|
78
84
|
```rb
|
79
85
|
Extensionator.crx("dir", "key.pem", "output.crx", inject_version: "4.5.1",
|
86
|
+
strip_key: true,
|
80
87
|
inject_key: true,
|
81
88
|
exclude: /\.md$/)
|
82
89
|
```
|
data/extensionator.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.add_development_dependency "bundler", "~> 1.1"
|
6
|
-
spec.add_runtime_dependency "rubyzip", "
|
6
|
+
spec.add_runtime_dependency "rubyzip", "1.1.7"
|
7
7
|
spec.add_runtime_dependency "slop", "~> 4.2"
|
8
8
|
spec.authors = ["Isaac Cambron"]
|
9
9
|
spec.description = "A tool for packaging Chrome extensions"
|
data/lib/extensionator.rb
CHANGED
@@ -17,6 +17,10 @@ module Extensionator
|
|
17
17
|
Creator.new(dir, opts).zip(dest_filename)
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.copy(dir, dest_directory, opts= {})
|
21
|
+
Creator.new(dir, opts).copy(dest_directory)
|
22
|
+
end
|
23
|
+
|
20
24
|
##deprecated, reverse compat
|
21
25
|
def self.create(dir, identity_file, dest_filename, opts = {})
|
22
26
|
crx(dir, identity_file, dest_filename, opts)
|
data/lib/extensionator/cli.rb
CHANGED
@@ -12,6 +12,7 @@ module Extensionator
|
|
12
12
|
o.string "-f", "--format", "Type of file to produce, either zip or crx. (Default: crx)"
|
13
13
|
o.string "--inject-version", "Inject a version number into the manifest file. (Default: none)"
|
14
14
|
o.bool "--inject-key", "Inject a key parameter into the manifest file. (Default: no)"
|
15
|
+
o.bool "--strip-key", "Remove the key parameter from the manifest file. (Default: no)"
|
15
16
|
o.bool "--skip-validation", "Don't try to validate this extension. Currently just checks that the manifest is parsable."
|
16
17
|
o.on "-v", "--version", "Extensionator version info." do
|
17
18
|
puts Extensionator::VERSION
|
@@ -29,8 +30,11 @@ module Extensionator
|
|
29
30
|
end
|
30
31
|
|
31
32
|
creator = Creator.new(opts[:directory] || ".", fixup_options(opts))
|
32
|
-
|
33
|
+
case opts[:format]
|
34
|
+
when "zip"
|
33
35
|
creator.zip(opts[:output] || "output.zip")
|
36
|
+
when "dir"
|
37
|
+
creator.copy(opts[:output] || "output")
|
34
38
|
else
|
35
39
|
creator.crx(opts[:output] || "output.crx")
|
36
40
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "find"
|
2
|
+
require "fileutils"
|
2
3
|
require "openssl"
|
3
4
|
require "pathname"
|
4
5
|
require "zip"
|
@@ -13,24 +14,40 @@ module Extensionator
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def zip(destination)
|
16
|
-
|
17
|
+
with_zip do |zip_str|
|
17
18
|
File.open(destination, "wb"){|f| f.write zip_str}
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
22
|
def crx(destination)
|
22
|
-
|
23
|
+
with_zip do |zip_str|
|
23
24
|
CRX.create(destination, zip_str, private_key)
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
def copy(destination)
|
29
|
+
FileUtils.mkdir_p(destination)
|
30
|
+
|
31
|
+
process_directory.each do |p|
|
32
|
+
path_in_dir, file = p
|
33
|
+
|
34
|
+
write_path = File.join(destination, path_in_dir)
|
35
|
+
|
36
|
+
if File.directory?(file)
|
37
|
+
FileUtils.mkdir_p(write_path)
|
38
|
+
else
|
39
|
+
FileUtils.cp(file, write_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
27
44
|
def validate
|
28
45
|
manifest.validate(dir_files)
|
29
46
|
end
|
30
47
|
|
31
48
|
private
|
32
49
|
|
33
|
-
def
|
50
|
+
def with_zip
|
34
51
|
files = process_directory
|
35
52
|
yield zip_up(files)
|
36
53
|
end
|
@@ -40,6 +57,7 @@ module Extensionator
|
|
40
57
|
|
41
58
|
manifest.validate(new_paths) unless @opts[:skip_validation]
|
42
59
|
manifest.inject_key(private_key) if @opts[:inject_key]
|
60
|
+
manifest.strip_key if @opts[:strip_key]
|
43
61
|
manifest.inject_version(@opts[:inject_version]) if @opts[:inject_version]
|
44
62
|
|
45
63
|
new_paths << manifest.write if manifest_updated?
|
@@ -53,7 +71,7 @@ module Extensionator
|
|
53
71
|
paths.each do |path_combo|
|
54
72
|
path_in_zip, file = path_combo
|
55
73
|
if File.directory?(file)
|
56
|
-
zip.mkdir(path_in_zip
|
74
|
+
zip.mkdir(path_in_zip)
|
57
75
|
else
|
58
76
|
zip.add(path_in_zip, file)
|
59
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extensionator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Cambron
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.1.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.1.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: slop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|