action_dispatch-draw_all 0.1.0
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/lib/action_dispatch/draw_all/version.rb +7 -0
- data/lib/action_dispatch/draw_all.rb +43 -0
- metadata +100 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c6f1fbef5430a68d8ae3b4a04fc631423313fdd1c187d8ad222bb4b7b98385b2
|
|
4
|
+
data.tar.gz: acff86cc35eaada34681fca8741f8330cdc042ab042edc4abbf49b29ff03d5e5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bb85e9dd87bf6ceaffb577d5a181641a038d5dd8df47c01f58f91d5bb942b0853f29125489083e906dad80c4862e2fe4a11833c2dfd4676aee37a90fcd792bfd
|
|
7
|
+
data.tar.gz: bdb0057c2f01758d69f511aea86bd077066a4f5b8f13c55927f8b6ddae0de22dac5fad419973039a3279733706080aaa02fc8f20d91c967af9799c6d4010663f
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "draw_all/version"
|
|
4
|
+
|
|
5
|
+
module ActionDispatch
|
|
6
|
+
module DrawAll
|
|
7
|
+
RoutesNotFound = Class.new(StandardError)
|
|
8
|
+
|
|
9
|
+
# Draws all matching files located inside the config/routes directories
|
|
10
|
+
def draw_all(routes_name)
|
|
11
|
+
drawn_any = false
|
|
12
|
+
|
|
13
|
+
Rails.application.config.paths['config/routes'].paths.each do |path|
|
|
14
|
+
route_path = path.join("#{routes_name}.rb")
|
|
15
|
+
|
|
16
|
+
drawn_any |= draw_route(route_path)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
return if drawn_any
|
|
20
|
+
|
|
21
|
+
msg = "Your router tried to #draw_all the external file #{routes_name}.rb,\n" \
|
|
22
|
+
"but the file was not found in:\n\n"
|
|
23
|
+
msg += Rails.application.config.paths['config/routes']
|
|
24
|
+
.paths
|
|
25
|
+
.map { |path| " * #{path}" }.join("\n")
|
|
26
|
+
|
|
27
|
+
raise RoutesNotFound, msg
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def draw_route(path)
|
|
33
|
+
if File.exist?(path)
|
|
34
|
+
instance_eval(File.read(path), path.to_s)
|
|
35
|
+
true
|
|
36
|
+
else
|
|
37
|
+
false
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
ActionDispatch::Routing::Mapper.prepend ActionDispatch::DrawAll
|
metadata
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: action_dispatch-draw_all
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- group::tenant-scale
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: actionpack
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '7'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '7'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: gitlab-styles
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 13.1.0
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 13.1.0
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rspec
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '3.12'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '3.12'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rspec-rails
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 6.0.1
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 6.0.1
|
|
68
|
+
description: Adds a draw_all method to ActionDispatch::Routing::Mapper to load multiple
|
|
69
|
+
route files matching a pattern from config/routes directories.
|
|
70
|
+
email:
|
|
71
|
+
- engineering@gitlab.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- lib/action_dispatch/draw_all.rb
|
|
77
|
+
- lib/action_dispatch/draw_all/version.rb
|
|
78
|
+
homepage: https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/action_dispatch-draw_all
|
|
79
|
+
licenses:
|
|
80
|
+
- MIT
|
|
81
|
+
metadata:
|
|
82
|
+
rubygems_mfa_required: 'true'
|
|
83
|
+
rdoc_options: []
|
|
84
|
+
require_paths:
|
|
85
|
+
- lib
|
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ">="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '3.0'
|
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
requirements: []
|
|
97
|
+
rubygems_version: 4.0.3
|
|
98
|
+
specification_version: 4
|
|
99
|
+
summary: Rails routing extension for drawing multiple route files
|
|
100
|
+
test_files: []
|