Class: CrxMake

Inherits:
Object
  • Object
show all
Defined in:
lib/crxmake.rb

Constant Summary collapse

VERSION =
'2.1.1'
MAGIC =

thx masover

'Cr24'
EXT_VERSION =

this is chromium extension version

[2].pack('V')
KEY =

CERT_PUBLIC_KEY_INFO struct

%w(30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00).map{|s| s.hex}.pack('C*')
KEY_SIZE =
1024

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ CrxMake

Returns a new instance of CrxMake.



23
24
25
# File 'lib/crxmake.rb', line 23

def initialize opt
  @opt = opt
end

Class Method Details

.make(opt) ⇒ Object



223
224
225
# File 'lib/crxmake.rb', line 223

def make opt
  new(opt).make
end

.zip(opt) ⇒ Object



227
228
229
# File 'lib/crxmake.rb', line 227

def zip opt
  new(opt).zip
end

Instance Method Details

#makeObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/crxmake.rb', line 27

def make
  check_valid_option @opt
  if @pkey
    read_key
  else
    generate_key
  end
  create_zip
  sign_zip
  write_crx
ensure
  remove_zip
end

#zipObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/crxmake.rb', line 41

def zip
  check_valid_option_zip @opt
  unless @pkey
    generate_key
    @pkey = @pkey_o
  end
  remove_zip
  create_zip do |zip|
    puts "include pem key: \"#{@pkey}\"" if @verbose
    zip.add('key.pem', @pkey)
  end
end