Hello community,

here is the log from the commit of package rubygem-fast_gettext for 
openSUSE:Factory checked in at 2016-08-17 12:00:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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    
    2016-06-05 14:18:16.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-fast_gettext.new/rubygem-fast_gettext.changes
   2016-08-17 12:00:02.000000000 +0200
@@ -1,0 +2,8 @@
+Wed Aug  3 04:31:08 UTC 2016 - [email protected]
+
+- updated to version 1.2.0
+ see installed CHANGELOG
+
+  1.1.0 -- translations are no longer eager loaded for improved startup 
performance, pass `eager_load: true` to preload for example in preforked web 
server
+
+-------------------------------------------------------------------

Old:
----
  fast_gettext-1.1.0.gem

New:
----
  fast_gettext-1.2.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-fast_gettext.spec ++++++
--- /var/tmp/diff_new_pack.Cqk4Hy/_old  2016-08-17 12:00:03.000000000 +0200
+++ /var/tmp/diff_new_pack.Cqk4Hy/_new  2016-08-17 12:00:03.000000000 +0200
@@ -24,15 +24,15 @@
 #
 
 Name:           rubygem-fast_gettext
-Version:        1.1.0
+Version:        1.2.0
 Release:        0
 %define mod_name fast_gettext
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  %{ruby >= 2.1.0}
 BuildRequires:  %{rubygem gem2rpm}
-BuildRequires:  %{ruby}
 BuildRequires:  ruby-macros >= 5
-Url:            http://github.com/grosser/fast_gettext
+Url:            https://github.com/grosser/fast_gettext
 Source:         http://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml
 Summary:        A simple, fast, memory-efficient and threadsafe implementation 
of

++++++ fast_gettext-1.1.0.gem -> fast_gettext-1.2.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG new/CHANGELOG
--- old/CHANGELOG       2016-05-30 17:54:15.000000000 +0200
+++ new/CHANGELOG       2016-08-02 16:58:21.000000000 +0200
@@ -1,3 +1,4 @@
+1.1.0 -- translations are no longer eager loaded for improved startup 
performance, pass `eager_load: true` to preload for example in preforked web 
server
 1.0.0 -- do not enforce attr_accessible unless ProtectedAttributes are loaded
 0.9.0 -- reworked internals of caching to be plugable
 0.7.0 -- set_locale resets to default locale if none of the available locales 
was tried to set
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Readme.md new/Readme.md
--- old/Readme.md       2016-05-30 17:54:15.000000000 +0200
+++ new/Readme.md       2016-08-02 16:58:21.000000000 +0200
@@ -50,24 +50,24 @@
 
 From mo files (traditional/default)
 
-    FastGettext.add_text_domain('my_app',:path => 'locale')
+    FastGettext.add_text_domain('my_app', path: 'locale')
 
 Or po files (less maintenance than mo)
 
-    FastGettext.add_text_domain('my_app',:path => 'locale', :type => :po)
+    FastGettext.add_text_domain('my_app', path: 'locale', type: :po)
     # :ignore_fuzzy => true to not use fuzzy translations
     # :report_warning => false to hide warnings about obsolete/fuzzy 
translations
 
 Or yaml files (use I18n syntax/indentation)
 
-    FastGettext.add_text_domain('my_app', :path => 'config/locales', :type => 
:yaml)
+    FastGettext.add_text_domain('my_app', path: 'config/locales', type: :yaml)
 
 Or database (scaleable, good for many locales/translators)
 
     # db access is cached <-> only first lookup hits the db
     require "fast_gettext/translation_repository/db"
     FastGettext::TranslationRepository::Db.require_models #load and include 
default models
-    FastGettext.add_text_domain('my_app', :type => :db, :model => 
TranslationKey)
+    FastGettext.add_text_domain('my_app', type: :db, model: TranslationKey)
 
 ### 3. Choose text domain and locale for translation
 Do this once in every Thread. (e.g. Rails -> ApplicationController)
@@ -83,7 +83,7 @@
     _('not-found') == 'not-found'
     s_('Namespace|not-found') == 'not-found'
     n_('Axis','Axis',3) == 'Achsen' #German plural of Axis
-    _('Hello %{name}!') % {:name => "Pete"} == 'Hello Pete!'
+    _('Hello %{name}!') % {name: "Pete"} == 'Hello Pete!'
 
 
 Managing translations
@@ -93,7 +93,7 @@
 
 Tell Gettext where your .mo or .po files lie, e.g. for locale/de/my_app.po and 
locale/de/LC_MESSAGES/my_app.mo
 
-    FastGettext.add_text_domain('my_app',:path=>'locale')
+    FastGettext.add_text_domain('my_app', path: 'locale')
 
 Use the [original GetText](http://github.com/mutoh/gettext) to create and 
manage po/mo-files.
 (Work on a po/mo parser & reader that is easier to use has started, 
contributions welcome @ [get_pomo](http://github.com/grosser/get_pomo) )
@@ -116,9 +116,9 @@
 since it runs in a different thread then e.g. controllers, so set them inside 
your application_controller.
 
     #environment.rb after initializers
-    Object.send(:include,FastGettext::Translation)
-    FastGettext.add_text_domain('accounting',:path=>'locale')
-    FastGettext.add_text_domain('frontend',:path=>'locale')
+    Object.send(:include, FastGettext::Translation)
+    FastGettext.add_text_domain('accounting', path: 'locale')
+    FastGettext.add_text_domain('frontend', path: 'locale')
     ...
 
     #application_controller.rb
@@ -165,19 +165,35 @@
 the first cannot translate a given key, the next is asked and so forth.
 
     repos = [
-      FastGettext::TranslationRepository.build('new', :path=>'....'),
-      FastGettext::TranslationRepository.build('old', :path=>'....')
+      FastGettext::TranslationRepository.build('new', path: '....'),
+      FastGettext::TranslationRepository.build('old', path: '....')
     ]
-    FastGettext.add_text_domain 'combined', :type=>:chain, :chain=>repos
+    FastGettext.add_text_domain 'combined', type: :chain, :chain: repos
+
+###Merge
+In some cases you can benefit from using merge repositories as an alternative 
to chains. They behave nearly the same. The difference is in the internal
+data structure. While chain repos iterate over the whole chain for each 
translation, merge repositories select and store the first translation at the 
time
+a subordinate repository is added. This puts the burden on the load phase and 
speeds up the translations.
+
+    repos = [
+      FastGettext::TranslationRepository.build('new', :path: '....'),
+      FastGettext::TranslationRepository.build('old', :path: '....')
+    ]
+    domain = FastGettext.add_text_domain 'combined', type: :merge, chain: repos
+
+Downside of this approach is that you have to reload the merge repo each time 
a language is changed.
+
+    FastGettext.locale = 'de'
+    domain.reload
 
 ###Logger
 When you want to know which keys could not be translated or were used, add a 
Logger to a Chain:
 
     repos = [
-      FastGettext::TranslationRepository.build('app', :path=>'....')
-      FastGettext::TranslationRepository.build('logger', :type=>:logger, 
:callback=>lambda{|key_or_array_of_ids| ... }),
+      FastGettext::TranslationRepository.build('app', path: '....')
+      FastGettext::TranslationRepository.build('logger', type: :logger, 
callback: lambda{|key_or_array_of_ids| ... }),
     }
-    FastGettext.add_text_domain 'combined', :type=>:chain, :chain=>repos
+    FastGettext.add_text_domain 'combined', type: :chain, chain: repos
 
 If the Logger is in position #1 it will see all translations, if it is in 
position #2 it will only see the unfound.
 Unfound may not always mean missing, if you choose not to translate a word 
because the key is a good translation, it will appear nevertheless.
@@ -223,6 +239,8 @@
     D_("string") # finds 'string' in any domain
     # etc.
 
+Alternatively you can use [merge 
repository](https://github.com/grosser/fast_gettext#merge) to achieve the same 
behaviour.
+
 FAQ
 ===
  - [Problems with ActiveRecord 
messages?](http://wiki.github.com/grosser/fast_gettext/activerecord)
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     2016-05-30 17:54:15.000000000 +0200
+++ new/lib/fast_gettext/mo_file.rb     2016-08-02 16:58:21.000000000 +0200
@@ -30,17 +30,17 @@
       nil
     end
 
+    def data
+      load_data if @data.nil?
+      @data
+    end
+
     def self.empty
       MoFile.new(File.join(File.dirname(__FILE__),'vendor','empty.mo'))
     end
 
     private
 
-    def data
-      load_data if @data.nil?
-      @data
-    end
-
     def load_data
       @data = if @filename.is_a? FastGettext::GetText::MOFile
         @filename
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/fast_gettext/translation_repository/merge.rb 
new/lib/fast_gettext/translation_repository/merge.rb
--- old/lib/fast_gettext/translation_repository/merge.rb        1970-01-01 
01:00:00.000000000 +0100
+++ new/lib/fast_gettext/translation_repository/merge.rb        2016-08-02 
16:58:21.000000000 +0200
@@ -0,0 +1,73 @@
+require 'fast_gettext/translation_repository/po'
+
+module FastGettext
+  module TranslationRepository
+    # Responsibility:
+    #  - merge data from multiple repositories into one hash structure
+    #  - can be used instead of searching for translations in multiple domains
+    #  - requires reload when current locale is changed
+    class Merge < Base
+      def initialize(name, options={})
+        clear
+        super(name, options)
+        options.fetch(:chain, []).each do |repo|
+          add_repo(repo)
+        end
+      end
+
+      def available_locales
+        @repositories.flat_map(&:available_locales).uniq
+      end
+
+      def pluralisation_rule
+        @repositories.each do |r|
+          result = r.pluralisation_rule and return result
+        end
+        nil
+      end
+
+      def plural(*keys)
+        @repositories.each do |r|
+          result = r.plural(*keys)
+          return result unless result.compact.empty?
+        end
+        []
+      end
+
+      def reload
+        @data = {}
+        @repositories.each do |r|
+          r.reload
+          load_repo(r)
+        end
+        super
+      end
+
+      def add_repo(repo)
+        raise "Unsupported repository" unless repo_supported?(repo)
+        @repositories << repo
+        load_repo(repo)
+        true
+      end
+
+      def [](key)
+        @data[key]
+      end
+
+      def clear
+        @repositories = []
+        @data = {}
+      end
+
+      protected
+
+      def repo_supported?(repo)
+        repo.respond_to?(:all_translations)
+      end
+
+      def load_repo(r)
+        @data = r.all_translations.merge(@data)
+      end
+    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   2016-05-30 
17:54:15.000000000 +0200
+++ new/lib/fast_gettext/translation_repository/mo.rb   2016-08-02 
16:58:21.000000000 +0200
@@ -24,6 +24,10 @@
         super
       end
 
+      def all_translations
+        current_translations.data
+      end
+
       protected
 
       def find_and_store_files(name,options)
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     2016-05-30 17:54:15.000000000 +0200
+++ new/lib/fast_gettext/version.rb     2016-08-02 16:58:21.000000000 +0200
@@ -1,3 +1,3 @@
 module FastGettext
-  VERSION = Version = '1.1.0'
+  VERSION = Version = '1.2.0'
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2016-05-30 17:54:15.000000000 +0200
+++ new/metadata        2016-08-02 16:58:21.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: fast_gettext
 version: !ruby/object:Gem::Version
-  version: 1.1.0
+  version: 1.2.0
 platform: ruby
 authors:
 - Michael Grosser
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2016-05-30 00:00:00.000000000 Z
+date: 2016-08-02 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rake
@@ -129,6 +129,7 @@
 - lib/fast_gettext/translation_repository/db_models/translation_key.rb
 - lib/fast_gettext/translation_repository/db_models/translation_text.rb
 - lib/fast_gettext/translation_repository/logger.rb
+- lib/fast_gettext/translation_repository/merge.rb
 - lib/fast_gettext/translation_repository/mo.rb
 - lib/fast_gettext/translation_repository/po.rb
 - lib/fast_gettext/translation_repository/yaml.rb
@@ -139,7 +140,7 @@
 - lib/fast_gettext/vendor/poparser.rb
 - lib/fast_gettext/vendor/string.rb
 - lib/fast_gettext/version.rb
-homepage: http://github.com/grosser/fast_gettext
+homepage: https://github.com/grosser/fast_gettext
 licenses:
 - MIT
 - Ruby
@@ -152,7 +153,7 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: '0'
+      version: 2.1.0
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="
@@ -160,7 +161,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.4.5.1
+rubygems_version: 2.5.1
 signing_key: 
 specification_version: 4
 summary: A simple, fast, memory-efficient and threadsafe implementation of 
GetText


Reply via email to