trek 0.1.13 → 0.1.15

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: 55936551def2bb25e098d7f095626b1c65851faced1f73d8421337b660c35dfc
4
- data.tar.gz: a55b3f4506ed2cb97258790e8a67194b32a5c409c311625d92aacc7c5bfe78d6
3
+ metadata.gz: 6b09da98ecaf56b2d61965f064a51258bc84dced5267977541a810f33416ee2f
4
+ data.tar.gz: ad5b3dfc7aaaeef7c8d996fd7ba89ee3f5057c5b93d9c40bcba859c37035b2d0
5
5
  SHA512:
6
- metadata.gz: 4eed1f56dace0fc8327f31f86294e2e1a3d394b25bcd662298191d4fd9f1c6a08442088c81cb7889e827ca66e9137c8f4498d6c9d614671daa78da6f4fd2fdc1
7
- data.tar.gz: '06689e0c0b07925a1095ac88d17dc0eba1b0f4db8cbb9664162fc259fb58d795b71653c1f1cc3307fa420bd287d7f78983ce5efa73f412e23d5e98c71cbb3964'
6
+ metadata.gz: ee62982045c3a349abfe75033fe60731cffb498408af1c6375afde95ef4477a7476f8781c4a206f72d4e04565e886165b652c9da488d0f8c3eb97c0a2c9b256b
7
+ data.tar.gz: dcb6b91baad0d783cefcf01c3afb15b54292d105844c291738e2a5972d96905c3c23e6d83435b35a78d0857eb7c12088d01ed21de3a595e8677002c26e214a29
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trek (0.1.13)
4
+ trek (0.1.15)
5
5
  action_policy (~> 0.6)
6
6
  actioncable
7
7
  acts_as_list (~> 1.1)
@@ -27,7 +27,6 @@ PATH
27
27
  shrine (~> 3.0)
28
28
  shrine-blurhash (~> 0.2)
29
29
  slim-rails (~> 4.0)
30
- sorcery (~> 0.17)
31
30
  strip_attributes (~> 2.0)
32
31
  view_component (< 5.0)
33
32
  view_component-form (~> 0.3)
@@ -138,7 +137,6 @@ GEM
138
137
  aws-sigv4 (1.12.1)
139
138
  aws-eventstream (~> 1, >= 1.0.2)
140
139
  base64 (0.3.0)
141
- bcrypt (3.1.21)
142
140
  bigdecimal (3.3.1)
143
141
  blurhash (0.1.8)
144
142
  brakeman (7.1.2)
@@ -204,19 +202,11 @@ GEM
204
202
  zeitwerk (~> 2.6)
205
203
  erb (6.0.1)
206
204
  erubi (1.13.1)
207
- faraday (2.14.1)
208
- faraday-net_http (>= 2.0, < 3.5)
209
- json
210
- logger
211
- faraday-net_http (3.4.2)
212
- net-http (~> 0.5)
213
205
  fastimage (2.4.0)
214
206
  ffi (1.17.3-arm64-darwin)
215
207
  ffi (1.17.3-x86_64-darwin)
216
208
  globalid (1.3.0)
217
209
  activesupport (>= 6.1)
218
- hashie (5.1.0)
219
- logger
220
210
  highline (3.1.2)
221
211
  reline
222
212
  htmlbeautifier (1.4.3)
@@ -245,9 +235,7 @@ GEM
245
235
  rdoc (>= 4.0.0)
246
236
  reline (>= 0.4.2)
247
237
  jmespath (1.6.2)
248
- json (2.18.1)
249
- jwt (3.1.2)
250
- base64
238
+ json (2.18.0)
251
239
  kaminari (1.2.2)
252
240
  activesupport (>= 4.1.0)
253
241
  kaminari-actionview (= 1.2.2)
@@ -297,10 +285,6 @@ GEM
297
285
  mobility (1.3.2)
298
286
  i18n (>= 0.6.10, < 2)
299
287
  request_store (~> 1.0)
300
- multi_xml (0.8.0)
301
- bigdecimal (>= 3.1, < 5)
302
- net-http (0.9.1)
303
- uri (>= 0.11.1)
304
288
  net-imap (0.6.2)
305
289
  date
306
290
  net-protocol
@@ -311,25 +295,10 @@ GEM
311
295
  net-smtp (0.5.1)
312
296
  net-protocol
313
297
  nio4r (2.7.5)
314
- nokogiri (1.19.0-arm64-darwin)
298
+ nokogiri (1.19.1-arm64-darwin)
315
299
  racc (~> 1.4)
316
- nokogiri (1.19.0-x86_64-darwin)
300
+ nokogiri (1.19.1-x86_64-darwin)
317
301
  racc (~> 1.4)
318
- oauth (1.1.3)
319
- base64 (~> 0.1)
320
- oauth-tty (~> 1.0, >= 1.0.6)
321
- snaky_hash (~> 2.0)
322
- version_gem (~> 1.1, >= 1.1.9)
323
- oauth-tty (1.0.6)
324
- version_gem (~> 1.1, >= 1.1.9)
325
- oauth2 (2.0.18)
326
- faraday (>= 0.17.3, < 4.0)
327
- jwt (>= 1.0, < 4.0)
328
- logger (~> 1.2)
329
- multi_xml (~> 0.5)
330
- rack (>= 1.2, < 4)
331
- snaky_hash (~> 2.0, >= 2.0.3)
332
- version_gem (~> 1.1, >= 1.1.9)
333
302
  parallel (1.27.0)
334
303
  parser (3.3.10.0)
335
304
  ast (~> 2.4.1)
@@ -344,7 +313,7 @@ GEM
344
313
  prettyprint
345
314
  prettyprint (0.2.0)
346
315
  prism (1.7.0)
347
- prosemirror_to_html (0.2.1)
316
+ prosemirror_to_html (0.3.0)
348
317
  nokogiri
349
318
  psych (5.3.1)
350
319
  date
@@ -508,14 +477,6 @@ GEM
508
477
  rexml (~> 3.2)
509
478
  rubocop (>= 1.0, < 2.0)
510
479
  slim (>= 3.0, < 6.0)
511
- snaky_hash (2.0.3)
512
- hashie (>= 0.1.0, < 6)
513
- version_gem (>= 1.1.8, < 3)
514
- sorcery (0.18.0)
515
- bcrypt (~> 3.1)
516
- oauth (>= 0.6)
517
- oauth2 (~> 2.0)
518
- railties (>= 7.1)
519
480
  stringio (3.2.0)
520
481
  strip_attributes (2.0.1)
521
482
  activemodel (>= 3.0, < 9.0)
@@ -533,7 +494,6 @@ GEM
533
494
  unicode-emoji (4.2.0)
534
495
  uri (1.1.1)
535
496
  useragent (0.16.11)
536
- version_gem (1.1.9)
537
497
  view_component (4.1.1)
538
498
  actionview (>= 7.1.0, < 8.2)
539
499
  activesupport (>= 7.1.0, < 8.2)
data/README.md CHANGED
@@ -21,7 +21,6 @@ Trek uses these gems under the hood:
21
21
  - [rails-i18n](https://github.com/svenfuchs/rails-i18n), [mobility](https://github.com/shioyama/mobility) and [i18n-tasks](https://github.com/glebm/i18n-tasks) for internationalization
22
22
  - [RSpec](https://github.com/rspec/rspec-rails) for testing
23
23
  - [Shrine](https://github.com/shrinerb/shrine) for attachments
24
- - [Sorcery](https://github.com/Sorcery/sorcery) for authentication
25
24
  - [StripAttributes](https://github.com/rmm5t/strip_attributes)
26
25
 
27
26
  You don't have to set them up yourself, but you can customize their configuration once Trek is installed.
@@ -8,24 +8,11 @@ module Trek
8
8
  class AuthenticationGenerator < Rails::Generators::Base
9
9
  include Trek::Generators::Helpers
10
10
 
11
- desc "Install Sorcery and its migrations."
11
+ desc "Setup authentication."
12
12
 
13
13
  source_root File.expand_path("../templates", __dir__)
14
14
 
15
- def add_gem
16
- gem "sorcery", "~> 0.17" unless in_gemfile?("sorcery")
17
- run "bundle install --quiet", abort_on_failure: true
18
- end
19
-
20
- def run_install
21
- generate "sorcery:install", "remember_me reset_password brute_force_protection activity_logging"
22
- end
23
-
24
- def config_user_mailer
25
- gsub_file "config/initializers/sorcery.rb",
26
- "# user.reset_password_mailer =",
27
- "user.reset_password_mailer = UserMailer"
28
- end
15
+ # TODO
29
16
  end
30
17
  end
31
18
  end
@@ -7,6 +7,6 @@ class TrekTaggings < <%= migration_class_name %>
7
7
  t.timestamps
8
8
  end
9
9
 
10
- add_index :taggings, [:taggable_id, :tag_id], unique: true
10
+ add_index :taggings, %i[taggable_type taggable_id tag_id], unique: true
11
11
  end
12
12
  end
@@ -2,28 +2,60 @@ module Trek
2
2
  # `TypographyFormatter` formats strings to enforce typography rules.
3
3
  # For now, only French typography rules about non-breaking spaces
4
4
  # and ellipsis are implemented.
5
+ #
6
+ # Supports both plain strings and ProseMirror JSONB hashes. When given
7
+ # a Hash, it walks the node tree and formats only `text` node values
8
+ # in place, leaving the structure intact.
5
9
  class TypographyFormatter
6
10
  NBSP = [160].pack("U*").freeze
7
11
  NBSP_BEFORE_CHARS = %w[: ; % € \$ °C °F » ! \? –].freeze
8
12
  NBSP_AFTER_CHARS = %w[«].freeze
9
13
  NBSP_BEFORE_UNITS = %w[g h ha kg km Ko ko kW L l m min ml Mo mo s].freeze
10
14
 
11
- def initialize(str)
12
- @source = str
13
- @output = str.dup
15
+ def initialize(input)
16
+ @source = input
17
+ @prosemirror = input.is_a?(Hash)
18
+ @output = @prosemirror ? deep_dup_hash(input) : input.dup
14
19
  end
15
20
 
16
21
  def formatted
17
22
  return @output if @output.nil?
18
23
 
24
+ if @prosemirror
25
+ format_prosemirror_node(@output)
26
+ else
27
+ format_string!
28
+ end
29
+
30
+ @output
31
+ end
32
+
33
+ private
34
+
35
+ def format_string!
19
36
  remove_double_spaces
20
37
  add_nbsp
21
38
  replace_ellipsis
39
+ end
22
40
 
23
- @output
41
+ def format_prosemirror_node(node)
42
+ return unless node.is_a?(Hash)
43
+
44
+ if node["type"] == "text" && node["text"].is_a?(String)
45
+ formatter = self.class.new(node["text"])
46
+ node["text"] = formatter.formatted
47
+ end
48
+
49
+ Array(node["content"]).each { |child| format_prosemirror_node(child) }
24
50
  end
25
51
 
26
- private
52
+ def deep_dup_hash(obj)
53
+ case obj
54
+ when Hash then obj.transform_values { |v| deep_dup_hash(v) }
55
+ when Array then obj.map { |v| deep_dup_hash(v) }
56
+ else obj.dup rescue obj
57
+ end
58
+ end
27
59
 
28
60
  def remove_double_spaces
29
61
  @output.gsub!(/(\p{Zs}{2,})/, " ")
data/lib/trek/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trek
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.15"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etaminstudio/trek",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "A modern CMS for Ruby on Rails",
5
5
  "main": "app/javascript/trek.js",
6
6
  "repository": {
data/trek.gemspec CHANGED
@@ -52,7 +52,6 @@ Gem::Specification.new do |spec|
52
52
  spec.add_dependency "shrine", "~> 3.0"
53
53
  spec.add_dependency "shrine-blurhash", "~> 0.2"
54
54
  spec.add_dependency "slim-rails", "~> 4.0"
55
- spec.add_dependency "sorcery", "~> 0.17"
56
55
  spec.add_dependency "strip_attributes", "~> 2.0"
57
56
  spec.add_dependency "view_component", "< 5.0"
58
57
  spec.add_dependency "view_component-form", "~> 0.3"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohamed Bengrich
@@ -368,20 +368,6 @@ dependencies:
368
368
  - - "~>"
369
369
  - !ruby/object:Gem::Version
370
370
  version: '4.0'
371
- - !ruby/object:Gem::Dependency
372
- name: sorcery
373
- requirement: !ruby/object:Gem::Requirement
374
- requirements:
375
- - - "~>"
376
- - !ruby/object:Gem::Version
377
- version: '0.17'
378
- type: :runtime
379
- prerelease: false
380
- version_requirements: !ruby/object:Gem::Requirement
381
- requirements:
382
- - - "~>"
383
- - !ruby/object:Gem::Version
384
- version: '0.17'
385
371
  - !ruby/object:Gem::Dependency
386
372
  name: strip_attributes
387
373
  requirement: !ruby/object:Gem::Requirement