rack-capture 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 702d6e7c443504b12de28619254711077de0e6b605fef65ca364e0760c731a4c
4
- data.tar.gz: 79621b6046182ee868d8bb146f2160f63de15961e791eb10b94cf4a91892cc5e
3
+ metadata.gz: 2f79f70c288700c5f342644d33ea160284c03f736bcf7087ed283040b9c2e7ba
4
+ data.tar.gz: 491769ee97aa6a55ded4ddb4db0b6c57625806bf4f4f7af9b3773e6e8e738894
5
5
  SHA512:
6
- metadata.gz: f480fbd7c4f807e65ba8f50d18c3f1657f68ec2dc6cab86ed523afbec17dec20e3a2eed031c069ac1323542fd992ff937dffd35c64b98a6c5f745a96cf6d6e4f
7
- data.tar.gz: 89aff18188238280e14e49af9074fa23a021330c165eece63eadf144d699c81f9d45ab7e9431b64e7491c632192ffe1caf3c6e919fbfe1f9d19678025e2281fd
6
+ metadata.gz: 77ed9519baed02126f4bf1075c482ae3915e24042844eb6b7c4157aa809cef3021887c0fa5873c29f1b5b2728cd6a450aa4a0a460ec45ef840b52177eb28a2c8
7
+ data.tar.gz: 506a67af2aeeebb56e2a8e0abb079b4a8dae933988eb422cc6b3af6347ca3c43aa98d4d86290222a2785bbe148db660844b9581f6932b691ea91e3f786489fd5
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.4.0 - 2020-11-06
11
+
12
+ ### Added
13
+
14
+ - Add `:output_directory_path` option.
15
+
16
+ ### Changed
17
+
18
+ - Change default output path from `"dist"` to `"output"`.
19
+
20
+ ### Fixed
21
+
22
+ - Fix output file name on GET /script_name/.
23
+
10
24
  ## 0.3.0 - 2020-11-06
11
25
 
12
26
  ### Added
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-capture (0.3.0)
4
+ rack-capture (0.4.0)
5
5
  rack
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -44,6 +44,13 @@ require 'rack/capture'
44
44
  end
45
45
  ```
46
46
 
47
+ ### Arguments
48
+
49
+ - `:app` - Rack application to be used for rendering response
50
+ - `:url` - URL
51
+ - `:output_directory_path` - Where to output files (default: `"output"`)
52
+ - `:script_name` - Rack SCRIPT_NAME, commonly used for GitHub Pages project sites (default: `""`)
53
+
47
54
  ## Development
48
55
 
49
56
  ### Setup
@@ -13,14 +13,17 @@ module Rack
13
13
  end
14
14
 
15
15
  # @param [#call] app Rack application.
16
+ # @param [String] output_directory_path
16
17
  # @param [String] script_name
17
18
  # @param [String] url
18
19
  def initialize(
19
20
  app:,
20
21
  url:,
22
+ output_directory_path: 'output',
21
23
  script_name: ''
22
24
  )
23
25
  @app = app
26
+ @output_directory_path = output_directory_path
24
27
  @script_name = script_name
25
28
  @url = url
26
29
  end
@@ -40,9 +43,9 @@ module Rack
40
43
 
41
44
  # @param [Rack::Response] response
42
45
  def calculate_destination(response:)
43
- destination = ::Pathname.new("dist#{path_info}")
46
+ destination = ::Pathname.new("#{@output_directory_path}#{path_info}")
44
47
  if response.content_type&.include?('text/html')
45
- destination += 'index' if uri.path == '/'
48
+ destination += 'index' if path_info == '/'
46
49
  destination = destination.sub_ext('.html')
47
50
  end
48
51
  destination
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  class Capture
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-capture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura