inversion 1.4.0 → 1.5.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.md +7 -0
- data/README.md +1 -1
- data/lib/inversion.rb +1 -1
- data/lib/roda/plugins/inversion.rb +225 -0
- data/spec/inversion/refinements_spec.rb +22 -0
- data/spec/roda/plugins/inversion_spec.rb +91 -0
- data.tar.gz.sig +0 -0
- metadata +50 -32
- metadata.gz.sig +0 -0
- data/spec/inversion/monkeypatches_spec.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 772c7fe7c3b9c566e4962e424da512a6bb2f52d9aa401d20317af3a744310793
|
4
|
+
data.tar.gz: 4a7d20b35a0e5b15730fa59998ebca00f448eccc5f5f7af23718c1bf356038f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1d273ca7ca57b36cdc411d5bba92d1b1189c26e087090cff257ff4d0f78cb25e32902f6007ea148eb49e9e9570a45802ad4187ea87688f8007621886b44090
|
7
|
+
data.tar.gz: 7d6f6e8a5868fe4f8a0f7f4835dcbfcdd66a8e06b3c2cffae7255e3b07bc70fd614c9213e0dcaaa0db40c6d7f252f89d6c8c80a8ac6ab6984e571f9458728f34
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.md
CHANGED
data/README.md
CHANGED
data/lib/inversion.rb
CHANGED
@@ -0,0 +1,225 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# vim: set nosta noet ts=4 sw=4 ft=ruby:
|
3
|
+
|
4
|
+
require 'inversion'
|
5
|
+
require 'loggability'
|
6
|
+
|
7
|
+
class Roda
|
8
|
+
module RodaPlugins
|
9
|
+
|
10
|
+
# A templated content-generation plugin for Roda Apps. It uses the
|
11
|
+
# Inversion[http://deveiate.org/projects/Inversion] templating system.
|
12
|
+
#
|
13
|
+
# It adds:
|
14
|
+
#
|
15
|
+
# * a preloaded/cached template table
|
16
|
+
# * a mechanism for fetching templates from the table
|
17
|
+
# * a global layout template which is automatically wrapped around responses
|
18
|
+
#
|
19
|
+
# Note: This is based almost entirely off the Strelka plugin of identical
|
20
|
+
# function.
|
21
|
+
#
|
22
|
+
# == Usage
|
23
|
+
#
|
24
|
+
# To use it, just load the <tt>:inversion</tt> plugin in your app:
|
25
|
+
#
|
26
|
+
# plugin :inversion, '/path/to/templates/directory'
|
27
|
+
#
|
28
|
+
# You can specify more than one templates directory; they'll be searched in the order
|
29
|
+
# you specify for the named template and the first match wins:
|
30
|
+
#
|
31
|
+
# plugin :inversion '/more/specific/templates', '/generic/app/templates'
|
32
|
+
#
|
33
|
+
# Then declare one or more templates that your application will use:
|
34
|
+
#
|
35
|
+
# templates console: 'views/console.tmpl',
|
36
|
+
# proctable: 'partials/proctable.tmpl'
|
37
|
+
#
|
38
|
+
# Then, inside your app, you can fetch a copy of one or more of the templates and
|
39
|
+
# return it as the response:
|
40
|
+
#
|
41
|
+
# r.root do
|
42
|
+
# tmpl = template( :console )
|
43
|
+
# tmpl.message = "Everything's up."
|
44
|
+
# tmpl.proctable = proctable
|
45
|
+
# return tmpl
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
#
|
49
|
+
# You can also just return the template if you don't need to do anything else to the
|
50
|
+
# response.
|
51
|
+
#
|
52
|
+
# When returning a template, either in the body of the response or directly, it will
|
53
|
+
# automatically set a few attributes for commonly-used objects:
|
54
|
+
#
|
55
|
+
# request :: The current Roda::Request
|
56
|
+
# response :: The current Roda::Response
|
57
|
+
# app :: The application object (Roda::App instance).
|
58
|
+
#
|
59
|
+
# If your app will *only* be loading and returning a template without doing anything
|
60
|
+
# with it, you can return just its name:
|
61
|
+
#
|
62
|
+
# r.root do
|
63
|
+
# return :console
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# It will be loaded, set as the response body, and the above common objects added to it.
|
67
|
+
#
|
68
|
+
#
|
69
|
+
# === Layouts
|
70
|
+
#
|
71
|
+
# Very often, you'll want all or most of the views in your app to share a common page
|
72
|
+
# layout. To accomplish this, you can declare a layout template:
|
73
|
+
#
|
74
|
+
# layout 'layout.tmpl'
|
75
|
+
#
|
76
|
+
# Any template that you return will be set as the 'body' attribute of this layout
|
77
|
+
# template (which you'd place into the layout with <tt><?attr body ?></tt>) and the
|
78
|
+
# layout rendered as the body of the response.
|
79
|
+
#
|
80
|
+
# Note that if you want any of the "common objects" from above with a layout template,
|
81
|
+
# they'll be set on it since it's the top-level template, but you can still access them
|
82
|
+
# using the <tt><?import ?></tt> directive:
|
83
|
+
#
|
84
|
+
# <?import request, app ?>
|
85
|
+
#
|
86
|
+
#
|
87
|
+
# == Template Locations
|
88
|
+
#
|
89
|
+
# Inversion looks for templates in a load path much like Ruby does for libraries that
|
90
|
+
# you 'require'. It contains just the current working directory by default. You can add
|
91
|
+
# your own template directories via the config file (under +template_paths+ in
|
92
|
+
# the +templates+ section), or programmatically from your application.
|
93
|
+
#
|
94
|
+
module Inversion
|
95
|
+
|
96
|
+
### Add the specified +template_paths+ to Inversion.
|
97
|
+
def self::configure( app, *template_paths )
|
98
|
+
::Inversion::Template.template_paths.concat( template_paths )
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
module ClassMethods
|
103
|
+
|
104
|
+
### Add this Gem's template location to the Inversion search path.
|
105
|
+
def self::extended( subclass )
|
106
|
+
subclass.instance_variable_set( :@template_map, {} )
|
107
|
+
subclass.instance_variable_set( :@layout_template, nil )
|
108
|
+
|
109
|
+
super
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
# The map of template names to template file paths.
|
114
|
+
attr_reader :template_map
|
115
|
+
|
116
|
+
# An optional layout/wrap template.
|
117
|
+
attr_accessor :layout_template
|
118
|
+
|
119
|
+
|
120
|
+
### Load instances for all the template paths specified in the App's class
|
121
|
+
### and return them in a hash keyed by name (Symbol).
|
122
|
+
def templates( hash )
|
123
|
+
@template_map = hash.each_with_object( {} ) do |(name, path), map|
|
124
|
+
enc = Encoding.default_internal || Encoding::UTF_8
|
125
|
+
map[ name ] = ::Inversion::Template.load( path, encoding: enc )
|
126
|
+
map
|
127
|
+
end
|
128
|
+
|
129
|
+
return self.template_map
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
### Load an Inversion::Template for the layout template.
|
134
|
+
def layout( tmpl )
|
135
|
+
enc = Encoding.default_internal || Encoding::UTF_8
|
136
|
+
self.layout_template = ::Inversion::Template.load( tmpl, encoding: enc )
|
137
|
+
return self.layout_template
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
module InstanceMethods
|
143
|
+
|
144
|
+
### Return a previously declared template object.
|
145
|
+
def template( tmpl )
|
146
|
+
template = self.class.template_map[ tmpl ] or
|
147
|
+
raise ArgumentError, "no %p template registered!" % [ tmpl ]
|
148
|
+
template.reload if template.changed?
|
149
|
+
return template.dup
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
module RequestMethods
|
155
|
+
|
156
|
+
### Hook block results for template rendering.
|
157
|
+
def block_result_body( result )
|
158
|
+
if ( template = self.extract_template_from_result( result ) )
|
159
|
+
|
160
|
+
# Wrap the template in a layout if there is one
|
161
|
+
template = self.wrap_in_layout( template )
|
162
|
+
|
163
|
+
# Set some default stuff on the top-level template
|
164
|
+
self.set_common_attributes( template )
|
165
|
+
|
166
|
+
return template.render
|
167
|
+
else
|
168
|
+
super
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
#########
|
174
|
+
protected
|
175
|
+
#########
|
176
|
+
|
177
|
+
### Fetch the template from the +result+ (if there is one) and return it.
|
178
|
+
def extract_template_from_result( result )
|
179
|
+
templates = self.scope.class.template_map
|
180
|
+
|
181
|
+
# Result is a template name.
|
182
|
+
if result.is_a?( Symbol ) && templates.key?( result )
|
183
|
+
return scope.template( result )
|
184
|
+
|
185
|
+
# Result is a template object.
|
186
|
+
elsif result.respond_to?( :render )
|
187
|
+
return result
|
188
|
+
end
|
189
|
+
|
190
|
+
# Not templated; returned as-is
|
191
|
+
return nil
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
### Wrap the specified +content+ template in the layout template and
|
196
|
+
### return it. If there isn't a layout declared, just return +content+ as-is.
|
197
|
+
def wrap_in_layout( content )
|
198
|
+
layout = self.scope.class.layout_template or return content
|
199
|
+
|
200
|
+
layout.reload if layout.changed?
|
201
|
+
l_template = layout.dup
|
202
|
+
l_template.body = content
|
203
|
+
|
204
|
+
return l_template
|
205
|
+
end
|
206
|
+
|
207
|
+
|
208
|
+
### Set some default values from the request in the given top-level +template+.
|
209
|
+
def set_common_attributes( template )
|
210
|
+
template.request = self
|
211
|
+
template.response = self.scope.response
|
212
|
+
template.app = self.scope
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
end # module Inversion
|
218
|
+
|
219
|
+
|
220
|
+
# Hook: Inform Roda that we exist.
|
221
|
+
register_plugin :inversion, Inversion
|
222
|
+
|
223
|
+
end # module RodaPlugins
|
224
|
+
end # class Roda
|
225
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env rspec -cfd -b
|
2
|
+
# vim: set noet nosta sw=4 ts=4 :
|
3
|
+
|
4
|
+
|
5
|
+
require_relative '../helpers'
|
6
|
+
|
7
|
+
require 'ripper'
|
8
|
+
require 'inversion/refinements'
|
9
|
+
|
10
|
+
|
11
|
+
RSpec.describe Inversion, "refinements" do
|
12
|
+
|
13
|
+
using Inversion::Refinements
|
14
|
+
|
15
|
+
it "exposes the Ripper::TokenPattern::MatchData's #tokens array" do
|
16
|
+
tagpattern = Ripper::TokenPattern.compile( '$(ident) $(sp) $(ident)' )
|
17
|
+
matchdata = tagpattern.match( "foo bar" )
|
18
|
+
expect( matchdata.tokens.map {|tok| tok[1]} ).to eq([ :on_ident, :on_sp, :on_ident ])
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
#!/usr/bin/env rspec -cfd -b
|
2
|
+
# vim: set noet nosta sw=4 ts=4 :
|
3
|
+
|
4
|
+
require_relative '../../helpers'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'roda'
|
8
|
+
$roda_support = true
|
9
|
+
rescue LoadError => err
|
10
|
+
warn "Roda support testing disabled: %p: %s" % [ err.class, err.message ]
|
11
|
+
$roda_support = false
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
RSpec.describe "Roda support", :if => $roda_support do
|
16
|
+
include Rack::Test::Methods if defined?( ::Rack )
|
17
|
+
|
18
|
+
before( :all ) do
|
19
|
+
setup_logging( :fatal )
|
20
|
+
end
|
21
|
+
|
22
|
+
before( :each ) do
|
23
|
+
allow( Inversion::Template ).to receive( :load ).and_return( tmpl )
|
24
|
+
app.app # looks weird, but creates an instance for Rack::Test.
|
25
|
+
end
|
26
|
+
|
27
|
+
let( :tmpl ) { Inversion::Template.new("Hi <?attr name ?>!") }
|
28
|
+
|
29
|
+
let( :app ) do
|
30
|
+
Class.new( Roda ) do
|
31
|
+
plugin :inversion
|
32
|
+
templates \
|
33
|
+
tmpl: 'template.tmpl'
|
34
|
+
|
35
|
+
route do |r|
|
36
|
+
r.get "symbol" do
|
37
|
+
:tmpl
|
38
|
+
end
|
39
|
+
|
40
|
+
r.get "unknown" do
|
41
|
+
template( :nope )
|
42
|
+
end
|
43
|
+
|
44
|
+
r.get "template" do
|
45
|
+
tmpl = template( :tmpl )
|
46
|
+
tmpl.name = "handsome"
|
47
|
+
return tmpl
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
it "registers itself with Roda on demand" do
|
55
|
+
plugs = Roda::RodaPlugins.instance_variable_get( :@plugins )
|
56
|
+
expect( plugs[:inversion] ).to be( Roda::RodaPlugins::Inversion )
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
it "extends the Roda DSL with a #template helper method" do
|
61
|
+
expect( app.instance_methods ).to include( :template )
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
it "falls through to Roda default behavior on unmapped symbols" do
|
66
|
+
get '/nonexistent'
|
67
|
+
expect( last_response ).to_not be_ok
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
it "can reference a known template via symbol" do
|
72
|
+
get '/symbol'
|
73
|
+
expect( last_response ).to be_ok
|
74
|
+
expect( last_response.body ).to eq( 'Hi !' )
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
it "can render a returned template via template()" do
|
79
|
+
get '/template'
|
80
|
+
expect( last_response ).to be_ok
|
81
|
+
expect( last_response.body ).to eq( 'Hi handsome!' )
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
it "fails fast if referencing an unknown template at runtime" do
|
86
|
+
expect {
|
87
|
+
get '/unknown'
|
88
|
+
}.to raise_error( ArgumentError, /no :nope template registered/ )
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,40 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inversion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
8
8
|
- Mahlon E. Smith
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
14
|
+
MIIENDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdtYWhs
|
15
|
+
b24vREM9bWFydGluaS9EQz1udTAeFw0yMTAxMTcwMDQzMDZaFw0zMTAxMTUwMDQz
|
16
|
+
MDZaMCIxIDAeBgNVBAMMF21haGxvbi9EQz1tYXJ0aW5pL0RDPW51MIIBojANBgkq
|
17
|
+
hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAsRZyNGaL3I8T2AkQsHKyixW10CY6T715
|
18
|
+
uOztbmZImekhmgE9Uj5xZCnUP4xG5ToJffgkxcbepyJwIHCjEQg7viL9EsA+rMNb
|
19
|
+
UX8dsa9jpvVD6nHAdoW8G0ee7SRBXhCfyNma8FtkDJfw2bwdKhxUKiHsULCSQ0Pd
|
20
|
+
p+4d5NnldgfB8cf4Hz9Ai/8FHacWnZVEiHa4Ngb5Fe42OUs+4XDQdpcgA7wCY633
|
21
|
+
q9rRVGK7MW9BzMv+hhQfElQMn1eDMgQVpO543viDT8JatwhhcYmKdzwTIIPAIybf
|
22
|
+
8MfJaimsh20OAqs3FAXNKjDVFbcXFfKUXXgVgMjUoEK5+Lp+pKPZXU4bIi5oYZqB
|
23
|
+
OttGPMD5rOWlAooWNQ7xbdHByUVqJmALSWHqPHdvVmAVsW8tNoB1qGbM+C6o80Ie
|
24
|
+
9H0389ja3TW4JK/0w/gFUmrVvYKRll44HaxS9nXNpiYBipbJmlR/R9qoe54ImQje
|
25
|
+
Z4vsWrWiDrK/oVYlUXOy7SE/jUAQF9UzAgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYD
|
26
|
+
VR0PBAQDAgSwMB0GA1UdDgQWBBSx8TRqCmTPOARICKiZ3c66sIG3pTAcBgNVHREE
|
27
|
+
FTATgRFtYWhsb25AbWFydGluaS5udTAcBgNVHRIEFTATgRFtYWhsb25AbWFydGlu
|
28
|
+
aS5udTANBgkqhkiG9w0BAQsFAAOCAYEAHbiAZTe46/kp1Tkm4s6D30VBaYaAdaYG
|
29
|
+
bZIaAaHtJO9MbUNS0FA01fxQpptjpOQT3cNNf8CX8UHPTaSuPFMfgVWj1xiX7Byb
|
30
|
+
hqhUcUTENOuUxxWGDCa4orCFctc3yihojTKGtbhODHVSHf9DRDyalRcvmyWzxMFT
|
31
|
+
XtBS05OUXc9O1bKqzNaRc9nMGw6Y+V79hIex4mZlMBkhTeVKxeeweCXfELXOQRmB
|
32
|
+
FgPgUyQn0AaSpplx0YoWdy/99fEkXSMvgeEoiR1ApR6aUuTlvIr1yUgzVBpWU4mE
|
33
|
+
XC+Ig+3jhqufGyE/Do+1M7n5QLpgGfpy3QmoOiKeYt3XzR5Z7XoxCAaKHNRxVEga
|
34
|
+
ojmVnDNlLQkkZZkbFNGPHjCIBs7h+6eoIYvy/eQ82c4vd6w9rR4v9bKUL8NNkcSz
|
35
|
+
49pOzX5KHZLTS9DKeaP/xcGPz6C8MiwQdYrZarr2SHRASX1zFa79rkItO8kE6RDr
|
36
|
+
b6WDF79UvZ55ajtE00TiwqjQL/ZPEtbd
|
36
37
|
-----END CERTIFICATE-----
|
37
|
-
date:
|
38
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
38
39
|
dependencies:
|
39
40
|
- !ruby/object:Gem::Dependency
|
40
41
|
name: loggability
|
@@ -154,14 +155,28 @@ dependencies:
|
|
154
155
|
requirements:
|
155
156
|
- - "~>"
|
156
157
|
- !ruby/object:Gem::Version
|
157
|
-
version: '0.
|
158
|
+
version: '0.2'
|
158
159
|
type: :development
|
159
160
|
prerelease: false
|
160
161
|
version_requirements: !ruby/object:Gem::Requirement
|
161
162
|
requirements:
|
162
163
|
- - "~>"
|
163
164
|
- !ruby/object:Gem::Version
|
164
|
-
version: '0.
|
165
|
+
version: '0.2'
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: roda
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - "~>"
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '3.67'
|
173
|
+
type: :development
|
174
|
+
prerelease: false
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '3.67'
|
165
180
|
- !ruby/object:Gem::Dependency
|
166
181
|
name: rspec-wait
|
167
182
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,12 +307,13 @@ files:
|
|
292
307
|
- lib/inversion/template/uriencodetag.rb
|
293
308
|
- lib/inversion/template/yieldtag.rb
|
294
309
|
- lib/inversion/tilt.rb
|
310
|
+
- lib/roda/plugins/inversion.rb
|
295
311
|
- spec/data/sinatra/hello.inversion
|
296
312
|
- spec/data/unknown-tag.tmpl
|
297
313
|
- spec/helpers.rb
|
298
314
|
- spec/inversion/mixins_spec.rb
|
299
|
-
- spec/inversion/monkeypatches_spec.rb
|
300
315
|
- spec/inversion/parser_spec.rb
|
316
|
+
- spec/inversion/refinements_spec.rb
|
301
317
|
- spec/inversion/renderstate_spec.rb
|
302
318
|
- spec/inversion/sinatra_spec.rb
|
303
319
|
- spec/inversion/template/attrtag_spec.rb
|
@@ -331,15 +347,17 @@ files:
|
|
331
347
|
- spec/inversion/template_spec.rb
|
332
348
|
- spec/inversion/tilt_spec.rb
|
333
349
|
- spec/inversion_spec.rb
|
350
|
+
- spec/roda/plugins/inversion_spec.rb
|
334
351
|
homepage: https://hg.sr.ht/~ged/Inversion
|
335
352
|
licenses:
|
336
353
|
- BSD-3-Clause
|
337
354
|
metadata:
|
338
355
|
homepage_uri: https://hg.sr.ht/~ged/Inversion
|
339
|
-
documentation_uri: http://deveiate.org/code/
|
356
|
+
documentation_uri: http://deveiate.org/code/inversion
|
357
|
+
changelog_uri: http://deveiate.org/code/inversion/History_md.html
|
340
358
|
source_uri: https://hg.sr.ht/~ged/Inversion/browse
|
341
359
|
bug_tracker_uri: https://todo.sr.ht/~ged/Inversion/browse
|
342
|
-
post_install_message:
|
360
|
+
post_install_message:
|
343
361
|
rdoc_options: []
|
344
362
|
require_paths:
|
345
363
|
- lib
|
@@ -354,8 +372,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
372
|
- !ruby/object:Gem::Version
|
355
373
|
version: '0'
|
356
374
|
requirements: []
|
357
|
-
rubygems_version: 3.3.
|
358
|
-
signing_key:
|
375
|
+
rubygems_version: 3.3.26
|
376
|
+
signing_key:
|
359
377
|
specification_version: 4
|
360
378
|
summary: Inversion is a templating system for Ruby.
|
361
379
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rspec -cfd -b
|
2
|
-
# vim: set noet nosta sw=4 ts=4 :
|
3
|
-
|
4
|
-
|
5
|
-
require_relative '../helpers'
|
6
|
-
|
7
|
-
require 'ripper'
|
8
|
-
require 'inversion/monkeypatches'
|
9
|
-
|
10
|
-
|
11
|
-
RSpec.describe Inversion, "monkeypatches" do
|
12
|
-
|
13
|
-
describe Inversion::RipperAdditions do
|
14
|
-
|
15
|
-
it "exposes the Ripper::TokenPattern::MatchData's #tokens array" do
|
16
|
-
tagpattern = Ripper::TokenPattern.compile( '$(ident) $(sp) $(ident)' )
|
17
|
-
matchdata = tagpattern.match( "foo bar" )
|
18
|
-
expect( matchdata.tokens.map {|tok| tok[1]} ).to eq([ :on_ident, :on_sp, :on_ident ])
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|