rhino_project_core 0.22.0.beta.15 → 0.23.0.beta.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: 9297934b3ffbbdd1df8ec4b09fe15aba8be8ae072963b8536158363d6b2bf20d
4
- data.tar.gz: 34a0a30b0cb956214d0db472393863b74969c2cec1c42103cdb687f37de33f90
3
+ metadata.gz: a6ec2703effbf613547e8504fa5f5bdaa45b621cc5c822e25884865d6757647b
4
+ data.tar.gz: 2ae0f2567bdb809ac9648223fcfed93ba4f5b2a9e1fc7bf53599c5e3771b3ce2
5
5
  SHA512:
6
- metadata.gz: 2632bf08d00d969f58e92fc9cc6318ccf8d2ce15725a03e8d871e455c0f8b982c048b3fdd9c1c0f36efd036143a0d26d8dcc639bb680de88defa6e4858f9d5a1
7
- data.tar.gz: '0541867ed790d7d979d4826c3d211a805410390776aa955994539e24125e3d525d66bf876b7338367f5ccc74aa96e7b620e452d6ce60447b2c4a9501e24161fe'
6
+ metadata.gz: 3f8833d190de928ca0797f2279cf04d47f427f4fad53c91006a6a0a407c5dcd2aecb56a0bcd503aa53adccc44379e66670b2621e1f87dbe0c8110204bfc12584
7
+ data.tar.gz: d1e99102ea0ff0c4f7ee121890c18fe88b412d861ac4f00a7d0ac7bb6ed1fe830fd98c6a5d370b20bf4e7e0f4f5e61fd19a56cfdbf5e69fd8d7ca63fa842a9ca
@@ -15,8 +15,6 @@ module Rhino
15
15
  class_option :db_port, type: :numeric, default: 5432, group: :database
16
16
  class_option :db_user, type: :string, group: :database
17
17
  class_option :db_password, type: :string, group: :database
18
- class_option :redis_port, type: :numeric, default: 6379, group: :redis
19
- class_option :redis_database, type: :numeric, default: 0, group: :redis
20
18
 
21
19
  attr_reader :server_port,
22
20
  :db_name,
@@ -24,9 +22,6 @@ module Rhino
24
22
  :db_port,
25
23
  :db_user,
26
24
  :db_password,
27
- :redis_host,
28
- :redis_port,
29
- :redis_database,
30
25
  :dockerized
31
26
 
32
27
  source_root File.expand_path("templates", __dir__)
@@ -92,18 +87,6 @@ module Rhino
92
87
  options[:db_password] || ENV["DB_PASSWORD"] || ""
93
88
  end
94
89
 
95
- def redis_host_default
96
- options[:redis_host] || ENV["REDIS_HOST"] || "localhost"
97
- end
98
-
99
- def redis_port_default
100
- options[:redis_port] || ENV["REDIS_PORT"]
101
- end
102
-
103
- def redis_database_default
104
- options[:redis_database] || ENV["REDIS_DATABASE"]
105
- end
106
-
107
90
  def dockerized_default
108
91
  options[:defaults] == "docker" ? "Y" : "N"
109
92
  end
@@ -114,7 +97,6 @@ module Rhino
114
97
  @server_port = ask_prompt("Port?", server_port_default)
115
98
 
116
99
  collect_database_info
117
- collect_redis_info
118
100
  end
119
101
 
120
102
  def collect_docker_info
@@ -126,9 +108,6 @@ module Rhino
126
108
  @db_user = "postgres"
127
109
  @db_password = "password"
128
110
  @db_port = 5432
129
- @redis_host = "redis"
130
- @redis_port = 6379
131
- @redis_database = 0
132
111
 
133
112
  puts <<~HERE
134
113
  The following docker configuration has been automatically set for you:
@@ -136,9 +115,6 @@ module Rhino
136
115
  Database port: #{db_port}
137
116
  Database user: #{db_user}
138
117
  Database password: #{db_password}
139
- Redis host: #{redis_host}
140
- Redis port: #{redis_port}
141
- Redis database: #{redis_database}
142
118
  HERE
143
119
  end
144
120
 
@@ -152,14 +128,6 @@ module Rhino
152
128
  nil
153
129
  end
154
130
 
155
- def collect_redis_info
156
- @redis_host ||= ask_prompt("Redis host?", redis_host_default)
157
- @redis_port ||= ask_prompt("Redis port?", redis_port_default)
158
- @redis_database ||= ask_prompt("Redis database?", redis_database_default)
159
-
160
- nil
161
- end
162
-
163
131
  def project_file(file)
164
132
  File.join(project_dir, file)
165
133
  end
@@ -9,9 +9,6 @@ DB_HOST=<%= db_host %>
9
9
  DB_PORT=<%= db_port %>
10
10
  DB_USERNAME=<%= db_user %>
11
11
  DB_PASSWORD=<%= db_password %>
12
- REDIS_HOST=<%= redis_host %>
13
- REDIS_PORT=<%= redis_port %>
14
- REDIS_DATABASE=<%= redis_database %>
15
12
 
16
13
  # Client
17
14
  VITE_API_ROOT_PATH=$ROOT_URL
@@ -11,6 +11,8 @@ module Rhino
11
11
  included do
12
12
  attribute :url
13
13
  attribute :url_attachment
14
+ attribute :previews, :json, default: {}
15
+ attribute :representations, :json, default: {}
14
16
  attribute :variants, :json, default: {}
15
17
 
16
18
  rhino_policy :active_storage_attachment
@@ -23,20 +25,35 @@ module Rhino
23
25
  url(attachment, disposition: :attachment)
24
26
  end
25
27
 
26
- def variants
27
- # Not everything may be processed into a variant based on mime type
28
- return unless variable?
28
+ def representations
29
+ return unless representable?
29
30
 
30
31
  record.attachment_reflections[self.name]&.named_variants&.keys&.index_with do |v|
31
- variant = variant(v)
32
+ representation = representation(v)
32
33
 
33
34
  {
34
- url: url(variant),
35
- url_attachment: url_attachment(variant)
35
+ url: url(representation),
36
+ url_attachment: url_attachment(representation)
36
37
  }
37
38
  end
38
39
  end
39
40
 
41
+ # FIXME: Cache for performance
42
+ def previews
43
+ # Not everything may be processed into a preview based on mime type
44
+ return unless previewable?
45
+
46
+ representations
47
+ end
48
+
49
+ # FIXME: Cache for performance
50
+ def variants
51
+ # Not everything may be processed into a variant based on mime type
52
+ return unless variable?
53
+
54
+ representations
55
+ end
56
+
40
57
  def display_name
41
58
  filename.to_s
42
59
  end
@@ -44,7 +61,7 @@ module Rhino
44
61
 
45
62
  class_methods do
46
63
  def readable_properties
47
- super + [ "variants", "signed_id"]
64
+ super + [ "previews", "representations", "variants", "signed_id"]
48
65
  end
49
66
  end
50
67
 
data/lib/rhino/version.rb CHANGED
@@ -8,9 +8,9 @@ module Rhino
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 0
11
- MINOR = 22
11
+ MINOR = 23
12
12
  TINY = 0
13
- PRE = "beta.15"
13
+ PRE = "beta.0"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhino_project_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0.beta.15
4
+ version: 0.23.0.beta.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Rosevear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-13 00:00:00.000000000 Z
11
+ date: 2025-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails