roda 3.50.0 → 3.51.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9da24f38f427b9256f05e92f40d67fe98bbdefb86419e5b8c13243f88418f8a
4
- data.tar.gz: 3acabff7d8879126d6fdf2199e0935c96d0ea1c975feef874122d67d2afe7315
3
+ metadata.gz: f935481900b15707f29c41122e9ba1101e4a1bb7b6e53ef6c7819f8e0113fb23
4
+ data.tar.gz: 3f4938ea16d81085a0b9ee365f1cc8d317fbafd06674f1cf0e8dda37b70f3b05
5
5
  SHA512:
6
- metadata.gz: 7535b67bed981d52d337643c24f13b206163392594b3f969e611b79020a8578994b934a34abc186cf07850725c1ce8a99fbcb859b58cce289b8138b329ca4c68
7
- data.tar.gz: 3fdbb4aa63d1cd82a7f6cbdfe01a9804388ab8b4461f9dda825332f030a1179737a21be4ea59c9e52fa856f6952d77578e972263397c62de4c42680340472313
6
+ metadata.gz: 00b35a151be77f3ed93ee0b664ce2b77162b1f14c02194e0228ec99969194c54c4ca0ddd538e0eb8bfcb4109ea6712428b554da06d69e572aaffa4d854e76559
7
+ data.tar.gz: ceb138da62c24fa2a3be1a57eda9187190f96b974483719894e0368ad47402258123d651403b373c09ff801d816cae2d0f9c88dcf154e2226fba4a864b9ed64d
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ = 3.51.0 (2021-12-15)
2
+
3
+ * Avoid method redefinition warning in error_handler plugin in verbose warning mode (jeremyevans)
4
+
5
+ * Allow run in multi_run plugin to be called without an app to remove existing handler (jeremyevans)
6
+
7
+ * Allow route in named_routes plugin to be called without a block to remove existing handler (jeremyevans)
8
+
1
9
  = 3.50.0 (2021-11-12)
2
10
 
3
11
  * Add capture_erb plugin for capturing ERB template blocks, instead of injecting them into the template output (jeremyevans)
data/README.rdoc CHANGED
@@ -12,7 +12,8 @@ maintainable web applications in ruby.
12
12
  Website :: http://roda.jeremyevans.net
13
13
  Source :: http://github.com/jeremyevans/roda
14
14
  Bugs :: http://github.com/jeremyevans/roda/issues
15
- Google Group :: http://groups.google.com/group/ruby-roda
15
+ Discussion Forum (GitHub Discussions) :: https://github.com/jeremyevans/roda/discussions
16
+ Alternate Discussion Forum (Google Group) :: http://groups.google.com/group/ruby-roda
16
17
 
17
18
  == Goals
18
19
 
@@ -0,0 +1,20 @@
1
+ = New Features
2
+
3
+ * The named_routes plugin now allows calling route without a block
4
+ to remove the existing route handler. The multi_run plugin
5
+ now allows calling run without an app to remove an existing handler.
6
+ These changes are designed to better support code reloading
7
+ libraries, so that if the related file is deleted, the related
8
+ handlers are also removed, without having to reload the entire
9
+ application.
10
+
11
+ = Other Improvements
12
+
13
+ * The error_handler plugin now avoids a method redefinition warning
14
+ in verbose warning mode.
15
+
16
+ = Other
17
+
18
+ * Roda's primary discussion forum is now GitHub Discussions. The
19
+ ruby-roda Google Group is still available for users who would
20
+ prefer to use that instead.
@@ -62,6 +62,7 @@ class Roda
62
62
  # the exception in the scope of the Roda instance.
63
63
  def error(&block)
64
64
  define_method(:handle_error, &block)
65
+ alias_method(:handle_error, :handle_error)
65
66
  private :handle_error
66
67
  end
67
68
  end
@@ -45,6 +45,9 @@ class Roda
45
45
  # subtrees, multi_run is a better approach, but it does not let you set instance
46
46
  # variables in the main Roda app and have those instance variables usable in
47
47
  # the routing subtrees.
48
+ #
49
+ # To handle development environments that reload code, you can call the
50
+ # +run+ class method without an app to remove dispatching for the prefix.
48
51
  module MultiRun
49
52
  # Initialize the storage for the dispatched applications
50
53
  def self.configure(app)
@@ -67,8 +70,12 @@ class Roda
67
70
 
68
71
  # Add a rack application to dispatch to for the given prefix when
69
72
  # r.multi_run is called.
70
- def run(prefix, app)
71
- multi_run_apps[prefix.to_s] = app
73
+ def run(prefix, app=nil)
74
+ if app
75
+ multi_run_apps[prefix.to_s] = app
76
+ else
77
+ multi_run_apps.delete(prefix.to_s)
78
+ end
72
79
  self::RodaRequest.refresh_multi_run_regexp!
73
80
  end
74
81
  end
@@ -38,6 +38,9 @@ class Roda
38
38
  # Note that in multi-threaded code, you should not attempt to add a
39
39
  # named route after accepting requests.
40
40
  #
41
+ # To handle development environments that reload code, you can call the
42
+ # +route+ class method without a block to remove an existing named route.
43
+ #
41
44
  # == Routing Files
42
45
  #
43
46
  # The convention when using the named_routes plugin is to have a single
@@ -124,7 +127,7 @@ class Roda
124
127
  # The names for the currently stored named routes
125
128
  def named_routes(namespace=nil)
126
129
  unless routes = opts[:namespaced_routes][namespace]
127
- raise RodaError, "unsupported multi_route namespace used: #{namespace.inspect}"
130
+ raise RodaError, "unsupported named_routes namespace used: #{namespace.inspect}"
128
131
  end
129
132
  routes.keys
130
133
  end
@@ -140,7 +143,12 @@ class Roda
140
143
  def route(name=nil, namespace=nil, &block)
141
144
  if name
142
145
  routes = opts[:namespaced_routes][namespace] ||= {}
143
- routes[name] = define_roda_method(routes[name] || "multi_route_#{namespace}_#{name}", 1, &convert_route_block(block))
146
+ if block
147
+ routes[name] = define_roda_method(routes[name] || "named_routes_#{namespace}_#{name}", 1, &convert_route_block(block))
148
+ elsif meth = routes[name]
149
+ routes.delete(name)
150
+ remove_method(meth)
151
+ end
144
152
  else
145
153
  super(&block)
146
154
  end
@@ -41,12 +41,12 @@ class Roda
41
41
  # end
42
42
  #
43
43
  # r.post 'baz' do
44
- # bar = Baz[1]
44
+ # baz = Baz[1]
45
45
  # r.redirect path(baz, 'c', 'd') # /baz/1/c/d
46
46
  # end
47
47
  #
48
48
  # r.post 'quux' do
49
- # bar = Quux[1]
49
+ # quux = Quux[1]
50
50
  # r.redirect url(quux, '/bar') # http://example.com/quux/1/bar
51
51
  # end
52
52
  # end
data/lib/roda/version.rb CHANGED
@@ -4,7 +4,7 @@ class Roda
4
4
  RodaMajorVersion = 3
5
5
 
6
6
  # The minor version of Roda, updated for new feature releases of Roda.
7
- RodaMinorVersion = 50
7
+ RodaMinorVersion = 51
8
8
 
9
9
  # The patch version of Roda, updated only for bug fixes from the last
10
10
  # feature release.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.50.0
4
+ version: 3.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-12 00:00:00.000000000 Z
11
+ date: 2021-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -222,6 +222,7 @@ extra_rdoc_files:
222
222
  - doc/release_notes/3.49.0.txt
223
223
  - doc/release_notes/3.5.0.txt
224
224
  - doc/release_notes/3.50.0.txt
225
+ - doc/release_notes/3.51.0.txt
225
226
  - doc/release_notes/3.6.0.txt
226
227
  - doc/release_notes/3.7.0.txt
227
228
  - doc/release_notes/3.8.0.txt
@@ -279,6 +280,7 @@ files:
279
280
  - doc/release_notes/3.49.0.txt
280
281
  - doc/release_notes/3.5.0.txt
281
282
  - doc/release_notes/3.50.0.txt
283
+ - doc/release_notes/3.51.0.txt
282
284
  - doc/release_notes/3.6.0.txt
283
285
  - doc/release_notes/3.7.0.txt
284
286
  - doc/release_notes/3.8.0.txt
@@ -406,7 +408,7 @@ metadata:
406
408
  bug_tracker_uri: https://github.com/jeremyevans/roda/issues
407
409
  changelog_uri: http://roda.jeremyevans.net/rdoc/files/CHANGELOG.html
408
410
  documentation_uri: http://roda.jeremyevans.net/documentation.html
409
- mailing_list_uri: https://groups.google.com/forum/#!forum/ruby-roda
411
+ mailing_list_uri: https://github.com/jeremyevans/roda/discussions
410
412
  source_code_uri: https://github.com/jeremyevans/roda
411
413
  post_install_message:
412
414
  rdoc_options: []
@@ -423,7 +425,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
423
425
  - !ruby/object:Gem::Version
424
426
  version: '0'
425
427
  requirements: []
426
- rubygems_version: 3.2.22
428
+ rubygems_version: 3.2.32
427
429
  signing_key:
428
430
  specification_version: 4
429
431
  summary: Routing tree web toolkit