Hello community, here is the log from the commit of package rubygem-js-routes for openSUSE:Factory checked in at 2020-03-07 21:38:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-js-routes (Old) and /work/SRC/openSUSE:Factory/.rubygem-js-routes.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-js-routes" Sat Mar 7 21:38:33 2020 rev:20 rq:773777 version:1.4.9 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-js-routes/rubygem-js-routes.changes 2019-08-06 15:09:48.423793124 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-js-routes.new.26092/rubygem-js-routes.changes 2020-03-07 21:38:37.240287631 +0100 @@ -1,0 +2,10 @@ +Mon Feb 10 15:00:51 UTC 2020 - Stephan Kulow <co...@suse.com> + +- updated to version 1.4.9 + see installed CHANGELOG.md + + ## v1.4.9 + + * Allow to specify null namespace and receive routes as an object without assigning it anywhere #247 + +------------------------------------------------------------------- Old: ---- js-routes-1.4.7.gem New: ---- js-routes-1.4.9.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-js-routes.spec ++++++ --- /var/tmp/diff_new_pack.8S9d8Z/_old 2020-03-07 21:38:37.796288005 +0100 +++ /var/tmp/diff_new_pack.8S9d8Z/_new 2020-03-07 21:38:37.800288009 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-js-routes # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # 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-js-routes -Version: 1.4.7 +Version: 1.4.9 Release: 0 %define mod_name js-routes %define mod_full_name %{mod_name}-%{version} @@ -32,7 +32,7 @@ BuildRequires: %{rubygem gem2rpm} BuildRequires: %{ruby} BuildRequires: ruby-macros >= 5 -Url: http://github.com/railsware/js-routes +URL: http://github.com/railsware/js-routes Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: Brings Rails named routes to javascript ++++++ js-routes-1.4.7.gem -> js-routes-1.4.9.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2019-06-24 14:34:09.000000000 +0200 +++ new/CHANGELOG.md 2019-07-19 17:19:33.000000000 +0200 @@ -1,5 +1,9 @@ ## master +## v1.4.9 + +* Allow to specify null namespace and receive routes as an object without assigning it anywhere #247 + ## v1.4.7 * Fix a LocalJumpError on secondary initialization of the app #248 Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/js_routes/version.rb new/lib/js_routes/version.rb --- old/lib/js_routes/version.rb 2019-06-24 14:34:09.000000000 +0200 +++ new/lib/js_routes/version.rb 2019-07-19 17:19:33.000000000 +0200 @@ -1,3 +1,3 @@ class JsRoutes - VERSION = "1.4.7" + VERSION = "1.4.9" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/js_routes.rb new/lib/js_routes.rb --- old/lib/js_routes.rb 2019-06-24 14:34:09.000000000 +0200 +++ new/lib/js_routes.rb 2019-07-19 17:19:33.000000000 +0200 @@ -118,18 +118,18 @@ end { - "GEM_VERSION" => JsRoutes::VERSION, - "ROUTES" => js_routes, - "NODE_TYPES" => json(NODE_TYPES), - "RAILS_VERSION" => ActionPack.version, - "DEPRECATED_GLOBBING_BEHAVIOR" => ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR == 0, - - "APP_CLASS" => application.class.to_s, - "NAMESPACE" => json(@configuration.namespace), - "DEFAULT_URL_OPTIONS" => json(@configuration.default_url_options), - "PREFIX" => json(@configuration.prefix), - "SPECIAL_OPTIONS_KEY" => json(@configuration.special_options_key), - "SERIALIZER" => @configuration.serializer || json(nil), + 'GEM_VERSION' => JsRoutes::VERSION, + 'ROUTES' => js_routes, + 'NODE_TYPES' => json(NODE_TYPES), + 'RAILS_VERSION' => ActionPack.version, + 'DEPRECATED_GLOBBING_BEHAVIOR' => ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR == 0, + + 'APP_CLASS' => application.class.to_s, + 'NAMESPACE' => json(@configuration.namespace), + 'DEFAULT_URL_OPTIONS' => json(@configuration.default_url_options), + 'PREFIX' => json(@configuration.prefix), + 'SPECIAL_OPTIONS_KEY' => json(@configuration.special_options_key), + 'SERIALIZER' => @configuration.serializer || json(nil), }.inject(File.read(File.dirname(__FILE__) + "/routes.js")) do |js, (key, value)| js.gsub!(key, value.to_s) end @@ -173,7 +173,8 @@ def mounted_app_routes(route) rails_engine_app = get_app_from_route(route) - if rails_engine_app.respond_to?(:superclass) && rails_engine_app.superclass == Rails::Engine && !route.path.anchored + if rails_engine_app.respond_to?(:superclass) && + rails_engine_app.superclass == Rails::Engine && !route.path.anchored rails_engine_app.routes.named_routes.map do |_, engine_route| build_route_if_match(engine_route, route) end @@ -183,7 +184,8 @@ end def get_app_from_route(route) - # rails engine in Rails 4.2 use additional ActionDispatch::Routing::Mapper::Constraints, which contain app + # rails engine in Rails 4.2 use additional + # ActionDispatch::Routing::Mapper::Constraints, which contain app if route.app.respond_to?(:app) && route.app.respond_to?(:constraints) route.app.app else @@ -191,8 +193,9 @@ end end - def build_route_if_match(route, parent_route=nil) - if any_match?(route, parent_route, @configuration[:exclude]) || !any_match?(route, parent_route, @configuration[:include]) + def build_route_if_match(route, parent_route = nil) + if any_match?(route, parent_route, @configuration[:exclude]) || + !any_match?(route, parent_route, @configuration[:include]) nil else build_js(route, parent_route) @@ -203,7 +206,7 @@ full_route = [parent_route.try(:name), route.name].compact.join('_') matchers = Array(matchers) - matchers.any? {|regex| full_route =~ regex} + matchers.any? { |regex| full_route =~ regex } end def build_js(route, parent_route) @@ -211,7 +214,7 @@ route_name = generate_route_name(name, (:path unless @configuration[:compact])) parent_spec = parent_route.try(:path).try(:spec) route_arguments = route_js_arguments(route, parent_spec) - url_link = generate_url_link(name, route_name, route_arguments, route) + url_link = generate_url_link(name, route_arguments) _ = <<-JS.strip! // #{name.join('.')} => #{parent_spec}#{route.path.spec} // function(#{build_params(route.required_parts)}) @@ -225,7 +228,8 @@ hash[part] = required_parts.include?(part) end default_options = route.defaults.select do |part, _| - FILTERED_DEFAULT_PARTS.exclude?(part) && URL_OPTIONS.include?(part) || parts_table[part] + FILTERED_DEFAULT_PARTS.exclude?(part) && + URL_OPTIONS.include?(part) || parts_table[part] end [ # JS objects don't preserve the order of properties which is crucial, @@ -235,19 +239,19 @@ serialize(route.path.spec, parent_spec) ].map do |argument| json(argument) - end.join(", ") + end.join(', ') end - def generate_url_link(name, route_name, route_arguments, route) - return "" unless @configuration[:url_links] + def generate_url_link(name, route_arguments) + return '' unless @configuration[:url_links] + <<-JS.strip! #{generate_route_name(name, :url)}: Utils.route(#{route_arguments}, true) JS end - def generate_route_name(name, suffix) - route_name = name.join('_') - route_name << "_#{ suffix }" if suffix + def generate_route_name(*parts) + route_name = parts.compact.join('_') @configuration[:camel_case] ? route_name.camelize(:lower) : route_name end @@ -257,7 +261,7 @@ def build_params(required_parts) params = required_parts + [LAST_OPTIONS_KEY] - params.join(", ") + params.join(', ') end # This function serializes Journey route into JSON structure @@ -266,7 +270,9 @@ # Routes.js file will be smaller. def serialize(spec, parent_spec=nil) return nil unless spec - return spec.tr(':', '') if spec.is_a?(String) + # Rails 4 globbing requires * removal + return spec.tr(':*', '') if spec.is_a?(String) + result = serialize_spec(spec, parent_spec) if parent_spec && result[1].is_a?(String) result = [ @@ -280,7 +286,7 @@ result end - def serialize_spec(spec, parent_spec=nil) + def serialize_spec(spec, parent_spec = nil) [ NODE_TYPES[spec.type], serialize(spec.left, parent_spec), @@ -288,4 +294,3 @@ ] end end - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/routes.js new/lib/routes.js --- old/lib/routes.js 2019-06-24 14:34:09.000000000 +0200 +++ new/lib/routes.js 2019-07-19 17:19:33.000000000 +0200 @@ -4,7 +4,7 @@ */ (function() { - var DeprecatedGlobbingBehavior, NodeTypes, ParameterMissing, ReservedOptions, SpecialOptionsKey, UriEncoderSegmentRegex, Utils, root, + var DeprecatedGlobbingBehavior, NodeTypes, ParameterMissing, ReservedOptions, SpecialOptionsKey, UriEncoderSegmentRegex, Utils, result, root, hasProp = {}.hasOwnProperty, slice = [].slice; @@ -336,9 +336,6 @@ visit_globbing: function(route, parameters, optional) { var left, right, type, value; type = route[0], left = route[1], right = route[2]; - if (left.replace(/^\*/i, "") !== left) { - route[1] = left = left.replace(/^\*/i, ""); - } value = parameters[left]; delete parameters[left]; if (value == null) { @@ -472,7 +469,7 @@ }, namespace: function(root, namespace, routes) { var index, j, len, part, parts; - parts = namespace.split("."); + parts = namespace ? namespace.split(".") : []; if (parts.length === 0) { return routes; } @@ -513,12 +510,14 @@ } }; + result = Utils.make(); + if (typeof define === "function" && define.amd) { define([], function() { - return Utils.make(); + return result; }); - } else { - Utils.make(); } + return result; + }).call(this); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/routes.js.coffee new/lib/routes.js.coffee --- old/lib/routes.js.coffee 2019-06-24 14:34:09.000000000 +0200 +++ new/lib/routes.js.coffee 2019-07-19 17:19:33.000000000 +0200 @@ -258,8 +258,6 @@ # visit_globbing: (route, parameters, optional) -> [type, left, right] = route - # fix for rails 4 globbing - route[1] = left = left.replace(/^\*/i, "") if left.replace(/^\*/i, "") isnt left value = parameters[left] delete parameters[left] return @visit(route, parameters, optional) unless value? @@ -377,7 +375,7 @@ result namespace: (root, namespace, routes) -> - parts = namespace.split(".") + parts = if namespace then namespace.split(".") else [] return routes if parts.length == 0 for part, index in parts if index < parts.length - 1 @@ -402,12 +400,12 @@ routes.default_serializer = (object, prefix) -> Utils.default_serializer(object, prefix) + # Browser globals Utils.namespace(root, NAMESPACE, routes) +result = Utils.make() # Set up Routes appropriately for the environment. if typeof define is "function" and define.amd # AMD - define [], -> Utils.make() -else - # Browser globals - Utils.make() + define [], -> result +return result diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2019-06-24 14:34:09.000000000 +0200 +++ new/metadata 2019-07-19 17:19:33.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: js-routes version: !ruby/object:Gem::Version - version: 1.4.7 + version: 1.4.9 platform: ruby authors: - Bogdan Gusiev autorequire: bindir: bin cert_chain: [] -date: 2019-06-24 00:00:00.000000000 Z +date: 2019-07-19 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: railties diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/js_routes/options_spec.rb new/spec/js_routes/options_spec.rb --- old/spec/js_routes/options_spec.rb 2019-06-24 14:34:09.000000000 +0200 +++ new/spec/js_routes/options_spec.rb 2019-07-19 17:19:33.000000000 +0200 @@ -167,36 +167,46 @@ expect(evaljs("Routes.no_format_path({format: 'json'})")).to eq(test_routes.no_format_path(format: 'json')) end - describe "when namespace option is specified" do + describe "namespace option" do let(:_options) { {:namespace => "PHM"} } it "should use this namespace for routing" do expect(evaljs("window.Routes")).to be_nil expect(evaljs("PHM.inbox_path")).not_to be_nil end - end - describe "when nested namespace option is specified" do - context "and defined on client" do - let(:_presetup) { "window.PHM = {}" } - let(:_options) { {:namespace => "PHM.Routes"} } + context "is nil" do + let(:_options) { {:namespace => nil} } it "should use this namespace for routing" do - expect(evaljs("PHM.Routes.inbox_path")).not_to be_nil + evaljs("window.zz = #{JsRoutes.generate(namespace: nil)}") + expect(evaljs("window.Routes")).to be_nil + expect(evaljs("window.zz.inbox_path")).not_to be_nil end + end - context "but undefined on client" do - let(:_options) { {:namespace => "PHM.Routes"} } - it "should initialize namespace" do - expect(evaljs("window.PHM.Routes.inbox_path")).not_to be_nil + describe "is nested" do + context "and defined on client" do + let(:_presetup) { "window.PHM = {}" } + let(:_options) { {:namespace => "PHM.Routes"} } + it "should use this namespace for routing" do + expect(evaljs("PHM.Routes.inbox_path")).not_to be_nil + end + end + + context "but undefined on client" do + let(:_options) { {:namespace => "PHM.Routes"} } + it "should initialize namespace" do + expect(evaljs("window.PHM.Routes.inbox_path")).not_to be_nil + end end - end - context "and some parts are defined" do - let(:_presetup) { "window.PHM = { Utils: {} };" } - let(:_options) { {:namespace => "PHM.Routes"} } - it "should not overwrite existing parts" do - expect(evaljs("window.PHM.Utils")).not_to be_nil - expect(evaljs("window.PHM.Routes.inbox_path")).not_to be_nil + context "and some parts are defined" do + let(:_presetup) { "window.PHM = { Utils: {} };" } + let(:_options) { {:namespace => "PHM.Routes"} } + it "should not overwrite existing parts" do + expect(evaljs("window.PHM.Utils")).not_to be_nil + expect(evaljs("window.PHM.Routes.inbox_path")).not_to be_nil + end 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 2019-06-24 14:34:09.000000000 +0200 +++ new/spec/spec_helper.rb 2019-07-19 17:19:33.000000000 +0200 @@ -95,11 +95,11 @@ if defined?(JRUBY_VERSION) jscontext[:log] = lambda do |context, value| - puts value + puts value.inspect end else jscontext.attach("log", proc do |value| - puts value + puts value.inspect end) end end