govuk_publishing_components 21.55.0 → 21.55.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34577f5058eb49bcbf88cbbdc4a50dc11ad7f87ee10706f1cb15bbcd7a08988e
|
|
4
|
+
data.tar.gz: 97ae0ad84975a91c8b2f560b4b80a095fbc75b7f6fd552bb6fcb92d9d8bbd9dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39186c5eb0a7a811aade0cfb0be8b483102473b19ac4f85035d384b01812909a54fda71dade7d9491d6c92968d118594b455682b49d5e3a894ebc6b835579120
|
|
7
|
+
data.tar.gz: 74b21c40ad38212747054d025dfcbca802a44465f9e833606c79e31a1c1fcbbdea880237eb9405361664129b8953ac6abc85498e66a72066cce6ade2f7ed005b
|
|
@@ -47,16 +47,7 @@ module GovukPublishingComponents
|
|
|
47
47
|
additional_files = "@import 'govuk_publishing_components/govuk_frontend_support';\n"
|
|
48
48
|
additional_files << "@import 'govuk_publishing_components/component_support';\n" unless print_styles
|
|
49
49
|
|
|
50
|
-
components = components_in_use
|
|
51
|
-
extra_components = []
|
|
52
|
-
|
|
53
|
-
components.each do |component|
|
|
54
|
-
components_in_component = components_within_component(component)
|
|
55
|
-
extra_components << components_in_component
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
components << extra_components.compact
|
|
59
|
-
components = components.flatten.uniq.sort
|
|
50
|
+
components = find_all_partials_in(components_in_use)
|
|
60
51
|
|
|
61
52
|
components.map { |component|
|
|
62
53
|
"@import 'govuk_publishing_components/components/#{print_path}#{component.gsub('_', '-')}';" if component_has_sass_file(component.gsub("_", "-"), print_styles)
|
|
@@ -66,16 +57,7 @@ module GovukPublishingComponents
|
|
|
66
57
|
def components_in_use_js
|
|
67
58
|
additional_files = "//= require govuk_publishing_components/lib\n"
|
|
68
59
|
|
|
69
|
-
components = components_in_use
|
|
70
|
-
extra_components = []
|
|
71
|
-
|
|
72
|
-
components.each do |component|
|
|
73
|
-
components_in_component = components_within_component(component)
|
|
74
|
-
extra_components << components_in_component
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
components << extra_components.compact
|
|
78
|
-
components = components.flatten.uniq.sort
|
|
60
|
+
components = find_all_partials_in(components_in_use)
|
|
79
61
|
|
|
80
62
|
components.map { |component|
|
|
81
63
|
"//= require govuk_publishing_components/components/#{component.gsub('_', '-')}" if component_has_js_file(component.gsub("_", "-"))
|
|
@@ -110,6 +92,34 @@ module GovukPublishingComponents
|
|
|
110
92
|
matches.flatten.uniq.map(&:to_s).sort.map { |m| m.gsub("govuk_publishing_components/components/", "") }
|
|
111
93
|
end
|
|
112
94
|
|
|
95
|
+
def find_all_partials_in(components)
|
|
96
|
+
components_to_search = components
|
|
97
|
+
partials_found = true
|
|
98
|
+
|
|
99
|
+
while partials_found
|
|
100
|
+
extra_components = find_partials_in(components_to_search)
|
|
101
|
+
|
|
102
|
+
if extra_components.any?
|
|
103
|
+
components << extra_components
|
|
104
|
+
components_to_search = extra_components
|
|
105
|
+
else
|
|
106
|
+
partials_found = false
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
components.flatten.uniq.sort
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def find_partials_in(components)
|
|
114
|
+
extra_components = []
|
|
115
|
+
components.each do |component|
|
|
116
|
+
components_in_component = components_within_component(component)
|
|
117
|
+
extra_components << components_in_component
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
extra_components.flatten.uniq.sort
|
|
121
|
+
end
|
|
122
|
+
|
|
113
123
|
def component_has_sass_file(component, print_styles)
|
|
114
124
|
print_path = "print/" if print_styles
|
|
115
125
|
Pathname.new(@component_gem_path + "/app/assets/stylesheets/govuk_publishing_components/components/#{print_path}_#{component}.scss").exist?
|
|
@@ -120,8 +130,10 @@ module GovukPublishingComponents
|
|
|
120
130
|
end
|
|
121
131
|
|
|
122
132
|
def components_within_component(component)
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
filename = @component_gem_path + "/app/views/govuk_publishing_components/components/#{component}.html.erb"
|
|
134
|
+
filename = filename.sub(/.*\K\//, "/_") # files begin with _ but the method may have been passed 'filename' or 'dir/partial'
|
|
135
|
+
data = File.read(filename)
|
|
136
|
+
match = data.scan(/(govuk_publishing_components\/components\/[\/a-z_-]+)/)
|
|
125
137
|
match.flatten.uniq.map(&:to_s).sort.map { |m| m.gsub("govuk_publishing_components/components/", "") }
|
|
126
138
|
end
|
|
127
139
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_publishing_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 21.55.
|
|
4
|
+
version: 21.55.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-06-
|
|
11
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gds-api-adapters
|