From 997f4926c3a3b6ebf65a230a1c22e96751a6b446 Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Wed, 7 Sep 2016 09:54:09 +0000 Subject: [PATCH 1/7] Use asset manifest --- .../stylesheets/relaunch/_container.scss | 8 +++---- app/assets/stylesheets/relaunch/_fonts.scss | 6 +++--- app/assets/stylesheets/relaunch/_footer.scss | 4 ++-- app/assets/stylesheets/relaunch/_header.scss | 14 ++++++------- app/assets/stylesheets/relaunch/_icons.scss | 6 +++--- .../relaunch/_leaflet_overrides.scss | 12 +++++------ app/assets/stylesheets/relaunch/_map.scss | 4 ++-- app/assets/stylesheets/relaunch/_overlay.scss | 6 +++--- app/assets/stylesheets/relaunch/_toolbar.scss | 21 +++++++++---------- 9 files changed, 40 insertions(+), 41 deletions(-) diff --git a/app/assets/stylesheets/relaunch/_container.scss b/app/assets/stylesheets/relaunch/_container.scss index 1b14bebdc..a18abdd10 100644 --- a/app/assets/stylesheets/relaunch/_container.scss +++ b/app/assets/stylesheets/relaunch/_container.scss @@ -1,5 +1,5 @@ #container { - background: url('container_bg.png') repeat-x 0 $headerHeight; + background: asset-url('container_bg.png') repeat-x 0 $headerHeight; display: block; padding-bottom: $footerHeight + 10px; padding-top: $headerHeight; @@ -45,10 +45,10 @@ padding-left: 80px; } p.osm { - background: url("/assets/openstreetmap_logo_small.jpg") no-repeat left center; + background: asset-url("/assets/openstreetmap_logo_small.jpg") no-repeat left center; } p.wheelmap { - background: url("/assets/markerhead.jpg") no-repeat 4px center; + background: asset-url("/assets/markerhead.jpg") no-repeat 4px center; } em { @@ -113,4 +113,4 @@ text-shadow: rgba(255, 255, 255, 0.5), 0, 1px, 1px; } } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/relaunch/_fonts.scss b/app/assets/stylesheets/relaunch/_fonts.scss index 5154f0867..83b31174e 100644 --- a/app/assets/stylesheets/relaunch/_fonts.scss +++ b/app/assets/stylesheets/relaunch/_fonts.scss @@ -3,6 +3,6 @@ $helvetica_light: 'HelveticaNeue-Light','Helvetica Neue Light','Helvetica Neue', @font-face { font-family: 'EntypoRegular'; - src: url('entypo.eot'); - src: url('entypo.eot?#iefix') format("embedded-opentype"), url('entypo.woff') format("woff"), url('entypo.ttf') format("truetype"), url('entypo.svg#EntypoRegular') format("svg"); -} \ No newline at end of file + src: asset-url('entypo.eot'); + src: asset-url('entypo.eot?#iefix') format("embedded-opentype"), asset-url('entypo.woff') format("woff"), asset-url('entypo.ttf') format("truetype"), asset-url('entypo.svg#EntypoRegular') format("svg"); +} diff --git a/app/assets/stylesheets/relaunch/_footer.scss b/app/assets/stylesheets/relaunch/_footer.scss index 4748c90bb..ac23c9e29 100644 --- a/app/assets/stylesheets/relaunch/_footer.scss +++ b/app/assets/stylesheets/relaunch/_footer.scss @@ -64,7 +64,7 @@ border-left: 0; padding: 1px 4px; margin-left: 5px; - background: url(/assets/bubble-left.png) no-repeat -5px center; + background: asset-url('/assets/bubble-left.png') no-repeat -5px center; } } @@ -78,4 +78,4 @@ .credits span { display: none; } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/relaunch/_header.scss b/app/assets/stylesheets/relaunch/_header.scss index de3615c81..9abf6950a 100644 --- a/app/assets/stylesheets/relaunch/_header.scss +++ b/app/assets/stylesheets/relaunch/_header.scss @@ -8,10 +8,10 @@ left: 0; z-index: 2; float: left; - background: url('bg_header.png'); + background: asset-url('bg_header.png'); @include if-min-resolution(1.3) { - background: url(bg_header@2x.png); + background: asset-url('bg_header@2x.png'); } .navbar-inner { @@ -31,10 +31,10 @@ margin: 7px 0 0 0; float: left; position: relative; - background: url(bg_logo.png) center left no-repeat; + background: asset-url('bg_logo.png') center left no-repeat; @include if-min-resolution(1.3) { - background: url(bg_logo@2x.png) center left no-repeat; + background: asset-url('bg_logo@2x.png') center left no-repeat; background-size: 150px 32px; } @@ -61,11 +61,11 @@ .christmas & { width: 160px; height: 42px; - background-image: url(bg_logo_christmas.png); + background-image: asset-url('bg_logo_christmas.png'); margin-top: 0; @include if-min-resolution(1.3) { - background-image: url(bg_logo_christmas@2x.png); + background-image: asset-url('bg_logo_christmas@2x.png'); background-size: 150px 39px; } @@ -191,4 +191,4 @@ nav { } } } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/relaunch/_icons.scss b/app/assets/stylesheets/relaunch/_icons.scss index 0571f50c8..ad106597d 100644 --- a/app/assets/stylesheets/relaunch/_icons.scss +++ b/app/assets/stylesheets/relaunch/_icons.scss @@ -8,14 +8,14 @@ } .leaflet-marker-icon { - background: transparent url('marker-sprites.png') no-repeat; + background: transparent asset-url('marker-sprites.png') no-repeat; width: 29px; height: 32px; margin-left: -15px; margin-top: -30px; @include if-min-resolution(1.3) { - background: transparent url('marker-sprites@2x.png') no-repeat; + background: transparent asset-url('marker-sprites@2x.png') no-repeat; background-size: 29px 128px; } @@ -58,4 +58,4 @@ $icons: sprite-map("icons/*[^@2x].png"); max-width: 22px; max-height: 22px; } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/relaunch/_leaflet_overrides.scss b/app/assets/stylesheets/relaunch/_leaflet_overrides.scss index 9e1028328..6e1c2c409 100644 --- a/app/assets/stylesheets/relaunch/_leaflet_overrides.scss +++ b/app/assets/stylesheets/relaunch/_leaflet_overrides.scss @@ -18,7 +18,7 @@ .leaflet-control-locate { a { - background-image: url('locate_btn.png'); + background-image: asset-url('locate_btn.png'); background-position: center center; background-repeat: no-repeat; background-color: rgba(255,255,255,0.8); @@ -28,18 +28,18 @@ }; @include if-min-resolution(1.3) { - background-image: url('locate_btn@2x.png'); + background-image: asset-url('locate_btn@2x.png'); } } &.requesting a { - background-image: url('spinner_locate.gif'); + background-image: asset-url('spinner_locate.gif'); } &.active a { - background-image: url(locate_btn_active.png); + background-image: asset-url('locate_btn_active.png'); @include if-min-resolution(1.3) { - background-image: url('locate_btn_active@2x.png'); + background-image: asset-url('locate_btn_active@2x.png'); } } } @@ -65,4 +65,4 @@ a { white-space: nowrap; } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/relaunch/_map.scss b/app/assets/stylesheets/relaunch/_map.scss index a96b3b0db..730468951 100644 --- a/app/assets/stylesheets/relaunch/_map.scss +++ b/app/assets/stylesheets/relaunch/_map.scss @@ -36,9 +36,9 @@ text-indent:-9999px; overflow:hidden; background-repeat:no-repeat; - background-image:url('mapbox_logo.png'); + background-image: asset-url('mapbox_logo.png'); @media screen and (max-width:$breakPhone) { bottom: 13px } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/relaunch/_overlay.scss b/app/assets/stylesheets/relaunch/_overlay.scss index 4d815a62d..ed6a3192e 100644 --- a/app/assets/stylesheets/relaunch/_overlay.scss +++ b/app/assets/stylesheets/relaunch/_overlay.scss @@ -34,7 +34,7 @@ top: 50%; margin: -325px 0 0 -350px; padding: 0 0 20px 0; - background: url('bg-overlay.png') #FFF no-repeat; + background: asset-url('bg-overlay.png') #FFF no-repeat; background-position: 0 219px; @include box-shadow(0 0 10px #333); @include border-radius(3px); @@ -85,7 +85,7 @@ margin: 0 0 40px 0; text-align: center; - background: url('logo-overlay.png') center top no-repeat; + background: asset-url('logo-overlay.png') center top no-repeat; font-size: 16px; line-height: 24px; @@ -290,4 +290,4 @@ margin-top: 5px; } } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/relaunch/_toolbar.scss b/app/assets/stylesheets/relaunch/_toolbar.scss index e2c4e51a7..955968cc4 100644 --- a/app/assets/stylesheets/relaunch/_toolbar.scss +++ b/app/assets/stylesheets/relaunch/_toolbar.scss @@ -133,7 +133,7 @@ } &--yes { - background-image: url('toolbar_marker_yes.png'); + background-image: asset-url('toolbar_marker_yes.png'); .popover-title { background-color: $wheelchair-yes; @@ -141,7 +141,7 @@ } &--limited { - background-image: url('toolbar_marker_limited.png'); + background-image: asset-url('toolbar_marker_limited.png'); .popover-title { background-color: $wheelchair-limited; @@ -149,7 +149,7 @@ } &--no { - background-image: url('toolbar_marker_no.png'); + background-image: asset-url('toolbar_marker_no.png'); .popover-title { background-color: $wheelchair-limited; @@ -157,7 +157,7 @@ } &--unknown { - background-image: url('toolbar_marker_unknown.png'); + background-image: asset-url('toolbar_marker_unknown.png'); .popover-title { background-color: $wheelchair-unknown; @@ -166,19 +166,19 @@ @include if-min-resolution(1.3) { &--yes { - background-image: url(toolbar_marker_yes@2x.png); + background-image: asset-url('toolbar_marker_yes@2x.png'); } &--limited { - background-image: url(toolbar_marker_limited@2x.png); + background-image: asset-url('toolbar_marker_limited@2x.png'); } &--no { - background-image: url(toolbar_marker_no@2x.png); + background-image: asset-url('toolbar_marker_no@2x.png'); } &--unknown { - background-image: url(toolbar_marker_unknown@2x.png); + background-image: asset-url('toolbar_marker_unknown@2x.png'); } } } @@ -193,7 +193,7 @@ } &-icon { - background: url('toolbar_marker_icon.png') no-repeat; + background: asset-url('toolbar_marker_icon.png') no-repeat; background-size: 100%; width: image_width('toolbar_marker_icon.png'); height: image_height('toolbar_marker_icon.png'); @@ -201,7 +201,7 @@ margin-top: 1px; // Cosmetic surgery @include if-min-resolution(1.3) { - background-image: url('toolbar_marker_icon@2x.png'); + background-image: asset-url('toolbar_marker_icon@2x.png'); } } @@ -616,4 +616,3 @@ } } } - From e57a57fe00f67c1c1b14375e6beeca9609cd223e Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Wed, 7 Sep 2016 09:57:16 +0000 Subject: [PATCH 2/7] Test cap (Do not merge this) --- config/deploy/staging.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index a50fdb43a..15f06d918 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -6,7 +6,7 @@ set :stage, :staging set :deploy_to, "/var/apps/#{fetch(:application)}/" -set :branch, :"feature/infra-rebuild" +set :branch, :"bugfix/apps-use-asset-manifest" set :rev, proc { `git rev-parse --short #{fetch(:branch)}`.chomp } # Simple Role Syntax From 21ec593bb22c4d533d4e7b4541b1fdc30c9c641b Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Wed, 7 Sep 2016 10:24:03 +0000 Subject: [PATCH 3/7] public assets should not be shared between deploys. --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 116ef6382..c0509c7b9 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -33,7 +33,7 @@ # Default value for linked_dirs is [] # set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} -set :linked_dirs, %w{ log tmp vendor/bundle public/system public/assets node_modules } +set :linked_dirs, %w{ log tmp vendor/bundle public/system node_modules } # Default value for keep_releases is 5 set :keep_releases, 5 From 49113c6fc748568c9e1f2b80168ebe3666b370f9 Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Wed, 7 Sep 2016 13:39:41 +0000 Subject: [PATCH 4/7] noop :set_linked_dirs --- config/deploy.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index c0509c7b9..62896f78e 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -44,6 +44,9 @@ namespace :deploy do + desc 'Overwrite defailt :set_linked_dirs so it does not make a bad symlink' + task :set_linked_dirs => do true end + desc 'Compile assets' task :compile_assets => [:set_rails_env] do # invoke 'deploy:assets:precompile' From 66400b86e47703784794f316a074d92cf9677cd7 Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Wed, 7 Sep 2016 13:41:50 +0000 Subject: [PATCH 5/7] Properly noop :set_linked_dirs --- config/deploy.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 62896f78e..d9989b4fb 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -41,11 +41,12 @@ # Clear existing task so we can replace it rather than "add" to it. Rake::Task["deploy:compile_assets"].clear +Rake::Task["deploy:set_linked_dirs"].clear namespace :deploy do - - desc 'Overwrite defailt :set_linked_dirs so it does not make a bad symlink' - task :set_linked_dirs => do true end + # We need to noop this because otherwise it creates an undesirable symlink + # Ref: https://github.com/capistrano/rails/blob/54da36a2dda5084a3cbe380b4a8f1ba282379f72/lib/capistrano/tasks/assets.rake#L121 + task :set_linked_dirs do end desc 'Compile assets' task :compile_assets => [:set_rails_env] do From e7fb6c783c8f9b0604073f872a0b8dd413e4ff8e Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Wed, 7 Sep 2016 13:49:56 +0000 Subject: [PATCH 6/7] Linting --- config/deploy.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index d9989b4fb..9b89eda2e 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -44,9 +44,11 @@ Rake::Task["deploy:set_linked_dirs"].clear namespace :deploy do - # We need to noop this because otherwise it creates an undesirable symlink - # Ref: https://github.com/capistrano/rails/blob/54da36a2dda5084a3cbe380b4a8f1ba282379f72/lib/capistrano/tasks/assets.rake#L121 - task :set_linked_dirs do end + + task :set_linked_dirs do + # noop due to cap/rails adding this to the run list + # Ref: https://github.com/capistrano/rails/blob/54da36a2dda5084a3cbe380b4a8f1ba282379f72/lib/capistrano/tasks/assets.rake#L121 + end desc 'Compile assets' task :compile_assets => [:set_rails_env] do From 82c403256e4642ebacce2c3dd7cd714d550b587c Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Wed, 7 Sep 2016 13:53:17 +0000 Subject: [PATCH 7/7] Revert branch redirect. Safe for merge --- config/deploy/production.rb | 2 +- config/deploy/staging.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 9770cb7d4..a0a05b1f6 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -6,7 +6,7 @@ set :stage, :production set :deploy_to, "/var/apps/#{fetch(:application)}/" -set :branch, :"feature/infrastructure-rebuild" +set :branch, :"feature/infra-rebuild" set :rev, proc { `git rev-parse --short #{fetch(:branch)}`.chomp } # Simple Role Syntax diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 15f06d918..a50fdb43a 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -6,7 +6,7 @@ set :stage, :staging set :deploy_to, "/var/apps/#{fetch(:application)}/" -set :branch, :"bugfix/apps-use-asset-manifest" +set :branch, :"feature/infra-rebuild" set :rev, proc { `git rev-parse --short #{fetch(:branch)}`.chomp } # Simple Role Syntax