-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
65 lines (54 loc) · 1.19 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require 'pathname'
require 'crxmake'
require 'json'
class Pathname
def [] x
join x
end
def to_str
to_s
end
end
NAME = "wetbanana"
ROOT = Pathname.new(__FILE__).dirname.realpath
SRC = ROOT["src"]
BUILD = ROOT["build"]
CRX = BUILD["#{NAME}.crx"]
KEY = ROOT["key.pem"]
MANIFEST = JSON.parse SRC["manifest.json"].read
VERSION = MANIFEST['version'].split(/\D/).map &:to_i
puts "NAME: #{NAME} #{VERSION}"
puts "ROOT: #{ROOT}"
def write_manifest
File.open SRC["manifest.json"],'w' do |io|
io.write JSON.pretty_generate MANIFEST
end
end
def write_version
MANIFEST["version"] = VERSION.join('.')
write_manifest
end
file CRX do |t|
CrxMake.make( :ex_dir => SRC,
:pkey => KEY,
:crx_output => CRX,
:verbose => true,
:ignoredir => /\.git/
)
end
desc "build a signed .crx file"
task :build => CRX
desc "clean generated files"
task :clean do
CRX.delete
end
namespace :beta do
desc "bump the beta build version"
task :bump do
4.times {|i| VERSION[i] ||= 0 }
VERSION[3] += 1
write_version
end
desc "generate a new beta build"
task :release => [:bump, :build]
end