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 +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/rack/capture.rb +5 -2
- data/lib/rack/capture/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f79f70c288700c5f342644d33ea160284c03f736bcf7087ed283040b9c2e7ba
|
4
|
+
data.tar.gz: 491769ee97aa6a55ded4ddb4db0b6c57625806bf4f4f7af9b3773e6e8e738894
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77ed9519baed02126f4bf1075c482ae3915e24042844eb6b7c4157aa809cef3021887c0fa5873c29f1b5b2728cd6a450aa4a0a460ec45ef840b52177eb28a2c8
|
7
|
+
data.tar.gz: 506a67af2aeeebb56e2a8e0abb079b4a8dae933988eb422cc6b3af6347ca3c43aa98d4d86290222a2785bbe148db660844b9581f6932b691ea91e3f786489fd5
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/Gemfile.lock
CHANGED
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
|
data/lib/rack/capture.rb
CHANGED
@@ -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("
|
46
|
+
destination = ::Pathname.new("#{@output_directory_path}#{path_info}")
|
44
47
|
if response.content_type&.include?('text/html')
|
45
|
-
destination += 'index' if
|
48
|
+
destination += 'index' if path_info == '/'
|
46
49
|
destination = destination.sub_ext('.html')
|
47
50
|
end
|
48
51
|
destination
|
data/lib/rack/capture/version.rb
CHANGED