skylight-core 4.0.0.alpha → 4.0.0.alpha2

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: ed175a550ab9f4dfeecf785242272a6415e1bc9b6a723f3d5df527bc806c020c
4
- data.tar.gz: dc65a9796aaafef2b25ab8f8aa2bc065b69653fa8f03f7696c08c3b78c26d7e1
3
+ metadata.gz: dcb4098f385b742f3c0a35e4f15870fbfefe917b3cd21c411ade2d523ebae700
4
+ data.tar.gz: 743e877a1931e73c52231db337f880e5628a5634de3e82d72e6dcc990f1a0ae6
5
5
  SHA512:
6
- metadata.gz: 5316aa9d177e810193ae1ed0c93c0ea8e307ed1cace0891083a797d260dd650a03a1afc6a287495b2a706a409a5c03543d22edc38cc0562667a87111d00f74ce
7
- data.tar.gz: 0524413c1fd1b13334ec6faa1b8372200c71b7a049d0c6aed4371e0220b5331c7a286333d3b48a348a064d43400e09650ca42b02a91fe5c3135760d017bf08c0
6
+ metadata.gz: 52153aa179543d1f8ec6a1c352d18e8b36050f3bfe14e56182a5db42528d831477199c8f8136f41ad1934c30fb748afa427a5f8f1d0d5c68afddfd49ce034d62
7
+ data.tar.gz: 265f428b0b1ea26a0bc7456ce4a00ec79cb5571378fbf8306a49f25ed7713fefdc036beba1bdc223e22f0829a87d15c0e623e4d86255807e7da37bc7f2169ff4
@@ -12,9 +12,9 @@ module Skylight::Core
12
12
  title = serializer_class.name.sub(/^ActiveModel::(Serializer::)?/, "")
13
13
 
14
14
  if (adapter_instance = payload[:adapter])
15
- adapter_name = adapter_instance.class.name
16
- .sub(/^ActiveModel::Serializer::Adapter::/, "")
17
- .sub(/^ActiveModelSerializers::Adapter::/, "")
15
+ adapter_name = adapter_instance.class.name.
16
+ sub(/^ActiveModel::Serializer::Adapter::/, "").
17
+ sub(/^ActiveModelSerializers::Adapter::/, "")
18
18
  desc = "Adapter: #{adapter_name}"
19
19
  end
20
20
 
@@ -0,0 +1,30 @@
1
+ module Skylight::Core
2
+ module Normalizers
3
+ class ActiveStorage < Normalizer
4
+ TITLES = {
5
+ "preview.active_storage" => "Preview",
6
+ "transform.active_storage" => "Transform",
7
+ "service_download.active_storage" => "Download",
8
+ "service_upload.active_storage" => "Upload",
9
+ "service_streaming_download.active_storage" => "Streaming Download",
10
+ "service_download_chunk.active_storage" => "Download Chunk",
11
+ "service_delete.active_storage" => "Delete",
12
+ "service_delete_prefixed.active_storage" => "Delete Prefixed",
13
+ "service_exist.active_storage" => "Exist",
14
+ "service_url.active_storage" => "Url"
15
+ }.freeze
16
+
17
+ TITLES.each_key do |key|
18
+ register key
19
+ end
20
+
21
+ def normalize(_trace, name, _payload)
22
+ title = ["ActiveStorage", TITLES[name]].join(" ")
23
+
24
+ cat = "app.#{name.split('.').reverse.join('.')}"
25
+
26
+ [cat, title, nil]
27
+ end
28
+ end
29
+ end
30
+ end
@@ -5,7 +5,15 @@ module Skylight::Core
5
5
  include Util::AllocationFree
6
6
 
7
7
  def setup
8
- @paths = config["normalizers.render.view_paths"] || []
8
+ @paths = []
9
+
10
+ Gem.path.each do |path|
11
+ @paths << "#{path}/bundler/gems".freeze
12
+ @paths << "#{path}/gems".freeze
13
+ @paths << path
14
+ end
15
+
16
+ @paths.concat(Array(config["normalizers.render.view_paths"]))
9
17
  end
10
18
 
11
19
  # Generic normalizer for renders
@@ -24,24 +32,19 @@ module Skylight::Core
24
32
  def relative_path(path)
25
33
  return path if relative_path?(path)
26
34
 
27
- root = array_find(@paths) { |p| path.start_with?(p) }
28
- type = :project
29
-
30
- unless root
31
- root = array_find(Gem.path) { |p| path.start_with?(p) }
32
- type = :gem
33
- end
34
-
35
- if root
35
+ if (root = array_find(@paths) { |p| path.start_with?(p) })
36
36
  start = root.size
37
37
  start += 1 if path.getbyte(start) == SEPARATOR_BYTE
38
- if type == :gem
39
- "$GEM_PATH/#{path[start, path.size]}"
40
- else
41
- path[start, path.size]
42
- end
38
+
39
+ path[start, path.size].sub(
40
+ # Matches a Gem Version or 12-digit hex (sha)
41
+ # that is preceeded by a `-` and followed by `/`
42
+ # Also matches 'app/views/' if it exists
43
+ %r{-(?:#{Gem::Version::VERSION_PATTERN}|[0-9a-f]{12})\/(?:app\/views\/)*},
44
+ ": ".freeze
45
+ )
43
46
  else
44
- "Absolute Path"
47
+ "Absolute Path".freeze
45
48
  end
46
49
  end
47
50
 
@@ -101,6 +101,7 @@ module Skylight::Core
101
101
  active_model_serializers/render
102
102
  active_record/instantiation
103
103
  active_record/sql
104
+ active_storage
104
105
  active_support/cache
105
106
  coach/handler_finish
106
107
  coach/middleware_finish
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.0.0-alpha".freeze
3
+ VERSION = "4.0.0-alpha2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.alpha
4
+ version: 4.0.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2018-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: beefcake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "<"
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
@@ -177,6 +177,7 @@ files:
177
177
  - lib/skylight/core/normalizers/active_model_serializers/render.rb
178
178
  - lib/skylight/core/normalizers/active_record/instantiation.rb
179
179
  - lib/skylight/core/normalizers/active_record/sql.rb
180
+ - lib/skylight/core/normalizers/active_storage.rb
180
181
  - lib/skylight/core/normalizers/active_support/cache.rb
181
182
  - lib/skylight/core/normalizers/active_support/cache_clear.rb
182
183
  - lib/skylight/core/normalizers/active_support/cache_decrement.rb