Hello community,
here is the log from the commit of package rubygem-gettext-setup for
openSUSE:Factory checked in at 2017-04-17 10:27:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-gettext-setup (Old)
and /work/SRC/openSUSE:Factory/.rubygem-gettext-setup.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-gettext-setup"
Mon Apr 17 10:27:18 2017 rev:8 rq:487596 version:0.20
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-gettext-setup/rubygem-gettext-setup.changes
2017-04-11 09:32:58.888330577 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-gettext-setup.new/rubygem-gettext-setup.changes
2017-04-17 10:27:23.001104596 +0200
@@ -1,0 +2,6 @@
+Thu Mar 30 04:31:56 UTC 2017 - [email protected]
+
+- updated to version 0.20
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
gettext-setup-0.18.gem
New:
----
gettext-setup-0.20.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-gettext-setup.spec ++++++
--- /var/tmp/diff_new_pack.I1evlR/_old 2017-04-17 10:27:24.524888802 +0200
+++ /var/tmp/diff_new_pack.I1evlR/_new 2017-04-17 10:27:24.528888235 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-gettext-setup
-Version: 0.18
+Version: 0.20
Release: 0
%define mod_name gettext-setup
%define mod_full_name %{mod_name}-%{version}
++++++ gettext-setup-0.18.gem -> gettext-setup-0.20.gem ++++++
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/gettext-setup/gettext_setup.rb
new/lib/gettext-setup/gettext_setup.rb
--- old/lib/gettext-setup/gettext_setup.rb 2017-03-22 00:05:44.000000000
+0100
+++ new/lib/gettext-setup/gettext_setup.rb 2017-03-30 00:23:16.000000000
+0200
@@ -1,11 +1,12 @@
# -*- encoding: utf-8 -*-
+
require 'fast_gettext'
require 'yaml'
require 'locale'
module GettextSetup
- @@config = nil
- @@translation_repositories = {}
+ @config = nil
+ @translation_repositories = {}
FastGettext.default_available_locales = []
# `locales_path` should include:
@@ -17,8 +18,8 @@
# :file_format - one of the supported backends for fast_gettext (e.g. :po,
:mo, :yaml, etc.)
def self.initialize(locales_path, options = {})
config_path = File.absolute_path('config.yaml', locales_path)
- @@config = YAML.load_file(config_path)['gettext']
- @@locales_path = locales_path
+ @config = YAML.load_file(config_path)['gettext']
+ @locales_path = locales_path
# Make the translation methods available everywhere
Object.send(:include, FastGettext::Translation)
@@ -30,7 +31,7 @@
# 'chain' is the only available multi-domain type in fast_gettext 1.1.0 We
should consider
# investigating 'merge' once we can bump our dependency
- FastGettext.add_text_domain('master_domain', type: :chain, chain:
@@translation_repositories.values)
+ FastGettext.add_text_domain('master_domain', type: :chain, chain:
@translation_repositories.values)
FastGettext.default_text_domain = 'master_domain'
# Likewise, be explicit in our default language choice.
@@ -40,31 +41,31 @@
Locale.set_default(default_locale)
end
- def self.add_repository_to_chain(project_name,options)
+ def self.add_repository_to_chain(project_name, options)
repository = FastGettext::TranslationRepository.build(project_name,
- :path =>
locales_path,
- :type =>
options[:file_format] || :po,
- :ignore_fuzzy =>
false)
- @@translation_repositories[project_name] = repository unless
@@translation_repositories.key? project_name
+ path: locales_path,
+ type:
options[:file_format] || :po,
+ ignore_fuzzy: false)
+ @translation_repositories[project_name] = repository unless
@translation_repositories.key? project_name
end
def self.locales_path
- @@locales_path
+ @locales_path
end
def self.config
- @@config ||= {}
+ @config ||= {}
end
def self.translation_repositories
- @@translation_repositories
+ @translation_repositories
end
def self.default_locale
- config['default_locale'] || "en"
+ config['default_locale'] || 'en'
end
- def self.set_default_locale(new_locale)
+ def self.default_locale=(new_locale)
FastGettext.default_locale = new_locale
Locale.set_default(new_locale)
config['default_locale'] = new_locale
@@ -81,31 +82,31 @@
end
def self.locales
- explicit = Dir.glob(File::absolute_path('*/*.po', locales_path)).map do |x|
- File::basename(File::dirname(x))
+ explicit = Dir.glob(File.absolute_path('*/*.po', locales_path)).map do |x|
+ File.basename(File.dirname(x))
end
- (explicit + [ default_locale]).uniq
+ (explicit + [default_locale]).uniq
end
# Given an HTTP Accept-Language header return the locale with the highest
# priority from it for which we have a locale available. If none exists,
# return the default locale
def self.negotiate_locale(accept_header)
- unless @@config
- raise ArgumentError, "No config.yaml found! Use
`GettextSetup.initialize(locales_path)` to locate your config.yaml"
+ unless @config
+ raise ArgumentError, 'No config.yaml found! Use
`GettextSetup.initialize(locales_path)` to locate your config.yaml'
end
return FastGettext.default_locale if accept_header.nil?
- available_locales = accept_header.split(",").map do |locale|
+ available_locales = accept_header.split(',').map do |locale|
pair = locale.strip.split(';q=')
pair << '1.0' unless pair.size == 2
pair[0] = FastGettext.default_locale if pair[0] == '*'
pair
- end.sort_by do |(locale,qvalue)|
+ end.sort_by do |(_, qvalue)|
-1 * qvalue.to_f
- end.select do |(locale,_)|
+ end.select do |(locale, _)|
FastGettext.available_locales.include?(locale)
end
- if available_locales and available_locales.first
+ if available_locales && available_locales.first
available_locales.first.first
else
# We can't satisfy the request preference. Just use the default locale.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/gettext-setup.rb new/lib/gettext-setup.rb
--- old/lib/gettext-setup.rb 2017-03-22 00:05:44.000000000 +0100
+++ new/lib/gettext-setup.rb 2017-03-30 00:23:16.000000000 +0200
@@ -1 +1 @@
-require 'gettext-setup/gettext_setup'
\ No newline at end of file
+require 'gettext-setup/gettext_setup'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/tasks/gettext.rake new/lib/tasks/gettext.rake
--- old/lib/tasks/gettext.rake 2017-03-22 00:05:44.000000000 +0100
+++ new/lib/tasks/gettext.rake 2017-03-30 00:23:16.000000000 +0200
@@ -8,7 +8,6 @@
# GettextSetup.initialize(File.absolute_path('locales', Dir.pwd))
namespace :gettext do
-
def locale_path
GettextSetup.locales_path
end
@@ -33,7 +32,7 @@
end
def pot_file_path
- File.join(locale_path, GettextSetup.config['project_name'] + ".pot")
+ File.join(locale_path, GettextSetup.config['project_name'] + '.pot')
end
def generate_new_pot
@@ -43,36 +42,32 @@
bugs_address = config['bugs_address']
copyright_holder = config['copyright_holder']
# Done this way to allow the user to enter an empty string in the config.
- if config.has_key?('comments_tag')
- comments_tag = config['comments_tag']
- else
- comments_tag = 'TRANSLATORS'
- end
- version=`git describe`
- system("rxgettext -o locales/#{project_name}.pot --no-wrap --sort-by-file
" +
- "--no-location --add-comments#{comments_tag.to_s == '' ? '' : '=' +
comments_tag} --msgid-bugs-address '#{bugs_address}' " +
- "--package-name '#{package_name}' " +
- "--package-version '#{version}' " +
+ comments_tag = config.key?('comments_tag') ? config['comments_tag'] :
'TRANSLATORS'
+ version = `git describe`
+ system("rxgettext -o locales/#{project_name}.pot --no-wrap --sort-by-file
" \
+ "--add-comments#{comments_tag.to_s == '' ? '' : '=' + comments_tag}
--msgid-bugs-address '#{bugs_address}' " \
+ "--package-name '#{package_name}' " \
+ "--package-version '#{version}' " \
"--copyright-holder='#{copyright_holder}'
--copyright-year=#{Time.now.year} " +
- "#{files_to_translate.join(" ")}")
+ files_to_translate.join(' '))
end
- desc "Generate a new POT file and replace old if strings changed"
+ desc 'Generate a new POT file and replace old if strings changed'
task :update_pot do
- if !File.exists? pot_file_path
- puts "No existing POT file, generating new"
+ if !File.exist? pot_file_path
+ puts 'No existing POT file, generating new'
generate_new_pot
else
- old_pot = pot_file_path + ".old"
+ old_pot = pot_file_path + '.old'
File.rename(pot_file_path, old_pot)
generate_new_pot
begin
_, stderr, status = Open3.capture3("msgcmp --use-untranslated
'#{old_pot}' '#{pot_file_path}'")
if status == 1 || /this message is not used/.match(stderr)
File.delete(old_pot)
- puts "String changes detected, replacing with updated POT file"
+ puts 'String changes detected, replacing with updated POT file'
else
- puts "No string changes detected, keeping old POT file"
+ puts 'No string changes detected, keeping old POT file'
File.rename(old_pot, pot_file_path)
end
rescue IOError
@@ -82,15 +77,15 @@
end
end
- desc "Generate POT file"
+ desc 'Generate POT file'
task :pot do
generate_new_pot
puts "POT file #{pot_file_path} has been generated"
end
- desc "Update PO file for a specific language"
+ desc 'Update PO file for a specific language'
task :po, [:language] do |_, args|
- language = args.language || ENV["LANGUAGE"]
+ language = args.language || ENV['LANGUAGE']
# Let's do some pre-verification of the environment.
if language.nil?
@@ -102,8 +97,8 @@
mkdir_p(language_path)
po_file_path = File.join(language_path,
- GettextSetup.config['project_name'] + ".po")
- if File.exists?(po_file_path)
+ GettextSetup.config['project_name'] + '.po')
+ if File.exist?(po_file_path)
system("msgmerge -U #{po_file_path} #{pot_file_path}")
else
system("msginit --no-translator -l #{language} -o #{po_file_path} -i
#{pot_file_path}")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2017-03-22 00:05:44.000000000 +0100
+++ new/metadata 2017-03-30 00:23:16.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: gettext-setup
version: !ruby/object:Gem::Version
- version: '0.18'
+ version: '0.20'
platform: ruby
authors:
- Puppet
autorequire:
bindir: bin
cert_chain: []
-date: 2017-03-21 00:00:00.000000000 Z
+date: 2017-03-29 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: fast_gettext
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/lib/gettext_setup_spec.rb
new/spec/lib/gettext_setup_spec.rb
--- old/spec/lib/gettext_setup_spec.rb 2017-03-22 00:05:44.000000000 +0100
+++ new/spec/lib/gettext_setup_spec.rb 2017-03-30 00:23:16.000000000 +0200
@@ -1,16 +1,16 @@
-require "rspec/expectations"
+require 'rspec/expectations'
require_relative '../spec_helper'
describe GettextSetup do
before(:each) do
- GettextSetup.initialize(File::join(File::dirname(File::dirname(__FILE__)),
'fixtures', 'locales'))
+ GettextSetup.initialize(File.join(File.dirname(File.dirname(__FILE__)),
'fixtures', 'locales'))
end
let(:config) do
GettextSetup.config
end
context 'initialize' do
- it "sets up correctly" do
- #
GettextSetup.initialize(File::join(File::dirname(File::dirname(__FILE__)),
'fixtures'))
+ it 'sets up correctly' do
+ #
GettextSetup.initialize(File.join(File.dirname(File.dirname(__FILE__)),
'fixtures'))
expect(GettextSetup.locales_path).to match(/\/spec\/fixtures/)
expect(config['project_name']).to eq('sinatra-i18n')
expect(config['package_name']).to eq('Sinatra i18n demo')
@@ -19,34 +19,34 @@
end
end
context 'negotiate_locale' do
- it "negotiates correctly" do
+ it 'negotiates correctly' do
FastGettext.locale = GettextSetup.negotiate_locale('de')
expect(FastGettext.locale).to eq('de')
expect(_('Hello, world!')).to eq('Hallo, Welt!')
end
- it "chooses the default locale when no match is found" do
+ it 'chooses the default locale when no match is found' do
expect(GettextSetup.negotiate_locale('no-match')).to
eq(config['default_locale'])
end
- it "chooses the language with the highest q value" do
+ it 'chooses the language with the highest q value' do
expect(GettextSetup.negotiate_locale('en;q=1, de;q=2')).to eq('de')
expect(GettextSetup.negotiate_locale('en;q=1, de;q=0')).to eq('en')
end
- it "chooses the first value when q values are equal" do
+ it 'chooses the first value when q values are equal' do
expect(GettextSetup.negotiate_locale('de;q=1, en;q=1')).to eq('de')
end
end
- context 'set_default_locale' do
+ context 'setting default_locale' do
before :each do
- GettextSetup.set_default_locale('en')
+ GettextSetup.default_locale = 'en'
end
it 'allows setting the default locale' do
expect(GettextSetup.default_locale).to eq('en')
- GettextSetup.set_default_locale('de')
+ GettextSetup.default_locale = 'de'
expect(GettextSetup.default_locale).to eq('de')
end
end
context 'clear' do
- it "can clear the locale" do
+ it 'can clear the locale' do
expect(GettextSetup.default_locale).to eq('en')
expect(GettextSetup.candidate_locales).to include('en')
GettextSetup.clear
@@ -57,10 +57,12 @@
context 'multiple locales' do
# locales/ loads the de locale and alt_locales/ loads the jp locale
before(:all) do
-
GettextSetup.initialize(File::join(File::dirname(File::dirname(__FILE__)),
'fixtures', 'alt_locales'))
+ GettextSetup.initialize(File.join(File.dirname(File.dirname(__FILE__)),
'fixtures', 'alt_locales'))
end
it 'can aggregate locales across projects' do
- expect(FastGettext.default_available_locales).to include('en','de','jp')
+ expect(FastGettext.default_available_locales).to include('en')
+ expect(FastGettext.default_available_locales).to include('de')
+ expect(FastGettext.default_available_locales).to include('jp')
end
it 'can switch to loaded locale' do
FastGettext.locale = GettextSetup.negotiate_locale('de,en')
@@ -71,28 +73,28 @@
end
context 'translation repository chain' do
before(:all) do
-
GettextSetup.initialize(File::join(File::dirname(File::dirname(__FILE__)),
'fixtures', 'alt_locales'))
+ GettextSetup.initialize(File.join(File.dirname(File.dirname(__FILE__)),
'fixtures', 'alt_locales'))
end
it 'chain is not nil' do
expect(GettextSetup.translation_repositories).not_to be_nil
end
it 'can translate without switching text domains' do
- FastGettext.locale = "de"
+ FastGettext.locale = 'de'
expect(_('Hello, world!')).to eq('Hallo, Welt!')
- FastGettext.locale = "jp"
+ FastGettext.locale = 'jp'
expect(_('Hello, world!')).to eq('こんにちは世界')
end
it 'does not allow duplicate repositories' do
-
GettextSetup.initialize(File::join(File::dirname(File::dirname(__FILE__)),
'fixtures', 'alt_locales'))
+ GettextSetup.initialize(File.join(File.dirname(File.dirname(__FILE__)),
'fixtures', 'alt_locales'))
repos = GettextSetup.translation_repositories
- expect(repos.select { |k,v| k == 'alt_locales' }.size).to eq(1)
+ expect(repos.select { |k, _| k == 'alt_locales' }.size).to eq(1)
end
it 'does allow multiple unique domains' do
-
GettextSetup.initialize(File::join(File::dirname(File::dirname(__FILE__)),
'fixtures', 'locales'))
+ GettextSetup.initialize(File.join(File.dirname(File.dirname(__FILE__)),
'fixtures', 'locales'))
repos = GettextSetup.translation_repositories
- expect(repos.size) == 2
- expect(repos.select { |k,v| k == 'alt_locales' }.size).to eq(1)
- expect(repos.select { |k,v| k == 'sinatra-i18n' }.size).to eq(1)
+ expect(repos.size == 2)
+ expect(repos.select { |k, _| k == 'alt_locales' }.size).to eq(1)
+ expect(repos.select { |k, _| k == 'sinatra-i18n' }.size).to eq(1)
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb
--- old/spec/spec_helper.rb 2017-03-22 00:05:44.000000000 +0100
+++ new/spec/spec_helper.rb 2017-03-30 00:23:16.000000000 +0200
@@ -1,6 +1,6 @@
require 'simplecov'
SimpleCov.start do
- add_filter "/spec/"
+ add_filter '/spec/'
end
require_relative '../lib/gettext-setup'