govuk-components 5.13.0 → 6.0.0b1
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 +4 -4
- data/README.md +29 -29
- data/app/components/govuk_component/header_component.html.erb +39 -55
- data/app/components/govuk_component/header_component.rb +2 -71
- data/app/components/govuk_component/service_navigation_component/navigation_item_component.rb +7 -2
- data/app/components/govuk_component/service_navigation_component.rb +1 -1
- data/app/components/govuk_component/tag_component.rb +1 -1
- data/app/helpers/govuk_components_helper.rb +2 -2
- data/lib/govuk/components/engine.rb +3 -11
- data/lib/govuk/components/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f97e535e9703bba722db814e9193bf4e0267b40ab1fd72208bdc6382b82a0df1
|
|
4
|
+
data.tar.gz: 88076d5caf8d3f79563b6b983ff4c6f3a7754ab75dc6e6d0be0d0270e0f1acf6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa0036d6229ac5776b268fb076bfea89ceec5b0eb9caf7d7435fc137fff4406f2f7b6e53435d627f6224f52ca489c453666b88e1763ac4e8d46ce0bb5d9800f3
|
|
7
|
+
data.tar.gz: a27910e167da38431c7a0840931cf8b1e1fd8639369149fc85d780592ce3db9ce8c10acc973e932fce0d2ffe883cd7293af44d2f1e0658c15a7fe6c868d31166
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://badge.fury.io/rb/govuk-components)
|
|
5
5
|
[](https://rubygems.org/gems/govuk-components)
|
|
6
6
|
[](https://github.com/x-govuk/govuk-components/blob/main/LICENSE.txt)
|
|
7
|
-
[](https://design-system.service.gov.uk)
|
|
8
8
|
[](https://viewcomponent.org/)
|
|
9
9
|
[](https://weblog.rubyonrails.org/releases/)
|
|
10
10
|
[](https://www.ruby-lang.org/en/downloads/)
|
|
@@ -15,41 +15,41 @@ It aims to implement the functionality from the original Nunjucks macros in a wa
|
|
|
15
15
|
|
|
16
16
|
## Documentation
|
|
17
17
|
|
|
18
|
-
The gem comes with [a full guide](https://govuk-components.
|
|
18
|
+
The gem comes with [a full guide](https://govuk-components.x-govuk.org/) that covers most aspects of day-to-day use, along with code and output examples. The examples in the guide (and the guide itself) are built using the components, so it will always be up to date.
|
|
19
19
|
|
|
20
20
|
[](https://app.netlify.com/sites/govuk-components/deploys)
|
|
21
21
|
|
|
22
22
|
## What’s included?
|
|
23
23
|
|
|
24
|
-
All of the non-form components from the GOV.UK Design System are implemented by this library as ViewComponents. Form components are implemented by the [GOV.UK Form Builder](https://govuk-form-builder.
|
|
24
|
+
All of the non-form components from the GOV.UK Design System are implemented by this library as ViewComponents. Form components are implemented by the [GOV.UK Form Builder](https://govuk-form-builder.x-govuk.org/).
|
|
25
25
|
|
|
26
26
|
The provided components are:
|
|
27
27
|
|
|
28
|
-
* [Accordion](https://govuk-components.
|
|
29
|
-
* [Back link](https://govuk-components.
|
|
30
|
-
* [Breadcrumbs](https://govuk-components.
|
|
31
|
-
* [Cookie banner](https://govuk-components.
|
|
32
|
-
* [Details](https://govuk-components.
|
|
33
|
-
* [Exit this page](https://govuk-components.
|
|
34
|
-
* [GOV.UK footer](https://govuk-components.
|
|
35
|
-
* [GOV.UK header](https://govuk-components.
|
|
36
|
-
* [Inset text](https://govuk-components.
|
|
37
|
-
* [Notification banner](https://govuk-components.
|
|
38
|
-
* [Panel](https://govuk-components.
|
|
39
|
-
* [Pagination](https://govuk-components.
|
|
40
|
-
* [Phase banner](https://govuk-components.
|
|
41
|
-
* [Section break](https://govuk-components.
|
|
42
|
-
* [Start button](https://govuk-components.
|
|
43
|
-
* [Summary list](https://govuk-components.
|
|
44
|
-
* [Tabs](https://govuk-components.
|
|
45
|
-
* [Tables](https://govuk-components.
|
|
46
|
-
* [Tags](https://govuk-components.
|
|
47
|
-
* [Task list](https://govuk-components.
|
|
48
|
-
* [Warning text](https://govuk-components.
|
|
49
|
-
|
|
50
|
-
This library also provides helpers for creating [links](https://govuk-components.
|
|
51
|
-
[buttons](https://govuk-components.
|
|
52
|
-
and [back to top links](https://govuk-components.
|
|
28
|
+
* [Accordion](https://govuk-components.x-govuk.org/components/accordion)
|
|
29
|
+
* [Back link](https://govuk-components.x-govuk.org/components/back-link)
|
|
30
|
+
* [Breadcrumbs](https://govuk-components.x-govuk.org/components/breadcrumbs)
|
|
31
|
+
* [Cookie banner](https://govuk-components.x-govuk.org/components/cookie-banner)
|
|
32
|
+
* [Details](https://govuk-components.x-govuk.org/components/details)
|
|
33
|
+
* [Exit this page](https://govuk-components.x-govuk.org/components/exit-this-page)
|
|
34
|
+
* [GOV.UK footer](https://govuk-components.x-govuk.org/components/footer)
|
|
35
|
+
* [GOV.UK header](https://govuk-components.x-govuk.org/components/header)
|
|
36
|
+
* [Inset text](https://govuk-components.x-govuk.org/components/inset-text)
|
|
37
|
+
* [Notification banner](https://govuk-components.x-govuk.org/components/notification-banner)
|
|
38
|
+
* [Panel](https://govuk-components.x-govuk.org/components/panel)
|
|
39
|
+
* [Pagination](https://govuk-components.x-govuk.org/components/pagination)
|
|
40
|
+
* [Phase banner](https://govuk-components.x-govuk.org/components/phase-banner)
|
|
41
|
+
* [Section break](https://govuk-components.x-govuk.org/components/section-break)
|
|
42
|
+
* [Start button](https://govuk-components.x-govuk.org/components/start-button)
|
|
43
|
+
* [Summary list](https://govuk-components.x-govuk.org/components/summary-list)
|
|
44
|
+
* [Tabs](https://govuk-components.x-govuk.org/components/tabs)
|
|
45
|
+
* [Tables](https://govuk-components.x-govuk.org/components/table)
|
|
46
|
+
* [Tags](https://govuk-components.x-govuk.org/components/tag)
|
|
47
|
+
* [Task list](https://govuk-components.x-govuk.org/components/task-list)
|
|
48
|
+
* [Warning text](https://govuk-components.x-govuk.org/components/warning-text)
|
|
49
|
+
|
|
50
|
+
This library also provides helpers for creating [links](https://govuk-components.x-govuk.org/helpers/link),
|
|
51
|
+
[buttons](https://govuk-components.x-govuk.org/helpers/button), [skip links](https://govuk-components.x-govuk.org/helpers/skip-link)
|
|
52
|
+
and [back to top links](https://govuk-components.x-govuk.org/helpers/back-to-top-link).
|
|
53
53
|
|
|
54
54
|
## Alternative syntax
|
|
55
55
|
|
|
@@ -97,7 +97,7 @@ Here are the rendered tabs:
|
|
|
97
97
|
|
|
98
98
|

|
|
99
99
|
|
|
100
|
-
For examples on usage see the [guide page](https://govuk-components.
|
|
100
|
+
For examples on usage see the [guide page](https://govuk-components.x-govuk.org/).
|
|
101
101
|
|
|
102
102
|
## Setup
|
|
103
103
|
|
|
@@ -1,60 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
<%= tag.div(**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<% if product_name.present? %>
|
|
36
|
-
<%= product_name %>
|
|
37
|
-
<% end %>
|
|
38
|
-
<% end %>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<% if service_name.present? || navigation_items.present? %>
|
|
42
|
-
<div class="<%= brand %>-header__content">
|
|
43
|
-
<% if service_name.present? %>
|
|
44
|
-
<%= link_to(service_name, service_url, class: ["#{brand}-header__link", "#{brand}-header__service-name"]) %>
|
|
45
|
-
<% end %>
|
|
46
|
-
|
|
47
|
-
<% if navigation_items.any? %>
|
|
48
|
-
<%= tag.nav(**navigation_html_attributes) do %>
|
|
49
|
-
<%= tag.button("Menu", type: "button", class: ["#{brand}-header__menu-button", "#{brand}-js-header-toggle"], hidden: true, aria: { controls: "navigation", label: menu_button_label }) %>
|
|
50
|
-
<ul id="navigation" class="<%= brand %>-header__navigation-list">
|
|
51
|
-
<% navigation_items.each do |item| %>
|
|
52
|
-
<%= item %>
|
|
53
|
-
<% end %>
|
|
54
|
-
</ul>
|
|
1
|
+
<header>
|
|
2
|
+
<%= tag.div(data: { module: "#{brand}-header" }, **html_attributes) do %>
|
|
3
|
+
<%= tag.div(**container_html_attributes) do %>
|
|
4
|
+
<div class="<%= brand %>-header__logo">
|
|
5
|
+
<%= link_to(homepage_url, class: ["#{brand}-header__link", "#{brand}-header__homepage-link"]) do %>
|
|
6
|
+
<% if custom_logo.present? %>
|
|
7
|
+
<%= custom_logo %>
|
|
8
|
+
<% else %>
|
|
9
|
+
<svg
|
|
10
|
+
focusable="false"
|
|
11
|
+
role="img"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
viewBox="0 0 324 60"
|
|
14
|
+
height="30"
|
|
15
|
+
width="162"
|
|
16
|
+
fill="currentcolor"
|
|
17
|
+
class="<%= brand %>-header__logotype"
|
|
18
|
+
aria-label="GOV.UK"
|
|
19
|
+
>
|
|
20
|
+
<title>GOV.UK</title>
|
|
21
|
+
<g>
|
|
22
|
+
<circle cx="20" cy="17.6" r="3.7"/>
|
|
23
|
+
<circle cx="10.2" cy="23.5" r="3.7"/>
|
|
24
|
+
<circle cx="3.7" cy="33.2" r="3.7"/>
|
|
25
|
+
<circle cx="31.7" cy="30.6" r="3.7"/>
|
|
26
|
+
<circle cx="43.3" cy="17.6" r="3.7"/>
|
|
27
|
+
<circle cx="53.2" cy="23.5" r="3.7"/>
|
|
28
|
+
<circle cx="59.7" cy="33.2" r="3.7"/>
|
|
29
|
+
<circle cx="31.7" cy="30.6" r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navigation %>
|
|
43
|
+
<%= phase_banner %>
|
|
44
|
+
</header>
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
2
|
-
renders_many :navigation_items, "NavigationItem"
|
|
3
2
|
renders_one :custom_logo
|
|
4
3
|
renders_one :product_name, "ProductName"
|
|
4
|
+
renders_one :service_navigation, "GovukComponent::ServiceNavigationComponent"
|
|
5
|
+
renders_one :phase_banner, "GovukComponent::PhaseBannerComponent"
|
|
5
6
|
|
|
6
7
|
attr_reader :homepage_url,
|
|
7
8
|
:service_name,
|
|
8
9
|
:service_url,
|
|
9
10
|
:menu_button_label,
|
|
10
|
-
:navigation_label,
|
|
11
|
-
:custom_navigation_classes,
|
|
12
11
|
:custom_container_classes,
|
|
13
12
|
:full_width_border
|
|
14
13
|
|
|
@@ -16,10 +15,6 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
|
16
15
|
html_attributes: {},
|
|
17
16
|
homepage_url: config.default_header_homepage_url,
|
|
18
17
|
menu_button_label: config.default_header_menu_button_label,
|
|
19
|
-
navigation_classes: [],
|
|
20
|
-
navigation_label: config.default_header_navigation_label,
|
|
21
|
-
service_name: config.default_header_service_name,
|
|
22
|
-
service_url: config.default_header_service_url,
|
|
23
18
|
container_classes: nil,
|
|
24
19
|
full_width_border: false)
|
|
25
20
|
|
|
@@ -27,20 +22,12 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
|
27
22
|
@service_name = service_name
|
|
28
23
|
@service_url = service_url
|
|
29
24
|
@menu_button_label = menu_button_label
|
|
30
|
-
@custom_navigation_classes = navigation_classes
|
|
31
|
-
@navigation_label = navigation_label
|
|
32
25
|
@custom_container_classes = container_classes
|
|
33
26
|
@full_width_border = full_width_border
|
|
34
27
|
|
|
35
28
|
super(classes:, html_attributes:)
|
|
36
29
|
end
|
|
37
30
|
|
|
38
|
-
def before_render
|
|
39
|
-
if service_name.present? || navigation_items.present?
|
|
40
|
-
Rails.logger.warn('Service name and navigation links are deprecated and will be removed in the next breaking release of GOV.UK Frontend. See https://github.com/alphagov/govuk-frontend/releases/tag/v5.9.0')
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
31
|
private
|
|
45
32
|
|
|
46
33
|
def default_attributes
|
|
@@ -52,66 +39,10 @@ private
|
|
|
52
39
|
}
|
|
53
40
|
end
|
|
54
41
|
|
|
55
|
-
def navigation_html_attributes
|
|
56
|
-
nc = ["#{brand}-header__navigation"].append(custom_navigation_classes).compact
|
|
57
|
-
|
|
58
|
-
{ class: nc, aria: { label: navigation_label } }
|
|
59
|
-
end
|
|
60
|
-
|
|
61
42
|
def container_html_attributes
|
|
62
43
|
{ class: ["#{brand}-header__container", "#{brand}-width-container"].append(custom_container_classes).compact }
|
|
63
44
|
end
|
|
64
45
|
|
|
65
|
-
class NavigationItem < GovukComponent::Base
|
|
66
|
-
attr_reader :text, :href, :options, :active
|
|
67
|
-
|
|
68
|
-
def initialize(text:, href: nil, options: {}, active: nil, classes: [], html_attributes: {})
|
|
69
|
-
@text = text
|
|
70
|
-
@href = href
|
|
71
|
-
@options = options
|
|
72
|
-
@active_override = active
|
|
73
|
-
|
|
74
|
-
super(classes:, html_attributes:)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def before_render
|
|
78
|
-
if active?
|
|
79
|
-
html_attributes[:class] << active_class
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def active_class
|
|
84
|
-
["#{brand}-header__navigation-item--active"] if active?
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def link?
|
|
88
|
-
href.present?
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def call
|
|
92
|
-
tag.li(**html_attributes) do
|
|
93
|
-
if link?
|
|
94
|
-
link_to(text, href, class: "#{brand}-header__link", **options)
|
|
95
|
-
else
|
|
96
|
-
text
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
private
|
|
102
|
-
|
|
103
|
-
def active?
|
|
104
|
-
return @active_override unless @active_override.nil?
|
|
105
|
-
return false if href.blank?
|
|
106
|
-
|
|
107
|
-
current_page?(href)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def default_attributes
|
|
111
|
-
{ class: ["#{brand}-header__navigation-item"] }
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
46
|
class ProductName < GovukComponent::Base
|
|
116
47
|
attr_reader :name
|
|
117
48
|
|
data/app/components/govuk_component/service_navigation_component/navigation_item_component.rb
CHANGED
|
@@ -76,8 +76,13 @@ private
|
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def aria_current
|
|
79
|
-
|
|
79
|
+
{ aria: { current: aria_current_value } }
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def aria_current_value
|
|
83
|
+
return 'page' if current?
|
|
84
|
+
return true if active?
|
|
80
85
|
|
|
81
|
-
|
|
86
|
+
nil
|
|
82
87
|
end
|
|
83
88
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class GovukComponent::TagComponent < GovukComponent::Base
|
|
2
2
|
attr_reader :text, :colour
|
|
3
3
|
|
|
4
|
-
COLOURS = %w(grey green
|
|
4
|
+
COLOURS = %w(grey green teal blue light-blue red purple magenta orange yellow).freeze
|
|
5
5
|
|
|
6
6
|
def initialize(text: nil, colour: config.default_tag_colour, classes: [], html_attributes: {})
|
|
7
7
|
@text = text
|
|
@@ -26,8 +26,8 @@ module GovukComponentsHelper
|
|
|
26
26
|
}.each do |name, klass|
|
|
27
27
|
define_method(name) do |*args, **kwargs, &block|
|
|
28
28
|
capture do
|
|
29
|
-
render(klass.constantize.new(*args, **kwargs)) do |
|
|
30
|
-
block.call(
|
|
29
|
+
render(klass.constantize.new(*args, **kwargs)) do |component|
|
|
30
|
+
block.presence&.call(component)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -53,11 +53,7 @@ module Govuk
|
|
|
53
53
|
# +:default_exit_this_page_timed_out_text+ Text announced by screen readers when the keyboard shortcut has timed out without successful activation. Default in govuk-frontend is 'Exit this page expired.' Defaults to nil so govuk-frontend value is used unless overridden.
|
|
54
54
|
# +:default_exit_this_page_press_two_more_times_text+ Text announced by screen readers when the user must press *Shift* two more times to activate the button. Default in govuk-frontend is 'Shift, press 2 more times to exit.' Defaults to nil so govuk-frontend value is used unless overridden.
|
|
55
55
|
# +:default_exit_this_page_press_one_more_time_text+ Text announced by screen readers when the user must press *Shift* one more time to activate the button. Default in govuk-frontend is 'Shift, press 1 more time to exit.' Defaults to nil so govuk-frontend value is used unless overridden.
|
|
56
|
-
# +:
|
|
57
|
-
# +:default_header_menu_button_label+ 'Show or hide navigation menu'
|
|
58
|
-
# +:default_header_homepage_url+ '/'
|
|
59
|
-
# +:default_header_service_name+ nil
|
|
60
|
-
# +:default_header_service_url+ '/'
|
|
56
|
+
# +:default_header_homepage_url+ 'https://www.gov.uk'
|
|
61
57
|
# +:default_footer_meta_text+ nil
|
|
62
58
|
# +:default_footer_copyright_text+ '© Crown copyright'
|
|
63
59
|
# +:default_footer_copyright_url+ "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
|
|
@@ -68,7 +64,7 @@ module Govuk
|
|
|
68
64
|
# +:default_phase_banner_text+ nil
|
|
69
65
|
# +:default_section_break_visible+ false
|
|
70
66
|
# +:default_section_break_size+ Size of the section break, possible values: +m+, +l+ and +xl+. Defaults to nil.
|
|
71
|
-
# +:default_tag_colour+ the default colour for tags, possible values: +grey+, +green+, +
|
|
67
|
+
# +:default_tag_colour+ the default colour for tags, possible values: +grey+, +green+, +teal+, +blue+, +red+, +purple+, +magenta+, +orange+, +yellow+. Defaults to +nil+
|
|
72
68
|
# +:default_start_button_as_button+ false
|
|
73
69
|
# +:default_summary_list_borders+ true
|
|
74
70
|
# +:default_summary_list_value_text+ the fallback text for summary list values which will be displayed when the value is nil. Defaults to +""+
|
|
@@ -119,11 +115,7 @@ module Govuk
|
|
|
119
115
|
default_exit_this_page_timed_out_text: nil,
|
|
120
116
|
default_exit_this_page_press_two_more_times_text: nil,
|
|
121
117
|
default_exit_this_page_press_one_more_time_text: nil,
|
|
122
|
-
|
|
123
|
-
default_header_menu_button_label: 'Show or hide menu',
|
|
124
|
-
default_header_homepage_url: '/',
|
|
125
|
-
default_header_service_name: nil,
|
|
126
|
-
default_header_service_url: '/',
|
|
118
|
+
default_header_homepage_url: 'https://www.gov.uk',
|
|
127
119
|
default_footer_meta_text: nil,
|
|
128
120
|
default_footer_copyright_text: '© Crown copyright',
|
|
129
121
|
default_footer_copyright_url: "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/",
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk-components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.0b1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- DfE developers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-02-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: html-attributes-utils
|
|
@@ -59,7 +59,7 @@ dependencies:
|
|
|
59
59
|
version: '4.0'
|
|
60
60
|
- - "<"
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '4.
|
|
62
|
+
version: '4.3'
|
|
63
63
|
type: :runtime
|
|
64
64
|
prerelease: false
|
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -69,7 +69,7 @@ dependencies:
|
|
|
69
69
|
version: '4.0'
|
|
70
70
|
- - "<"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '4.
|
|
72
|
+
version: '4.3'
|
|
73
73
|
- !ruby/object:Gem::Dependency
|
|
74
74
|
name: deep_merge
|
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -146,14 +146,14 @@ dependencies:
|
|
|
146
146
|
requirements:
|
|
147
147
|
- - '='
|
|
148
148
|
- !ruby/object:Gem::Version
|
|
149
|
-
version: 5.
|
|
149
|
+
version: 5.2.0
|
|
150
150
|
type: :development
|
|
151
151
|
prerelease: false
|
|
152
152
|
version_requirements: !ruby/object:Gem::Requirement
|
|
153
153
|
requirements:
|
|
154
154
|
- - '='
|
|
155
155
|
- !ruby/object:Gem::Version
|
|
156
|
-
version: 5.
|
|
156
|
+
version: 5.2.0
|
|
157
157
|
- !ruby/object:Gem::Dependency
|
|
158
158
|
name: sassc-rails
|
|
159
159
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -244,14 +244,14 @@ dependencies:
|
|
|
244
244
|
requirements:
|
|
245
245
|
- - "~>"
|
|
246
246
|
- !ruby/object:Gem::Version
|
|
247
|
-
version: 4.
|
|
247
|
+
version: 4.7.0
|
|
248
248
|
type: :development
|
|
249
249
|
prerelease: false
|
|
250
250
|
version_requirements: !ruby/object:Gem::Requirement
|
|
251
251
|
requirements:
|
|
252
252
|
- - "~>"
|
|
253
253
|
- !ruby/object:Gem::Version
|
|
254
|
-
version: 4.
|
|
254
|
+
version: 4.7.0
|
|
255
255
|
- !ruby/object:Gem::Dependency
|
|
256
256
|
name: rubypants
|
|
257
257
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -433,9 +433,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
433
433
|
version: '0'
|
|
434
434
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
435
435
|
requirements:
|
|
436
|
-
- - "
|
|
436
|
+
- - ">"
|
|
437
437
|
- !ruby/object:Gem::Version
|
|
438
|
-
version:
|
|
438
|
+
version: 1.3.1
|
|
439
439
|
requirements: []
|
|
440
440
|
rubygems_version: 3.4.19
|
|
441
441
|
signing_key:
|