govuk_document_types 1.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f789c70349961ccb4ddc415ffc398ef47ab69faf0028bacb93329ab8ddc2c2f
4
- data.tar.gz: ac205000cf9fc8c16864126521efa05b7d8144b818092489ed92b3808e582bd7
3
+ metadata.gz: eafd1e5501cefa5331b908c7357798f5f0a235d88ac91f300b1ce8f03f875350
4
+ data.tar.gz: abe7b6241cdacb05bf3bef50918f0a77f3d9079694f64a4e217a05d3dbaf81f7
5
5
  SHA512:
6
- metadata.gz: '012833c1d2ad5b68779578a1544e2344819a0da9ee67a9d0cf345e4163fdae7c5e6fe4855f476fdb5c58087e695946bdcb983a3d37d500ea05fca7024b32d61f'
7
- data.tar.gz: 1d0f62f78a9f0fb884ae3010d5fac1c40e79c80087fab0c68e4a5acb740ee0a381cb772016e7bd0aa2ed3c2ceddf0a085f63c49d29b1b4fc06df929b3ae26a1f
6
+ metadata.gz: bda63a418c5d4f865ac7788134461865ed62195ff7b649d02d25c23867c36c98184fd22dd520031c128c1e7265c79400370078998818e5f61d3fd883da978571
7
+ data.tar.gz: 76da516561c3edf0cccd15c733e50aa5eb92fa2b5c0531f35c0410e5c2eb597262bd91d81074681869ac2722fe086f2af30e82856027a21ed8f6c11fb686b8cd
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: /
5
+ schedule:
6
+ interval: daily
@@ -0,0 +1,53 @@
1
+ on: [push, pull_request]
2
+
3
+ jobs:
4
+ codeql-sast:
5
+ name: CodeQL SAST scan
6
+ uses: alphagov/govuk-infrastructure/.github/workflows/codeql-analysis.yml@main
7
+ permissions:
8
+ security-events: write
9
+
10
+ dependency-review:
11
+ name: Dependency Review scan
12
+ uses: alphagov/govuk-infrastructure/.github/workflows/dependency-review.yml@main
13
+
14
+ # This matrix job runs the test suite against multiple Ruby versions
15
+ test_matrix:
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [3.1, 3.2]
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Clone publishing-api for content schemas
24
+ uses: actions/checkout@v2
25
+ with:
26
+ repository: alphagov/publishing-api
27
+ ref: main
28
+ path: tmp/publishing-api
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ bundler-cache: true
33
+ - run: bundle exec rake
34
+ env:
35
+ GOVUK_CONTENT_SCHEMAS_PATH: tmp/publishing-api/content_schemas
36
+
37
+ # Branch protection rules cannot directly depend on status checks from matrix jobs.
38
+ # So instead we define `test` as a dummy job which only runs after the preceding `test_matrix` checks have passed.
39
+ # Solution inspired by: https://github.community/t/status-check-for-a-matrix-jobs/127354/3
40
+ test:
41
+ needs: test_matrix
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - run: echo "All matrix tests have passed 🚀"
45
+
46
+ publish:
47
+ needs: test
48
+ if: ${{ github.ref == 'refs/heads/main' }}
49
+ permissions:
50
+ contents: write
51
+ uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.yml@main
52
+ secrets:
53
+ 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
- 2.6.6
1
+ 3.1.5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 3.0.0
2
+
3
+ * BREAKING: Remove specialist topics ([PR #108](https://github.com/alphagov/govuk_document_types/pull/108))
4
+ * Drop support for Ruby 3.0
5
+
6
+ # 2.0.0
7
+
8
+ * BREAKING: Drop support for Ruby 2.7 ([PR #89](https://github.com/alphagov/govuk_document_types/pull/89))
9
+ * Added new call for evidence document type to supertypes and group ([PR #91](https://github.com/alphagov/govuk_document_types/pull/91))
10
+
1
11
  # 1.0.1
2
12
 
3
13
  * Remove Flood & Coastal Erosion Risk Management Report (FCERM) Research Report from research supergroup
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in govuk_document_types.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -37,4 +37,4 @@ bundle exec rake
37
37
 
38
38
  ## License
39
39
 
40
- [MIT License](LICENSE.txt)
40
+ [MIT License](LICENCE)
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rubocop/rake_task"
2
3
  require "rspec/core/rake_task"
3
4
 
5
+ RuboCop::RakeTask.new
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task default: :spec
8
+ task default: %i[rubocop spec]
data/data/supergroups.yml CHANGED
@@ -21,6 +21,7 @@ content_purpose_supergroup:
21
21
  subgroups:
22
22
  - policy
23
23
  - consultations
24
+ - calls_for_evidence
24
25
  - id: research_and_statistics
25
26
  subgroups:
26
27
  - research
data/data/supertypes.yml CHANGED
@@ -17,7 +17,6 @@ user_journey_document_supertype:
17
17
  - service_manual_topic
18
18
  - services_and_information
19
19
  - taxon
20
- - topic
21
20
  - topical_event
22
21
 
23
22
  email_document_supertype:
@@ -27,6 +26,9 @@ email_document_supertype:
27
26
  items:
28
27
  - id: "publications"
29
28
  document_types:
29
+ - call_for_evidence
30
+ - call_for_evidence_outcome
31
+ - closed_call_for_evidence
30
32
  - closed_consultation
31
33
  - consultation
32
34
  - consultation_outcome
@@ -43,6 +45,7 @@ email_document_supertype:
43
45
  - national_statistics
44
46
  - notice
45
47
  - official_statistics
48
+ - open_call_for_evidence
46
49
  - open_consultation
47
50
  - policy_paper
48
51
  - promotional
@@ -69,6 +72,12 @@ government_document_supertype:
69
72
  # we expect that everything should be mapped to a valid supertype.
70
73
  default: other
71
74
  items:
75
+ - id: calls-for-evidence
76
+ document_types:
77
+ - call_for_evidence
78
+ - open_call_for_evidence
79
+ - call_for_evidence_outcome
80
+ - closed_call_for_evidence
72
81
  - id: consultations
73
82
  document_types:
74
83
  - consultation
@@ -162,10 +171,8 @@ content_purpose_subgroup:
162
171
  - id: news
163
172
  document_types:
164
173
  - case_study
165
- - news_article
166
174
  - news_story
167
175
  - press_release
168
- - world_location_news_article
169
176
  - world_news_story
170
177
  - fatality_notice
171
178
  - id: decisions
@@ -191,7 +198,6 @@ content_purpose_subgroup:
191
198
  - completed_transaction
192
199
  - local_transaction
193
200
  - form
194
- - calculator
195
201
  - smart_answer
196
202
  - simple_smart_answer
197
203
  - place
@@ -236,7 +242,6 @@ content_purpose_subgroup:
236
242
  - consultation_outcome
237
243
  - id: research
238
244
  document_types:
239
- - dfid_research_output
240
245
  - independent_report
241
246
  - research
242
247
  - id: statistics
@@ -260,6 +265,11 @@ content_purpose_subgroup:
260
265
  - aaib_report
261
266
  - raib_report
262
267
  - maib_report
268
+ - id: calls_for_evidence
269
+ document_types:
270
+ - open_call_for_evidence
271
+ - closed_call_for_evidence
272
+ - call_for_evidence_outcome
263
273
 
264
274
  content_purpose_supergroup:
265
275
  name: "Content Purpose Supergroup"
@@ -270,10 +280,8 @@ content_purpose_supergroup:
270
280
  document_types:
271
281
  - medical_safety_alert
272
282
  - drug_safety_update
273
- - news_article
274
283
  - news_story
275
284
  - press_release
276
- - world_location_news_article
277
285
  - world_news_story
278
286
  - fatality_notice
279
287
  - tax_tribunal_decision
@@ -296,7 +304,6 @@ content_purpose_supergroup:
296
304
  - completed_transaction
297
305
  - local_transaction
298
306
  - form
299
- - calculator
300
307
  - smart_answer
301
308
  - simple_smart_answer
302
309
  - place
@@ -333,9 +340,11 @@ content_purpose_supergroup:
333
340
  - open_consultation
334
341
  - closed_consultation
335
342
  - consultation_outcome
343
+ - open_call_for_evidence
344
+ - closed_call_for_evidence
345
+ - call_for_evidence_outcome
336
346
  - id: research_and_statistics
337
347
  document_types:
338
- - dfid_research_output
339
348
  - independent_report
340
349
  - research
341
350
  - statistics
@@ -1,7 +1,6 @@
1
- # coding: utf-8
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 'govuk_document_types/version'
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.files = `git ls-files -z`.split("\x0").reject do |f|
15
+ spec.required_ruby_version = ">= 3.1"
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 = ["lib"]
22
+ spec.require_paths = %w[lib]
22
23
 
23
- spec.add_development_dependency "rake", "~> 10.0"
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.17.1"
27
29
  end
@@ -1,7 +1,7 @@
1
- require 'rails'
1
+ require "rails"
2
2
  module GovukDocumentTypes
3
3
  class TranslationsRailtie < ::Rails::Railtie
4
- initializer 'govuk_document_types' do |app|
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__), '../..', pattern)]
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? ? '*' : "{#{array.join ','}}"
18
+ array.blank? ? "*" : "{#{array.join ','}}"
19
19
  end
20
20
  end
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module GovukDocumentTypes
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "3.0.0".freeze
3
3
  end
@@ -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__) + "/../data/supertypes.yml")
7
- SUPERGROUPS = YAML.load_file(File.dirname(__FILE__) + "/../data/supergroups.yml")
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['document_types'].include?(document_type)
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('content_purpose_supergroup', 'items')
32
- .select { |supergroup| supergroup_ids.include?(supergroup['id']) }
33
- .map { |supergroup| supergroup['subgroups'] }
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('content_purpose_subgroup', 'items')
46
- .select { |subgroup| subgroup_ids.include?(subgroup['id']) }
47
- .map { |subgroup| subgroup['document_types'] }
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: 1.0.1
4
+ version: 3.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: 2021-05-27 00:00:00.000000000 Z
11
+ date: 2024-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: govuk_schemas
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '10.0'
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: '10.0'
26
+ version: 4.5.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: i18n-spec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
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: '3.0'
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: govuk-lint
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: i18n-spec
70
+ name: rubocop-govuk
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - '='
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: 4.17.1
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: '0'
82
+ version: 4.17.1
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
- - Jenkinsfile
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.1'
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.1.6
130
+ rubygems_version: 3.5.11
115
131
  signing_key:
116
132
  specification_version: 4
117
133
  summary: Gem to share document type groupings
data/Jenkinsfile DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env groovy
2
-
3
- library("govuk")
4
-
5
- node {
6
- govuk.buildProject()
7
- }
File without changes