Class: CrxMake

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

Constant Summary collapse

VERSION =
'2.2.0'
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.



32
33
34
# File 'lib/crxmake.rb', line 32

def initialize opt
  @opt = opt
end

Class Method Details

.make(opt) ⇒ Object



240
241
242
# File 'lib/crxmake.rb', line 240

def make opt
  new(opt).make
end

.zip(opt) ⇒ Object



244
245
246
# File 'lib/crxmake.rb', line 244

def zip opt
  new(opt).zip
end

Instance Method Details

#makeObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/crxmake.rb', line 36

def make
  check_valid_option @opt
  if @pkey
    read_key
  else
    generate_key
  end
  zip_buffer = create_zip
  sign_zip(zip_buffer)
  write_crx(zip_buffer)
ensure
  #remove_zip
end

#zipObject



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/crxmake.rb', line 50

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