-
Notifications
You must be signed in to change notification settings - Fork 32
/
Rakefile
73 lines (64 loc) · 1.98 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
LANGUAGES = FileList['lang-*'].map do |file|
file.gsub(/lang-(\w+)/,'\1')
end
desc "List all known localizations"
task :localizations do
str = LANGUAGES.join(', ')
puts "Available localizations: " + str
end
task :target do
if ARGV.size <= 1 # Only tasks is given
TARGET = './poignant-site'
$stderr.puts "*warning* no path given on command line: using default #{TARGET}"
else
TARGET = ARGV[1]
end
end
desc "Create default (english) version of the (poignant) guide"
task :default => [ :target ] do
generate_for( 'en', TARGET )
end
desc "Create all versions of the (poignant) guide"
task :all => [ :target ] do
LANGUAGES.each do |language|
generate_for( language, TARGET )
end
end
LANGUAGES.each do |lang|
desc "Create #{lang} version of the (poignant) guide"
[lang, "lang-#{lang}"].each do |lang_cmd|
task lang_cmd.intern => [ :target ] do
generate_for( lang , TARGET )
end
end
end
desc "Basic info on how to call rake with this file"
task :info do
print "\nrake <" + LANGUAGES.join("|") + "|all|default> [path]\n\n"
puts "Will generate the book (localized or all versions) in path."
puts "If path is not given it will default to ./poignant-site"
puts "Each language version will then go in a directory named "
puts "after its name (i.e. en, fr ..)"
puts
end
def generate_for( language , path)
target = File.join( path, language )
puts "About to generate for #{language} in #{target}"
sh "ruby scripts/poignant.rb #{target} #{language}"
end
desc "Combina os trechos do poignant em um unico arquivo"
task :merge_pt do
File.open('lang-pt/poignant.yml', "w") do |output|
files = Dir["lang-pt/*.yml"]
files -= %w[lang-pt/localization.yml lang-pt/poignant.yml lang-pt/poignant_merged.yml lang-pt/poignant_final.yml]
files.sort!
files.each do |ind|
output.write(File.read(ind))
end
end
end
desc "Task for cruise Control"
task :cruise do
CruiseControl::invoke_rake_task 'merge_pt'
CruiseControl::invoke_rake_task 'pt'
end