alchaplinsky / polymer-core-rails

Polymer core elements for Ruby on Rails project
MIT License
32 stars 17 forks source link

rake assets:precompile not working InvalidURIError #13

Open matystl opened 9 years ago

matystl commented 9 years ago

I managed to precompile rails polymer assets but without polymer core: This is working like charm:

gem 'polymer-rails'
#gem 'polymer-core-rails'
gem 'polymer-paper-rails', git: "https://github.com/alchapone/polymer-paper-rails.git"

This:

gem 'polymer-rails'
gem 'polymer-core-rails'
#or this gem 'polymer-core-rails', git: "https://github.com/alchapone/polymer-core-rails.git"
gem 'polymer-paper-rails', git: "https://github.com/alchapone/polymer-paper-rails.git"

Throws:

rake aborted!
URI::InvalidURIError: bad URI(is not URI?): http://fonts.googleapis.com/css?family=Roboto:400,300,500,700|Source+Code+Pro
  (in /home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-core-rails-0.2.6/app/assets/components/core-doc-viewer/elements/core-doc-page.html)
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-rails-0.2.8/lib/polymer-rails/component.rb:54:in `is_external?'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-rails-0.2.8/lib/polymer-rails/component.rb:26:in `block in stylesheets'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-rails-0.2.8/lib/polymer-rails/component.rb:26:in `reject'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-rails-0.2.8/lib/polymer-rails/component.rb:26:in `stylesheets'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-rails-0.2.8/lib/polymer-rails/processors/components_processor.rb:35:in `inline_styles'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-rails-0.2.8/lib/polymer-rails/processors/components_processor.rb:13:in `process'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/polymer-rails-0.2.8/lib/polymer-rails/railtie.rb:20:in `block (2 levels) in <class:Railtie>'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processor.rb:29:in `call'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processor.rb:29:in `evaluate'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:12:in `initialize'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `each'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:16:in `initialize'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
/home/maty/.rvm/gems/ruby-2.0.0-p598/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
stefl commented 9 years ago

To "fix" this temporarily I added this monkeypatch as _monkeypatch_uri.rb in my rails/initializers folder. Not good, but it does mean you can deploy:

module URI
  class << self

    def parse_with_safety(uri)
      parse_without_safety uri.gsub('|', '+')
    end

    alias parse_without_safety parse
    alias parse parse_with_safety
  end
end
alexvbush commented 9 years ago

thanks for the snippet @stefl ! fixed it for me.