parliament-routes 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +67 -0
- data/Rakefile +36 -0
- data/app/lib/ext/action_dispatch/routing/mapper.rb +77 -0
- data/config/routes.rb +287 -0
- data/lib/parliament/engine.rb +19 -0
- data/lib/parliament/engine/engine.rb +11 -0
- data/lib/parliament/engine/version.rb +5 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f9b8b90010e2446af9ae99a63c9805f9c6d55c35
|
4
|
+
data.tar.gz: b3eaebef9fee56364eb449440320373f1ee84225
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d0ca45ef0829340632f6464a3543dc3271cb15fc5768200b486a482fc9a98f3b9712245081f3832c08c6b57d7899214e3602f002467b35cc5530de5fedc63175
|
7
|
+
data.tar.gz: 28c1c53c4cda52766db3154760ae8c70a0c8946ba775843c55d5ae90aa35c3898c867a922fdeb91c529f10374e196cc14279e8112357a1f642cf4a24c2ba8444
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Bryony Watson
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Parliament.uk-routes
|
2
|
+
|
3
|
+
[Parliament.uk-routes](https://github.com/ukparliament/parliament.uk-routes "Parliament.uk-routes") is an engine created by the [Parliamentary Digital Service](https://github.com/ukparliament "Parliamentary Digital Service") that holds all of the routes for the UK parliament prototype website, which can then be called upon by any applications that include this gem.
|
4
|
+
|
5
|
+
> **NOTE:** This gem is in active development and is likely to change at short notice. It is not recommended that you use this in any production environment.
|
6
|
+
|
7
|
+
### Contents
|
8
|
+
|
9
|
+
- [Requirements](#requirements)
|
10
|
+
- [Installation](#installation)
|
11
|
+
- [Usage](#usage)
|
12
|
+
- [Getting Started with Development](#getting-started-with-development)
|
13
|
+
- [Running the tests](#running-the-tests)
|
14
|
+
- [Contributing](#contributing)
|
15
|
+
- [License](#license)
|
16
|
+
|
17
|
+
## Requirements
|
18
|
+
[Parliament.uk-routes](https://github.com/ukparliament/parliament.uk-routes "Parliament.uk-routes") requires the following:
|
19
|
+
* [Ruby](https://www.ruby-lang.org/en/)
|
20
|
+
* [Bundler](http://http://bundler.io/)
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
Add this line to your application's Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'parliament-routes'
|
27
|
+
```
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
```bash
|
31
|
+
$ bundle
|
32
|
+
```
|
33
|
+
|
34
|
+
Or install it yourself as:
|
35
|
+
```bash
|
36
|
+
$ gem install parliament-routes
|
37
|
+
```
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
The engine works in the background adding routes to the application that uses it.
|
41
|
+
|
42
|
+
## Getting Started with Development
|
43
|
+
To clone the repository and set up the dependencies, run the following:
|
44
|
+
```bash
|
45
|
+
git clone https://github.com/ukparliament/parliament.uk-routes.git
|
46
|
+
cd parliament-routes
|
47
|
+
bundle install
|
48
|
+
```
|
49
|
+
|
50
|
+
### Running the tests
|
51
|
+
We use [RSpec](http://rspec.info/) as our testing framework and tests can be run using:
|
52
|
+
```bash
|
53
|
+
bundle exec rspec
|
54
|
+
```
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.
|
58
|
+
|
59
|
+
1. Fork the repository
|
60
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
61
|
+
1. Commit your changes (`git commit -am 'Add some feature'`)
|
62
|
+
1. Push to the branch (`git push origin my-new-feature`)
|
63
|
+
1. Ensure your changes are tested using [Rspec][rspec]
|
64
|
+
1. Create a new Pull Request
|
65
|
+
|
66
|
+
## License
|
67
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'routes'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task default: :test
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module ActionDispatch
|
2
|
+
module Routing
|
3
|
+
class Mapper
|
4
|
+
# Mapper class provides methods for routes.rb
|
5
|
+
ID_FORMAT_REGEX = /\w{8}/
|
6
|
+
|
7
|
+
# @since 0.0.1
|
8
|
+
# Creates routes for listables
|
9
|
+
#
|
10
|
+
# @param [String] a_z_action a to z route.
|
11
|
+
# @param [String] letter_action letter route.
|
12
|
+
def listable(a_z_action, letter_action)
|
13
|
+
scope '/a-z', as: 'a_z' do
|
14
|
+
get '/', to: a_z_action
|
15
|
+
|
16
|
+
scope '/:letter', as: 'letter' do
|
17
|
+
get '/', to: letter_action
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Creates routes for lookupable
|
23
|
+
#
|
24
|
+
# @param [String] action lookup by letter route.
|
25
|
+
def lookupable(action)
|
26
|
+
get '/:letters', to: action
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates default routes
|
30
|
+
#
|
31
|
+
# @param [String] route_name multiple base routes.
|
32
|
+
# @param [Boolean] current indicates whether to use only current (defaults to true).
|
33
|
+
# @param [Boolean] lookup indicates whether to use lookup (defaults to true).
|
34
|
+
# @param [Boolean] postcode indicates whether to use postcode (defaults to true).
|
35
|
+
|
36
|
+
def build_default_routes(route_name, current: true, lookup: true, postcode: true)
|
37
|
+
get '/', to: "#{route_name}#index"
|
38
|
+
get '/current', to: "#{route_name}#current" if current
|
39
|
+
get '/lookup', to: "#{route_name}#lookup" if lookup
|
40
|
+
post '/postcode_lookup', to: "#{route_name}#postcode_lookup", as: 'postcode_lookup' if postcode
|
41
|
+
end
|
42
|
+
|
43
|
+
# Creates base routes and current routes
|
44
|
+
#
|
45
|
+
# @param [String] parent_route_name parent route.
|
46
|
+
# @param [String] route_name current route.
|
47
|
+
def build_root_and_current_routes(parent_route_name, route_name)
|
48
|
+
scope "/#{route_name}", as: route_name do
|
49
|
+
get '/', to: "#{parent_route_name}#index"
|
50
|
+
get '/current', to: "#{parent_route_name}#current"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Creates members routes
|
55
|
+
#
|
56
|
+
# @param [String] route_name members route.
|
57
|
+
# @param [Boolean] current indicates whether to use current (defaults to true).
|
58
|
+
def build_members_routes(route_name, current: true)
|
59
|
+
scope '/members', as: 'members' do
|
60
|
+
get '/', to: "#{route_name}#index"
|
61
|
+
|
62
|
+
listable("#{route_name}#a_to_z", "#{route_name}#letters")
|
63
|
+
|
64
|
+
scope '/current', as: 'current' do # /route_name/:id/members/current
|
65
|
+
if current
|
66
|
+
get '/', to: "#{route_name}#current"
|
67
|
+
|
68
|
+
listable("#{route_name}#a_to_z_current", "#{route_name}#current_letters")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
yield if block_given?
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
# require mapper class which holds methods for routing
|
2
|
+
require_relative '../app/lib/ext/action_dispatch/routing/mapper.rb'
|
3
|
+
|
4
|
+
# Using Rails.application.routes.draw as we want to
|
5
|
+
# add to the host application's routes, not the engine's routes
|
6
|
+
|
7
|
+
Rails.application.routes.draw do
|
8
|
+
id_format_regex = self.class::ID_FORMAT_REGEX
|
9
|
+
|
10
|
+
### Root ###
|
11
|
+
# /
|
12
|
+
root 'home#index'
|
13
|
+
|
14
|
+
### MPs ###
|
15
|
+
# /mps
|
16
|
+
get '/mps', to: 'home#mps'
|
17
|
+
|
18
|
+
### People ###
|
19
|
+
# /people (multiple 'people' scope)
|
20
|
+
scope '/people', as: 'people' do
|
21
|
+
build_default_routes('people', current: false)
|
22
|
+
listable('people#a_to_z', 'people#letters')
|
23
|
+
|
24
|
+
# /people/members
|
25
|
+
build_members_routes('people/members', current: true)
|
26
|
+
end
|
27
|
+
|
28
|
+
# /people (single 'person' scope)
|
29
|
+
scope '/people', as: 'person' do
|
30
|
+
# /people/:person_id
|
31
|
+
scope '/:person_id' do
|
32
|
+
get '/', to: 'people#show', person_id: id_format_regex
|
33
|
+
|
34
|
+
# /people/:person_id/constituencies
|
35
|
+
build_root_and_current_routes('people/constituencies', 'constituencies')
|
36
|
+
|
37
|
+
get '/contact-points', to: 'people/contact_points#index'
|
38
|
+
|
39
|
+
# /people/:person_id/houses
|
40
|
+
build_root_and_current_routes('people/houses', 'houses')
|
41
|
+
|
42
|
+
# /people/:person_id/parties
|
43
|
+
build_root_and_current_routes('people/parties', 'parties')
|
44
|
+
end
|
45
|
+
|
46
|
+
# Allow lookups - but ensure they are SECOND in the routes list after /people/:person_id
|
47
|
+
lookupable('people#lookup_by_letters')
|
48
|
+
end
|
49
|
+
|
50
|
+
### Parties ###
|
51
|
+
# /parties (multiple 'parties' scope)
|
52
|
+
scope '/parties', as: 'parties' do
|
53
|
+
build_default_routes('parties', postcode: false)
|
54
|
+
listable('parties#a_to_z', 'parties#letters')
|
55
|
+
end
|
56
|
+
|
57
|
+
# /parties (single 'party' scope)
|
58
|
+
scope '/parties', as: 'party' do
|
59
|
+
# /parties/:party_id
|
60
|
+
scope '/:party_id' do
|
61
|
+
get '/', to: 'parties#show', party_id: id_format_regex
|
62
|
+
|
63
|
+
# /parties/:party_id/members
|
64
|
+
build_members_routes('parties/members', current: true)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Allow lookups - but ensure they are SECOND in the routes list after /parties/:party_id
|
68
|
+
lookupable('parties#lookup_by_letters')
|
69
|
+
end
|
70
|
+
|
71
|
+
### Postcodes ###
|
72
|
+
# /postcodes (multiple 'postcodes' scope)
|
73
|
+
scope '/postcodes', as: 'postcodes' do
|
74
|
+
get '/', to: 'postcodes#index'
|
75
|
+
post '/lookup', to: 'postcodes#lookup'
|
76
|
+
end
|
77
|
+
|
78
|
+
# /postcodes (single 'postcode' scope)
|
79
|
+
scope '/postcodes', as: 'postcode' do
|
80
|
+
# /postcodes/:postcode
|
81
|
+
scope '/:postcode' do
|
82
|
+
get '/', to: 'postcodes#show'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
### Constituencies ###
|
87
|
+
# /constituencies (multiple 'constituencies' scope)
|
88
|
+
scope '/constituencies', as: 'constituencies' do
|
89
|
+
build_default_routes('constituencies', current: false)
|
90
|
+
listable('constituencies#a_to_z', 'constituencies#letters')
|
91
|
+
|
92
|
+
# /constituencies/current
|
93
|
+
scope '/current', as: 'current' do
|
94
|
+
get '/', to: 'constituencies#current'
|
95
|
+
|
96
|
+
listable('constituencies#a_to_z_current', 'constituencies#current_letters')
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# /constituencies (single 'constituency' scope)
|
101
|
+
scope '/constituencies', as: 'constituency' do
|
102
|
+
# /constituencies/:constituency_id
|
103
|
+
scope '/:constituency_id' do
|
104
|
+
get '/', to: 'constituencies#show', constituency_id: id_format_regex
|
105
|
+
get '/contact-point', to: 'constituencies/contact_points#index'
|
106
|
+
get '/map', to: 'constituencies#map'
|
107
|
+
|
108
|
+
# /constituencies/:constituency_id/members
|
109
|
+
build_root_and_current_routes('constituencies/members', 'members')
|
110
|
+
end
|
111
|
+
|
112
|
+
# Allow lookups - but ensure they are SECOND in the routes list after /constituencies/:constituency_id
|
113
|
+
lookupable('constituencies#lookup_by_letters')
|
114
|
+
end
|
115
|
+
|
116
|
+
## Contact Points ##
|
117
|
+
# /contact-points (multiple 'contact_points' scope)
|
118
|
+
scope '/contact-points', as: 'contact_points' do
|
119
|
+
get '/', to: 'contact_points#index'
|
120
|
+
end
|
121
|
+
|
122
|
+
# /contact-points (single 'contact_point' scope)
|
123
|
+
scope '/contact-points', as: 'contact_point' do
|
124
|
+
# /contact-points/:contact_point_id
|
125
|
+
scope '/:contact_point_id' do
|
126
|
+
get '/', to: 'contact_points#show', contact_point_id: id_format_regex
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
## Houses ##
|
131
|
+
# /houses (multiple 'houses' scope)
|
132
|
+
scope '/houses', as: 'houses' do
|
133
|
+
build_default_routes('houses', current: false, postcode: false)
|
134
|
+
end
|
135
|
+
|
136
|
+
# /houses (single 'house' scope)
|
137
|
+
scope '/houses', as: 'house' do
|
138
|
+
# /houses/:house_id
|
139
|
+
scope '/:house_id' do
|
140
|
+
get '/', to: 'houses#show', house_id: id_format_regex
|
141
|
+
|
142
|
+
# /houses/:house_id/members
|
143
|
+
build_members_routes('houses/members', current: true)
|
144
|
+
|
145
|
+
# /houses/:house_id/parties
|
146
|
+
scope '/parties', as: 'parties' do
|
147
|
+
get '/', to: 'houses/parties#index'
|
148
|
+
get '/current', to: 'houses/parties#current'
|
149
|
+
|
150
|
+
# /houses/:house_id/parties/:party_id
|
151
|
+
scope '/:party_id', as: 'party' do
|
152
|
+
get '/', to: 'houses/parties#show'
|
153
|
+
|
154
|
+
# /houses/:house_id/parties/:party_id/members
|
155
|
+
scope '/members', as: 'members' do
|
156
|
+
get '/', to: 'houses/parties/members#index'
|
157
|
+
|
158
|
+
listable('houses/parties/members#a_to_z', 'houses/parties/members#letters')
|
159
|
+
|
160
|
+
# /houses/:house_id/parties/:party_id/members/current
|
161
|
+
scope '/current', as: 'current' do
|
162
|
+
get '/', to: 'houses/parties/members#current'
|
163
|
+
|
164
|
+
listable('houses/parties/members#a_to_z_current', 'houses/parties/members#current_letters')
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Allow lookups - but ensure they are SECOND in the routes list after /houses/:house_id
|
172
|
+
lookupable('houses#lookup_by_letters')
|
173
|
+
end
|
174
|
+
|
175
|
+
### Parliaments ###
|
176
|
+
# /parliaments (multiple 'parliaments' scope)
|
177
|
+
scope '/parliaments', as: 'parliaments' do
|
178
|
+
build_default_routes('parliaments', postcode: false)
|
179
|
+
get '/previous', to: 'parliaments#previous'
|
180
|
+
get '/next', to: 'parliaments#next'
|
181
|
+
end
|
182
|
+
|
183
|
+
# /parliaments (single 'parliament' scope)
|
184
|
+
scope '/parliaments', as: 'parliament' do
|
185
|
+
# /parliaments/:parliament_id
|
186
|
+
scope '/:parliament_id' do
|
187
|
+
get '/', to: 'parliaments#show', parliament_id: id_format_regex
|
188
|
+
|
189
|
+
# /parliaments/:parliament_id/next
|
190
|
+
get '/next', to: 'parliaments#next_parliament'
|
191
|
+
|
192
|
+
# /parliaments/:parliament_id/previous
|
193
|
+
get '/previous', to: 'parliaments#previous_parliament'
|
194
|
+
|
195
|
+
build_members_routes('parliaments/members', current: false)
|
196
|
+
|
197
|
+
scope '/houses', as: 'houses' do
|
198
|
+
# /parliaments/:parliament_id/houses
|
199
|
+
get '/', to: 'parliaments/houses#index'
|
200
|
+
end
|
201
|
+
|
202
|
+
scope '/houses', as: 'house' do
|
203
|
+
scope ':house_id' do
|
204
|
+
# /parliaments/:parliament_id/houses/:house_id
|
205
|
+
get '/', to: 'parliaments/houses#show', house_id: id_format_regex
|
206
|
+
|
207
|
+
scope '/members', as: 'members' do
|
208
|
+
# /parliaments/:parliament_id/houses/:house_id/members
|
209
|
+
get '/', to: 'parliaments/houses/members#index'
|
210
|
+
|
211
|
+
listable('parliaments/houses/members#a_to_z', 'parliaments/houses/members#letters')
|
212
|
+
end
|
213
|
+
|
214
|
+
scope '/parties', as: 'parties' do
|
215
|
+
# /parliaments/:parliament_id/houses/:house_id/parties
|
216
|
+
get '/', to: 'parliaments/houses/parties#index'
|
217
|
+
end
|
218
|
+
|
219
|
+
scope '/parties', as: 'party' do
|
220
|
+
scope ':party_id' do
|
221
|
+
# /parliaments/:parliament_id/houses/:house_id/parties/:party_id
|
222
|
+
get '/', to: 'parliaments/houses/parties#show', party_id: id_format_regex
|
223
|
+
|
224
|
+
scope '/members', as: 'members' do
|
225
|
+
# /parliaments/:parliament_id/houses/:house_id/parties/:party_id/members
|
226
|
+
get '/', to: 'parliaments/houses/parties/members#index'
|
227
|
+
|
228
|
+
listable('parliaments/houses/parties/members#a_to_z', 'parliaments/houses/parties/members#letters')
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
scope '/parties', as: 'parties' do
|
236
|
+
# parliaments/:parliament_id/parties
|
237
|
+
get '/', to: 'parliaments/parties#index'
|
238
|
+
end
|
239
|
+
|
240
|
+
scope '/parties', as: 'party' do
|
241
|
+
scope '/:party_id' do
|
242
|
+
# /parliaments/:parliament_id/parties/:party_id
|
243
|
+
get '/', to: 'parliaments/parties#show', party_id: id_format_regex
|
244
|
+
|
245
|
+
scope '/members', as: 'members' do
|
246
|
+
# /parliaments/:parliament_id/parties/:party_id/members
|
247
|
+
get '/', to: 'parliaments/parties/members#index'
|
248
|
+
|
249
|
+
listable('parliaments/parties/members#a_to_z', 'parliaments/parties/members#letters')
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
scope '/constituencies', as: 'constituencies' do
|
255
|
+
# parliaments/:parliament_id/constituencies
|
256
|
+
get '/', to: 'parliaments/constituencies#index'
|
257
|
+
|
258
|
+
listable('parliaments/constituencies#a_to_z', 'parliaments/constituencies#letters')
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
## Resource
|
264
|
+
# /resource/
|
265
|
+
scope '/resource', as: 'resource' do
|
266
|
+
get '/', to: 'resource#index'
|
267
|
+
scope '/:resource_id' do
|
268
|
+
get '/', to: 'resource#show', resource_id: id_format_regex
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
## Meta ##
|
273
|
+
# /meta
|
274
|
+
scope '/meta', as: 'meta' do
|
275
|
+
get '/', to: 'meta#index'
|
276
|
+
get '/cookie-policy', to: 'meta#cookie_policy'
|
277
|
+
end
|
278
|
+
|
279
|
+
## Media
|
280
|
+
# /media/
|
281
|
+
scope '/media', as: 'media' do
|
282
|
+
get '/', to: 'media#index'
|
283
|
+
scope '/:medium_id' do
|
284
|
+
get '/', to: 'media#show', medium_id: id_format_regex
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Parliament
|
2
|
+
module Engine
|
3
|
+
def load!
|
4
|
+
register_rails_files if rails?
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def rails?
|
10
|
+
defined?(::Rails)
|
11
|
+
end
|
12
|
+
|
13
|
+
def register_rails_files
|
14
|
+
require 'parliament/engine/engine'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Parliament::Engine.load!
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: parliament-routes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bryony Watson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.1'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capybara
|
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'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- watsonb@parliament.uk
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- MIT-LICENSE
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- app/lib/ext/action_dispatch/routing/mapper.rb
|
80
|
+
- config/routes.rb
|
81
|
+
- lib/parliament/engine.rb
|
82
|
+
- lib/parliament/engine/engine.rb
|
83
|
+
- lib/parliament/engine/version.rb
|
84
|
+
homepage:
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.6.12
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Summary of routes.
|
108
|
+
test_files: []
|