yast-rake 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/tasks/pot.rake +72 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7830a04721a56df2b14ce21212821533565668ad
|
4
|
+
data.tar.gz: 91c065a28fc28c495923909f9c4802c7c7110643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90faa3ec75f651288d4f51a16b646c4398db609a5f1ee7d4d965f1c8090810fac559bdeb76157094368db6e0ca1200f10812682c075fb570587a018cbc349e2e
|
7
|
+
data.tar.gz: 429338e7cf63b77ee9ed584dc5316df016eefd60b5979d10626f212520397bf636bfe3229c2525a096161bfebad3ba4895ca56af82b4cbf99c0395d9cbedc1a7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
data/lib/tasks/pot.rake
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
#--
|
2
|
+
# Yast rake
|
3
|
+
#
|
4
|
+
# Copyright (C) 2014 Novell, Inc.
|
5
|
+
# This library is free software; you can redistribute it and/or modify
|
6
|
+
# it only under the terms of version 2.1 of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful, but WITHOUT
|
10
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
11
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
12
|
+
# details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
#++
|
18
|
+
|
19
|
+
desc "Collect translatable strings and create POT files"
|
20
|
+
task :pot do
|
21
|
+
y2tool = "/usr/bin/y2tool"
|
22
|
+
raise "File #{y2tool} is missing, install yast2-devtools" unless File.exist?(y2tool)
|
23
|
+
|
24
|
+
sh "#{y2tool} y2makepot"
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :check do
|
28
|
+
# print failed lines and a hint to STDERR
|
29
|
+
def report_pot_errors(lines)
|
30
|
+
$stderr.puts "Failed lines:"
|
31
|
+
$stderr.puts "-" * 30
|
32
|
+
$stderr.puts lines
|
33
|
+
$stderr.puts "-" * 30
|
34
|
+
$stderr.puts
|
35
|
+
$stderr.puts "Note: \#{foo} substitution in translatable strings does" \
|
36
|
+
" not work properly, use"
|
37
|
+
$stderr.puts " _(\"foo %{bar} baz\") % { :bar => bar }"
|
38
|
+
$stderr.puts "or"
|
39
|
+
$stderr.puts " _(\"foo %s baz\") % bar"
|
40
|
+
$stderr.puts
|
41
|
+
end
|
42
|
+
|
43
|
+
# remove gettext keywords and extra quotes
|
44
|
+
def clean_pot_lines(lines)
|
45
|
+
# leave just the text
|
46
|
+
lines.each do |line|
|
47
|
+
line.sub!(/^msgid \"/, "")
|
48
|
+
line.sub!(/^\"/, "")
|
49
|
+
line.sub!(/\"$/, "")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Check translatable strings for common mistakes"
|
54
|
+
# depends on the global "pot" task defined above
|
55
|
+
task :pot => :"rake:pot" do
|
56
|
+
Dir["*.pot"].each do |pot|
|
57
|
+
puts "Checking #{pot}..."
|
58
|
+
lines = File.readlines(pot)
|
59
|
+
# remove comments
|
60
|
+
lines.reject!{ |line| line.match(/^#/) }
|
61
|
+
# Ruby substitution present?
|
62
|
+
lines.select!{ |line| line.include?('#{') }
|
63
|
+
|
64
|
+
clean_pot_lines(lines)
|
65
|
+
|
66
|
+
if !lines.empty?
|
67
|
+
report_pot_errors(lines)
|
68
|
+
raise "ERROR: Ruby substitution found in a translatable string"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yast-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Reidinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -49,6 +49,7 @@ extra_rdoc_files: []
|
|
49
49
|
files:
|
50
50
|
- lib/yast/rake.rb
|
51
51
|
- lib/tasks/install.rake
|
52
|
+
- lib/tasks/pot.rake
|
52
53
|
- lib/tasks/test_unit.rake
|
53
54
|
- lib/tasks/version.rake
|
54
55
|
- lib/tasks/run.rake
|