govuk_publishing_components 1.11.0 → 1.12.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
  SHA1:
3
- metadata.gz: 8e46bcab548aa86ded198500c1ef47b6967a4405
4
- data.tar.gz: b29345bd70ee782b127bbe8e5c5640a28dfe3649
3
+ metadata.gz: 04b3957a214548180a22d3921bcc25b1fa69163e
4
+ data.tar.gz: 5a593705b493da4e2cf8cd098201a8acd4751b21
5
5
  SHA512:
6
- metadata.gz: 2f18566d1fc8338914133467e623d20b8a31adcec1cde09f20be989987952a6cd8fb925856930cbff7bc227088c2e2913e65330170ab956cc29cdce8096d623e
7
- data.tar.gz: 8a32cd97cfcf7d34bdfb9d0fc056e686b6300b6bb18e3bfe6838719bdfdc80ce6e3e8e33276675a5a98886dd92bebe3192b67adb63259c7a4eb7630d72a11494
6
+ metadata.gz: 26c42d56b90861b235c351040bffa9a8e9297ba50a83b2500f6557d9929c38d02148911217d6fb051807b4e8c4825f01c6cc8305ea4bd29e56682df833c2476e
7
+ data.tar.gz: aea09284f8bedd1969ab41eb3a9acfd433133a3a3534a748522b31bf26cc46d8e52069ae7d726c0aae2553b495aa03539ecbb33365c172af44327ec0f99ddf61
data/Rakefile CHANGED
@@ -19,11 +19,11 @@ end
19
19
  namespace :assets do
20
20
  desc "Test precompiling assets through dummy application"
21
21
 
22
- task :precompile do |t|
22
+ task :precompile do
23
23
  Rake::Task['app:assets:precompile'].invoke
24
24
  end
25
25
 
26
- task :clean do |t|
26
+ task :clean do
27
27
  Rake::Task['app:assets:clean'].invoke
28
28
  end
29
29
  end
@@ -46,6 +46,23 @@ $border-color: #ccc;
46
46
  }
47
47
  }
48
48
 
49
+ .component-violation {
50
+ border: 3px solid $error-colour;
51
+ margin: 0 0 $gutter;
52
+ padding: $gutter $gutter;
53
+
54
+ .component-violation__title {
55
+ @include bold-24;
56
+ }
57
+
58
+ .component-violation__link {
59
+ display: block;
60
+ @include bold-19;
61
+ color: $error-colour;
62
+ margin: $gutter-half 0;
63
+ }
64
+ }
65
+
49
66
  .component-doc-h2 {
50
67
  @include bold-27;
51
68
  margin: ($gutter * 1.5) 0 $gutter;
@@ -4,6 +4,12 @@
4
4
  <div class="component-show">
5
5
  <div class="grid-row">
6
6
  <div class="column-two-thirds">
7
+ <% if !@component_doc.accessibility_criteria.present? %>
8
+ <div class="component-violation">
9
+ <h2 class="component-violation__title">This component is not valid</h2>
10
+ <p><a class="component-violation__link" href="https://github.com/alphagov/govuk_publishing_components/blob/master/docs/accessibility_acceptance_criteria.md">Please define accessibility acceptance criteria for this component.</a></p>
11
+ </div>
12
+ <% end %>
7
13
  <p class="component-description">
8
14
  <%= @component_doc.description %>
9
15
  </p>
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '1.11.0'.freeze
2
+ VERSION = '1.12.0'.freeze
3
3
  end
@@ -1,22 +1,50 @@
1
- desc 'warns if component view files exist without corresponding documentation'
2
- task :validate_component_documentation do
3
- components_missing_docs = []
4
- component_views = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.html.erb"]
5
1
 
6
- component_views.each do |partial|
7
- expected_component_docs_file = partial.split('/')[-1].gsub('html.erb', 'yml')
8
- expected_component_docs_file.sub!(/^_/, '')
2
+ namespace :component do
3
+ desc 'warns if component view files exist without corresponding documentation'
4
+ task :validate_documentation_exists do
5
+ print "Validating that each component has documentation... "
6
+ components_missing_docs = []
7
+ component_views = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.html.erb"]
8
+ component_views.each do |partial|
9
+ expected_component_docs_file = partial.split('/')[-1].gsub('html.erb', 'yml')
10
+ expected_component_docs_file.sub!(/^_/, '')
9
11
 
10
- expected_component_docs_path = "app/views/#{GovukPublishingComponents::Config.component_directory_name}/docs/#{expected_component_docs_file}"
11
- components_missing_docs << partial unless File.exist?(expected_component_docs_path)
12
+ expected_component_docs_path = "app/views/#{GovukPublishingComponents::Config.component_directory_name}/docs/#{expected_component_docs_file}"
13
+ components_missing_docs << partial unless File.exist?(expected_component_docs_path)
14
+ end
15
+
16
+ if components_missing_docs.any?
17
+ error = "You have components which are missing documentation. These components will not be displayed in the component guide:\n"
18
+ components_missing_docs.each { |component| error += "\t" + component + "\n" }
19
+ error += "\n"
20
+ raise NotImplementedError, error
21
+ end
22
+ puts "✔︎"
23
+ end
24
+
25
+ desc 'warns if component is missing accessibility criteria'
26
+ task :validate_accessibility_criteria_exist do
27
+ print "Validating that each component has accessibility criteria... "
28
+ errors = []
29
+
30
+ component_docs = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.yml"]
31
+ component_docs.each do |doc_file|
32
+ file = YAML.load_file(doc_file)
33
+
34
+ if file['accessibility_criteria'].nil? && file['shared_accessibility_criteria'].nil?
35
+ errors << file['name']
36
+ end
37
+ end
38
+ if errors.any?
39
+ error = "The following components need accessibility criteria:\n#{errors.join("\n")}"
40
+ raise NotImplementedError, error
41
+ end
42
+ puts "✔︎"
12
43
  end
13
44
 
14
- if components_missing_docs.any?
15
- error = "You have components which are missing documentation. These components will not be displayed in the component guide:\n"
16
- components_missing_docs.each { |component| error += "\t" + component + "\n" }
17
- error += "\n"
18
- raise NotImplementedError, error
45
+ desc 'warns if component view files exist without corresponding documentation or accessibility critera'
46
+ task :validate_documentation do
47
+ Rake::Task["component:validate_documentation_exists"].invoke
48
+ Rake::Task["component:validate_accessibility_criteria_exist"].invoke
19
49
  end
20
50
  end
21
-
22
- Rake::Task["validate_component_documentation"].invoke
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: 1.11.0
4
+ version: 1.12.0
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: 2017-09-28 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.1.0
103
+ version: '3.3'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.1.0
110
+ version: '3.3'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement