Merge pull request #7507 from SuperTux88/sprockets-3

Upgrade sprockets
This commit is contained in:
Benjamin Neff 2017-07-31 21:43:22 +02:00
commit c42315f3ee
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
10 changed files with 43 additions and 29 deletions

View file

@ -15,7 +15,7 @@ cache:
bundler: true
directories:
- app/assets/images
- tmp/cache/assets/test
- tmp/cache/assets
branches:
only:

View file

@ -57,7 +57,7 @@ gem "bootstrap-sass", "3.3.7"
gem "bootstrap-switch-rails", "3.3.3"
gem "compass-rails", "3.0.2"
gem "sass-rails", "5.0.6"
gem "sprockets", "2.12.4"
gem "sprockets-rails", "3.2.0"
# Database
@ -312,7 +312,4 @@ group :development, :test do
gem "jasmine-jquery-rails", "2.0.3"
gem "rails-assets-jasmine-ajax", "3.3.1", source: "https://rails-assets.org"
gem "sinon-rails", "1.15.0"
# silence assets
gem "quiet_assets", "1.1.0"
end

View file

@ -287,7 +287,6 @@ GEM
tilt (>= 1.2)
hashdiff (0.3.4)
hashie (3.5.6)
hike (1.2.3)
hitimes (1.2.5)
http (2.2.2)
addressable (~> 2.3)
@ -464,8 +463,6 @@ GEM
byebug (~> 9.0)
pry (~> 0.10)
public_suffix (2.0.5)
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.6.8)
rack-cors (1.0.1)
rack-google-analytics (1.2.0)
@ -657,15 +654,13 @@ GEM
spring (>= 0.9.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
state_machines (0.5.0)
string-direction (1.2.0)
yard (~> 0.8)
@ -686,7 +681,7 @@ GEM
activerecord (>= 3.2)
thor (0.19.1)
thread_safe (0.3.6)
tilt (1.4.1)
tilt (2.0.8)
timecop (0.9.1)
timers (4.1.2)
hitimes
@ -829,7 +824,6 @@ DEPENDENCIES
pronto-scss (= 0.9.1)
pry
pry-byebug
quiet_assets (= 1.1.0)
rack-cors (= 1.0.1)
rack-google-analytics (= 1.2.0)
rack-piwik (= 0.3.0)
@ -879,7 +873,7 @@ DEPENDENCIES
spring (= 2.0.2)
spring-commands-cucumber (= 1.0.1)
spring-commands-rspec (= 1.0.4)
sprockets (= 2.12.4)
sprockets-rails (= 3.2.0)
string-direction (= 1.2.0)
test_after_commit (= 1.1.0)
thor (= 0.19.1)

View file

@ -1,5 +1,5 @@
//= require emojione
//= require favico.js
//= require favico.js/favico
//= require jquery.ui/ui/resizable
//= require jquery.ui/ui/draggable

View file

@ -32,6 +32,9 @@ Diaspora::Application.configure do
# Expands the lines which load the assets
config.assets.debug = true
# No assets request logging
config.assets.quiet = true
# Set the logging destination(s)
config.log_to = %w[stdout file]

View file

@ -16,6 +16,20 @@ Diaspora::Application.configure do
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# No assets request logging
config.assets.quiet = true
# Precompile poltergeist_disable_transition.css for tests
config.assets.precompile += %w[poltergeist_disable_transition.css]
# Don't precompile all themes for tests
config.assets.precompile -= %w[color_themes/*/desktop.css color_themes/*/mobile.css]
config.assets.precompile += %w[
color_themes/original/desktop.css
color_themes/dark_green/desktop.css
color_themes/original/mobile.css
]
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false

View file

@ -103,3 +103,10 @@ Logging::Rails.configure do |config|
end
end
end
# Include LoggerSilence from ActiveSupport. This is needed to silent assets
# requests with `config.assets.quiet`, because the default silence method of
# the logging gem is no-op. See: https://github.com/TwP/logging/issues/11
Logging::Logger.send :alias_method, :local_level, :level
Logging::Logger.send :alias_method, :local_level=, :level=
Logging::Logger.send :include, LoggerSilence

View file

@ -15,7 +15,7 @@ namespace :assets do
logger = ::Logging::Logger["assets:non_digest_assets"]
non_digest_assets = Diaspora::Application.config.assets.non_digest_assets
manifest_path = Dir.glob(File.join(Rails.root, "public/assets/manifest-*.json")).first
manifest_path = Dir.glob(Rails.root.join("public", "assets", ".sprockets-manifest-*.json")).first
JSON.load(File.new(manifest_path))["assets"].each do |logical_path, digested_path|
logical_pathname = Pathname.new(logical_path)

View file

@ -54,13 +54,13 @@ describe ApplicationHelper, :type => :helper do
end
it 'includes jquery.js from asset pipeline' do
expect(helper.jquery_include_tag).to match(/jquery3\.js/)
expect(helper.jquery_include_tag).to match(/jquery3-[0-9a-f]{64}\.js/)
expect(helper.jquery_include_tag).not_to match(/jquery\.com/)
end
end
it 'inclues jquery_ujs.js' do
expect(helper.jquery_include_tag).to match(/jquery_ujs\.js/)
expect(helper.jquery_include_tag).to match(/jquery_ujs-[0-9a-f]{64}\.js/)
end
it "disables ajax caching" do

View file

@ -10,11 +10,10 @@ describe AvatarPresenter do
it "returns the default images if no images set" do
@profile = FactoryGirl.create(:profile, person: alice.person)
@presenter = AvatarPresenter.new(@profile)
expect(@presenter.base_hash).to eq(
small: "/assets/user/default.png",
medium: "/assets/user/default.png",
large: "/assets/user/default.png"
)
expect(@presenter.base_hash.keys).to eq(%i[small medium large])
expect(@presenter.base_hash[:small]).to match(%r{/assets/user/default-[0-9a-f]{64}\.png})
expect(@presenter.base_hash[:medium]).to match(%r{/assets/user/default-[0-9a-f]{64}\.png})
expect(@presenter.base_hash[:large]).to match(%r{/assets/user/default-[0-9a-f]{64}\.png})
end
end
end