diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-01-28 11:25:15 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-28 11:25:15 -0600 |
commit | c454dec170da32fc83b8d78c61c3f452c819f0ed (patch) | |
tree | df05c491f06e845a0e8266afcb23962e95160a4a /lib/tasks | |
parent | a5f7934420e1d26682700e02aa8fc9333e808f47 (diff) | |
parent | b78d06b78143b16dccc5d5afaa8796473b68bea1 (diff) | |
download | gitlab-ce-c454dec170da32fc83b8d78c61c3f452c819f0ed.tar.gz |
Merge branch 'master' into go-go-gadget-webpack
* master: (33 commits)
Improved code style on the issue_sidebar_spec.rb
add CHAGELOG.md entry for !8831
remove assets:compile step from relative_url docs
update scripts and docs to reference the newly namespaced rake task
namespace assets rake tasks to gitlab:assets:*
correct gzip files if they exist as well
automatically correct CSS urls on assets:precompile
remove hard-coded assets path for ace editor modules
Fixed cancel button in the services form not redirecting back to the integrations settings view
Fix search bar search param encoding
Fix a transient failure in the `Explore::ProjectsController` spec
Fix filtering with multiple words
Fix project name label's for reference in project settings
Fixed merge request tabs extra margin
Don't call `#uniq` on a relation
Move Gitlab::Shell and Gitlab::ShellAdapter files to lib/
Move ApplicationSetting DEFAULTS to `.defaults` instead
Move a begin/rescue clause to ApplicationSetting.expire
Use badge partial as single source of truth instead of having 2 partials doing the same
Changes after review
...
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/assets.rake | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/assets.rake b/lib/tasks/gitlab/assets.rake new file mode 100644 index 00000000000..5d884bf9f66 --- /dev/null +++ b/lib/tasks/gitlab/assets.rake @@ -0,0 +1,47 @@ +namespace :gitlab do + namespace :assets do + desc 'GitLab | Assets | Compile all frontend assets' + task :compile do + Rake::Task['assets:precompile'].invoke + Rake::Task['gitlab:assets:fix_urls'].invoke + end + + desc 'GitLab | Assets | Clean up old compiled frontend assets' + task :clean do + Rake::Task['assets:clean'].invoke + end + + desc 'GitLab | Assets | Remove all compiled frontend assets' + task :purge do + Rake::Task['assets:clobber'].invoke + end + + desc 'GitLab | Assets | Fix all absolute url references in CSS' + task :fix_urls do + css_files = Dir['public/assets/*.css'] + css_files.each do | file | + # replace url(/assets/*) with url(./*) + puts "Fixing #{file}" + system "sed", "-i", "-e", 's/url(\([\"\']\?\)\/assets\//url(\1.\//g', file + + # rewrite the corresponding gzip file (if it exists) + gzip = "#{file}.gz" + if File.exist?(gzip) + puts "Fixing #{gzip}" + + FileUtils.rm(gzip) + mtime = File.stat(file).mtime + + File.open(gzip, 'wb+') do |f| + gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION) + gz.mtime = mtime + gz.write IO.binread(file) + gz.close + + File.utime(mtime, mtime, f.path) + end + end + end + end + end +end |