forked from skoji/Readium-Web-Components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
109 lines (83 loc) · 4.4 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
require "erb"
# ------------------------------------------------------------------------------------------------------------------------
# Helper methods
# ------------------------------------------------------------------------------------------------------------------------
def gen_simple_api_consolidated(template_file_path, output_file_path)
puts "gen_simple_api_consolidated"
epub_reading_system = File.read('epub-modules/development/epub_reading_system.js')
epubcfi = File.read('epub-modules/development/epub_cfi.js')
epub_reflowable = File.read('epub-modules/development/epub_reflowable_module.js')
epub_fixed = File.read('epub-modules/development/epub_fixed_module.js')
epub_parser = File.read('epub-modules/development/epub_parser_module.js')
epub = File.read('epub-modules/development/epub_module.js')
epub_reader = File.read('epub-modules/development/epub_reader_module.js')
template = File.read(template_file_path)
erb = ERB.new(template)
File.open(output_file_path, "w") do |f|
f.puts erb.result(binding)
end
end
def gen_simple_api_non_consolidated(template_file_path, output_file_path)
puts "gen_simple_api_non_consolidated"
epub_reading_system = ""
epubcfi = ""
epub_reflowable = ""
epub_fixed = ""
epub_parser = ""
epub = ""
epub_reader = ""
template = File.read(template_file_path)
erb = ERB.new(template)
File.open(output_file_path, "w") do |f|
f.puts erb.result(binding)
end
end
# ------------------------------------------------------------------------------------------------------------------------
# Tasks
# ------------------------------------------------------------------------------------------------------------------------
task :create_release do
Rake::Task[:build].invoke()
readium_js_modules = "epub-modules/development/epub_cfi.js " +
"epub-modules/development/epub_fixed_module.js " +
"epub-modules/development/epub_module.js " +
"epub-modules/development/epub_parser_module.js " +
"epub-modules/development/epub_reading_system.js " +
"epub-modules/development/epub_reflowable_module.js " +
"epub-modules/development/epub_reader_module.js "
`java -jar build/yuicompressor-2.4.7.jar epub-modules/development/SimpleReadium.js -o epub-modules/release/SimpleReadium.min.js`
`gzip -fc epub-modules/release/SimpleReadium.min.js > epub-modules/release/SimpleReadium.min.js.gz`
`zip epub-modules/release/Readium.js.zip #{readium_js_modules}`
`zip epub-modules/release/SimpleReadium.js.zip epub-modules/development/SimpleReadium.js`
end
task :gen_all_modules do
puts ":gen_all_modules"
puts "epub_reading_system.js"
`cp "epub-modules/epub_reading_system.js" "epub-modules/development/epub_reading_system.js"`
puts `rake -f epub-modules/epub/Rakefile gen_module`
puts `rake -f epub-modules/epub-cfi/Rakefile gen_module`
puts `rake -f epub-modules/epub-fixed/Rakefile gen_module`
puts `rake -f epub-modules/epub-parser/Rakefile gen_module`
puts `rake -f epub-modules/epub-reader/Rakefile gen_module`
puts `rake -f epub-modules/epub-reflowable/Rakefile gen_module`
end
task :copy_all_dependencies do
puts ":copy_all_dependencies"
puts `rake -f epub-modules/epub/Rakefile copy_dependencies`
puts `rake -f epub-modules/epub-cfi/Rakefile copy_dependencies`
puts `rake -f epub-modules/epub-fixed/Rakefile copy_dependencies`
puts `rake -f epub-modules/epub-parser/Rakefile copy_dependencies`
puts `rake -f epub-modules/epub-reader/Rakefile copy_dependencies`
puts `rake -f epub-modules/epub-reflowable/Rakefile copy_dependencies`
puts `rake -f samples-project-testing/Rakefile copy_dependencies`
end
desc "top-level task (runs all module subtasks)"
task :build do
puts ":build"
`mkdir epub-modules/development`
Rake::Task[:gen_all_modules].invoke()
gen_simple_api_consolidated("epub-modules/simple-readium-js/simple_rwc_template.js.erb", "epub-modules/development/SimpleReadium.js")
puts "=> SimpleReadium.js"
gen_simple_api_non_consolidated("epub-modules/simple-readium-js/simple_rwc_template.js.erb", "epub-modules/development/SimpleReadium_Dev.js")
puts "=> SimpleReadium_Dev.js"
Rake::Task[:copy_all_dependencies].invoke()
end