govuk_document_types 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +44 -0
- data/.rubocop.yml +18 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/Rakefile +3 -1
- data/data/supergroups.yml +1 -0
- data/data/supertypes.yml +18 -8
- data/govuk_document_types.gemspec +10 -8
- data/lib/govuk_document_types/translations_railtie.rb +4 -4
- data/lib/govuk_document_types/version.rb +1 -1
- data/lib/govuk_document_types.rb +9 -9
- data/rails/locale/en.yml +1 -0
- metadata +38 -22
- data/Jenkinsfile +0 -7
- /data/{LICENSE.txt → LICENCE} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3b729644e55efe8ac733b1bf0c2613a65c2c739fc94cb3318b5b4270520eaea
|
4
|
+
data.tar.gz: 03d7678ad10b4d91354b233adf96313bca1a2928a936c9ad35ef08ac5e7e59c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff79f8bcf5310ed241623f5c5734cc0c813d2831bc097eaf3a5173e9471c150e9bf2c7992a505fb891032800edfb07da13ab7b5f36001981c8298718cb3eb1e
|
7
|
+
data.tar.gz: 4cf6f46dcb8c84d69726d9ba847b17f0b0d47f9016a7ca624c41d7ecaf05d514c42005db5da43d18f5d317aadbb7a3d6785a5acaa97501722fd2d70093d566ef
|
@@ -0,0 +1,44 @@
|
|
1
|
+
on: [push, pull_request]
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
# This matrix job runs the test suite against multiple Ruby versions
|
5
|
+
test_matrix:
|
6
|
+
strategy:
|
7
|
+
fail-fast: false
|
8
|
+
matrix:
|
9
|
+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
10
|
+
ruby: ['3.0', 3.1, 3.2]
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Clone publishing-api for content schemas
|
15
|
+
uses: actions/checkout@v2
|
16
|
+
with:
|
17
|
+
repository: alphagov/publishing-api
|
18
|
+
ref: main
|
19
|
+
path: tmp/publishing-api
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
bundler-cache: true
|
24
|
+
- run: bundle exec rake
|
25
|
+
env:
|
26
|
+
GOVUK_CONTENT_SCHEMAS_PATH: tmp/publishing-api/content_schemas
|
27
|
+
|
28
|
+
# Branch protection rules cannot directly depend on status checks from matrix jobs.
|
29
|
+
# So instead we define `test` as a dummy job which only runs after the preceding `test_matrix` checks have passed.
|
30
|
+
# Solution inspired by: https://github.community/t/status-check-for-a-matrix-jobs/127354/3
|
31
|
+
test:
|
32
|
+
needs: test_matrix
|
33
|
+
runs-on: ubuntu-latest
|
34
|
+
steps:
|
35
|
+
- run: echo "All matrix tests have passed 🚀"
|
36
|
+
|
37
|
+
publish:
|
38
|
+
needs: test
|
39
|
+
if: ${{ github.ref == 'refs/heads/main' }}
|
40
|
+
permissions:
|
41
|
+
contents: write
|
42
|
+
uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.yml@main
|
43
|
+
secrets:
|
44
|
+
GEM_HOST_API_KEY: ${{ secrets.ALPHAGOV_RUBYGEMS_API_KEY }}
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-govuk:
|
3
|
+
- config/default.yml
|
4
|
+
- config/rspec.yml
|
5
|
+
|
6
|
+
inherit_mode:
|
7
|
+
merge:
|
8
|
+
- Exclude
|
9
|
+
|
10
|
+
# **************************************************************
|
11
|
+
# TRY NOT TO ADD OVERRIDES IN THIS FILE
|
12
|
+
#
|
13
|
+
# This repo is configured to follow the RuboCop GOV.UK styleguide.
|
14
|
+
# Any rules you override here will cause this repo to diverge from
|
15
|
+
# the way we write code in all other GOV.UK repos.
|
16
|
+
#
|
17
|
+
# See https://github.com/alphagov/rubocop-govuk/blob/main/CONTRIBUTING.md
|
18
|
+
# **************************************************************
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 2.0.0
|
2
|
+
|
3
|
+
* BREAKING: Drop support for Ruby 2.7 ([PR #89](https://github.com/alphagov/govuk_document_types/pull/89))
|
4
|
+
* Added new call for evidence document type to supertypes and group ([PR #91](https://github.com/alphagov/govuk_document_types/pull/91))
|
5
|
+
|
1
6
|
# 1.0.1
|
2
7
|
|
3
8
|
* Remove Flood & Coastal Erosion Risk Management Report (FCERM) Research Report from research supergroup
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/data/supergroups.yml
CHANGED
data/data/supertypes.yml
CHANGED
@@ -27,6 +27,9 @@ email_document_supertype:
|
|
27
27
|
items:
|
28
28
|
- id: "publications"
|
29
29
|
document_types:
|
30
|
+
- call_for_evidence
|
31
|
+
- call_for_evidence_outcome
|
32
|
+
- closed_call_for_evidence
|
30
33
|
- closed_consultation
|
31
34
|
- consultation
|
32
35
|
- consultation_outcome
|
@@ -43,6 +46,7 @@ email_document_supertype:
|
|
43
46
|
- national_statistics
|
44
47
|
- notice
|
45
48
|
- official_statistics
|
49
|
+
- open_call_for_evidence
|
46
50
|
- open_consultation
|
47
51
|
- policy_paper
|
48
52
|
- promotional
|
@@ -69,6 +73,12 @@ government_document_supertype:
|
|
69
73
|
# we expect that everything should be mapped to a valid supertype.
|
70
74
|
default: other
|
71
75
|
items:
|
76
|
+
- id: calls-for-evidence
|
77
|
+
document_types:
|
78
|
+
- call_for_evidence
|
79
|
+
- open_call_for_evidence
|
80
|
+
- call_for_evidence_outcome
|
81
|
+
- closed_call_for_evidence
|
72
82
|
- id: consultations
|
73
83
|
document_types:
|
74
84
|
- consultation
|
@@ -162,10 +172,8 @@ content_purpose_subgroup:
|
|
162
172
|
- id: news
|
163
173
|
document_types:
|
164
174
|
- case_study
|
165
|
-
- news_article
|
166
175
|
- news_story
|
167
176
|
- press_release
|
168
|
-
- world_location_news_article
|
169
177
|
- world_news_story
|
170
178
|
- fatality_notice
|
171
179
|
- id: decisions
|
@@ -191,7 +199,6 @@ content_purpose_subgroup:
|
|
191
199
|
- completed_transaction
|
192
200
|
- local_transaction
|
193
201
|
- form
|
194
|
-
- calculator
|
195
202
|
- smart_answer
|
196
203
|
- simple_smart_answer
|
197
204
|
- place
|
@@ -236,7 +243,6 @@ content_purpose_subgroup:
|
|
236
243
|
- consultation_outcome
|
237
244
|
- id: research
|
238
245
|
document_types:
|
239
|
-
- dfid_research_output
|
240
246
|
- independent_report
|
241
247
|
- research
|
242
248
|
- id: statistics
|
@@ -260,6 +266,11 @@ content_purpose_subgroup:
|
|
260
266
|
- aaib_report
|
261
267
|
- raib_report
|
262
268
|
- maib_report
|
269
|
+
- id: calls_for_evidence
|
270
|
+
document_types:
|
271
|
+
- open_call_for_evidence
|
272
|
+
- closed_call_for_evidence
|
273
|
+
- call_for_evidence_outcome
|
263
274
|
|
264
275
|
content_purpose_supergroup:
|
265
276
|
name: "Content Purpose Supergroup"
|
@@ -270,10 +281,8 @@ content_purpose_supergroup:
|
|
270
281
|
document_types:
|
271
282
|
- medical_safety_alert
|
272
283
|
- drug_safety_update
|
273
|
-
- news_article
|
274
284
|
- news_story
|
275
285
|
- press_release
|
276
|
-
- world_location_news_article
|
277
286
|
- world_news_story
|
278
287
|
- fatality_notice
|
279
288
|
- tax_tribunal_decision
|
@@ -296,7 +305,6 @@ content_purpose_supergroup:
|
|
296
305
|
- completed_transaction
|
297
306
|
- local_transaction
|
298
307
|
- form
|
299
|
-
- calculator
|
300
308
|
- smart_answer
|
301
309
|
- simple_smart_answer
|
302
310
|
- place
|
@@ -333,9 +341,11 @@ content_purpose_supergroup:
|
|
333
341
|
- open_consultation
|
334
342
|
- closed_consultation
|
335
343
|
- consultation_outcome
|
344
|
+
- open_call_for_evidence
|
345
|
+
- closed_call_for_evidence
|
346
|
+
- call_for_evidence_outcome
|
336
347
|
- id: research_and_statistics
|
337
348
|
document_types:
|
338
|
-
- dfid_research_output
|
339
349
|
- independent_report
|
340
350
|
- research
|
341
351
|
- statistics
|
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require "govuk_document_types/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "govuk_document_types"
|
@@ -13,15 +12,18 @@ Gem::Specification.new do |spec|
|
|
13
12
|
spec.homepage = "https://github.com/alphagov/govuk_document_types"
|
14
13
|
spec.license = "MIT"
|
15
14
|
|
16
|
-
spec.
|
15
|
+
spec.required_ruby_version = ">= 3.0"
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
17
|
f.match(%r{^(test|spec|features)/})
|
18
18
|
end
|
19
|
+
|
19
20
|
spec.bindir = "exe"
|
20
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = %w[lib]
|
22
23
|
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
-
spec.add_development_dependency "govuk-lint", "~> 3.0"
|
24
|
+
spec.add_development_dependency "govuk_schemas", ">= 4.5.0"
|
26
25
|
spec.add_development_dependency "i18n-spec"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "rubocop-govuk", "4.10.0"
|
27
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require "rails"
|
2
2
|
module GovukDocumentTypes
|
3
3
|
class TranslationsRailtie < ::Rails::Railtie
|
4
|
-
initializer
|
4
|
+
initializer "govuk_document_types" do |app|
|
5
5
|
GovukDocumentTypes::TranslationsRailtie.instance_eval do
|
6
6
|
pattern = pattern_from app.config.i18n.available_locales
|
7
7
|
add("rails/locale/#{pattern}.yml")
|
@@ -9,13 +9,13 @@ module GovukDocumentTypes
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.add(pattern)
|
12
|
-
files = Dir[File.join(File.dirname(__FILE__),
|
12
|
+
files = Dir[File.join(File.dirname(__FILE__), "../..", pattern)]
|
13
13
|
I18n.load_path.concat(files)
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.pattern_from(args)
|
17
17
|
array = Array(args || [])
|
18
|
-
array.blank? ?
|
18
|
+
array.blank? ? "*" : "{#{array.join ','}}"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/govuk_document_types.rb
CHANGED
@@ -3,15 +3,15 @@ require "govuk_document_types/version"
|
|
3
3
|
require "yaml"
|
4
4
|
|
5
5
|
module GovukDocumentTypes
|
6
|
-
SUPERTYPES = YAML.load_file(File.dirname(__FILE__)
|
7
|
-
SUPERGROUPS = YAML.load_file(File.dirname(__FILE__)
|
6
|
+
SUPERTYPES = YAML.load_file("#{File.dirname(__FILE__)}/../data/supertypes.yml")
|
7
|
+
SUPERGROUPS = YAML.load_file("#{File.dirname(__FILE__)}/../data/supergroups.yml")
|
8
8
|
|
9
9
|
def self.supertypes(document_type:)
|
10
10
|
types = {}
|
11
11
|
|
12
12
|
SUPERTYPES.each do |name, definition|
|
13
13
|
group_data = definition["items"].find do |supertype|
|
14
|
-
supertype[
|
14
|
+
supertype["document_types"].include?(document_type)
|
15
15
|
end
|
16
16
|
|
17
17
|
type = (group_data && group_data["id"]) || definition["default"]
|
@@ -28,9 +28,9 @@ module GovukDocumentTypes
|
|
28
28
|
|
29
29
|
def self.supergroup_subgroups(*supergroup_ids)
|
30
30
|
SUPERGROUPS
|
31
|
-
.dig(
|
32
|
-
.select { |supergroup| supergroup_ids.include?(supergroup[
|
33
|
-
.map { |supergroup| supergroup[
|
31
|
+
.dig("content_purpose_supergroup", "items")
|
32
|
+
.select { |supergroup| supergroup_ids.include?(supergroup["id"]) }
|
33
|
+
.map { |supergroup| supergroup["subgroups"] }
|
34
34
|
.flatten
|
35
35
|
.uniq
|
36
36
|
.sort
|
@@ -42,9 +42,9 @@ module GovukDocumentTypes
|
|
42
42
|
|
43
43
|
def self.subgroup_document_types(*subgroup_ids)
|
44
44
|
SUPERTYPES
|
45
|
-
.dig(
|
46
|
-
.select { |subgroup| subgroup_ids.include?(subgroup[
|
47
|
-
.map { |subgroup| subgroup[
|
45
|
+
.dig("content_purpose_subgroup", "items")
|
46
|
+
.select { |subgroup| subgroup_ids.include?(subgroup["id"]) }
|
47
|
+
.map { |subgroup| subgroup["document_types"] }
|
48
48
|
.flatten
|
49
49
|
.uniq
|
50
50
|
.sort
|
data/rails/locale/en.yml
CHANGED
@@ -10,6 +10,7 @@ en:
|
|
10
10
|
content_purpose_subgroup:
|
11
11
|
announcements: Announcements
|
12
12
|
business_support: Business funds and grants
|
13
|
+
calls_for_evidence: Calls for evidence
|
13
14
|
consultations: Consultations
|
14
15
|
decisions: Decisions
|
15
16
|
freedom_of_information_releases: Freedom of information releases
|
metadata
CHANGED
@@ -1,45 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_document_types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: govuk_schemas
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.5.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: i18n-spec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
@@ -53,19 +67,19 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '3.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rubocop-govuk
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - '='
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 4.10.0
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - '='
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 4.10.0
|
69
83
|
description: Gem to share document type groupings
|
70
84
|
email:
|
71
85
|
- govuk-dev@digital.cabinet-office.gov.uk
|
@@ -73,13 +87,15 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
90
|
+
- ".github/dependabot.yml"
|
91
|
+
- ".github/workflows/ci.yml"
|
76
92
|
- ".gitignore"
|
77
93
|
- ".rspec"
|
94
|
+
- ".rubocop.yml"
|
78
95
|
- ".ruby-version"
|
79
96
|
- CHANGELOG.md
|
80
97
|
- Gemfile
|
81
|
-
-
|
82
|
-
- LICENSE.txt
|
98
|
+
- LICENCE
|
83
99
|
- README.md
|
84
100
|
- Rakefile
|
85
101
|
- bin/console
|
@@ -104,14 +120,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
120
|
requirements:
|
105
121
|
- - ">="
|
106
122
|
- !ruby/object:Gem::Version
|
107
|
-
version: '0'
|
123
|
+
version: '3.0'
|
108
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
125
|
requirements:
|
110
126
|
- - ">="
|
111
127
|
- !ruby/object:Gem::Version
|
112
128
|
version: '0'
|
113
129
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
130
|
+
rubygems_version: 3.4.16
|
115
131
|
signing_key:
|
116
132
|
specification_version: 4
|
117
133
|
summary: Gem to share document type groupings
|
data/Jenkinsfile
DELETED
/data/{LICENSE.txt → LICENCE}
RENAMED
File without changes
|