impression 0.12 → 0.14

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: e9b79a3bb3823fad2c5c7ad2ed7f187c2c398dea84c62d9d0fdbd481238f499a
4
- data.tar.gz: 6cd1d41db73b992ee6f2027220440871d6512811f23b810ba064733a0538e7d4
3
+ metadata.gz: 76c18adee5b69fe0e3d02d2eeb8530142899f9de803ee7eed1f3c131884022f6
4
+ data.tar.gz: 29914f3e6cc48f4205422f6e50ecd36f6114b9a731fdec8a58998eaf73319cfb
5
5
  SHA512:
6
- metadata.gz: 734ab33bb5056e06076403fc774a13851953edec042b915826577aaa810c8e9d39c1a242b95836b5b6dcb61404d0fd1e8ab3afaf0cd095105a14d5ccd1bab9ea
7
- data.tar.gz: df49438b49021b4d42de855f72b2342ecfe9416a2ea118feb8d09580d8ac4c0bb3f10b87d25edc020cdf37be8a91a5d0d4f85119b3a7bf3e3d3186b917477594
6
+ metadata.gz: 86d4bd1c95d1de78ebb38b76ad7c8d2aa3227cd0229c3874bac78704f2d3407efb8eecf301d982305dd8e74169a3d20299770b624b5a76aea79dda42fdbddceb
7
+ data.tar.gz: 486af13f289f550d8fe5c4c48805697d32c50ed3f813f4517335718eb0c754337e125ea9a552e1fc0f954adb4e2fca4efbfed58982cc309c175521bc840357b6
data/.github/FUNDING.yml CHANGED
@@ -1 +1 @@
1
- github: ciconia
1
+ github: noteflakes
@@ -16,7 +16,7 @@ jobs:
16
16
  runs-on: ${{matrix.os}}
17
17
 
18
18
  env:
19
- POLYPHONY_USE_LIBEV: "1"
19
+ POLYPHONY_LIBEV: "1"
20
20
 
21
21
  steps:
22
22
  - name: Setup machine
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.14 2024-12-11
2
+
3
+ - Remove Polyphony, Tipi deps
4
+
5
+ ## 0.13 2022-04-05
6
+
7
+ - Prevent race condiution on loading Ruby modules
8
+
1
9
  ## 0.12 2022-02-16
2
10
 
3
11
  - Implement `RackApp` resource class (#16)
data/Gemfile.lock CHANGED
@@ -1,88 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- impression (0.12)
4
+ impression (0.14)
5
5
  modulation (~> 1.1)
6
6
  papercraft (~> 0.23)
7
- polyphony (~> 0.77)
8
7
  qeweney (~> 0.18)
9
- tipi (~> 0.50)
10
8
 
11
9
  GEM
12
10
  remote: https://rubygems.org/
13
11
  specs:
14
- acme-client (2.0.9)
15
- faraday (>= 0.17, < 2.0.0)
16
- docile (1.4.0)
17
- escape_utils (1.2.1)
18
- ever (0.1)
19
- extralite (1.12)
20
- faraday (1.9.3)
21
- faraday-em_http (~> 1.0)
22
- faraday-em_synchrony (~> 1.0)
23
- faraday-excon (~> 1.1)
24
- faraday-httpclient (~> 1.0)
25
- faraday-multipart (~> 1.0)
26
- faraday-net_http (~> 1.0)
27
- faraday-net_http_persistent (~> 1.0)
28
- faraday-patron (~> 1.0)
29
- faraday-rack (~> 1.0)
30
- faraday-retry (~> 1.0)
31
- ruby2_keywords (>= 0.0.4)
32
- faraday-em_http (1.0.0)
33
- faraday-em_synchrony (1.0.0)
34
- faraday-excon (1.1.0)
35
- faraday-httpclient (1.0.1)
36
- faraday-multipart (1.0.3)
37
- multipart-post (>= 1.2, < 3)
38
- faraday-net_http (1.0.1)
39
- faraday-net_http_persistent (1.2.0)
40
- faraday-patron (1.0.0)
41
- faraday-rack (1.0.0)
42
- faraday-retry (1.0.3)
43
- h1p (0.3)
44
- http-2 (0.11.0)
45
- json (2.6.1)
46
- kramdown (2.3.1)
12
+ docile (1.4.1)
13
+ escape_utils (1.2.2)
14
+ json (2.8.2)
15
+ kramdown (2.3.2)
47
16
  rexml
48
17
  kramdown-parser-gfm (1.1.0)
49
18
  kramdown (~> 2.0)
50
- localhost (1.1.9)
51
19
  minitest (5.11.3)
52
- modulation (1.1)
53
- msgpack (1.4.5)
54
- multipart-post (2.1.1)
55
- papercraft (0.23)
20
+ modulation (1.2)
21
+ papercraft (0.29)
56
22
  escape_utils (~> 1.2.1)
57
23
  kramdown (~> 2.3.1)
58
24
  kramdown-parser-gfm (~> 1.1.0)
59
25
  rouge (~> 3.27.0)
60
- polyphony (0.77)
61
26
  qeweney (0.18)
62
27
  escape_utils (~> 1.2.1)
63
- rack (2.2.3)
64
28
  rake (12.3.3)
65
- rexml (3.2.5)
29
+ rexml (3.3.9)
66
30
  rouge (3.27.0)
67
- ruby2_keywords (0.0.5)
68
31
  simplecov (0.17.1)
69
32
  docile (~> 1.1)
70
33
  json (>= 1.8, < 3)
71
34
  simplecov-html (~> 0.10.0)
72
35
  simplecov-html (0.10.2)
73
- tipi (0.50)
74
- acme-client (~> 2.0.9)
75
- ever (~> 0.1)
76
- extralite (~> 1.2)
77
- h1p (~> 0.3)
78
- http-2 (~> 0.11)
79
- localhost (~> 1.1.4)
80
- msgpack (~> 1.4.2)
81
- polyphony (~> 0.77)
82
- qeweney (~> 0.17)
83
- rack (>= 2.0.8, < 2.3.0)
84
- websocket (~> 1.2.8)
85
- websocket (1.2.9)
86
36
 
87
37
  PLATFORMS
88
38
  ruby
data/impression.gemspec CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
  s.required_ruby_version = '>= 2.6'
22
22
 
23
- s.add_runtime_dependency 'polyphony', '~>0.77'
24
- s.add_runtime_dependency 'tipi', '~>0.50'
23
+ # s.add_runtime_dependency 'polyphony', '~>0.93'
24
+ # s.add_runtime_dependency 'tipi', '~>0.52'
25
25
  s.add_runtime_dependency 'qeweney', '~>0.18'
26
26
 
27
27
  s.add_runtime_dependency 'papercraft', '~>0.23'
@@ -16,6 +16,7 @@ module Impression
16
16
  def initialize(**props)
17
17
  super
18
18
  @layouts = {}
19
+ # @file_info_loader = spin { run_file_info_loader }
19
20
  end
20
21
 
21
22
  # Returns a list of pages found in the given directory (relative to the base
@@ -46,6 +47,66 @@ module Impression
46
47
  symbolize_names: true
47
48
  }.freeze
48
49
 
50
+ # Runs a file info loader handling incoming requests for file info. This
51
+ # method is run in a fiber setup in #initialize.
52
+ #
53
+ # @return [void]
54
+ def run_file_info_loader
55
+ loop do
56
+ peer, path = receive
57
+ begin
58
+ info = calculate_path_info(path)
59
+ peer << info
60
+ rescue Polyphony::BaseException
61
+ raise
62
+ rescue => e
63
+ peer.raise(e)
64
+ end
65
+ end
66
+ end
67
+
68
+ def safe_calculate_path_info(path)
69
+ # @file_info_loader << [Fiber.current, path]
70
+ # receive
71
+ calculate_path_info(path)
72
+ end
73
+
74
+ # Returns the path info for the given relative path.
75
+ #
76
+ # @param path [String] relative path
77
+ # @return [Hash] path info
78
+ def get_path_info(path)
79
+ @path_info_cache[path] ||= safe_calculate_path_info(path)
80
+ end
81
+
82
+ # Returns complete file info for Markdown files
83
+ #
84
+ # @param info [Hash] file info
85
+ # @param path [String] file path
86
+ # @return [Hash] file info
87
+ def file_info_md(info, path)
88
+ atts, content = parse_markdown_file(path)
89
+ info = info.merge(atts)
90
+ info[:html_content] = Papercraft.markdown(content)
91
+ info[:kind] = :markdown
92
+ if !info[:date] && (m = path.match(DATE_REGEXP))
93
+ info[:date] = Date.parse(m[1])
94
+ end
95
+ info
96
+ end
97
+
98
+ # Returns complete file info for Ruby files
99
+ #
100
+ # @param info [Hash] file info
101
+ # @param path [String] file path
102
+ # @return [Hash] file info
103
+ def file_info_rb(info, path)
104
+ info.merge(
105
+ kind: :module,
106
+ module: import(path)
107
+ )
108
+ end
109
+
49
110
  # Returns the path info for the given file path.
50
111
  #
51
112
  # @param path [String] file path
@@ -54,19 +115,12 @@ module Impression
54
115
  info = super
55
116
  case info[:ext]
56
117
  when '.md'
57
- atts, content = parse_markdown_file(path)
58
- info = info.merge(atts)
59
- info[:html_content] = Papercraft.markdown(content)
60
- info[:kind] = :markdown
118
+ file_info_md(info, path)
61
119
  when '.rb'
62
- info[:module] = import(path)
63
- info[:kind] = :module
64
- end
65
- if (m = path.match(DATE_REGEXP))
66
- info[:date] ||= Date.parse(m[1])
120
+ file_info_rb(info, path)
121
+ else
122
+ info
67
123
  end
68
-
69
- info
70
124
  end
71
125
 
72
126
  # Returns the pretty URL for the given relative path. For pages, the
@@ -238,10 +292,10 @@ module Impression
238
292
  layout ||= 'default'
239
293
  path = File.join(@directory, "_layouts/#{layout}.rb")
240
294
  raise "Layout not found #{path}" unless File.file?(path)
241
-
295
+
242
296
  import path
243
297
  end
244
-
298
+
245
299
  # Parses the markdown file at the given path.
246
300
  #
247
301
  # @param path [String] file path
@@ -258,11 +312,11 @@ module Impression
258
312
  if (m = content.match(FRONT_MATTER_REGEXP))
259
313
  front_matter = m[1]
260
314
  content = m.post_match
261
-
315
+
262
316
  yaml = YAML.safe_load(front_matter, **YAML_OPTS)
263
317
  atts = atts.merge(yaml)
264
318
  end
265
-
319
+
266
320
  [atts, content]
267
321
  end
268
322
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'fileutils'
4
- require 'tipi'
4
+ # require 'tipi'
5
5
  require_relative './resource'
6
6
 
7
7
  module Impression
@@ -3,7 +3,7 @@
3
3
  require 'json'
4
4
 
5
5
  module Impression
6
-
6
+
7
7
  module RequestExtensions
8
8
 
9
9
  # Response extensions for `Qeweney::Request`
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Impression
4
-
4
+
5
5
  # Extensions for `Qeweney::Request`
6
6
  module RequestExtensions
7
7
 
@@ -8,7 +8,7 @@ require_relative './request_extensions/responses'
8
8
 
9
9
  # Extensions to `Qeweney::Request`
10
10
  class Qeweney::Request
11
-
11
+
12
12
  # include Impression::Pages::RequestMethods
13
13
  include Impression::RequestExtensions::Routing
14
14
  include Impression::RequestExtensions::Responses
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Impression
4
- VERSION = '0.12'
4
+ VERSION = '0.14'
5
5
  end
data/lib/impression.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'polyphony'
3
+ # require 'polyphony'
4
4
 
5
5
  require_relative './impression/request_extensions'
6
6
  require_relative './impression/resource'
data/test/test_app.rb CHANGED
@@ -260,7 +260,7 @@ class AppTest < MiniTest::Test
260
260
  def test_template_resource_and_request
261
261
  req = mock_req(':method' => 'GET', ':path' => '/foobar?q=42')
262
262
  @app.route_and_call(req)
263
-
263
+
264
264
  foo = Papercraft.html {
265
265
  html5 {
266
266
  head {
@@ -360,14 +360,14 @@ class AbstractAppTest < MiniTest::Test
360
360
 
361
361
  def test_abstract_app_each
362
362
  app = Impression::App.new(path: '/')
363
-
363
+
364
364
  buffer = []
365
365
  app.each { |r| buffer << r }
366
366
  assert_equal [app], buffer
367
367
 
368
368
  foo = PathRenderingResource.new(parent: app, path: 'foo')
369
369
  bar = PathRenderingResource.new(parent: app, path: 'bar')
370
-
370
+
371
371
  buffer = []
372
372
  app.each { |r| buffer << r }
373
373
  assert_equal [app, foo, bar], buffer
@@ -55,7 +55,7 @@ class ResourceTest < MiniTest::Test
55
55
  req = mock_req(':method' => 'GET', ':path' => '/foo/bar/littlebar')
56
56
  assert_equal r4, r1.route(req)
57
57
  assert_equal '/', req.resource_relative_path
58
-
58
+
59
59
  req = mock_req(':method' => 'GET', ':path' => '/foo/bar/littlebar/littlebaz')
60
60
  assert_equal r4, r1.route(req)
61
61
  assert_equal '/littlebaz', req.resource_relative_path
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: impression
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.12'
4
+ version: '0.14'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-16 00:00:00.000000000 Z
11
+ date: 2024-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: polyphony
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.77'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0.77'
27
- - !ruby/object:Gem::Dependency
28
- name: tipi
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.50'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.50'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: qeweney
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -208,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
180
  - !ruby/object:Gem::Version
209
181
  version: '0'
210
182
  requirements: []
211
- rubygems_version: 3.3.3
183
+ rubygems_version: 3.5.16
212
184
  signing_key:
213
185
  specification_version: 4
214
186
  summary: Impression - a modern web framework for Ruby