govuk_document_types 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +4 -0
- data/Jenkinsfile +50 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/data/supertypes.yml +25 -0
- data/govuk_document_types.gemspec +26 -0
- data/lib/govuk_document_types/version.rb +3 -0
- data/lib/govuk_document_types.rb +20 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cb2c7e30189a9de446d75eef1685fb2ee181bea5
|
4
|
+
data.tar.gz: de40cae6c9c04d1c3ba93b964fbaf1ccaef87cef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: de17a5c09ec29123400c361e182b2fb7233b14341239f4b4f5792d0b16858c0bfe59ad7eae95963e4a5444e5c6dc6b0e245171ec5742300a7018820b9e3404e0
|
7
|
+
data.tar.gz: 766af3a3e8fd0f42194f14e8745f3871016ac42962193ad2c7abb9cf3e36f8aa8c0ac4a46f37dea96d354b6637887c26ea024f564dfb355046a47b5e78789cb4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Jenkinsfile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env groovy
|
2
|
+
|
3
|
+
REPOSITORY = 'govuk_document_types'
|
4
|
+
|
5
|
+
node {
|
6
|
+
def govuk = load '/var/lib/jenkins/groovy_scripts/govuk_jenkinslib.groovy'
|
7
|
+
|
8
|
+
try {
|
9
|
+
stage('Checkout') {
|
10
|
+
checkout scm
|
11
|
+
}
|
12
|
+
|
13
|
+
stage('Clean') {
|
14
|
+
govuk.cleanupGit()
|
15
|
+
govuk.mergeMasterBranch()
|
16
|
+
}
|
17
|
+
|
18
|
+
stage("Set up content schema dependency") {
|
19
|
+
govuk.contentSchemaDependency()
|
20
|
+
}
|
21
|
+
|
22
|
+
stage('Bundle') {
|
23
|
+
echo 'Bundling'
|
24
|
+
sh("bundle install --path ${JENKINS_HOME}/bundles/${JOB_NAME}")
|
25
|
+
}
|
26
|
+
|
27
|
+
stage('Linter') {
|
28
|
+
govuk.rubyLinter()
|
29
|
+
}
|
30
|
+
|
31
|
+
stage('Tests') {
|
32
|
+
govuk.setEnvar('RAILS_ENV', 'test')
|
33
|
+
govuk.runTests('spec')
|
34
|
+
}
|
35
|
+
|
36
|
+
if(env.BRANCH_NAME == "master") {
|
37
|
+
stage('Publish Gem') {
|
38
|
+
govuk.publishGem(REPOSITORY, env.BRANCH_NAME)
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
} catch (e) {
|
43
|
+
currentBuild.result = 'FAILED'
|
44
|
+
step([$class: 'Mailer',
|
45
|
+
notifyEveryUnstableBuild: true,
|
46
|
+
recipients: 'govuk-ci-notifications@digital.cabinet-office.gov.uk',
|
47
|
+
sendToIndividuals: true])
|
48
|
+
throw e
|
49
|
+
}
|
50
|
+
}
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Tijmen Brommet
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# GovukDocumentTypes
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/govuk_document_types`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'govuk_document_types'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install govuk_document_types
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/govuk_document_types.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "govuk_document_types"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/data/supertypes.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Groups used for navigation.
|
2
|
+
navigation_document_supertype:
|
3
|
+
- id: guidance
|
4
|
+
document_types:
|
5
|
+
- answer
|
6
|
+
- contact
|
7
|
+
- detailed_guide
|
8
|
+
- document_collection
|
9
|
+
- form
|
10
|
+
- guidance
|
11
|
+
- guide
|
12
|
+
- licence
|
13
|
+
- local_transaction
|
14
|
+
- manual
|
15
|
+
- map
|
16
|
+
- notice
|
17
|
+
- place
|
18
|
+
- programme
|
19
|
+
- promotional
|
20
|
+
- regulation
|
21
|
+
- simple_smart_answer
|
22
|
+
- smart_answer
|
23
|
+
- statutory_guidance
|
24
|
+
- transaction
|
25
|
+
- travel_advice
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'govuk_document_types/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "govuk_document_types"
|
8
|
+
spec.version = GovukDocumentTypes::VERSION
|
9
|
+
spec.authors = ["GOV.UK Dev"]
|
10
|
+
spec.email = ["govuk-dev@digital.cabinet-office.gov.uk"]
|
11
|
+
spec.summary = "Gem to share document type groupings"
|
12
|
+
spec.description = "Gem to share document type groupings"
|
13
|
+
spec.homepage = "https://github.com/alphagov/govuk_document_types"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
spec.add_development_dependency "govuk-lint", "~> 2.0"
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "govuk_document_types/version"
|
2
|
+
require "yaml"
|
3
|
+
|
4
|
+
module GovukDocumentTypes
|
5
|
+
def self.supertypes(document_type:)
|
6
|
+
@supertypes ||= YAML.load_file(File.dirname(__FILE__) + "/../data/supertypes.yml")
|
7
|
+
|
8
|
+
types = {}
|
9
|
+
|
10
|
+
@supertypes.each do |name, ary|
|
11
|
+
group_data = ary.find do |supertype|
|
12
|
+
supertype['document_types'].include?(document_type)
|
13
|
+
end
|
14
|
+
|
15
|
+
types.merge!(name => (group_data && group_data["id"]))
|
16
|
+
end
|
17
|
+
|
18
|
+
types
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: govuk_document_types
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- GOV.UK Dev
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: govuk-lint
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
description: Gem to share document type groupings
|
56
|
+
email:
|
57
|
+
- govuk-dev@digital.cabinet-office.gov.uk
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".ruby-version"
|
65
|
+
- CHANGELOG.md
|
66
|
+
- Gemfile
|
67
|
+
- Jenkinsfile
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- data/supertypes.yml
|
74
|
+
- govuk_document_types.gemspec
|
75
|
+
- lib/govuk_document_types.rb
|
76
|
+
- lib/govuk_document_types/version.rb
|
77
|
+
homepage: https://github.com/alphagov/govuk_document_types
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.5.1
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Gem to share document type groupings
|
101
|
+
test_files: []
|