shiplog 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 485562aa63450450f32dbcb5b6565702f7e39bbf3fb84743cc49a8acd099d0ed
4
- data.tar.gz: 9096af90498cd2561892963753b21a2026138253594ebb6d73ab0b6816f64b96
3
+ metadata.gz: a624887b92e388e7234f1c9051437c7c8732b624f448ae4ed6a50834668835b3
4
+ data.tar.gz: 1a0f18b1f55b919bf9fcf04da75379666428a49fd312c75ea55c6d064e613959
5
5
  SHA512:
6
- metadata.gz: 582ffdd4f37981e7c2a90829189f4f57e64a500f8f02542c3387bcd94764978b5eb96499da9245765292910da016f6f9f0a9d3752d5ff5d817a2b694cd404fa1
7
- data.tar.gz: 617c35b629ec73ca599ef8cb4386d0bd3c6738ab78b801b93621e28b46e4c89cd68b63091661d42e1c44f71c5d301f280568c6f20bd76cf3f56c14075ce4b940
6
+ metadata.gz: 3dd499eff9f0656078de85134f584ee13eddea6e98d9ad431d363da5bb4c53ce8c06c784914fc4ad2fdf5f30a4a2bc9c53632eed87b3dae1bbbd907efb1cfc88
7
+ data.tar.gz: c2322fb8cde5158aa51656e04d885faede534ab939e0a83677245ea1ab6130d11806cc7145f456f9b211b6b8fe7d2b7e821c198261660b23fe974db1dfee8226
data/CHANGELOG.md CHANGED
@@ -1,18 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.2 (2026-10-26)
4
+
5
+ 0.3.1 hosts should upgrade.
6
+
7
+ ### Fixed
8
+
9
+ - Boot failure in 0.3.1: when a host initializer or gem loaded `ActionView::Base` early (for example `ActionView::Base.field_error_proc = ...` in `config/initializers`), the engine's `action_view` hook ran before the autoloaders existed and raised `NameError: uninitialized constant Shiplog::HeadTagsHelper`. `Shiplog::HeadTagsHelper` now lives in `lib/shiplog/head_tags_helper.rb` and is required explicitly, so it is neither autoloaded nor reloaded (it is included into a class that never reloads).
10
+ - `shiplog_head_tags` raised `NoMethodError` in a view that lacks Shiplog's helpers, such as a ViewComponent or Phlex component rendered on a Shiplog page. It returns an empty string there: call it in the layout.
11
+ - `shiplog_head_tags` no longer autoloads `Shiplog::PublicController` (and the host's parent controller) when a host page or mailer renders a layout that calls it. Shiplog's public controllers answer a `shiplog_public_page?` marker instead.
12
+ - `og:image` and `Article.image` agree: `og:image` is the first screenshot whose URL can be built (it skipped to the callable when the first one had none), `Article.image` all of them, otherwise the `config.og_image` image.
13
+ - The `EXCEPT_KEYS` constant is no longer visible in the host's views (it moved to `Shiplog::HeadTags`).
14
+
15
+ ### Changed
16
+
17
+ - The legacy `content_for :shiplog_og` block includes the `config.og_image` fallback image when it is set (it did so in 0.3.1; the 0.3.1 notes said it was exactly as in 0.3.0).
18
+
19
+ ### Upgrading
20
+
21
+ - Bump `config.cache_version` when you change your layout's head or override a `shiplog/head/*` partial: ETags don't cover layouts.
22
+ - `config.og_image` output is not part of the ETag (only its presence is): bump `cache_version` when it changes.
23
+ - With `except: :canonical`, `og:url` still carries Shiplog's canonical (which honours `config.canonical_url`). A host writing its own canonical should make it agree, and should not emit one on search pages, where Shiplog sets `noindex` (`content_for(:shiplog_robots)` is `"noindex"` there).
24
+
3
25
  ## 0.3.1 (2026-10-26)
4
26
 
5
27
  ### Added
6
28
 
7
- - schema.org structured data (JSON-LD) on the public pages, through the new `content_for :shiplog_structured_data` (one `<script type="application/ld+json">` per page). A permalink page is an `Article` (`headline`, `description`, `inLanguage`, `datePublished`, `dateModified`, `url`, `mainEntityOfPage`, and when available `image`, `articleSection` and `publisher`, plus `isPartOf` the changelog); the changelog list is a `CollectionPage` with an `ItemList` of the entries on the page (left out for search results and an empty list); the roadmap is a `CollectionPage` with an `ItemList` of its cards. Titles and descriptions follow the request locale and `config.canonical_url`. The JSON is built from a Hash with `<`, `>` and `&` escaped as `\u003c`, `\u003e` and `\u0026`, so a `</script>` in a title cannot break out of the tag.
8
- - `shiplog_head_tags(except: [])` (`Shiplog::HeadTagsHelper`, with the data side in `Shiplog::HeadHelper`): one call in a host layout's `<head>` renders the description, canonical link, robots, Open Graph, Twitter card, Atom link and JSON-LD of the public pages, through the overridable partials `shiplog/_head_tags` and `shiplog/head/_meta`, `_open_graph`, `_feed` and `_structured_data`. `except:` takes `:description`, `:canonical`, `:robots`, `:open_graph`, `:twitter`, `:feed` and `:structured_data`; other keys raise `ArgumentError`. It returns an empty string outside Shiplog pages. It is available in every view of the host (a Rails `action_view` load hook includes `Shiplog::HeadTagsHelper`, which holds only this method). Shiplog's own layout uses it.
29
+ - schema.org structured data (JSON-LD) on the public pages, rendered by `shiplog_head_tags` (the legacy route is `content_for :shiplog_structured_data`; one `<script type="application/ld+json">` per page). A permalink page is an `Article` (`headline`, `description`, `inLanguage`, `datePublished`, `dateModified`, `url`, `mainEntityOfPage`, and when available `image`, `articleSection` and `publisher`, plus `isPartOf` the changelog); the changelog list is a `CollectionPage` with an `ItemList` of the entries on the page (left out for search results and an empty list); the roadmap is a `CollectionPage` with an `ItemList` of its cards. Titles and descriptions follow the request locale and `config.canonical_url`. The JSON is built from a Hash with `<`, `>` and `&` escaped as `\u003c`, `\u003e` and `\u0026`, so a `</script>` in a title cannot break out of the tag.
30
+ - `shiplog_head_tags(except: [])` (`Shiplog::HeadTagsHelper`, with the data side in `Shiplog::HeadHelper`): one call in a host layout's `<head>` renders the description, canonical link, robots, Open Graph, Twitter card, Atom link and JSON-LD of the public pages, through the overridable partials `shiplog/_head_tags` and `shiplog/head/_meta`, `_open_graph`, `_feed` and `_structured_data`. `except:` takes `:description`, `:canonical`, `:robots`, `:open_graph`, `:twitter`, `:feed` and `:structured_data`; other keys raise `ArgumentError`. It returns an empty string outside Shiplog pages. It is available in every view of the host (a Rails `action_view` load hook includes `Shiplog::HeadTagsHelper`, which holds only this method). **0.3.1 can fail to boot, see 0.3.2.** Shiplog's own layout uses it.
9
31
  - A canonical link (new): a list page's own URL (its `area` and `page`, no other query parameters), a permalink's URL, honouring `config.canonical_url`. Search pages are `noindex` and have no canonical, so the two signals do not disagree. Twitter card tags (`twitter:card`, and `twitter:image`) are new too.
10
- - `config.og_image` (`nil` or `->(entry, locale) { url }`, evaluated in the view): the share image of a permalink page without a screenshot, as `og:image` (with `og:image:alt`), `twitter:image`, `twitter:card` = `summary_large_image` and `Article.image`. Paths are made absolute; an error or a non-http(s) value is logged and ignored. Part of `render_digest`.
32
+ - `config.og_image` (`nil` or `->(entry, locale) { url }`, evaluated in the view): the share image of a permalink page without a screenshot, as `og:image` (with `og:image:alt`), `twitter:image`, `twitter:card` = `summary_large_image` and `Article.image`. Paths are made absolute; an error or a non-http(s) value is logged and ignored. Only its presence is part of `render_digest`, not its output: bump `config.cache_version` when the output changes.
11
33
  - `config.structured_data` (default `true`; `false` turns the JSON-LD off). Part of `render_digest`, so changing it refreshes cached pages.
12
34
 
13
35
  ### Upgrading
14
36
 
15
- - Custom `config.public_layout`: replace the `content_for(:shiplog_description)`, `:shiplog_og`, `:shiplog_feed`, `:shiplog_robots` and `:shiplog_structured_data` renders in the `<head>` with `<%= shiplog_head_tags %>`, and pass `except:` for the tags your layout writes itself (for example `except: [:open_graph, :twitter]` if it has its own share card). The `content_for` blocks are still filled as in 0.3.0 and still work, but are superseded: use `shiplog_head_tags` or the blocks, not both, because `shiplog_head_tags` does not read the blocks and rendering both duplicates the tags. Hosts that keep the blocks need no change.
37
+ - Custom `config.public_layout`: replace the `content_for(:shiplog_description)`, `:shiplog_og`, `:shiplog_feed`, `:shiplog_robots` and `:shiplog_structured_data` renders in the `<head>` with `<%= shiplog_head_tags %>`, and pass `except:` for the tags your layout writes itself (for example `except: [:open_graph, :twitter]` if it has its own share card). The `content_for` blocks still work (`:shiplog_og` now also carries the `config.og_image` fallback image), but are superseded: use `shiplog_head_tags` or the blocks, not both, because `shiplog_head_tags` does not read the blocks and rendering both duplicates the tags. Hosts that keep the blocks need no change.
16
38
  - Hosts with a custom `config.public_layout` that stay on the blocks should render `<%= content_for(:shiplog_structured_data) %>` in the `<head>`, next to `content_for(:shiplog_og)`. Without it the pages work as before, with no structured data. Shiplog's own layout already does.
17
39
 
18
40
  ## 0.3.0 (2026-10-26)
data/README.md CHANGED
@@ -113,11 +113,11 @@ All settings live in `config/initializers/shiplog.rb`:
113
113
  | `extra_pages` | `[]` | Pages added to the switcher after Roadmap and Changelog: `[{ label:, path: }]`, each a String or a callable evaluated in the view. See [Product updates navigation](#product-updates-navigation). Anything else raises `ArgumentError`. |
114
114
  | `repository_labels` | `{}` | Tag shown on a roadmap card for the repository of its issue: `{ "owner/name" => "iPhone & iPad" }`. Values are Strings or callables evaluated in the view; repositories without one show no tag. |
115
115
  | `roadmap_shipped_count` | `4` | How many recently shipped changelog entries (features and changes) the roadmap lists below its columns. `0` hides the section. |
116
- | `cache_version` | `nil` | A String added to the public pages' ETag. Callables (`extra_pages`, `repository_labels`, `feedback_path`) cannot be fingerprinted, so bump it when the output of a callable you configured changes. |
116
+ | `cache_version` | `nil` | A String added to the public pages' ETag. Callables (`extra_pages`, `repository_labels`, `feedback_path`, `og_image`) cannot be fingerprinted, so bump it when the output of a callable you configured changes. Also bump it when you change your layout's head or override a `shiplog/head/*` partial: ETags don't cover layouts. |
117
117
  | `feedback_path` | `nil` | Target of the roadmap's "Suggest a feature" link, a String or a callable evaluated in the view. No link while `nil`. |
118
118
  | `changelog_search` | `true` | Search box on the public changelog and `?q=` filtering. `false` hides the form and ignores `q`. See [Changelog search](#changelog-search). |
119
119
  | `structured_data` | `true` | schema.org JSON-LD on the public pages (see [Head tags](#head-tags)). `false` emits none. See [Structured data](#structured-data). Part of the ETag. |
120
- | `og_image` | `nil` | The image shared with a permalink page that has no screenshot: `nil` or a callable `->(entry, locale) { url }` evaluated in the view (`instance_exec`, so `main_app` route helpers work). See [Head tags](#head-tags). Anything else raises `ArgumentError`. Callables are not part of the ETag: bump `cache_version` when its output changes. |
120
+ | `og_image` | `nil` | The image shared with a permalink page that has no screenshot: `nil` or a callable `->(entry, locale) { url }` evaluated in the view (`instance_exec`, so `main_app` route helpers work). See [Head tags](#head-tags). Anything else raises `ArgumentError`. Only its presence is part of the ETag, not its output: bump `cache_version` when its output changes. |
121
121
  | `on_changelog_seen` | `nil` | `->(controller) { ... }` called before each changelog index or permalink view renders (also for a 304 revisit), to stamp a visitor's "last seen" time. See [What's new](#whats-new-the-unseen-count). Anything but `nil` or a callable raises `ArgumentError`. |
122
122
  | `images` | `true` | [Screenshots](#screenshots) in entries. Effective only when Active Storage is loaded in the host; `false` turns fetching, upload and rendering off. `true` or `false`, anything else raises `ArgumentError`. |
123
123
  | `max_images_per_entry` | `4` | How many images are fetched from the GitHub body of a draft. A non-negative Integer; `0` fetches none (admin uploads are not capped). |
@@ -415,11 +415,14 @@ Shiplog's pages describe themselves in the `<head>`: description, canonical link
415
415
  </head>
416
416
  ```
417
417
 
418
- `shiplog_head_tags` is available in every view of your app (the only Shiplog helper that is), and on any page that is not a Shiplog page it returns an empty string, so it is safe in a layout shared with your own pages. `<title>` stays yours: it is `content_for(:title)`.
418
+ `shiplog_head_tags` is available in every view of your app (the only Shiplog helper that is), and on any page that is not a Shiplog page it returns an empty string, so it is safe in a layout shared with your own pages. Call it in the layout, not inside a component (ViewComponent, Phlex): in a view that doesn't have Shiplog's helpers it also returns an empty string. `<title>` stays yours: it is `content_for(:title)`.
419
+
420
+ After changing your layout's `<head>` or overriding a `shiplog/head/*` partial, bump `config.cache_version`: ETags don't cover layouts, so visitors with a cached page would keep the old tags.
419
421
 
420
422
  - **What each page gets.** Permalink: `description`, `canonical` (the permalink), `og:title`, `og:description`, `og:type` = `article`, `og:url`, `og:image` and `og:image:alt` when there is an image, `twitter:card` (`summary_large_image` with an image, `summary` without) and `twitter:image`, the Atom link and the `Article` JSON-LD. Changelog list: `canonical` (the list's own URL, with its `area` and `page` but without any other query parameter), `og:title`, `og:type` = `website`, `og:url`, `twitter:card` = `summary`, the Atom link and the `CollectionPage`. Roadmap: the same without the Atom link. Each key is emitted once.
421
423
  - **Search pages** (`?q=`) are `noindex` and have **no canonical** (and no `og:url`, no JSON-LD). The alternative, a canonical pointing at the plain list, would tell search engines to index a page while `noindex` tells them not to; mixed signals are ignored or worse, so a search page just asks not to be indexed.
422
424
  - **`except:`** leaves groups out, for tags your layout already writes: `shiplog_head_tags(except: [:canonical, :twitter])`. Valid keys: `:description`, `:canonical`, `:robots`, `:open_graph` (the `og:*` tags), `:twitter` (the `twitter:*` tags), `:feed` and `:structured_data`. Any other key raises `ArgumentError`.
425
+ - **`except: :canonical` and `og:url`.** `except: :canonical` drops only the `<link rel="canonical">`. `og:url` keeps Shiplog's canonical, which honours `config.canonical_url`; to change it, drop `:open_graph` too. A host that writes its own canonical should make it agree with that one, and should not emit a canonical on search pages, where Shiplog sets `noindex`: Shiplog fills `content_for(:shiplog_robots)` with `"noindex"` there (and leaves it empty elsewhere), which your layout can check.
423
426
  - **Overridable partials.** Copy one into your app at the same path to change it (like the other [partials](#4-override-the-partials)):
424
427
 
425
428
  | Partial | Renders |
@@ -431,8 +434,8 @@ Shiplog's pages describe themselves in the `<head>`: description, canonical link
431
434
  | `shiplog/head/_structured_data.html.erb` | the JSON-LD `<script>` |
432
435
 
433
436
  Every partial gets the same locals: `head` (a Hash with `:kind` (`:permalink`, `:changelog` or `:roadmap`), `:title`, `:entry` (permalink only), `:image`, `:canonical` and `:description`), `description`, `canonical`, `robots`, `open_graph` and `twitter` (Hashes of tag name to content), `feed_url`, `feed_title` and `json_ld`. What `except:` removed arrives as `nil` or `{}`, so a partial that renders its locals respects it.
434
- - **The share image.** The permalink page's image is the first screenshot (absolute URL), else what `config.og_image` returns, else none. `config.og_image` is `nil` or `->(entry, locale) { url }`, evaluated in the view (`instance_exec`, so `main_app.my_card_url(entry.slug)` works). A path (`"/cards/dark.png"`) is made absolute with `config.canonical_url` or the request's origin. A callable that raises, or returns anything but an http(s) URL or a path (`javascript:`, `//host`, `nil`), is logged once for the page (`[shiplog] config.og_image ...`) and the page renders without the image. The same image goes in `Article.image` of the JSON-LD. List pages and the roadmap get no image from Shiplog: your default applies, through your own tags (`except: [:open_graph, :twitter]`) or an override of `_open_graph`.
435
- - **The older `content_for` blocks** (`:shiplog_description`, `:shiplog_og`, `:shiplog_feed`, `:shiplog_robots`, `:shiplog_structured_data`) are still filled exactly as in 0.3.0 and still work, but are superseded. Use `shiplog_head_tags` **or** the blocks, not both: `shiplog_head_tags` never reads the blocks, so a layout that renders both emits the tags twice. The blocks have neither the canonical link nor the Twitter tags. Upgrading: replace the `content_for` renders in your `<head>` with `shiplog_head_tags`, and pass `except:` for the tags your layout writes itself.
437
+ - **The share image.** The permalink page's image is the first screenshot whose URL can be built (absolute URL), else what `config.og_image` returns, else none. `config.og_image` is `nil` or `->(entry, locale) { url }`, evaluated in the view (`instance_exec`, so `main_app.my_card_url(entry.slug)` works). A path (`"/cards/dark.png"`) is made absolute with `config.canonical_url` or the request's origin. A callable that raises, or returns anything but an http(s) URL or a path (`javascript:`, `//host`, `nil`), is logged once for the page (`[shiplog] config.og_image ...`) and the page renders without the image. `Article.image` of the JSON-LD lists all the screenshots with a URL, else that same callable image. List pages and the roadmap get no image from Shiplog: your default applies, through your own tags (`except: [:open_graph, :twitter]`) or an override of `_open_graph`.
438
+ - **The older `content_for` blocks** (`:shiplog_description`, `:shiplog_og`, `:shiplog_feed`, `:shiplog_robots`, `:shiplog_structured_data`) are still filled as in 0.3.0 and still work, but are superseded. The one difference: `:shiplog_og` now includes the `config.og_image` fallback image when that is set and the entry has no screenshot. Use `shiplog_head_tags` **or** the blocks, not both: `shiplog_head_tags` never reads the blocks, so a layout that renders both emits the tags twice. The blocks have neither the canonical link nor the Twitter tags. Upgrading: replace the `content_for` renders in your `<head>` with `shiplog_head_tags`, and pass `except:` for the tags your layout writes itself.
436
439
 
437
440
  ## Atom feed
438
441
 
@@ -13,6 +13,10 @@ module Shiplog
13
13
  helper Shiplog::HeadHelper
14
14
  layout -> { Shiplog.config.public_layout }
15
15
 
16
+ # Marks the controllers of the public pages, for shiplog_head_tags: checking this instead of the class keeps
17
+ # host pages from autoloading Shiplog::PublicController (and the host's parent controller).
18
+ def shiplog_public_page? = true
19
+
16
20
  private
17
21
 
18
22
  # Calls config.on_changelog_seen for a visit to the changelog index or a permalink page. It runs before
@@ -9,7 +9,7 @@ module Shiplog
9
9
  # shiplog/head/_open_graph og:* and twitter:*
10
10
  # shiplog/head/_feed the Atom alternate link
11
11
  # shiplog/head/_structured_data the JSON-LD script
12
- # Each receives the locals `head` (a Hash: :kind, :title, :url, :entry, :image, :canonical), `description`,
12
+ # Each receives the locals `head` (a Hash: :kind, :title, :entry, :canonical, :image, :description), `description`,
13
13
  # `canonical`, `robots`, `open_graph` and `twitter` (Hashes of tag name => content), `feed_url`, `feed_title`
14
14
  # and `json_ld`. Whatever `except:` removed arrives as nil or an empty Hash.
15
15
  module HeadHelper
@@ -55,15 +55,16 @@ module Shiplog
55
55
  safe_join(tags.compact_blank.map { |property, content| tag.meta(property:, content:) }, "\n")
56
56
  end
57
57
 
58
- # The absolute URL of the image to show when the page is shared, or nil: the entry's first screenshot, else
58
+ # The absolute URL of the image to show when the page is shared, or nil: the entry's first screenshot with a URL, else
59
59
  # what config.og_image returns for it. Computed once per entry per render, so a failing callable is logged
60
60
  # once for a page.
61
61
  def shiplog_entry_og_image(entry)
62
62
  @shiplog_og_images ||= {}.compare_by_identity
63
63
  return @shiplog_og_images[entry] if @shiplog_og_images.key?(entry)
64
64
 
65
- image = shiplog_images(entry).first
66
- @shiplog_og_images[entry] = (shiplog_image_url(image) if image) || shiplog_configured_og_image(entry)
65
+ # Same rule as the JSON-LD Article image: screenshots whose URL can't be built are skipped.
66
+ screenshot = shiplog_images(entry).lazy.filter_map { |image| shiplog_image_url(image) }.first
67
+ @shiplog_og_images[entry] = screenshot || shiplog_configured_og_image(entry)
67
68
  end
68
69
 
69
70
  # What config.og_image gives for an entry (called in the view with the entry and the locale), as an absolute
@@ -46,8 +46,9 @@ module Shiplog
46
46
  # current), on every visit, and may write: keep it cheap, e.g. write only when the stored time is older than
47
47
  # the newest entry. Nil by default. Not part of the ETag: it doesn't change the markup.
48
48
  attr_reader :on_changelog_seen
49
- # Bump it when the output of a callable you configured changes (extra_pages, repository_labels, feedback_path):
50
- # callables cannot be part of the ETag, so this is how cached public pages learn about it.
49
+ # Bump it when the output of a callable you configured changes (extra_pages, repository_labels, feedback_path,
50
+ # og_image): callables cannot be part of the ETag, so this is how cached public pages learn about it. Also
51
+ # bump it after changing the layout's head or a shiplog/head/* partial: ETags don't cover layouts.
51
52
  attr_accessor :cache_version
52
53
  attr_reader :extra_pages, :repository_labels, :roadmap_shipped_count
53
54
  # How many product areas the AI may create (default 8). Past it, entries can only join existing areas.
@@ -1,22 +1,32 @@
1
1
  module Shiplog
2
+ # Constants of shiplog_head_tags. Not included anywhere, so views of the host cannot see them.
3
+ module HeadTags
4
+ EXCEPT_KEYS = %i[description canonical robots open_graph twitter feed structured_data].freeze
5
+ end
6
+
2
7
  # The one helper added to every view of the host (like a pagination gem's `paginate`), so a layout shared
3
8
  # with the host's own pages can call `shiplog_head_tags`. The rest lives in Shiplog::HeadHelper, which only
4
9
  # the engine's controllers include.
10
+ #
11
+ # This file is required by lib/shiplog.rb rather than autoloaded: the engine includes the module into
12
+ # ActionView::Base from an on_load hook, which can run during boot before the autoloaders are set up, and
13
+ # ActionView::Base never reloads, so the module must not either.
5
14
  module HeadTagsHelper
6
- EXCEPT_KEYS = %i[description canonical robots open_graph twitter feed structured_data].freeze
7
-
8
15
  # The head tags of the current Shiplog page; an empty string on any other page. `except:` leaves groups
9
16
  # out, for tags your layout already writes: :description, :canonical, :robots, :open_graph, :twitter,
10
17
  # :feed, :structured_data. An unknown key raises ArgumentError.
11
18
  #
19
+ # Call it in the layout, not inside a component (ViewComponent, Phlex): there it gives an empty string.
12
20
  # Use it OR the older `content_for :shiplog_*` blocks in a layout, not both: both would emit the tags twice.
13
21
  def shiplog_head_tags(except: [])
14
22
  keys = Array(except).map { |key| key.respond_to?(:to_sym) ? key.to_sym : key }
15
- unknown = keys - EXCEPT_KEYS
23
+ unknown = keys - HeadTags::EXCEPT_KEYS
16
24
  if unknown.any?
17
- raise ArgumentError, "Unknown shiplog_head_tags except: key(s) #{unknown.map(&:inspect).join(", ")}. Valid keys: #{EXCEPT_KEYS.map(&:inspect).join(", ")}"
25
+ raise ArgumentError, "Unknown shiplog_head_tags except: key(s) #{unknown.map(&:inspect).join(", ")}. Valid keys: #{HeadTags::EXCEPT_KEYS.map(&:inspect).join(", ")}"
18
26
  end
19
- return "".html_safe unless controller.is_a?(Shiplog::PublicController)
27
+ # A marker, not is_a?(Shiplog::PublicController): that would autoload the controller (and the host's
28
+ # parent controller) on every host page. Views that don't have the engine's helper (components) skip too.
29
+ return "".html_safe unless controller.respond_to?(:shiplog_public_page?) && respond_to?(:shiplog_render_head_tags, true)
20
30
 
21
31
  shiplog_render_head_tags(keys)
22
32
  end
@@ -1,3 +1,3 @@
1
1
  module Shiplog
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
data/lib/shiplog.rb CHANGED
@@ -4,6 +4,7 @@ require "shiplog/configuration"
4
4
  require "shiplog/github/errors"
5
5
  require "shiplog/github/queries"
6
6
  require "shiplog/github/client"
7
+ require "shiplog/head_tags_helper"
7
8
  require "shiplog/engine"
8
9
  require "shiplog/admin/engine"
9
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiplog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trackberry
@@ -73,7 +73,6 @@ files:
73
73
  - app/helpers/shiplog/callable_helper.rb
74
74
  - app/helpers/shiplog/frontend_helper.rb
75
75
  - app/helpers/shiplog/head_helper.rb
76
- - app/helpers/shiplog/head_tags_helper.rb
77
76
  - app/helpers/shiplog/host_routes_helper.rb
78
77
  - app/helpers/shiplog/permalink_helper.rb
79
78
  - app/helpers/shiplog/roadmap_helper.rb
@@ -181,6 +180,7 @@ files:
181
180
  - lib/shiplog/github/client.rb
182
181
  - lib/shiplog/github/errors.rb
183
182
  - lib/shiplog/github/queries.rb
183
+ - lib/shiplog/head_tags_helper.rb
184
184
  - lib/shiplog/version.rb
185
185
  - lib/tasks/shiplog.rake
186
186
  homepage: https://github.com/Trackberry/shiplog