-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
41 lines (34 loc) · 1.5 KB
/
Copy pathRakefile
File metadata and controls
41 lines (34 loc) · 1.5 KB
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
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
# The dependencies are noisy under -w; their warnings drown out our own.
t.warning = false
end
task default: :test
namespace :languages do
desc "Re-fetch every provider's language lists from its vendor"
task :refresh do
require "translation_diff"
not_shipped = TranslationDiff::Languages::NOT_SHIPPED
unless not_shipped.empty?
puts "not shipping data for #{not_shipped.join(', ')}: a vendor credential or a private instance " \
"would make the file unshareable"
end
skip = [:null, *not_shipped]
providers = TranslationDiff::Providers.names.reject { |name| skip.include?(name) }.map do |name|
TranslationDiff::Providers.build(name, TranslationDiff.config)
rescue TranslationDiff::ConfigurationError => e
warn "skipping #{name}: #{e.message}"
nil
end.compact
report = TranslationDiff::Languages::Refresh.call(providers: providers)
puts "updated: #{report[:updated].join(', ')}" unless report[:updated].empty?
puts "skipped: #{report[:skipped].join(', ')}" unless report[:skipped].empty?
report[:failed].each { |name, message| warn "failed: #{name}: #{message}" }
end
end
# The task itself ships in lib/, so a host application's own `rake` can load it too -- this just reuses it here.
load File.expand_path("lib/translation_diff/tasks/translation_diff.rake", __dir__)