forked from bitcoincashorg/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
33 lines (29 loc) · 949 Bytes
/
Copy pathRakefile
File metadata and controls
33 lines (29 loc) · 949 Bytes
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
require 'bundler'
Bundler.setup
namespace :docker do
desc "build docker images"
task :build => ['translations:build'] do
puts "Building bitcoincash docker image"
puts `docker build -t bitcoincash .`
end
end
namespace :translations do
require 'erb'
require 'i18n'
require "i18n/backend/fallbacks"
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
I18n.load_path = Dir['./translations/*.yml']
desc "build translated html files"
task :build do
puts "Building bitcoincash translated html files"
template = File.read('index.html.erb')
renderer = ERB.new(template)
I18n.available_locales.sort.each do |locale|
puts "Building #{locale}"
I18n.locale = locale
File.write(File.join('.', 'html', "index.#{locale}.html"), renderer.result())
File.write(File.join('.', 'html', "index.html"), renderer.result()) if locale == :en
end
end
end
task :default => 'docker:build'