Hello community,
here is the log from the commit of package rubygem-gettext_i18n_rails for
openSUSE:Factory checked in at 2015-10-12 10:02:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-gettext_i18n_rails (Old)
and /work/SRC/openSUSE:Factory/.rubygem-gettext_i18n_rails.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-gettext_i18n_rails"
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-gettext_i18n_rails/rubygem-gettext_i18n_rails.changes
2015-04-10 09:53:55.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-gettext_i18n_rails.new/rubygem-gettext_i18n_rails.changes
2015-10-12 10:02:48.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Oct 9 04:29:36 UTC 2015 - [email protected]
+
+- updated to version 1.3.0
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
gettext_i18n_rails-1.2.3.gem
New:
----
gettext_i18n_rails-1.3.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-gettext_i18n_rails.spec ++++++
--- /var/tmp/diff_new_pack.7oRVGJ/_old 2015-10-12 10:02:49.000000000 +0200
+++ /var/tmp/diff_new_pack.7oRVGJ/_new 2015-10-12 10:02:49.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-gettext_i18n_rails
-Version: 1.2.3
+Version: 1.3.0
Release: 0
%define mod_name gettext_i18n_rails
%define mod_full_name %{mod_name}-%{version}
++++++ gettext_i18n_rails-1.2.3.gem -> gettext_i18n_rails-1.3.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/gettext_i18n_rails/base_parser.rb
new/lib/gettext_i18n_rails/base_parser.rb
--- old/lib/gettext_i18n_rails/base_parser.rb 2015-04-03 08:55:56.000000000
+0200
+++ new/lib/gettext_i18n_rails/base_parser.rb 2015-10-09 01:33:56.000000000
+0200
@@ -9,7 +9,7 @@
def self.parse(file, msgids = [])
return msgids unless load_library
code = convert_to_code(File.read(file))
- RubyGettextExtractor.parse_string(code, file, msgids)
+ RubyGettextExtractor.parse_string(code, msgids, file)
rescue Racc::ParseError => e
$stderr.puts "file ignored: ruby_parser cannot read #{extension} files
with 1.9 syntax --- #{file}: (#{e.message.strip})"
return msgids
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/gettext_i18n_rails/ruby_gettext_extractor.rb
new/lib/gettext_i18n_rails/ruby_gettext_extractor.rb
--- old/lib/gettext_i18n_rails/ruby_gettext_extractor.rb 2015-04-03
08:55:56.000000000 +0200
+++ new/lib/gettext_i18n_rails/ruby_gettext_extractor.rb 2015-10-09
01:33:56.000000000 +0200
@@ -1,37 +1,36 @@
-# new ruby parser from retoo, that should help extracting "#{_('xxx')}", which
is needed especially when parsing haml files
+gem 'ruby_parser', '>= 3.7.1' # sync with gemspec
require 'ruby_parser'
+gem 'sexp_processor'
+require 'sexp_processor'
+
module RubyGettextExtractor
extend self
def parse(file, targets = []) # :nodoc:
- content = File.read(file)
- parse_string(content, file, targets)
+ parse_string(File.new(file), targets)
end
- def parse_string(content, file, targets=[])
- # file is just for information in error messages
+ def parse_string(content, targets = [], file = nil)
+ syntax_tree = RubyParser.for_current_ruby.parse(content)
- parser = if RUBY_VERSION =~ /^1\.8/
- Extractor18.new(file, targets)
- else
- Extractor19.new(file, targets)
- end
- parser.run(content)
- end
+ processor = Extractor.new(targets, file)
+ processor.require_empty = false
+ processor.process(syntax_tree)
- def target?(file) # :nodoc:
- return file =~ /\.rb$/
+ processor.results
end
- module ExtractorMethods
- def initialize(filename, targets)
- @filename = filename
- @targets = Hash.new
+ class Extractor < SexpProcessor
+ attr_reader :results
+
+ def initialize(targets, file_name = nil)
+ @file_name = file_name
+ @targets = {}
@results = []
targets.each do |a|
- k, v = a
+ k, _v = a
# things go wrong if k already exists, but this
# should not happen (according to the gettext doc)
@targets[k] = a
@@ -41,99 +40,100 @@
super()
end
- def run(content)
- # ruby parser has an ugly bug which causes that several \000's take
- # ages to parse. This avoids this probelm by stripping them away (they
probably wont appear in keys anyway)
- # See bug report:
http://rubyforge.org/tracker/index.php?func=detail&aid=26898&group_id=439&atid=1778
- safe_content = content.gsub(/\\\d\d\d/, '')
- self.parse(safe_content)
- return @results
- end
-
def extract_string(node)
- if node.first == :str
- return node.last
- elsif node.first == :call
+ case node.first
+ when :str
+ node.last
+ when :call
type, recv, meth, args = node
-
- # node has to be in form of "string"+"other_string"
+ # node has to be in form of "string" + "other_string"
return nil unless recv && meth == :+
- first_part = extract_string(recv)
+ first_part = extract_string(recv)
second_part = extract_string(args)
- return nil unless first_part && second_part
- return first_part.to_s + second_part.to_s
+ first_part && second_part ? first_part.to_s + second_part.to_s : nil
else
- return nil
+ nil
end
end
- def extract_key(args, seperator)
- key = nil
- if args.size == 2
- key = extract_string(args.value)
- else
- # this could be n_("aaa","aaa2",1)
- # all strings arguemnts are extracted and joined with \004 or \000
-
- arguments = args[1..(-1)]
+ def extract_key_singular(args, separator)
+ key = extract_string(args) if args.size == 2 || args.size == 4
- res = []
- arguments.each do |a|
- str = extract_string(a)
- # only add strings
- res << str if str
- end
+ return nil unless key
+ key.gsub("\n", '\n').gsub("\t", '\t').gsub("\0", '\0')
+ end
- return nil if res.empty?
- key = res.join(seperator)
+ def extract_key_plural(args, separator)
+ # this could be n_("aaa", "aaa plural", @retireitems.length)
+ # s(s(:str, "aaa"),
+ # s(:str, "aaa plural"),
+ # s(:call, s(:ivar, :@retireitems), :length))
+ # all strings arguments are extracted and joined with \004 or \000
+ arguments = args[0..(-2)]
+
+ res = []
+ arguments.each do |a|
+ next unless a.kind_of? Sexp
+ str = extract_string(a)
+ res << str if str
end
+ key = res.empty? ? nil : res.join(separator)
+
return nil unless key
+ key.gsub("\n", '\n').gsub("\t", '\t').gsub("\0", '\0')
+ end
+
+ def store_key(key, args)
+ if key
+ res = @targets[key]
- key.gsub!("\n", '\n')
- key.gsub!("\t", '\t')
- key.gsub!("\0", '\0')
-
- return key
- end
-
- def new_call recv, meth, args = nil
- # we dont care if the method is called on a a object
- if recv.nil?
- if (meth == :_ || meth == :p_ || meth == :N_ || meth == :pgettext ||
meth == :s_)
- key = extract_key(args, "\004")
- elsif meth == :n_
- key = extract_key(args, "\000")
- else
- # skip
+ unless res
+ res = [key]
+ @results << res
+ @targets[key] = res
end
- if key
- res = @targets[key]
+ file_name = @file_name.nil? ? args.file : @file_name
+ res << "#{file_name}:#{args.line}"
+ end
+ end
- unless res
- res = [key]
- @results << res
- @targets[key] = res
- end
+ def gettext_simple_call(args)
+ # args comes in 2 forms:
+ # s(s(:str, "Button Group Order:"))
+ # s(:str, "Button Group Order:")
+ # normalizing:
+ args = args.first if Sexp === args.sexp_type
+
+ key = extract_key_singular(args, "\004")
+ store_key(key, args)
+ end
+
+ def gettext_plural_call(args)
+ key = extract_key_plural(args, "\000")
+ store_key(key, args)
+ end
+
+ def process_call exp
+ _call = exp.shift
+ _recv = process exp.shift
+ meth = exp.shift
+
+ case meth
+ when :_, :p_, :N_, :pgettext, :s_
+ gettext_simple_call(exp)
+ when :n_
+ gettext_plural_call(exp)
+ end
- res << "#{@filename}:#{lexer.lineno}"
- end
+ until exp.empty? do
+ process(exp.shift)
end
- super recv, meth, args
+ s()
end
end
-
- class Extractor18 < Ruby18Parser
- include ExtractorMethods
- end
-
- class Extractor19 < Ruby19Parser
- include ExtractorMethods
- end
-
-
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/gettext_i18n_rails/version.rb
new/lib/gettext_i18n_rails/version.rb
--- old/lib/gettext_i18n_rails/version.rb 2015-04-03 08:55:56.000000000
+0200
+++ new/lib/gettext_i18n_rails/version.rb 2015-10-09 01:33:56.000000000
+0200
@@ -1,3 +1,3 @@
module GettextI18nRails
- Version = VERSION = '1.2.3'
+ Version = VERSION = '1.3.0'
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-04-03 08:55:56.000000000 +0200
+++ new/metadata 2015-10-09 01:33:56.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: gettext_i18n_rails
version: !ruby/object:Gem::Version
- version: 1.2.3
+ version: 1.3.0
platform: ruby
authors:
- Michael Grosser
autorequire:
bindir: bin
cert_chain: []
-date: 2015-04-03 00:00:00.000000000 Z
+date: 2015-10-08 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: fast_gettext
@@ -100,14 +100,28 @@
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: '3'
+ version: 3.7.1
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: '3'
+ version: 3.7.1
+- !ruby/object:Gem::Dependency
+ name: sexp_processor
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: '0'
+ type: :development
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: '0'
- !ruby/object:Gem::Dependency
name: rspec
requirement: !ruby/object:Gem::Requirement