From eeeba5fe312522d597f2dfd35a4f2e90c4fed9fb Mon Sep 17 00:00:00 2001 From: Dzmitry Monich Date: Mon, 17 Apr 2023 01:29:34 +0400 Subject: [PATCH] Task 5 --- .gitignore | 6 +- .ruby-version | 2 +- Gemfile | 8 +- Gemfile.lock | 31 +- Makefile | 15 + app/controllers/stories_controller.rb | 10 + app/views/layouts/_top_bar.html.erb | 6 +- case-study-template.md | 59 + docker-compose.yml | 31 +- nginx/nginx.conf | 25 + sitespeed-result/Comparison.png | Bin 0 -> 1081876 bytes sitespeed-result/browsertime-push.har | 1 + sitespeed-result/browsertime-without.har | 1 + sitespeed-result/with_push.png | Bin 0 -> 706799 bytes sitespeed-result/without_push.png | Bin 0 -> 737475 bytes yarn.lock | 8360 +++++++++++++--------- 16 files changed, 5086 insertions(+), 3469 deletions(-) create mode 100644 case-study-template.md create mode 100644 nginx/nginx.conf create mode 100644 sitespeed-result/Comparison.png create mode 100644 sitespeed-result/browsertime-push.har create mode 100644 sitespeed-result/browsertime-without.har create mode 100644 sitespeed-result/with_push.png create mode 100644 sitespeed-result/without_push.png diff --git a/.gitignore b/.gitignore index df2840a..fd62b0f 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,8 @@ package-lock.json .idea/ #sitemap -/public/sitemap.xml.gz \ No newline at end of file +/public/sitemap.xml.gz + +/nginx/certs/* +/sitespeed-result/host.docker.internal/**/* +/sitespeed-result/www.sitespeed.io/**/* diff --git a/.ruby-version b/.ruby-version index 6a6a3d8..ec1cf33 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.1 +2.6.3 diff --git a/Gemfile b/Gemfile index bf57e9a..cd1b713 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ # rubocop:disable LineLength source "https://rubygems.org" -ruby "2.6.1" +ruby "2.6.3" # Enforce git to transmitted via https. # workaround until bundler 2.0 is released. @@ -16,7 +16,7 @@ end gem "actionpack-action_caching", "~> 1.2" gem "active_record_union", "~> 1.3" gem "acts-as-taggable-on", "~> 5.0" -gem "acts_as_follower", github: "thepracticaldev/acts_as_follower", branch: "master" +gem "acts_as_follower", github: "forem/acts_as_follower", branch: "master" gem "addressable", "~> 2.5", ">= 2.5.2" gem "administrate", "~> 0.11" gem "ahoy_email", "~> 0.5" @@ -89,7 +89,7 @@ gem "sdoc", "~> 1.0", group: :doc gem "serviceworker-rails", "~> 0.5" gem "share_meow_client", "~> 0.1" gem "sitemap_generator", "~> 6.0" -gem "skylight", "~> 3.1" +# gem "skylight", "~> 3.1" gem "slack-notifier", "~> 2.3" gem "sprockets", "~> 3.7" gem "staccato", "~> 0.5" @@ -122,7 +122,7 @@ group :development, :test do gem "derailed", "~> 0.1" gem "erb_lint", "~> 0.0", require: false gem "faker", git: "https://github.com/stympy/faker.git", branch: "master" - gem "fix-db-schema-conflicts", github: "thepracticaldev/fix-db-schema-conflicts", branch: "master" + gem "fix-db-schema-conflicts", github: "jakeonrails/fix-db-schema-conflicts", branch: "master" gem "memory_profiler", "~> 0.9" gem "parallel_tests", "~> 2.27" gem "pry-byebug", "~> 3.7" diff --git a/Gemfile.lock b/Gemfile.lock index 331bf9c..b1ed435 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,26 +1,26 @@ GIT - remote: https://github.com/stympy/faker.git - revision: 9910aa58d92c018abab25d491191576fcc1a7707 + remote: https://github.com/forem/acts_as_follower.git + revision: 06393d3693a1a3d4b390aec4976c8b8f3a81cf01 branch: master specs: - faker (1.9.1) - i18n (>= 0.7) + acts_as_follower (0.2.1) + activerecord (>= 4.0) GIT - remote: https://github.com/thepracticaldev/acts_as_follower.git - revision: 288690cd99bc470eaee493fce5bfa9fe23157692 + remote: https://github.com/jakeonrails/fix-db-schema-conflicts.git + revision: 1e94f518503f1d1addd6ed052454efcbec0b3c6a branch: master specs: - acts_as_follower (0.2.1) - activerecord (>= 4.0) + fix-db-schema-conflicts (3.1.0) + rubocop (>= 0.38.0) GIT - remote: https://github.com/thepracticaldev/fix-db-schema-conflicts.git - revision: 4172392392e1a8d907f7ab673cb5ddd9a4a31940 + remote: https://github.com/stympy/faker.git + revision: 9910aa58d92c018abab25d491191576fcc1a7707 branch: master specs: - fix-db-schema-conflicts (3.0.2) - rubocop (>= 0.38.0) + faker (1.9.1) + i18n (>= 0.7) GEM remote: https://rubygems.org/ @@ -843,10 +843,6 @@ GEM tilt (~> 2.0) sitemap_generator (6.0.2) builder (~> 3.0) - skylight (3.1.4) - skylight-core (= 3.1.4) - skylight-core (3.1.4) - activesupport (>= 4.2.0) slack-notifier (2.3.2) smart_properties (1.13.1) spring (2.0.2) @@ -1057,7 +1053,6 @@ DEPENDENCIES simplecov (~> 0.16) sinatra (~> 2.0) sitemap_generator (~> 6.0) - skylight (~> 3.1) slack-notifier (~> 2.3) spring (~> 2.0) spring-commands-rspec (~> 1.0) @@ -1082,7 +1077,7 @@ DEPENDENCIES zonebie (~> 0.6.1) RUBY VERSION - ruby 2.6.1p33 + ruby 2.6.3p62 BUNDLED WITH 1.17.3 diff --git a/Makefile b/Makefile index 97e82a0..65fff80 100644 --- a/Makefile +++ b/Makefile @@ -2,3 +2,18 @@ run: docker-compose build && docker-compose run --rm web rails db:setup + +setup: + bin/setup + +dev: + bin/startup + +clean: + bin/rails jobs:clear + +up: + docker-compose up + +down: + docker-compose down \ No newline at end of file diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index df60029..8a010a0 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -7,6 +7,16 @@ def index return handle_user_or_organization_or_podcast_index if params[:username] return handle_tag_index if params[:tag] + push_headers = [ + "<#{view_context.asset_path('bell.svg')}>; rel=preload; as=image", + "<#{view_context.asset_path('menu.svg')}>; rel=preload; as=image", + "<#{view_context.asset_path('connect.svg')}>; rel=preload; as=image", + "<#{view_context.asset_path('stack.svg')}>; rel=preload; as=image", + "<#{view_context.asset_path('lightning.svg')}>; rel=preload; as=image", + ] + + response.headers["Link"] = push_headers.join(", ") + handle_base_index end diff --git a/app/views/layouts/_top_bar.html.erb b/app/views/layouts/_top_bar.html.erb index bf2750f..fca6cfe 100644 --- a/app/views/layouts/_top_bar.html.erb +++ b/app/views/layouts/_top_bar.html.erb @@ -13,11 +13,11 @@ WRITE A POST - <%= inline_svg("connect.svg", size: "100% * 100%") %> + <%= image_tag("connect.svg", size: "100% * 100%") %>
- <%= inline_svg("bell.svg", size: "100% * 100%") %> + <%= image_tag("bell.svg", size: "100% * 100%") %>