hammer_cli 3.7.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/hammer +1 -6
- data/doc/release_notes.md +15 -0
- data/lib/hammer_cli/help/builder.rb +1 -2
- data/lib/hammer_cli/i18n/find_task.rb +88 -0
- data/lib/hammer_cli/i18n.rb +4 -0
- data/lib/hammer_cli/options/normalizers.rb +2 -5
- data/lib/hammer_cli/settings.rb +7 -0
- data/lib/hammer_cli/task_helper.rb +84 -0
- data/lib/hammer_cli/testing/output_matchers.rb +1 -1
- data/lib/hammer_cli/utils.rb +1 -1
- data/lib/hammer_cli/version.rb +1 -1
- data/locale/Makefile.def +29 -7
- data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/cs_CZ/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ka/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +0 -0
- data/man/hammer.1.gz +0 -0
- data/test/functional/help_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/unit/abstract_test.rb +54 -54
- data/test/unit/apipie/command_test.rb +26 -27
- data/test/unit/apipie/option_builder_test.rb +28 -28
- data/test/unit/apipie/option_definition_test.rb +5 -5
- data/test/unit/apipie/test_helper.rb +3 -0
- data/test/unit/bash_test.rb +21 -21
- data/test/unit/command_extensions_test.rb +68 -68
- data/test/unit/completer_test.rb +57 -57
- data/test/unit/csv_parser_test.rb +12 -12
- data/test/unit/defaults_test.rb +3 -3
- data/test/unit/help/builder_test.rb +7 -7
- data/test/unit/help/definition/abstract_item_test.rb +2 -2
- data/test/unit/help/definition/list_test.rb +2 -2
- data/test/unit/help/definition/note_test.rb +2 -2
- data/test/unit/help/definition/section_test.rb +2 -2
- data/test/unit/help/definition/text_test.rb +2 -2
- data/test/unit/help/definition_test.rb +36 -36
- data/test/unit/help/text_builder_test.rb +39 -39
- data/test/unit/history_test.rb +6 -6
- data/test/unit/i18n_test.rb +2 -2
- data/test/unit/logger_test.rb +1 -1
- data/test/unit/main_test.rb +7 -7
- data/test/unit/modules_test.rb +24 -25
- data/test/unit/option_builder_test.rb +1 -1
- data/test/unit/options/matcher_test.rb +15 -15
- data/test/unit/options/normalizers_test.rb +92 -88
- data/test/unit/options/option_definition_test.rb +11 -11
- data/test/unit/options/option_family_test.rb +7 -7
- data/test/unit/options/validators/dsl_test.rb +35 -35
- data/test/unit/output/adapter/abstract_test.rb +10 -10
- data/test/unit/output/adapter/base_test.rb +36 -36
- data/test/unit/output/adapter/csv_test.rb +38 -38
- data/test/unit/output/adapter/json_test.rb +38 -38
- data/test/unit/output/adapter/table_test.rb +42 -50
- data/test/unit/output/adapter/yaml_test.rb +38 -38
- data/test/unit/output/definition_test.rb +43 -43
- data/test/unit/output/dsl_test.rb +19 -19
- data/test/unit/output/field_filter_test.rb +10 -10
- data/test/unit/output/fields_test.rb +27 -27
- data/test/unit/output/formatters_test.rb +39 -39
- data/test/unit/output/output_test.rb +14 -14
- data/test/unit/output/record_collection_test.rb +18 -18
- data/test/unit/settings_test.rb +35 -35
- data/test/unit/utils_test.rb +30 -27
- metadata +33 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c1d1eca37ea41bee11e7826fbfc491b99bce78026eee0f3ae72acaa2b472503
|
4
|
+
data.tar.gz: f327b7901efa9824e5118ac7e20daa42835e8d01813be55e2db4001697249a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e945cf3fb8671ec5089e45e4a75f47cd906c99b47124b5887b8b8ed627fb6a41145218fd07638b78208ac8e845342e9e4f7a2418b4c5b5f091eeaafc6a74d4a6
|
7
|
+
data.tar.gz: c56001b49b27c10ba388e84791b1b0794a5a7873a0320877cd0a73e393b1bd1da1b64b6e745d54bf618f0fda71f56c174cc4d74fa1128963b6a4895a97b70aa4
|
data/bin/hammer
CHANGED
@@ -56,12 +56,7 @@ end
|
|
56
56
|
# load user's settings
|
57
57
|
require 'hammer_cli/settings'
|
58
58
|
|
59
|
-
|
60
|
-
HammerCLI::Settings.load_from_paths CFG_PATH
|
61
|
-
|
62
|
-
CFG_PATH_LOCAL = ['./config/']
|
63
|
-
|
64
|
-
HammerCLI::Settings.load_from_paths CFG_PATH_LOCAL
|
59
|
+
HammerCLI::Settings.load_from_defaults
|
65
60
|
|
66
61
|
if preparser.config
|
67
62
|
if File.file? preparser.config
|
data/doc/release_notes.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
Release notes
|
2
2
|
=============
|
3
|
+
### 3.8.0 (2023-08-25)
|
4
|
+
* Consider false values in string#format, [#36588](http://projects.theforeman.org/issues/36588)
|
5
|
+
* Drop unicode gem ([PR #376](https://github.com/theforeman/hammer-cli/pull/376))
|
6
|
+
* Improve regex for keyvaluelist normalizer, [#36258](http://projects.theforeman.org/issues/36258)
|
7
|
+
* Fix minitest ([PR #375](https://github.com/theforeman/hammer-cli/pull/375))
|
8
|
+
* Add ga to run tests on ruby 3+
|
9
|
+
* Wrap commands with class.new to clone, [#36592](http://projects.theforeman.org/issues/36592)
|
10
|
+
* Try to upgrade ci_reporter, [#36592](http://projects.theforeman.org/issues/36592)
|
11
|
+
* Update minitest version, [#36592](http://projects.theforeman.org/issues/36592)
|
12
|
+
* Improve rakefile tx commands, [#36283](http://projects.theforeman.org/issues/36283)
|
13
|
+
* Move makefile targets to rakefile, [#36283](http://projects.theforeman.org/issues/36283)
|
14
|
+
* Update transifex automation, [#36283](http://projects.theforeman.org/issues/36283)
|
15
|
+
* Add packit config ([PR #370](https://github.com/theforeman/hammer-cli/pull/370))
|
16
|
+
* Bump to 3.8.0-develop
|
17
|
+
|
3
18
|
### 3.7.0 (2023-05-23)
|
4
19
|
* Honor tz in datetime normalizer ([PR #369](https://github.com/theforeman/hammer-cli/pull/369)), [#36418](http://projects.theforeman.org/issues/36418)
|
5
20
|
* Remove unused code, [#36337](http://projects.theforeman.org/issues/36337)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'unicode'
|
2
1
|
module HammerCLI
|
3
2
|
module Help
|
4
3
|
class Builder < Clamp::Help::Builder
|
@@ -46,7 +45,7 @@ module HammerCLI
|
|
46
45
|
else
|
47
46
|
item.help
|
48
47
|
end
|
49
|
-
description.gsub(/^(.)/) {
|
48
|
+
description.gsub(/^(.)/) { Regexp.last_match(1).capitalize }.wrap.each_line do |line|
|
50
49
|
line " %-#{label_width}s %s" % [label, line]
|
51
50
|
label = ''
|
52
51
|
end
|
@@ -1,10 +1,13 @@
|
|
1
1
|
require 'rake'
|
2
|
+
require_relative '../task_helper'
|
2
3
|
|
3
4
|
module HammerCLI
|
4
5
|
module I18n
|
5
6
|
class FindTask
|
6
7
|
include Rake::DSL
|
7
8
|
|
9
|
+
MIN_TRANSLATION_PERC = 50
|
10
|
+
|
8
11
|
def initialize(domain, version)
|
9
12
|
@domain = domain
|
10
13
|
@version = version
|
@@ -30,6 +33,91 @@ module HammerCLI
|
|
30
33
|
task :find => [:setup] do
|
31
34
|
Rake::Task["gettext:po:update"].invoke
|
32
35
|
end
|
36
|
+
|
37
|
+
desc 'Check languages with 50% or more coverage and create needed files'
|
38
|
+
task :find_new do
|
39
|
+
client = HammerCLI::TaskHelper::I18n::TxApiClient.new(domain: @domain)
|
40
|
+
stats = client.language_stats_collection
|
41
|
+
lang_percentages = stats['data'].each_with_object({}) do |lang, res|
|
42
|
+
res[lang['id'].split(':').last] = (lang['attributes']['translated_strings'] * 100.0 / lang['attributes']['total_strings']).round
|
43
|
+
end
|
44
|
+
lang_percentages.select { |_, v| v >= MIN_TRANSLATION_PERC }.each_key do |lang|
|
45
|
+
lang_dir = File.join(@domain.locale_dir, lang)
|
46
|
+
FileUtils.mkpath(lang_dir)
|
47
|
+
FileUtils.cp(File.join(@domain.locale_dir, "#{@domain.domain_name}.pot"), File.join(lang_dir, "#{@domain.domain_name}.po"))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
namespace :tx do
|
53
|
+
desc 'Pull translations from transifex'
|
54
|
+
task :pull do
|
55
|
+
raise 'Command tx not found. Make sure you have transifex-client installed and configured.' unless system("command -v tx >/dev/null 2>&1")
|
56
|
+
|
57
|
+
sh "tx pull -f"
|
58
|
+
edit_files = Dir.glob(File.join(@domain.locale_dir, '**', '*.edit.po'))
|
59
|
+
edit_files.each do |edit_file|
|
60
|
+
`sed -i 's/^\\("Project-Id-Version: \\).*$/\\1#{@domain.domain_name} #{@version}\\\\n"/' #{edit_file};`
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
desc 'Merge .edit.po into .po'
|
65
|
+
task :update_po do
|
66
|
+
edit_files = Dir.glob(File.join(@domain.locale_dir, '**', '*.edit.po'))
|
67
|
+
edit_files.each do |edit_file|
|
68
|
+
po_file = edit_file.gsub('.edit.po', '.po')
|
69
|
+
sh "msgcat --use-first --no-location #{edit_file} #{po_file} --output-file #{po_file}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'Generate MO files from PO files'
|
74
|
+
task :all_mo do
|
75
|
+
po_files = Dir.glob(File.join(@domain.locale_dir, '**', "#{@domain.domain_name}.po"))
|
76
|
+
po_files.each do |po_file|
|
77
|
+
dir = File.dirname(po_file) + '/LC_MESSAGES'
|
78
|
+
FileUtils.mkdir_p(dir)
|
79
|
+
sh "msgfmt -o #{dir}/#{@domain.domain_name}.mo #{po_file}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
desc 'Download and merge translations from Transifex'
|
84
|
+
task :update do
|
85
|
+
Rake::Task['gettext:find_new'].invoke
|
86
|
+
Rake::Task['gettext:find'].invoke
|
87
|
+
Rake::Task['tx:pull'].invoke
|
88
|
+
Rake::Task['tx:update_po'].invoke
|
89
|
+
Rake::Task['tx:all_mo'].invoke
|
90
|
+
locale_dir = File.expand_path(@domain.locale_dir, __dir__)
|
91
|
+
sh "git add #{locale_dir}"
|
92
|
+
sh 'git commit -m "i18n - extracting new, pulling from tx"'
|
93
|
+
puts 'Changes commited!'
|
94
|
+
end
|
95
|
+
|
96
|
+
desc 'Check for malformed strings'
|
97
|
+
task :check do
|
98
|
+
raise 'Command pofilter not found. Make sure you have translate-toolkit installed.' unless system("command -v pofilter >/dev/null 2>&1")
|
99
|
+
|
100
|
+
po_files = Dir.glob(File.join(@domain.locale_dir, '**',"#{@domain.domain_name}.po"))
|
101
|
+
po_files.each do |po_file|
|
102
|
+
pox_file = po_file.gsub('.po', '.pox')
|
103
|
+
sh "msgfmt -c #{po_file}"
|
104
|
+
sh "pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines -t endwhitespace -t endpunc \
|
105
|
+
-t puncspacing -t options -t printf -t validchars --gnome #{po_file} > #{pox_file};"
|
106
|
+
sh("! grep -q msgid #{pox_file}") do |ok, _|
|
107
|
+
sh "cat #{pox_file}" unless ok
|
108
|
+
abort "See errors above for #{pox_file}."
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
desc 'Clean everything, removes *.edit.po, *.po.timestamp and *.pox files'
|
114
|
+
task :clean do
|
115
|
+
edit_files = Dir.glob(File.join(@domain.locale_dir, '**', '*.edit.po'))
|
116
|
+
timestamp_files = Dir.glob(File.join(@domain.locale_dir, '**', '*.po.time_stamp'))
|
117
|
+
pox_files = Dir.glob(File.join(@domain.locale_dir, '**', '*.pox'))
|
118
|
+
messages_file = Dir.glob(File.join(@domain.locale_dir, '..', 'messages.mo'))
|
119
|
+
FileUtils.rm_f(edit_files + timestamp_files + pox_files + messages_file)
|
120
|
+
end
|
33
121
|
end
|
34
122
|
end
|
35
123
|
|
data/lib/hammer_cli/i18n.rb
CHANGED
@@ -137,6 +137,10 @@ module HammerCLI
|
|
137
137
|
File.expand_path(File.join(File.dirname(__FILE__), '../../locale/Makefile.def'))
|
138
138
|
end
|
139
139
|
|
140
|
+
def self.find_by_name(name)
|
141
|
+
domains.find { |domain| domain.class.to_s.split('::').first.underscore == name }
|
142
|
+
end
|
143
|
+
|
140
144
|
init
|
141
145
|
end
|
142
146
|
end
|
@@ -50,9 +50,7 @@ module HammerCLI
|
|
50
50
|
end
|
51
51
|
|
52
52
|
class KeyValueList < AbstractNormalizer
|
53
|
-
|
54
|
-
PAIR_RE = '([^,=]+)=([^,\{\[]+|[\{\[][^\{\}\[\]]*[\}\]])'
|
55
|
-
FULL_RE = "^((%s)[,]?)+$" % PAIR_RE
|
53
|
+
FULL_RE = '([^=,]+)=([\{\[][^\{\}\[\]]*[\}\]]|[^\0]+?)(?=,[^,]+=|$)'
|
56
54
|
|
57
55
|
class << self
|
58
56
|
def completion_type
|
@@ -68,7 +66,6 @@ module HammerCLI
|
|
68
66
|
def format(val)
|
69
67
|
return {} unless val.is_a?(String)
|
70
68
|
return {} if val.empty?
|
71
|
-
|
72
69
|
if valid_key_value?(val)
|
73
70
|
parse_key_value(val)
|
74
71
|
else
|
@@ -89,7 +86,7 @@ module HammerCLI
|
|
89
86
|
|
90
87
|
def parse_key_value(val)
|
91
88
|
result = {}
|
92
|
-
val.scan(Regexp.new(
|
89
|
+
val.scan(Regexp.new(FULL_RE)) do |key, value|
|
93
90
|
value = value.strip
|
94
91
|
if value.start_with?('[')
|
95
92
|
value = value.scan(/[^,\[\]]+/)
|
data/lib/hammer_cli/settings.rb
CHANGED
@@ -4,6 +4,8 @@ require 'logging'
|
|
4
4
|
module HammerCLI
|
5
5
|
|
6
6
|
class Settings
|
7
|
+
CFG_PATH = ['~/.hammer/', '/etc/hammer/', "#{::RbConfig::CONFIG['sysconfdir']}/hammer/"].uniq
|
8
|
+
CFG_PATH_LOCAL = ['./config/']
|
7
9
|
|
8
10
|
def self.get(*keys)
|
9
11
|
keys.inject(settings) do |value, key|
|
@@ -41,6 +43,11 @@ module HammerCLI
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
46
|
+
def self.load_from_defaults
|
47
|
+
load_from_paths CFG_PATH
|
48
|
+
load_from_paths CFG_PATH_LOCAL
|
49
|
+
end
|
50
|
+
|
44
51
|
def self.load(settings_hash)
|
45
52
|
deep_merge!(settings, settings_hash)
|
46
53
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'openssl'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module HammerCLI
|
7
|
+
module TaskHelper
|
8
|
+
module I18n
|
9
|
+
class TxApiClient
|
10
|
+
class GeneralError < StandardError
|
11
|
+
def initialize(error)
|
12
|
+
msg = case error
|
13
|
+
when Hash
|
14
|
+
"#{error['title']}: #{error['detail']}"
|
15
|
+
when Array
|
16
|
+
error.join("\n")
|
17
|
+
else
|
18
|
+
error.to_s
|
19
|
+
end
|
20
|
+
super(msg)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
TX_CONFIG_RC_FILE = '~/.transifexrc'
|
25
|
+
TX_BASE_API_URL = 'https://rest.api.transifex.com'
|
26
|
+
|
27
|
+
def initialize(domain:)
|
28
|
+
@domain = domain
|
29
|
+
end
|
30
|
+
|
31
|
+
def language_stats_collection
|
32
|
+
make_call(
|
33
|
+
path: '/resource_language_stats',
|
34
|
+
params: {
|
35
|
+
'filter[project]' => 'o:foreman:p:foreman',
|
36
|
+
'filter[resource]' => "o:foreman:p:foreman:r:#{@domain.domain_name}"
|
37
|
+
}
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def make_call(path:, params: {}, http_method: :GET, content_type: 'application/vnd.api+json', body: nil)
|
44
|
+
url = URI(TX_BASE_API_URL + path)
|
45
|
+
url.query = URI.encode_www_form(params)
|
46
|
+
|
47
|
+
body = Net::HTTP.start(url.host, url.port, use_ssl: true) do |https|
|
48
|
+
request = Object.const_get("Net::HTTP::#{http_method.to_s.capitalize}").new(url)
|
49
|
+
request["accept"] = 'application/vnd.api+json'
|
50
|
+
request["content-type"] = content_type
|
51
|
+
request["authorization"] = "Bearer #{api_token}"
|
52
|
+
request.body = body
|
53
|
+
|
54
|
+
response = https.request(request).read_body
|
55
|
+
JSON.parse(response) rescue { 'errors' => ['Could not parse response']}
|
56
|
+
end
|
57
|
+
return body unless body['errors']
|
58
|
+
|
59
|
+
raise GeneralError.new(body['errors']&.first)
|
60
|
+
end
|
61
|
+
|
62
|
+
def api_token
|
63
|
+
return ENV['TX_TOKEN'] if ENV['TX_TOKEN']
|
64
|
+
|
65
|
+
token = nil
|
66
|
+
config_file = File.expand_path(TX_CONFIG_RC_FILE)
|
67
|
+
if File.exist?(config_file)
|
68
|
+
File.open(config_file) do |file|
|
69
|
+
file.find do |line|
|
70
|
+
match = line.match(/^(?<type>token|password)\s*=\s*(?<token>\S+)$/)
|
71
|
+
next unless match
|
72
|
+
|
73
|
+
token = match[:token]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
raise GeneralError.new("Could not find API token. Set it in #{config_file} or TX_TOKEN.") unless token
|
78
|
+
|
79
|
+
token
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/hammer_cli/utils.rb
CHANGED
@@ -6,7 +6,7 @@ class String
|
|
6
6
|
if params.is_a? Hash
|
7
7
|
array_params = self.scan(/%[<{]([^>}]*)[>}]/).collect do |name|
|
8
8
|
name = name[0]
|
9
|
-
params[name.to_s]
|
9
|
+
!params[name.to_s].nil? ? params[name.to_s].to_s : params[name.to_sym].to_s
|
10
10
|
end
|
11
11
|
self.gsub(/%[<]([^>]*)[>]/, '%')
|
12
12
|
.gsub(/%[{]([^}]*)[}]/, '%s')
|
data/lib/hammer_cli/version.rb
CHANGED
data/locale/Makefile.def
CHANGED
@@ -3,7 +3,19 @@
|
|
3
3
|
#
|
4
4
|
# Run make help to list available targets
|
5
5
|
#
|
6
|
-
|
6
|
+
define DOMAIN_CMD
|
7
|
+
require "rubygems";
|
8
|
+
require "hammer_cli";
|
9
|
+
HammerCLI::Settings.load_from_defaults;
|
10
|
+
HammerCLI::Modules.load_all;
|
11
|
+
spec = Gem::Specification::load(Dir.glob("../*.gemspec").first);
|
12
|
+
i18n_domain = spec.respond_to?(:metadata) && spec.metadata["i18n_domain"];
|
13
|
+
puts i18n_domain || HammerCLI::I18n.find_by_name(spec.name)&.domain_name || spec.name
|
14
|
+
endef
|
15
|
+
ifeq ($(origin DOMAIN), undefined)
|
16
|
+
DOMAIN := $(shell bundle exec ruby -e '$(DOMAIN_CMD)')
|
17
|
+
endif
|
18
|
+
VERSION = $(shell ruby -rrubygems -e 'puts Gem::Specification::load(Dir.glob("../*.gemspec").first).version')
|
7
19
|
POTFILE = $(DOMAIN).pot
|
8
20
|
MOFILE = $(DOMAIN).mo
|
9
21
|
POFILES = $(shell find . -name '$(DOMAIN).po')
|
@@ -12,12 +24,17 @@ POXFILES = $(patsubst %.po,%.pox,$(POFILES))
|
|
12
24
|
EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
|
13
25
|
TIMESTAMPFILES = $(patsubst %.po,%.po.time_stamp,$(POFILES))
|
14
26
|
|
15
|
-
|
16
|
-
|
17
|
-
|
27
|
+
.PHONY: vars
|
28
|
+
vars:
|
29
|
+
@echo VERSION: $(VERSION)
|
30
|
+
@echo DOMAIN: $(DOMAIN)
|
18
31
|
|
19
32
|
.PHONY: all-mo
|
20
|
-
all-mo:
|
33
|
+
all-mo: ## Generate MO files from PO files (default)
|
34
|
+
for po_file in $(POFILES); do \
|
35
|
+
mkdir -p $$(dirname $$po_file)/LC_MESSAGES; \
|
36
|
+
msgfmt -o $$(dirname $$po_file)/LC_MESSAGES/$(MOFILE) $$po_file; \
|
37
|
+
done
|
21
38
|
|
22
39
|
# Check for malformed strings
|
23
40
|
%.pox: %.po
|
@@ -44,7 +61,7 @@ uniq-po: ## Unify duplicate translations in .po files
|
|
44
61
|
.PHONY: tx-pull
|
45
62
|
tx-pull: $(EDITFILES)
|
46
63
|
@command -v tx >/dev/null 2>&1 || { echo "Command tx not found. Make sure you have transifex-client installed and configured." >&2; exit 1; }
|
47
|
-
tx pull -f
|
64
|
+
cd .. && tx pull -f
|
48
65
|
for f in $(EDITFILES); do \
|
49
66
|
sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
|
50
67
|
done
|
@@ -61,8 +78,13 @@ update-po:
|
|
61
78
|
extract-strings:
|
62
79
|
bundle exec rake gettext:find
|
63
80
|
|
81
|
+
# Check languages with 50% or more coverage and create needed files
|
82
|
+
.PHONY: find-new
|
83
|
+
find-new:
|
84
|
+
bundle exec rake gettext:find_new
|
85
|
+
|
64
86
|
.PHONY: tx-update
|
65
|
-
tx-update: extract-strings tx-pull update-po
|
87
|
+
tx-update: find-new extract-strings tx-pull update-po all-mo ## Download and merge translations from Transifex
|
66
88
|
git add ../locale
|
67
89
|
git commit -m "i18n - extracting new, pulling from tx"
|
68
90
|
@echo Changes commited!
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/man/hammer.1.gz
CHANGED
Binary file
|