govuk_navigation_helpers 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +19 -0
- data/Rakefile +17 -0
- data/govuk_navigation_helpers.gemspec +27 -0
- data/jenkins.sh +57 -0
- data/lib/govuk_navigation_helpers/version.rb +3 -0
- data/lib/govuk_navigation_helpers.rb +5 -0
- data/spec/spec_helper.rb +84 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 68f75d61c3b660e079b9c64a30e3a99cc04850b3
|
4
|
+
data.tar.gz: f018b0023a25f3dba8ec58742c4abcce083a3d8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 781df8adc2fa3e43335f89da904a7ffc389943fe6906756f6ba5e933322e70cb85515c2ce0cbaf21d78d10ab8c298bd24efc2bc2bb26223df344e3386c1af0f2
|
7
|
+
data.tar.gz: caadaeab8b6cb296803094498591c2e0ed7780dd03f70a6dac5fff41c0fd35f8d5ae1fcd8c2143c2fd70ecbfc96386f1df242d3a2f9602c987e86beb7d967efc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Tijmen Brommet
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# GOV.UK Navigation Helpers
|
2
|
+
|
3
|
+
This is a gem to share code between GOV.UK frontends.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'govuk_navigation_helpers', '~> VERSION'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TBD.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
|
9
|
+
task :default => [:spec]
|
10
|
+
|
11
|
+
require "gem_publisher"
|
12
|
+
|
13
|
+
desc "Publish gem to RubyGems"
|
14
|
+
task :publish_gem do |t|
|
15
|
+
published_gem = GemPublisher.publish_if_updated("govuk_navigation_helpers.gemspec", :rubygems)
|
16
|
+
puts "Published #{published_gem}" if published_gem
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'govuk_navigation_helpers/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "govuk_navigation_helpers"
|
8
|
+
spec.version = GovukNavigationHelpers::VERSION
|
9
|
+
spec.authors = ["GOV.UK Dev"]
|
10
|
+
spec.email = ["govuk-dev@digital.cabinet-office.gov.uk"]
|
11
|
+
spec.summary = "Gem to transform items from the content-store into payloads for GOV.UK components"
|
12
|
+
spec.description = "Gem to transform items from the content-store into payloads for GOV.UK components"
|
13
|
+
spec.homepage = "https://github.com/alphagov/govuk_navigation_helpers"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
24
|
+
spec.add_development_dependency "gem_publisher", "~> 1.5.0"
|
25
|
+
|
26
|
+
spec.required_ruby_version = ">= 2.3.1"
|
27
|
+
end
|
data/jenkins.sh
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
REPO_NAME=${REPO_NAME:-"alphagov/govuk_navigation_helpers"}
|
4
|
+
CONTEXT_MESSAGE=${CONTEXT_MESSAGE:-"default"}
|
5
|
+
GH_STATUS_GIT_COMMIT=${SCHEMA_GIT_COMMIT:-${GIT_COMMIT}}
|
6
|
+
|
7
|
+
function github_status {
|
8
|
+
REPO_NAME="$1"
|
9
|
+
STATUS="$2"
|
10
|
+
MESSAGE="$3"
|
11
|
+
gh-status "$REPO_NAME" "$GH_STATUS_GIT_COMMIT" "$STATUS" -d "Build #${BUILD_NUMBER} ${MESSAGE}" -u "$BUILD_URL" -c "$CONTEXT_MESSAGE" >/dev/null
|
12
|
+
}
|
13
|
+
|
14
|
+
function error_handler {
|
15
|
+
trap - ERR # disable error trap to avoid recursion
|
16
|
+
local parent_lineno="$1"
|
17
|
+
local message="$2"
|
18
|
+
local code="${3:-1}"
|
19
|
+
if [[ -n "$message" ]] ; then
|
20
|
+
echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}"
|
21
|
+
else
|
22
|
+
echo "Error on or near line ${parent_lineno}; exiting with status ${code}"
|
23
|
+
fi
|
24
|
+
github_status "$REPO_NAME" error "errored on Jenkins"
|
25
|
+
exit "${code}"
|
26
|
+
}
|
27
|
+
|
28
|
+
trap 'error_handler ${LINENO}' ERR
|
29
|
+
github_status "$REPO_NAME" pending "is running on Jenkins"
|
30
|
+
|
31
|
+
# Cleanup anything left from previous test runs
|
32
|
+
git clean -fdx
|
33
|
+
|
34
|
+
# Try to merge master into the current branch, and abort if it doesn't exit
|
35
|
+
# cleanly (ie there are conflicts). This will be a noop if the current branch
|
36
|
+
# is master.
|
37
|
+
git merge --no-commit origin/master || git merge --abort
|
38
|
+
|
39
|
+
# Bundle and run tests against multiple ruby versions
|
40
|
+
for version in 2.3.1; do
|
41
|
+
rm -f Gemfile.lock
|
42
|
+
export RBENV_VERSION=$version
|
43
|
+
echo "Running tests under ruby $version"
|
44
|
+
bundle install --path "${HOME}/bundles/${JOB_NAME}"
|
45
|
+
if ! bundle exec rake ${TEST_TASK:-"default"}; then
|
46
|
+
github_status "$REPO_NAME" failure "failed on Jenkins"
|
47
|
+
exit 1
|
48
|
+
fi
|
49
|
+
done
|
50
|
+
unset RBENV_VERSION
|
51
|
+
|
52
|
+
if [[ -n "$PUBLISH_GEM" ]]; then
|
53
|
+
bundle install --path "${HOME}/bundles/${JOB_NAME}"
|
54
|
+
bundle exec rake publish_gem --trace
|
55
|
+
fi
|
56
|
+
|
57
|
+
github_status "$REPO_NAME" success "succeeded on Jenkins"
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = true
|
41
|
+
end
|
42
|
+
|
43
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
44
|
+
# have no way to turn it off -- the option exists only for backwards
|
45
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
46
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
47
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
48
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
49
|
+
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
55
|
+
config.filter_run_when_matching :focus
|
56
|
+
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
59
|
+
# you configure your source control system to ignore this file.
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
61
|
+
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
63
|
+
# recommended. For more details, see:
|
64
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
65
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
66
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
67
|
+
config.disable_monkey_patching!
|
68
|
+
|
69
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
70
|
+
# be too noisy due to issues in dependencies.
|
71
|
+
config.warnings = true
|
72
|
+
|
73
|
+
# Run specs in random order to surface order dependencies. If you find an
|
74
|
+
# order dependency and want to debug it, you can fix the order by providing
|
75
|
+
# the seed, which is printed after each run.
|
76
|
+
# --seed 1234
|
77
|
+
config.order = :random
|
78
|
+
|
79
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
80
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
81
|
+
# test failures related to randomization by passing the same `--seed` value
|
82
|
+
# as the one that triggered the failure.
|
83
|
+
Kernel.srand config.seed
|
84
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: govuk_navigation_helpers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- GOV.UK Dev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gem_publisher
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.5.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.5.0
|
69
|
+
description: Gem to transform items from the content-store into payloads for GOV.UK
|
70
|
+
components
|
71
|
+
email:
|
72
|
+
- govuk-dev@digital.cabinet-office.gov.uk
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".ruby-version"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- govuk_navigation_helpers.gemspec
|
85
|
+
- jenkins.sh
|
86
|
+
- lib/govuk_navigation_helpers.rb
|
87
|
+
- lib/govuk_navigation_helpers/version.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
homepage: https://github.com/alphagov/govuk_navigation_helpers
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.3.1
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.5.1
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Gem to transform items from the content-store into payloads for GOV.UK components
|
113
|
+
test_files:
|
114
|
+
- spec/spec_helper.rb
|