-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
73 lines (62 loc) · 1.71 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
# -*- ruby -*-
require "find"
require "fileutils"
require "rubygems"
require "yard"
require "bundler/gem_helper"
class Bundler::GemHelper
def version_tag
"#{version}"
end
end
base_dir = File.dirname(__FILE__)
helper = Bundler::GemHelper.new(base_dir)
helper.install
spec = helper.gemspec
# spec.executables.each do |bin|
# bin = "bin/#{bin}"
# bin_help = "#{bin}.help"
# File.open(bin_help, "w") do |f|
# lang = ENV["LANG"]
# ENV["LANG"] = "C"
# f.puts(`#{RUBY} -I #{File.join(base_dir, 'lib')} #{bin} --help`)
# ENV["LANG"] = lang
# end
# at_exit do
# FileUtils.rm_f(bin_help)
# end
# end
desc "Update *.po/*.pot files and create *.mo from *.po files"
task :gettext => ["gettext:po:update", "gettext:mo:create"]
namespace :gettext do
desc "Setup environment for GetText"
task :environment do
require "gettext/tools"
end
namespace :po do
desc "Update po/pot files (GetText)"
task :update => "gettext:environment" do
module GetText::RGetText
class << self
alias_method :generate_pot_original, :generate_pot
def generate_pot(ary)
ary = ary.collect {|key, *other| [key.gsub(/\\/, "\\\\\\"), *other]}
generate_pot_original(ary)
end
end
end
files = Dir.glob("{lib,rails}/**/*.rb")
files += Dir.glob("bin/asl*")
GetText.update_pofiles("active-samba-ldap",
files,
"ActiveSambaLdap #{ActiveSambaLdap::VERSION}")
end
end
namespace :mo do
desc "Create *.mo from *.po (GetText)"
task :create => "gettext:environment" do
GetText.create_mofiles
end
end
end
task(:gem).prerequisites.unshift("gettext:mo:create")