roda 3.29.0 → 3.30.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: 47d34c142084b4dc11049861f97621177bd1071744caff3b18ad113a79308139
4
- data.tar.gz: 7021cfd179b0bd159f93ff31d86b9128686686d2f63c2068863b3ffc5150b44a
3
+ metadata.gz: 40d384d8a60174df9dcfdb645c5bf607232c44012827659d06691561666d2a74
4
+ data.tar.gz: 7f8cfedfb18a5125be0cbc7bb77cd60b45f2f869717ae163c9779be3bc054264
5
5
  SHA512:
6
- metadata.gz: 48fa41c207a4e37aaa3deb8eb773480bd015875e8f2c9ef7d4489ef6b2538ad98001afa9ab1adf7555ebc100929a5cd0b7eb1b333cc331255818583c1d1dfb25
7
- data.tar.gz: 4f7103b4730ed2f51309704c8f991c5c3f7fc3c865e07ba917219b54ef9019e0bafddbdeca280bd8343c8fd1e496ca5e3444e674eb59c93e98f5bdf7eab09647
6
+ metadata.gz: d5619d3e9ac99a426662057ba932ae8477d251e8252710f9fce7b33ffb5ccaec45673c3b933906d71e45ec1b4be6444467d5d7ad3be04df6123b66e19432ea4f
7
+ data.tar.gz: 0da11db1409e19bf6a11b5c2f9e88da573b9e00175de4bf753da1fab2d4877a1ef84013a5194d349237fbc362205efccbc03fd0b56ba800fc6e903583baf9cf1
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ = 3.30.0 (2020-03-13)
2
+
3
+ * Support :relative_paths assets plugin option to use relative paths for the assets (jeremyevans)
4
+
5
+ * Make run_append_slash and run_handler plugins work when used together (janko) (#185)
6
+
7
+ * Make :header matcher in header_matchers plugin work for Content-Type and Content-Length (jeremyevans) (#184)
8
+
1
9
  = 3.29.0 (2020-02-14)
2
10
 
3
11
  * Remove specs and old release notes from the gem to reduce gem size by over 35% (jeremyevans)
@@ -1107,7 +1107,7 @@ Roda's plugin system is based on the plugin system used by
1107
1107
 
1108
1108
  Roda fully supports the currently supported versions of Ruby (MRI) and JRuby. It may
1109
1109
  support unsupported versions of Ruby or JRuby, but such support may be dropped in any
1110
- minor version of keeping it becomes a support issue. The minimum Ruby version
1110
+ minor version if keeping it becomes a support issue. The minimum Ruby version
1111
1111
  required to run the current version of Roda is 1.9.2.
1112
1112
 
1113
1113
  == License
@@ -0,0 +1,14 @@
1
+ = New Features
2
+
3
+ * A :relative_paths plugin option has been added to the assets
4
+ plugin. This option makes the paths to the asset files in the
5
+ link and script tags relative paths instead of absolute paths.
6
+
7
+ = Other Improvements
8
+
9
+ * The :header matcher in the header_matchers plugin now works
10
+ correctly for the Content-Type and Content-Length headers, which
11
+ are not prefixed with HTTP_ in the rack environment.
12
+
13
+ * The run_append_slash and run_handler plugins now work correctly
14
+ when used together.
@@ -291,6 +291,8 @@ class Roda
291
291
  # non-compiled mode, but will write the metadata to the file if compile_assets is called.
292
292
  # :public :: Path to your public folder, in which compiled files are placed (default: 'public'). Relative
293
293
  # paths will be considered relative to the application's :root option.
294
+ # :relative_paths :: Use relative paths instead of absolute paths when setting up link and script tags for
295
+ # assets.
294
296
  # :sri :: Enables subresource integrity when setting up references to compiled assets. The value should be
295
297
  # :sha256, :sha384, or :sha512 depending on which hash algorithm you want to use. This changes the
296
298
  # hash algorithm that Roda will use when naming compiled asset files. The default is :sha256, you
@@ -621,8 +623,10 @@ class Roda
621
623
  stype = ltype.to_s
622
624
 
623
625
  url_prefix = request.script_name if self.class.opts[:add_script_name]
626
+ relative_paths = o[:relative_paths]
624
627
 
625
- if o[:compiled]
628
+ paths = if o[:compiled]
629
+ relative_paths = false if o[:compiled_asset_host]
626
630
  if ukey = _compiled_assets_hash(type, true)
627
631
  ["#{o[:compiled_asset_host]}#{url_prefix}/#{o[:"compiled_#{stype}_prefix"]}.#{ukey}.#{stype}"]
628
632
  else
@@ -642,6 +646,15 @@ class Roda
642
646
  "#{url_prefix}/#{o[:"#{stype}_prefix"]}#{mtime}#{prefix}#{f}#{o[:"#{stype}_suffix"]}"
643
647
  end
644
648
  end
649
+
650
+ if relative_paths && (slash_count = request.path.count('/')) >= 1
651
+ relative_prefix = "../" * (slash_count - 1)
652
+ paths.map! do |path|
653
+ "#{relative_prefix}#{path.slice(1,100000000)}"
654
+ end
655
+ end
656
+
657
+ paths
645
658
  end
646
659
 
647
660
  # Return a string containing html tags for the given asset type.
@@ -244,10 +244,10 @@ END
244
244
 
245
245
  frames = exception.backtrace.map.with_index do |line, i|
246
246
  frame = {:id=>i}
247
- if line =~ /(.*?):(\d+)(:in `(.*)')?/
247
+ if line =~ /\A(.*?):(\d+)(?::in `(.*)')?\Z/
248
248
  filename = frame[:filename] = $1
249
249
  lineno = frame[:lineno] = $2.to_i
250
- frame[:function] = $4
250
+ frame[:function] = $3
251
251
 
252
252
  begin
253
253
  lineno -= 1
@@ -261,8 +261,6 @@ END
261
261
  end
262
262
 
263
263
  frame
264
- else
265
- nil
266
264
  end
267
265
  end.compact
268
266
 
@@ -51,7 +51,11 @@ class Roda
51
51
 
52
52
  # Match if the given uppercase key is present inside the environment.
53
53
  def match_header(key)
54
- if v = @env["HTTP_#{key.upcase.tr("-","_")}"]
54
+ key = key.upcase.tr("-","_")
55
+ unless key == "CONTENT_TYPE" || key == "CONTENT_LENGTH"
56
+ key = "HTTP_#{key}"
57
+ end
58
+ if v = @env[key]
55
59
  @captures << v
56
60
  end
57
61
  end
@@ -33,7 +33,7 @@ class Roda
33
33
  # does not contain a trailing slash, a trailing slash is appended to the
34
34
  # path internally, or a redirect is issued when configured with
35
35
  # <tt>use_redirects: true</tt>.
36
- def run(app)
36
+ def run(*)
37
37
  if remaining_path.empty?
38
38
  if scope.opts[:run_append_slash_redirect]
39
39
  redirect("#{path}/")
@@ -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 = 29
7
+ RodaMinorVersion = 30
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.29.0
4
+ version: 3.30.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: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2020-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -205,6 +205,7 @@ extra_rdoc_files:
205
205
  - doc/release_notes/3.27.0.txt
206
206
  - doc/release_notes/3.28.0.txt
207
207
  - doc/release_notes/3.29.0.txt
208
+ - doc/release_notes/3.30.0.txt
208
209
  files:
209
210
  - CHANGELOG
210
211
  - MIT-LICENSE
@@ -235,6 +236,7 @@ files:
235
236
  - doc/release_notes/3.28.0.txt
236
237
  - doc/release_notes/3.29.0.txt
237
238
  - doc/release_notes/3.3.0.txt
239
+ - doc/release_notes/3.30.0.txt
238
240
  - doc/release_notes/3.4.0.txt
239
241
  - doc/release_notes/3.5.0.txt
240
242
  - doc/release_notes/3.6.0.txt