Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asset_host (as a proc) generates different digest for the same content #155

Closed
dnagir opened this issue Jun 30, 2014 · 3 comments
Closed

Comments

@dnagir
Copy link

dnagir commented Jun 30, 2014

Repro (rail 4.1x, Ruby 2.1):

GIven this in config/applicaiton.rb

    config.assets.enabled = true
    config.assets.initialize_on_precompile = false

    config.assets.precompile = ['application.js']
    config.action_controller.asset_host = proc { |source, request| 'http://example.com' }

(note the proc is used that always returns the same value)

And the app/assets/javascripts/application.js file with the simple content:

alert('hi')

When I run the precompile task multiple time, I'm getting different file names (digest) generated every time I run the precompilation:

$ rm -rf public/assets/ && RAILS_ENV=production RAILS_GROUP=assets bundle exec rake assets:precompile
I, [2014-06-30T17:24:55.598915 #52443]  INFO -- : Writing /Users/dnagir/proj/pc/abc/public/assets/application-7eafc8bc5bc0cdf0d1960b64bdff6a15.js

$ rm -rf public/assets/ && RAILS_ENV=production RAILS_GROUP=assets b rake assets:precompile
I, [2014-06-30T17:24:58.784216 #52513]  INFO -- : Writing /Users/dnagir/proj/pc/abc/public/assets/application-124c96284aeddcd0a85f2f370e021ac2.js

Bothe generated files have exactly the same content:

alert('hi')
;

The minimal Gemfile:

source 'http://rubygems.org'

gem 'rails', '~> 4.1.2'

gem 'pg'

with the Gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (4.1.2)
      actionpack (= 4.1.2)
      actionview (= 4.1.2)
      mail (~> 2.5.4)
    actionpack (4.1.2)
      actionview (= 4.1.2)
      activesupport (= 4.1.2)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.2)
      activesupport (= 4.1.2)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.2)
      activesupport (= 4.1.2)
      builder (~> 3.1)
    activerecord (4.1.2)
      activemodel (= 4.1.2)
      activesupport (= 4.1.2)
      arel (~> 5.0.0)
    activesupport (4.1.2)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    arel (5.0.1.20140414130214)
    builder (3.2.2)
    erubis (2.7.0)
    hike (1.2.3)
    i18n (0.6.9)
    json (1.8.1)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25.1)
    minitest (5.3.5)
    multi_json (1.10.1)
    pg (0.17.1)
    polyglot (0.3.5)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.1.2)
      actionmailer (= 4.1.2)
      actionpack (= 4.1.2)
      actionview (= 4.1.2)
      activemodel (= 4.1.2)
      activerecord (= 4.1.2)
      activesupport (= 4.1.2)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.2)
      sprockets-rails (~> 2.0)
    railties (4.1.2)
      actionpack (= 4.1.2)
      activesupport (= 4.1.2)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.3.2)
    sprockets (2.12.1)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.1.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    thor (0.19.1)
    thread_safe (0.3.4)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (1.2.1)
      thread_safe (~> 0.1)

PLATFORMS
  ruby

DEPENDENCIES
  pg
  rails (~> 4.1.2)
@matthewd
Copy link
Member

This sounds like #138 -- @dnagir can you confirm?

@rafaelfranca
Copy link
Member

Yes, seem so. I guess I need to release a new version. I'll do today.

@dnagir
Copy link
Author

dnagir commented Jul 1, 2014

Yes, looks like it. Thanks.

I'll comment there.

@matthewd matthewd closed this as completed Jul 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants