diff --git a/.ruby-version b/.ruby-version index a04abec..1f7da99 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.10 +2.7.7 diff --git a/Gemfile b/Gemfile index bb4de2b..cc6cace 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,19 @@ source 'https://rubygems.org' +# we still need BigDecimal.new for ActiveSupport 4.x +gem 'bigdecimal', '~> 1.4' + gem 'rake' gem 'middleman', '~> 3.4.1' gem 'middleman-livereload' gem 'middleman-s3_sync' -gem 'middleman-cloudfront' +gem 'middleman-cloudfront', '0.2.1' gem 'middleman-autoprefixer' gem 'middleman-minify-html' gem 'middleman-sprockets' gem "middleman-es6", git: "https://github.com/vast/middleman-es6" gem 'uglifier' +gem 'contentful', '~> 2.13.0' gem "contentful_middleman", '~> 2.1.2' gem 'middleman-syntax' @@ -27,9 +31,15 @@ gem 'stopwords-filter', require: 'stopwords' # ensure we have secure version gem 'nokogiri', '>= 1.10.8' +# debugging tools +# gem 'debug' +# gem 'binding_of_caller' + # tests group :test do gem 'capybara' + gem 'ffi', '~> 1.16.3' + gem 'selenium-webdriver', '~> 3.0' gem 'capybara-selenium' gem 'chromedriver-helper' # for headless chrome gem 'rspec' diff --git a/Gemfile.lock b/Gemfile.lock index 52fc4c0..8b6a997 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,8 +16,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) ansi (1.5.0) archive-zip (0.12.0) io-like (~> 0.3.0) @@ -31,6 +31,7 @@ GEM babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) + bigdecimal (1.4.4) builder (3.2.2) capybara (2.4.4) mime-types (>= 1.16) @@ -64,8 +65,8 @@ GEM sass (>= 3.3.0, < 3.5) compass-import-once (1.0.5) sass (>= 3.2, < 3.5) - contentful (2.5.0) - http (> 0.8, < 3.0) + contentful (2.13.3) + http (> 0.8, < 5.0) multi_json (~> 1) contentful-webhook-listener (0.3.0) contentful_middleman (2.1.3) @@ -74,8 +75,7 @@ GEM middleman-core (~> 3.4) crass (1.0.6) diff-lcs (1.4.4) - domain_name (0.5.20170404) - unf (>= 0.0.5, < 1.0.0) + domain_name (0.6.20240107) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) @@ -83,7 +83,10 @@ GEM eventmachine (1.2.0.1) excon (0.71.0) execjs (2.7.0) - ffi (1.9.25) + ffi (1.16.3) + ffi-compiler (1.3.2) + ffi (>= 1.15.5) + rake fission (0.5.0) CFPropertyList (~> 2.2) fog (1.38.0) @@ -233,14 +236,16 @@ GEM hooks (0.4.1) uber (~> 0.0.14) htmlcompressor (0.2.0) - http (2.2.2) + http (4.4.1) addressable (~> 2.3) http-cookie (~> 1.0) - http-form_data (~> 1.0.1) - http_parser.rb (~> 0.6.0) - http-cookie (1.0.3) + http-form_data (~> 2.2) + http-parser (~> 1.2.0) + http-cookie (1.0.7) domain_name (~> 0.5) - http-form_data (1.0.3) + http-form_data (2.3.0) + http-parser (1.2.3) + ffi-compiler (>= 1.0, < 2.0) http_parser.rb (0.6.0) i18n (0.7.0) inflecto (0.0.2) @@ -317,7 +322,7 @@ GEM mime-types-data (3.2016.0521) mini_portile2 (2.8.0) minitest (5.10.1) - multi_json (1.13.1) + multi_json (1.15.0) nenv (0.3.0) nokogiri (1.13.6) mini_portile2 (~> 2.8.0) @@ -335,7 +340,7 @@ GEM pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) - public_suffix (4.0.6) + public_suffix (5.1.1) racc (1.6.0) rack (1.6.12) rack-livereload (0.3.16) @@ -399,9 +404,7 @@ GEM uglifier (2.7.2) execjs (>= 0.3.0) json (>= 1.8.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.2) + unf (0.2.0) xml-simple (1.1.5) xpath (2.0.0) nokogiri (~> 1.3) @@ -411,14 +414,17 @@ PLATFORMS DEPENDENCIES aws-s3 + bigdecimal (~> 1.4) capybara capybara-selenium chromedriver-helper + contentful (~> 2.13.0) contentful_middleman (~> 2.1.2) + ffi (~> 1.16.3) guard-rspec middleman (~> 3.4.1) middleman-autoprefixer - middleman-cloudfront + middleman-cloudfront (= 0.2.1) middleman-es6! middleman-livereload middleman-minify-html @@ -431,6 +437,7 @@ DEPENDENCIES rails-html-sanitizer rake rspec + selenium-webdriver (~> 3.0) stopwords-filter string-urlize uglifier diff --git a/README.md b/README.md index 7ed34f3..630cdc5 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Built with Middleman, Contentful, and Lunr.js search. ### To Deploy Locally: - Be able to run locally first. - Run tests: `$ bundle exec rspec spec` + - Those will only work fully after having downloaded content (via `middleman contentful` below and building the site via `middleman build` below) - Set `APP_ENV` to either `production` or `staging` with your target; defaults to `staging`. - Download from Contentful: `$ bundle exec middleman contentful` - Build Static HTML to deploy: `$ bundle exec middleman build --verbose` diff --git a/mappers/help/page.rb b/mappers/help/page.rb index 2804fc4..c7ca2e0 100644 --- a/mappers/help/page.rb +++ b/mappers/help/page.rb @@ -5,8 +5,12 @@ def map(context, entry) super # Adds a "content available in locales" field to the page; NOTE: 'en' is available in all locales. - context.content_langs = context&.content&.keys - context.content_langs = ['en'] if context.content_langs.blank? + begin + context.content_langs = context&.content&.keys + context.content_langs = ['en'] if context.content_langs.blank? + rescue KeyError + context.content_langs = ['en'] + end keys = entry.fields_with_locales.keys