uffizzi_core 2.1.0 → 2.1.1

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: c131ada77fc0357b6617553f51247c1b9194635a3b741b6f17b6ac901921c3ff
4
- data.tar.gz: 30a013a396f81d5cbfb13932222dbd020fd3b88e94511119266970114ae9d0d8
3
+ metadata.gz: 9ff3664e2d0ace5264aea60fd9a6c2b6f592632b3e5f844411a230941ee953da
4
+ data.tar.gz: b41024e92002bbac34eb430fd6da45740c921c595515b4c8e82b6d184a04a421
5
5
  SHA512:
6
- metadata.gz: 0060c147865cb0bf5f530159e5022dee28b5994d6a20a3b67d235482e1a398fa93228029a44ae22e31fea0c241f723c48f9a51c0597dd4c1b5db62f22083088d
7
- data.tar.gz: 91fb0c6c8dc3e3fc8fd1e85ea0de05e0a43597f5c89090f8789bb1c57fb93efcad2bdbb959c4c005179d7d4db959f9da45822a73eb65f1379773492fa885f785
6
+ metadata.gz: 2af201493e2a9fb7a6cc8793586bfd8881270cb13fe76804e35dda0d5ecfff87d9d608dbdc54276ba2db7839208c38baa8e861fa15d692d5b322f81c4bda916b
7
+ data.tar.gz: 9f41c789e248872b742cfda598b40c38b3a9e8298d86fa890c80e56943440de19e74e8ab904e482b3d03d1562f99bc91ce475b3b6cb11459346f0d2eefc8af98
@@ -37,6 +37,12 @@ module UffizziCore::DependencyInjectionConcern
37
37
  module_class(:notification_module)
38
38
  end
39
39
 
40
+ def deployment_module
41
+ return unless module_exists?(:deployment_module)
42
+
43
+ module_class(:deployment_module)
44
+ end
45
+
40
46
  private
41
47
 
42
48
  def module_exists?(module_name)
@@ -19,6 +19,7 @@ module UffizziCore::Concerns::Models::User
19
19
  has_many :accounts, through: :memberships
20
20
  has_many :user_projects, dependent: :destroy
21
21
  has_many :projects, through: :user_projects
22
+ has_many :deployments, class_name: UffizziCore::Deployment.name, foreign_key: :deployed_by_id, dependent: :nullify
22
23
 
23
24
  has_one_attached :avatar
24
25
 
@@ -32,14 +33,6 @@ module UffizziCore::Concerns::Models::User
32
33
  accounts.find_by(kind: UffizziCore::Account.kind.personal)
33
34
  end
34
35
 
35
- def active_projects
36
- projects.active
37
- end
38
-
39
- def deployments
40
- UffizziCore::Deployment.where(project_id: active_projects)
41
- end
42
-
43
36
  def full_name
44
37
  "#{first_name} #{last_name}"
45
38
  end
@@ -99,7 +99,7 @@ class UffizziCore::DeploymentService
99
99
  end
100
100
 
101
101
  def build_pull_request_subdomain(deployment)
102
- repo_name, pull_request_number = pull_request_data(deployment)
102
+ _, repo_name, pull_request_number = pull_request_data(deployment)
103
103
  raise UffizziCore::Deployment::LabelsNotFoundError if repo_name.nil? || pull_request_number.nil?
104
104
 
105
105
  formatted_repo_name = format_url_safe(repo_name.split('/').last.downcase)
@@ -276,6 +276,9 @@ class UffizziCore::DeploymentService
276
276
  envs.push('name' => 'UFFIZZI_URL', 'value' => "https://#{deployment.preview_url}")
277
277
  envs.push('name' => 'UFFIZZI_DOMAIN', 'value' => deployment.preview_url)
278
278
 
279
+ preview_url = "https://#{deployment_module.build_preview_url(deployment)}" if deployment_module.present?
280
+ envs.push('name' => 'UFFIZZI_PREDICTABLE_URL', 'value' => preview_url || '')
281
+
279
282
  container.variables = [] if container.variables.nil?
280
283
 
281
284
  container.variables.push(*envs)
@@ -304,13 +307,13 @@ class UffizziCore::DeploymentService
304
307
  def github_pull_request_data(deployment)
305
308
  github_data = deployment.metadata.dig('labels', 'github')
306
309
 
307
- [github_data['repository'], github_data.dig('event', 'number')]
310
+ [:github, github_data['repository'], github_data.dig('event', 'number')]
308
311
  end
309
312
 
310
313
  def gitlab_merge_request_data(deployment)
311
314
  gitlab_data = deployment.metadata.dig('labels', 'gitlab')
312
315
 
313
- [gitlab_data['repo'], gitlab_data.dig('merge_request', 'number')]
316
+ [:gitlab, gitlab_data['repo'], gitlab_data.dig('merge_request', 'number')]
314
317
  end
315
318
 
316
319
  def format_url_safe(name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.1.0'
4
+ VERSION = '2.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uffizzi_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Thurman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-30 00:00:00.000000000 Z
12
+ date: 2023-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm