Hello community, here is the log from the commit of package rubygem-fast_gettext for openSUSE:Factory checked in at 2016-06-05 14:18:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-fast_gettext (Old) and /work/SRC/openSUSE:Factory/.rubygem-fast_gettext.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-fast_gettext" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-fast_gettext/rubygem-fast_gettext.changes 2015-10-24 10:23:35.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-fast_gettext.new/rubygem-fast_gettext.changes 2016-06-05 14:18:16.000000000 +0200 @@ -1,0 +2,6 @@ +Tue May 31 04:28:56 UTC 2016 - co...@suse.com + +- updated to version 1.1.0 + see installed CHANGELOG + +------------------------------------------------------------------- Old: ---- fast_gettext-1.0.0.gem New: ---- fast_gettext-1.1.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-fast_gettext.spec ++++++ --- /var/tmp/diff_new_pack.WExlVX/_old 2016-06-05 14:18:17.000000000 +0200 +++ /var/tmp/diff_new_pack.WExlVX/_new 2016-06-05 14:18:17.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-fast_gettext # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-fast_gettext -Version: 1.0.0 +Version: 1.1.0 Release: 0 %define mod_name fast_gettext %define mod_full_name %{mod_name}-%{version} ++++++ fast_gettext-1.0.0.gem -> fast_gettext-1.1.0.gem ++++++ Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/fast_gettext/mo_file.rb new/lib/fast_gettext/mo_file.rb --- old/lib/fast_gettext/mo_file.rb 2015-10-14 22:45:49.000000000 +0200 +++ new/lib/fast_gettext/mo_file.rb 2016-05-30 17:54:15.000000000 +0200 @@ -6,17 +6,13 @@ PLURAL_SEPERATOR = "\000" # file => path or FastGettext::GetText::MOFile - def initialize(file) - if file.is_a? FastGettext::GetText::MOFile - @data = file - else - @data = FastGettext::GetText::MOFile.open(file, "UTF-8") - end - make_singular_and_plural_available + def initialize(file, options={}) + @filename = file + load_data if options[:eager_load] end def [](key) - @data[key] + data[key] end #returns the plural forms or all singular translations that where found @@ -28,7 +24,7 @@ def pluralisation_rule #gettext uses 0 as default rule, which would turn off all pluralisation, very clever... #additionally parsing fails when directly accessing po files, so this line was taken from gettext/mofile - (@data['']||'').split("\n").each do |line| + (data['']||'').split("\n").each do |line| return lambda{|n|eval($2)} if /^Plural-Forms:\s*nplurals\s*\=\s*(\d*);\s*plural\s*\=\s*([^;]*)\n?/ =~ line end nil @@ -40,6 +36,20 @@ private + def data + load_data if @data.nil? + @data + end + + def load_data + @data = if @filename.is_a? FastGettext::GetText::MOFile + @filename + else + FastGettext::GetText::MOFile.open(@filename, "UTF-8") + end + make_singular_and_plural_available + end + #(if plural==singular, prefer singular) def make_singular_and_plural_available data = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/fast_gettext/po_file.rb new/lib/fast_gettext/po_file.rb --- old/lib/fast_gettext/po_file.rb 2015-10-14 22:45:49.000000000 +0200 +++ new/lib/fast_gettext/po_file.rb 2016-05-30 17:54:15.000000000 +0200 @@ -2,8 +2,28 @@ module FastGettext # Responsibility: # - abstract po files for Po Repository - class PoFile + class PoFile < MoFile + def initialize(file, options={}) + @options = options + super + end + def self.to_mo_file(file, options={}) + MoFile.new(parse_po_file(file, options)) + end + + protected + + def load_data + @data = if @filename.is_a? FastGettext::GetText::MOFile + @filename + else + FastGettext::PoFile.parse_po_file(@filename, @options) + end + make_singular_and_plural_available + end + + def self.parse_po_file(file, options={}) require 'fast_gettext/vendor/poparser' parser = FastGettext::GetText::PoParser.new @@ -13,7 +33,7 @@ mo_file = FastGettext::GetText::MOFile.new parser.parse(File.read(file), mo_file) - MoFile.new(mo_file) + mo_file end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/fast_gettext/translation_repository/mo.rb new/lib/fast_gettext/translation_repository/mo.rb --- old/lib/fast_gettext/translation_repository/mo.rb 2015-10-14 22:45:49.000000000 +0200 +++ new/lib/fast_gettext/translation_repository/mo.rb 2016-05-30 17:54:15.000000000 +0200 @@ -7,6 +7,7 @@ class Mo < Base def initialize(name,options={}) super + @eager_load = options.fetch(:eager_load, false) reload end @@ -28,7 +29,7 @@ def find_and_store_files(name,options) # parse all .mo files with the right name, that sit in locale/LC_MESSAGES folders find_files_in_locale_folders(File.join('LC_MESSAGES',"#{name}.mo"), options[:path]) do |locale,file| - MoFile.new(file) + MoFile.new(file, eager_load: @eager_load) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/fast_gettext/translation_repository/po.rb new/lib/fast_gettext/translation_repository/po.rb --- old/lib/fast_gettext/translation_repository/po.rb 2015-10-14 22:45:49.000000000 +0200 +++ new/lib/fast_gettext/translation_repository/po.rb 2016-05-30 17:54:15.000000000 +0200 @@ -10,7 +10,7 @@ def find_and_store_files(name, options) require 'fast_gettext/po_file' find_files_in_locale_folders("#{name}.po", options[:path]) do |locale,file| - PoFile.to_mo_file(file, options) + PoFile.new(file, options) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/fast_gettext/translation_repository.rb new/lib/fast_gettext/translation_repository.rb --- old/lib/fast_gettext/translation_repository.rb 2015-10-14 22:45:49.000000000 +0200 +++ new/lib/fast_gettext/translation_repository.rb 2016-05-30 17:54:15.000000000 +0200 @@ -4,14 +4,13 @@ module TranslationRepository extend self - # only single-word types supported atm (mytype works, MyType will not) def build(name, options) type = options[:type] || :mo - class_name = type.to_s.capitalize + class_name = type.to_s.split('_').map(&:capitalize).join unless FastGettext::TranslationRepository.constants.map{|c|c.to_s}.include?(class_name) - require "fast_gettext/translation_repository/#{type}" + require "fast_gettext/translation_repository/#{type}" end eval(class_name).new(name,options) end end -end \ No newline at end of file +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/fast_gettext/version.rb new/lib/fast_gettext/version.rb --- old/lib/fast_gettext/version.rb 2015-10-14 22:45:49.000000000 +0200 +++ new/lib/fast_gettext/version.rb 2016-05-30 17:54:15.000000000 +0200 @@ -1,3 +1,3 @@ module FastGettext - VERSION = Version = '1.0.0' + VERSION = Version = '1.1.0' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-10-14 22:45:49.000000000 +0200 +++ new/metadata 2016-05-30 17:54:15.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: fast_gettext version: !ruby/object:Gem::Version - version: 1.0.0 + version: 1.1.0 platform: ruby authors: - Michael Grosser autorequire: bindir: bin cert_chain: [] -date: 2015-10-14 00:00:00.000000000 Z +date: 2016-05-30 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake @@ -160,7 +160,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.2.2 +rubygems_version: 2.4.5.1 signing_key: specification_version: 4 summary: A simple, fast, memory-efficient and threadsafe implementation of GetText