Hello community, here is the log from the commit of package rubygem-mustache for openSUSE:Factory checked in at 2016-04-12 19:37:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-mustache (Old) and /work/SRC/openSUSE:Factory/.rubygem-mustache.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-mustache" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-mustache/rubygem-mustache.changes 2015-07-14 17:44:40.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-mustache.new/rubygem-mustache.changes 2016-04-12 19:37:55.000000000 +0200 @@ -1,0 +2,6 @@ +Wed Apr 6 06:26:11 UTC 2016 - co...@suse.com + +- updated to version 1.0.3 + no changelog found + +------------------------------------------------------------------- Old: ---- mustache-1.0.2.gem New: ---- mustache-1.0.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-mustache.spec ++++++ --- /var/tmp/diff_new_pack.U9qbTw/_old 2016-04-12 19:37:56.000000000 +0200 +++ /var/tmp/diff_new_pack.U9qbTw/_new 2016-04-12 19:37:56.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-mustache # -# 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-mustache -Version: 1.0.2 +Version: 1.0.3 Release: 0 %define mod_name mustache %define mod_full_name %{mod_name}-%{version} ++++++ mustache-1.0.2.gem -> mustache-1.0.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2015-06-24 16:45:05.000000000 +0200 +++ new/README.md 2016-03-24 13:43:22.000000000 +0100 @@ -379,15 +379,15 @@ * Home: <http://mustache.github.io> * Bugs: <https://github.com/mustache/mustache/issues> * List: <musta...@librelist.com> -* Gems: <http://rubygems.org/gems/mustache> +* Gems: <https://rubygems.org/gems/mustache> -[1]: http://code.google.com/p/google-ctemplate/ +[1]: https://github.com/olafvdspek/ctemplate [2]: http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html [3]: http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html [4]: https://github.com/brynary/rack-bug/ [5]: http://img.skitch.com/20091027-n8pxwwx8r61tc318a15q1n6m14.png -[fk]: http://help.github.com/forking/ -[is]: https://github.com/defunkt/mustache/issues +[fk]: https://help.github.com/forking/ +[is]: https://github.com/mustache/mustache/issues [irc]: irc://irc.freenode.net/#{ [vim]: https://github.com/mustache/vim-mustache-handlebars [emacs]: https://github.com/mustache/vim-mustache-handlebars diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bin/mustache new/bin/mustache --- old/bin/mustache 2015-06-24 16:45:05.000000000 +0200 +++ new/bin/mustache 2016-03-24 13:43:22.000000000 +0100 @@ -11,7 +11,7 @@ # Return a structure describing the options. def self.parse_options(args) opts = OptionParser.new do |opts| - opts.banner = "Usage: mustache [-c] [-t] [-r library] FILE ..." + opts.banner = "Usage: mustache [-c] [-t] [-e] [-r library] FILE ..." opts.separator " " @@ -42,6 +42,11 @@ exit end + opts.on("-e", "--error", + "Raise an error on context misses.") do |e| + Mustache.raise_on_context_miss = true + end + opts.on('-r', '--require LIB', 'Require a Ruby library before running.') do |lib| require lib end Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mustache/context.rb new/lib/mustache/context.rb --- old/lib/mustache/context.rb 2015-06-24 16:45:05.000000000 +0200 +++ new/lib/mustache/context.rb 2016-03-24 13:43:22.000000000 +0100 @@ -97,7 +97,7 @@ # Do we know about a particular key? In other words, will calling # `context[key]` give us a result that was set. Basically. def has_key?(key) - !!fetch(key, false) + fetch(key, false) rescue ContextMiss false end @@ -114,7 +114,7 @@ next if frame == self value = find(frame, name, :__missing) - return value if value != :__missing + return value if :__missing != value end if default == :__raise || mustache_in_stack.raise_on_context_miss? @@ -138,8 +138,11 @@ def find(obj, key, default = nil) return find_in_hash(obj.to_hash, key, default) if obj.respond_to?(:to_hash) - key = to_tag(key) - return default unless obj.respond_to?(key) + unless obj.respond_to?(key) + # no match for the key, but it may include a hyphen, so try again replacing hyphens with underscores. + key = key.to_s.tr('-', '_') + return default unless obj.respond_to?(key) + end meth = obj.method(key) rescue proc { obj.send(key) } meth.arity == 1 ? meth.to_proc : meth.call @@ -152,18 +155,18 @@ private - - # If a class, we need to find tags (methods) per Parser::ALLOWED_CONTENT. - def to_tag key - key.to_s.include?('-') ? key.to_s.tr('-', '_') : key - end - # Fetches a hash key if it exists, or returns the given default. def find_in_hash(obj, key, default) return obj[key] if obj.has_key?(key) return obj[key.to_s] if obj.has_key?(key.to_s) - obj.fetch(key, default) + # If default is :__missing then we are from #fetch which is hunting through the stack + # If default is nil then we are reducing dot notation + if :__missing != default && mustache_in_stack.raise_on_context_miss? + raise ContextMiss.new("Can't find #{key} in #{obj}") + else + obj.fetch(key, default) + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mustache/generator.rb new/lib/mustache/generator.rb --- old/lib/mustache/generator.rb 2015-06-24 16:45:05.000000000 +0200 +++ new/lib/mustache/generator.rb 2016-03-24 13:43:22.000000000 +0100 @@ -113,7 +113,7 @@ elsif v.is_a?(Proc) t = Mustache::Template.new(v.call(#{raw.inspect}).to_s) def t.tokens(src=@source) - p = Parser.new + p = Mustache::Parser.new p.otag, p.ctag = #{delims.inspect} p.compile(src) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mustache/parser.rb new/lib/mustache/parser.rb --- old/lib/mustache/parser.rb 2015-06-24 16:45:05.000000000 +0200 +++ new/lib/mustache/parser.rb 2016-03-24 13:43:22.000000000 +0100 @@ -121,7 +121,7 @@ scan_tags || scan_text end - if !@sections.empty? + unless @sections.empty? # We have parsed the whole file, but there's still opened sections. type, pos, _ = @sections.pop error "Unclosed section #{type.inspect}", pos diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mustache/template.rb new/lib/mustache/template.rb --- old/lib/mustache/template.rb 2015-06-24 16:45:05.000000000 +0200 +++ new/lib/mustache/template.rb 2016-03-24 13:43:22.000000000 +0100 @@ -110,9 +110,6 @@ end - private - - # Simple recursive iterator for tokens def self.recursor(toks, section, &block) toks.map do |token| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/mustache/version.rb new/lib/mustache/version.rb --- old/lib/mustache/version.rb 2015-06-24 16:45:05.000000000 +0200 +++ new/lib/mustache/version.rb 2016-03-24 13:43:22.000000000 +0100 @@ -1,3 +1,3 @@ class Mustache - VERSION = '1.0.2' + VERSION = '1.0.3' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-06-24 16:45:05.000000000 +0200 +++ new/metadata 2016-03-24 13:43:22.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: mustache version: !ruby/object:Gem::Version - version: 1.0.2 + version: 1.0.3 platform: ruby authors: - Chris Wanstrath @@ -11,7 +11,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2015-06-24 00:00:00.000000000 Z +date: 2016-03-24 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler @@ -229,7 +229,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.5 +rubygems_version: 2.5.1 signing_key: specification_version: 4 summary: Mustache is a framework-agnostic way to render logic-free views. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/fixtures/liberal.mustache new/test/fixtures/liberal.mustache --- old/test/fixtures/liberal.mustache 2015-06-24 16:45:05.000000000 +0200 +++ new/test/fixtures/liberal.mustache 2016-03-24 13:43:22.000000000 +0100 @@ -1 +1 @@ -{{first-name}} {{middle_name!}} {{lastName?}} +{{first-name}} {{middle_name!}} {{lastName?}} {{street-address}} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/fixtures/liberal.rb new/test/fixtures/liberal.rb --- old/test/fixtures/liberal.rb 2015-06-24 16:45:05.000000000 +0200 +++ new/test/fixtures/liberal.rb 2016-03-24 13:43:22.000000000 +0100 @@ -14,6 +14,10 @@ def lastName? 'sheurs' end + + define_method :'street-address' do + '123 Somewhere St' + end end if $0 == __FILE__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/mustache_test.rb new/test/mustache_test.rb --- old/test/mustache_test.rb 2015-06-24 16:45:05.000000000 +0200 +++ new/test/mustache_test.rb 2016-03-24 13:43:22.000000000 +0100 @@ -430,6 +430,29 @@ end end + def test_not_found_deep_in_context_raises_when_asked_to + instance = Mustache.new + instance.raise_on_context_miss = true + + instance[:list] = { :item => { :value => 1234 } } + + instance.template = '{{list.item.no_value}}' + + assert_raises Mustache::ContextMiss do + instance.render + end + end + + def test_found_in_nested_context_when_asked_to_raise + instance = Mustache.new + instance.raise_on_context_miss = true + + instance[:item] = { :list => [ { :value => 1235, :deep_list => [{:x => 'y'}]}] } + + instance.template = '{{#item.list}}{{#deep_list}}{{value}}{{/deep_list}}{{/item.list}}' + assert_equal '1235', instance.render + end + def test_knows_when_its_been_compiled_when_set_with_string klass = Class.new(Mustache) @@ -518,7 +541,7 @@ def test_liberal_tag_names_in_class assert_equal <<-end_liberal, Liberal.render -kevin j sheurs +kevin j sheurs 123 Somewhere St end_liberal end