govuk_document_types 1.0.0 → 2.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: f152778caca037e3809f912c605c4584dee81a1b0e12e8673f8bc83ba5765aef
4
- data.tar.gz: 1099c56c1e8b2f1dfcfe92100d78a76fec263e193e16a8f93daba8e28060a0e9
3
+ metadata.gz: e3b729644e55efe8ac733b1bf0c2613a65c2c739fc94cb3318b5b4270520eaea
4
+ data.tar.gz: 03d7678ad10b4d91354b233adf96313bca1a2928a936c9ad35ef08ac5e7e59c7
5
5
  SHA512:
6
- metadata.gz: 6b68846617a60aee53b4d3742382b749a757e53db4aa581e3b860d41ec42f78493440012479806a35ed39799f70d8f79f1b2d87fb5dbe91561c299d9f69568bc
7
- data.tar.gz: 9152ba233f0554176f18511b33bf59a10d1e818a53eb8c69077eb44d75158e4c895df1fb3eef1969dfe2bb78174f975964744725a1638b0da7ff48e884e2ae1f
6
+ metadata.gz: aff79f8bcf5310ed241623f5c5734cc0c813d2831bc097eaf3a5173e9471c150e9bf2c7992a505fb891032800edfb07da13ab7b5f36001981c8298718cb3eb1e
7
+ data.tar.gz: 4cf6f46dcb8c84d69726d9ba847b17f0b0d47f9016a7ca624c41d7ecaf05d514c42005db5da43d18f5d317aadbb7a3d6785a5acaa97501722fd2d70093d566ef
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: /
5
+ schedule:
6
+ interval: daily
@@ -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
- 2.6.6
1
+ 3.0.5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
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
+
6
+ # 1.0.1
7
+
8
+ * Remove Flood & Coastal Erosion Risk Management Report (FCERM) Research Report from research supergroup
9
+
1
10
  # 1.0.0
2
11
 
3
12
  * Remove deprecated supertypes
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
@@ -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,8 +243,6 @@ content_purpose_subgroup:
236
243
  - consultation_outcome
237
244
  - id: research
238
245
  document_types:
239
- - dfid_research_output
240
- - flood_and_coastal_erosion_risk_management_research_report
241
246
  - independent_report
242
247
  - research
243
248
  - id: statistics
@@ -261,6 +266,11 @@ content_purpose_subgroup:
261
266
  - aaib_report
262
267
  - raib_report
263
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
264
274
 
265
275
  content_purpose_supergroup:
266
276
  name: "Content Purpose Supergroup"
@@ -271,10 +281,8 @@ content_purpose_supergroup:
271
281
  document_types:
272
282
  - medical_safety_alert
273
283
  - drug_safety_update
274
- - news_article
275
284
  - news_story
276
285
  - press_release
277
- - world_location_news_article
278
286
  - world_news_story
279
287
  - fatality_notice
280
288
  - tax_tribunal_decision
@@ -297,7 +305,6 @@ content_purpose_supergroup:
297
305
  - completed_transaction
298
306
  - local_transaction
299
307
  - form
300
- - calculator
301
308
  - smart_answer
302
309
  - simple_smart_answer
303
310
  - place
@@ -334,10 +341,11 @@ content_purpose_supergroup:
334
341
  - open_consultation
335
342
  - closed_consultation
336
343
  - consultation_outcome
344
+ - open_call_for_evidence
345
+ - closed_call_for_evidence
346
+ - call_for_evidence_outcome
337
347
  - id: research_and_statistics
338
348
  document_types:
339
- - dfid_research_output
340
- - flood_and_coastal_erosion_risk_management_research_report
341
349
  - independent_report
342
350
  - research
343
351
  - 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.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 = ["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.10.0"
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.0".freeze
2
+ VERSION = "2.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.0
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: 2021-04-12 00:00:00.000000000 Z
11
+ date: 2023-07-11 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.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: '0'
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
- - 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.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.1.4
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
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env groovy
2
-
3
- library("govuk")
4
-
5
- node {
6
- govuk.buildProject()
7
- }
File without changes