roda-hash_branch_view_namespace 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 84e28719a8c1b0d7559f31061f76f25ca49dc2559c834ef41ca3e99dc456f7b9
4
+ data.tar.gz: ea6438ac430040f6405f236ab62e7dae6f18626cf3c9167716db9de586ba7791
5
+ SHA512:
6
+ metadata.gz: fb0ac52b457ded813d351f25d1b21a035f0a9a050f399d5b83b55339f349e1718dbc490525e9f33323d31f6ca22fe011e50e817d7c61bd949ff6634a1cd73c63
7
+ data.tar.gz: dbb03918967f1d06af6812170b9f998811930fe920051dc89be33e70e4b8ecfc9fc81b75fb0d5b554dbc6e44f04b510887056e0c81ace7d139e0cb0d8b8613f1
@@ -0,0 +1,3 @@
1
+ require "roda"
2
+ require_relative "plugins/hash_branch_view_namespace"
3
+
@@ -0,0 +1,51 @@
1
+ # frozen-string-literal: true
2
+
3
+ class Roda
4
+ module RodaPlugins
5
+ module HashBranchViewNamespace
6
+ def self.load_dependencies(app)
7
+ app.plugin :hash_branches
8
+ app.plugin :view_options
9
+ end
10
+
11
+ def self.configure(app)
12
+ app.opts[:hash_branch_view_subdir_methods] ||= {}
13
+ end
14
+
15
+ module ClassMethods
16
+ def freeze
17
+ opts[:hash_branch_view_subdir_methods].freeze.each_value(&:freeze)
18
+ super
19
+ end
20
+
21
+ def inherited(subclass)
22
+ super
23
+
24
+ h = subclass.opts[:hash_branch_view_subdir_methods]
25
+ opts[:hash_branch_view_subdir_methods].each do |namespace, routes|
26
+ h[namespace] = routes.dup
27
+ end
28
+ end
29
+
30
+ def hash_branch(namespace='', segment, &block)
31
+ meths = opts[:hash_branch_view_subdir_methods][namespace] ||= {}
32
+
33
+ if block
34
+ meth = meths[segment] = define_roda_method(meths[segment] || "_hash_branch_view_subdir_#{namespace}_#{segment}", 1, &convert_route_block(block))
35
+ super do |*_|
36
+ append_view_subdir(namespace.to_s << "/" << segment)
37
+ send(meth, @_request)
38
+ end
39
+ else
40
+ if meth = meths.delete(segment)
41
+ remove_method(meth)
42
+ end
43
+ super
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ register_plugin(:hash_branch_view_namespace, HashBranchViewNamespace)
50
+ end
51
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: roda-hash_branch_view_namespace
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Henrique F. Teixeira
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: roda
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '3.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '3.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rack-test
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: tilt
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ email:
55
+ - hriqueft@gmail.com
56
+ executables: []
57
+ extensions: []
58
+ extra_rdoc_files: []
59
+ files:
60
+ - lib/roda/hash_branch_view_namespace.rb
61
+ - lib/roda/plugins/hash_branch_view_namespace.rb
62
+ homepage: https://github.com/roda-project/roda-hash_branch_view_namespace
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ homepage_uri: https://github.com/roda-project/roda-hash_branch_view_namespace
67
+ source_code_uri: https://github.com/roda-project/roda-hash_branch_view_namespace
68
+ changelog_uri: https://github.com/roda-project/roda-hash_branch_view_namespace/blob/main/CHANGELOG.md
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 3.0.0
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubygems_version: 4.0.17
84
+ specification_version: 4
85
+ summary: A Roda plugin for match views folders with hash branch namespaces + paths
86
+ test_files: []