Hello community, here is the log from the commit of package rubygem-js-routes for openSUSE:Factory checked in at 2016-07-01 09:59:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-js-routes (Old) and /work/SRC/openSUSE:Factory/.rubygem-js-routes.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-js-routes" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-js-routes/rubygem-js-routes.changes 2016-04-12 19:35:45.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-js-routes.new/rubygem-js-routes.changes 2016-07-01 09:59:28.000000000 +0200 @@ -1,0 +2,11 @@ +Fri Jun 3 04:29:19 UTC 2016 - co...@suse.com + +- updated to version 1.2.6 + see installed CHANGELOG.md + + ## v1.2.6 + + * Use default prefix from `Rails.application.config.relative_url_root` #186 + * Bugfix route globbing with optional fragments bug #191 + +------------------------------------------------------------------- Old: ---- js-routes-1.2.5.gem New: ---- js-routes-1.2.6.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-js-routes.spec ++++++ --- /var/tmp/diff_new_pack.k6eiqN/_old 2016-07-01 09:59:29.000000000 +0200 +++ /var/tmp/diff_new_pack.k6eiqN/_new 2016-07-01 09:59:29.000000000 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-js-routes -Version: 1.2.5 +Version: 1.2.6 Release: 0 %define mod_name js-routes %define mod_full_name %{mod_name}-%{version} ++++++ js-routes-1.2.5.gem -> js-routes-1.2.6.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2016-03-24 05:55:28.000000000 +0100 +++ new/.travis.yml 2016-06-02 13:06:54.000000000 +0200 @@ -6,6 +6,7 @@ - 2.0 - 2.1 - 2.2 + - 2.3.1 - jruby-19mode - ruby-head - jruby-head diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2016-03-24 05:55:28.000000000 +0100 +++ new/CHANGELOG.md 2016-06-02 13:06:54.000000000 +0200 @@ -1,5 +1,10 @@ ## master +## v1.2.6 + +* Use default prefix from `Rails.application.config.relative_url_root` #186 +* Bugfix route globbing with optional fragments bug #191 + ## v1.2.5 * Bugfix subdomain default parameter in routes #184 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Guardfile new/Guardfile --- old/Guardfile 2016-03-24 05:55:28.000000000 +0100 +++ new/Guardfile 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -guard 'coffeescript', :output => 'lib', :all_on_start => true do - watch(%r{^lib/(.+\.coffee)$}) -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Readme.md new/Readme.md --- old/Readme.md 2016-03-24 05:55:28.000000000 +0100 +++ new/Readme.md 2016-06-02 13:06:54.000000000 +0200 @@ -58,7 +58,7 @@ * Default: `Routes` * `prefix` - String representing a url path to prepend to all paths. * Example: `http://yourdomain.com`. This will cause route helpers to generate full path only. - * Default: blank + * Default: Rails.application.config.relative_url_root * `camel_case` (version >= 0.8.8) - Generate camel case route names. * Default: false * `url_links` (version >= 0.8.9) - Generate `*_url` helpers (in addition to the default `*_path` helpers). @@ -109,6 +109,15 @@ JsRoutes.generate!("#{path}/api_routes.js", :namespace => "ApiRoutes", :include => /^api_/, :default_url_options => {:format => "json"}) ``` +### Rails relative URL root + +If you've installed your application in a sub-path or sub-URI of your server instead of at the root, you need to set the `RAILS_RELATIVE_URL_ROOT` environment variable to the correct path prefix for your application when you precompile assets. Eg., if your application's base URL is "https://appl.example.com/Application1", the command to precompile assets would be: +``` +RAILS_RELATIVE_URL_ROOT=/Application1 RAILS_ENV=production bundle exec rake assets:precompile +``` +The environment variable is only needed for precompilation of assets, at any other time (eg. when assets are compiled on-the-fly as in the development environment) Rails will set the relative URL root correctly on it's own. + + ## Usage Configuration above will create a nice javascript file with `Routes` object that has all the rails routes available: Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/js-routes.gemspec new/js-routes.gemspec --- old/js-routes.gemspec 2016-03-24 05:55:28.000000000 +0100 +++ new/js-routes.gemspec 2016-06-02 13:06:54.000000000 +0200 @@ -24,8 +24,7 @@ s.add_runtime_dependency(%q<sprockets-rails>) s.add_development_dependency(%q<rspec>, [">= 3.0.0"]) s.add_development_dependency(%q<bundler>, [">= 1.1.0"]) - s.add_development_dependency(%q<guard>, [">= 0"]) - s.add_development_dependency(%q<guard-coffeescript>, [">= 0"]) + s.add_development_dependency(%q<coffee-script>, [">= 0"]) s.add_development_dependency(%q<appraisal>, [">= 0.5.2"]) if defined?(JRUBY_VERSION) s.add_development_dependency(%q<therubyrhino>, [">= 2.0.4"]) 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 2016-03-24 05:55:28.000000000 +0100 +++ new/lib/js_routes/version.rb 2016-06-02 13:06:54.000000000 +0200 @@ -1,3 +1,3 @@ class JsRoutes - VERSION = "1.2.5" + VERSION = "1.2.6" 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 2016-03-24 05:55:28.000000000 +0100 +++ new/lib/js_routes.rb 2016-06-02 13:06:54.000000000 +0200 @@ -104,7 +104,7 @@ "APP_CLASS" => Rails.application.class.to_s, "NAMESPACE" => @options[:namespace], "DEFAULT_URL_OPTIONS" => json(@options[:default_url_options].merge(deprecate_url_options)), - "PREFIX" => @options[:prefix] || "", + "PREFIX" => @options[:prefix] || Rails.application.config.relative_url_root || "", "NODE_TYPES" => json(NODE_TYPES), "SERIALIZER" => @options[:serializer] || "null", "ROUTES" => js_routes, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/routes.js new/lib/routes.js --- old/lib/routes.js 2016-03-24 05:55:28.000000000 +0100 +++ new/lib/routes.js 2016-06-02 13:06:54.000000000 +0200 @@ -193,7 +193,7 @@ options = this.normalize_options(default_parts, required_parameters, optional_parts, args); parameters = options['url_parameters']; result = "" + (this.get_prefix()) + (this.visit(route, parameters)); - url = Utils.clean_path("" + result); + url = Utils.clean_path(result); if (options['trailing_slash'] === true) { url = url.replace(/(.*?)[\/]?$/, "$1/"); } @@ -224,7 +224,7 @@ case NodeTypes.CAT: left_part = this.visit(left, parameters, optional); right_part = this.visit(right, parameters, optional); - if (optional && (((left[0] === NodeTypes.SYMBOL || left[0] === NodeTypes.CAT) && !left_part) || ((right[0] === NodeTypes.SYMBOL || right[0] === NodeTypes.CAT) && !right_part))) { + if (optional && ((this.is_optional_node(left[0]) && !left_part) || ((this.is_optional_node(right[0])) && !right_part))) { return ""; } return "" + left_part + right_part; @@ -244,6 +244,9 @@ throw new Error("Unknown Rails node type"); } }, + is_optional_node: function(node) { + return node === NodeTypes.STAR || node === NodeTypes.SYMBOL || node === NodeTypes.CAT; + }, build_path_spec: function(route, wildcard) { var left, right, type; if (wildcard == null) { 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 2016-03-24 05:55:28.000000000 +0100 +++ new/lib/routes.js.coffee 2016-06-02 13:06:54.000000000 +0200 @@ -126,7 +126,7 @@ # path result = "#{@get_prefix()}#{@visit(route, parameters)}" - url = Utils.clean_path("#{result}") + url = Utils.clean_path(result) # set trailing_slash url = url.replace(/(.*?)[\/]?$/, "$1/") if options['trailing_slash'] is true # set additional url params @@ -161,8 +161,9 @@ when NodeTypes.CAT left_part = @visit(left, parameters, optional) right_part = @visit(right, parameters, optional) - return "" if optional and (((left[0] == NodeTypes.SYMBOL or left[0] == NodeTypes.CAT) and not left_part) or - ((right[0] == NodeTypes.SYMBOL or right[0] == NodeTypes.CAT) and not right_part)) + if optional and ((@is_optional_node(left[0]) and not left_part) or + ((@is_optional_node(right[0])) and not right_part)) + return "" "#{left_part}#{right_part}" when NodeTypes.SYMBOL value = parameters[left] @@ -181,6 +182,10 @@ else throw new Error("Unknown Rails node type") + + is_optional_node: (node) -> + node == NodeTypes.STAR or node == NodeTypes.SYMBOL or node == NodeTypes.CAT + # # This method build spec for route # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-03-24 05:55:28.000000000 +0100 +++ new/metadata 2016-06-02 13:06:54.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: js-routes version: !ruby/object:Gem::Version - version: 1.2.5 + version: 1.2.6 platform: ruby authors: - Bogdan Gusiev autorequire: bindir: bin cert_chain: [] -date: 2016-03-24 00:00:00.000000000 Z +date: 2016-06-02 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: railties @@ -67,21 +67,7 @@ - !ruby/object:Gem::Version version: 1.1.0 - !ruby/object:Gem::Dependency - name: guard - 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: guard-coffeescript + name: coffee-script requirement: !ruby/object:Gem::Requirement requirements: - - ">=" @@ -151,7 +137,6 @@ - Appraisals - CHANGELOG.md - Gemfile -- Guardfile - LICENSE.txt - Rakefile - Readme.md @@ -180,7 +165,6 @@ - spec/js_routes/rails_routes_compatibility_spec.rb - spec/js_routes/zzz_last_post_rails_init_spec.rb - spec/spec_helper.rb -- temp homepage: http://github.com/railsware/js-routes licenses: - MIT @@ -201,7 +185,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.7 +rubygems_version: 2.5.1 signing_key: specification_version: 4 summary: Brings Rails named routes to javascript 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 2016-03-24 05:55:28.000000000 +0100 +++ new/spec/js_routes/options_spec.rb 2016-06-02 13:06:54.000000000 +0200 @@ -186,9 +186,18 @@ describe "default_url_options" do context "with optional route parts" do - let(:_options) { {:default_url_options => {:optional_id => "12", :format => "json"}}} - it "should use this opions to fill optional parameters" do - expect(evaljs("Routes.things_path()")).to eq(routes.things_path(:optional_id => 12, :format => "json")) + context "provided" do + let(:_options) { { :default_url_options => { :optional_id => "12", :format => "json" } } } + it "should use this opions to fill optional parameters" do + expect(evaljs("Routes.things_path()")).to eq(routes.things_path(:optional_id => 12, :format => "json")) + end + end + + context "not provided" do + let(:_options) { { :default_url_options => { :format => "json" } } } + it "breaks" do + expect(evaljs("Routes.foo_all_path()")).to eq(routes.foo_all_path(:format => "json")) + 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 2016-03-24 05:55:28.000000000 +0100 +++ new/spec/spec_helper.rb 2016-06-02 13:06:54.000000000 +0200 @@ -5,7 +5,7 @@ require 'rspec' require 'rails/all' require 'js-routes' -require "active_support/core_ext/hash/slice" +require 'active_support/core_ext/hash/slice' require 'coffee-script' # fix ends_with? error for rails 3.2 require 'active_support/core_ext/string/starts_ends_with' if 3 == Rails::VERSION::MAJOR @@ -104,6 +104,7 @@ get "/:controller(/:action(/:id))" => "classic#classic", :as => :classic get "/other_optional/(:optional_id)" => "foo#foo", :as => :foo + get '/other_optional(/*optional_id)' => 'foo#foo', :as => :foo_all get 'books/*section/:title' => 'books#show', :as => :book get 'books/:title/*section' => 'books#show', :as => :book_title @@ -167,11 +168,16 @@ def inspectify(value) case value + when V8::Array + value.map do |v| + inspectify(v) + end when V8::Object + require 'byebug'; byebug value.to_h.map do |k,v| [k, inspectify(v)] end.to_h - when String, nil + when String, nil, Fixnum, FalseClass, TrueClass value else raise "wtf #{value.class}?" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/temp new/temp --- old/temp 2016-03-24 05:55:28.000000000 +0100 +++ new/temp 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -#<ActionDispatch::Journey::Route:0x007f8c4bdba798 @name="blog_app", @app=BlogEngine::Engine, @path=#<ActionDispatch::Journey::Path::Pattern:0x007f8c4bdbb120 @anchored=false, @spec=/blog, @requirements={}, @separators="/.?", @names=[], @optional_names=[], @required_names=[], @re=nil, @offsets=nil>, @dispatcher=false, @constraints={:required_defaults=>[]}, @defaults={}, @required_defaults=nil, @required_parts=[], @parts=[], @decorated_ast=nil, @precedence=61> -#<ActionDispatch::Journey::Route:0x007f8c4a861658 @name="support", @app=BlogEngine::Engine, @path=#<ActionDispatch::Journey::Path::Pattern:0x007f8c4a85c838 @anchored=true, @spec=/support(/page/:page)(.:format), @requirements={}, @separators="/.?", @names=["page", "format"], @optional_names=["page", "format"], @required_names=[], @re=nil, @offsets=nil>, @dispatcher=false, @constraints={:required_defaults=>[], :request_method=>/^GET$/}, @defaults={}, @required_defaults=nil, @required_parts=[], @parts=[:page, :format], @decorated_ast=nil, @precedence=0>