uffizzi_core 0.2.2 → 0.2.5

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: 5085353e167434c11ae0155c5d55a4f3476124a2450b013de65361c303614090
4
- data.tar.gz: 36d5fb3f8aa7d15a9f274cec8ccbe92fcbc4dca9c67a9573e7b05c9080db87f3
3
+ metadata.gz: 3cf0385b90270853a0014af3854253436050a54617c7351acb13bd93ab166e92
4
+ data.tar.gz: 0b0cc859f136ae6c78c358668db24b894e860f4dd56d1b2916aa90af1e3deed0
5
5
  SHA512:
6
- metadata.gz: 54aa46774504fb1059e2fd5175842e3ea2544f015d5f605a1a84ad3150087910048bdbd1d27bf5bfcb32af4d8b05db30076991a4c2f2827490c473c7f2e35e5e
7
- data.tar.gz: '085bb9ce07490be191221d2d44b83c5bb6b0622d139ae90a62fca7da7d8e5dcac7ae2970167ca8c49df1d14d8e067eee396200573bf337aea6c4c618defcbda9'
6
+ metadata.gz: 6a9b81839c201a3958e45ff607141ac0b871694e56d8ffdc9b7c0a94963b9ad620b7d3a7e631b9d346ec8944d8d2e2ce8f3df2ed23faae6c7c637ce4866217b9
7
+ data.tar.gz: 0eea7cb1e2e2c01d80f6b01733db2424bce357d1f6da54b3f5c118dc78b649db8ac54ff499ca315f3642de55f3d906177b705aa372ae682bc87f6c26a2ac5910
@@ -62,7 +62,7 @@ class UffizziCore::Api::Cli::V1::Projects::ComposeFilesController < UffizziCore:
62
62
 
63
63
  def compose_file
64
64
  compose_file = resource_project.compose_file
65
- raise ActiveRecord::RecordNotFound if compose_file.blank?
65
+ raise ActiveRecord::RecordNotFound.new("Couldn't find UffizziCore::ComposeFile", UffizziCore::ComposeFile) if compose_file.blank?
66
66
 
67
67
  compose_file
68
68
  end
@@ -11,11 +11,13 @@ class UffizziCore::ApplicationController < ActionController::Base
11
11
  DEFAULT_PER_PAGE = 20
12
12
 
13
13
  protect_from_forgery with: :exception
14
- rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
15
14
  RESCUABLE_EXCEPTIONS = [RuntimeError, TypeError, NameError, ArgumentError, SyntaxError].freeze
16
15
  rescue_from *RESCUABLE_EXCEPTIONS do |exception|
17
16
  render_server_error(exception)
18
17
  end
18
+ rescue_from ActiveRecord::RecordNotFound do |exception|
19
+ render_not_found(exception)
20
+ end
19
21
 
20
22
  before_action :authenticate_request!
21
23
  skip_before_action :verify_authenticity_token
@@ -29,8 +31,9 @@ class UffizziCore::ApplicationController < ActionController::Base
29
31
  UffizziCore::JsonResponder
30
32
  end
31
33
 
32
- def render_not_found
33
- render json: { errors: { title: ['Resource Not Found'] } }, status: :not_found
34
+ def render_not_found(exception)
35
+ resource = exception.model || 'Resource'
36
+ render json: { errors: { title: ["#{resource} Not Found"] } }, status: :not_found
34
37
  end
35
38
 
36
39
  def render_server_error(error)
@@ -19,7 +19,6 @@ module UffizziCore::Concerns::Models::ComposeFile
19
19
 
20
20
  enumerize :kind, in: [:main, :temporary], predicates: true, scope: :shallow, default: :main
21
21
 
22
- validates :project, uniqueness: { scope: :project }, if: -> { kind.main? }
23
22
  validates :source, presence: true
24
23
  validate :main_compose_file_uniqueness, on: :create, if: -> { kind.main? }
25
24
 
@@ -12,7 +12,7 @@ module UffizziCore::Concerns::Models::Project
12
12
 
13
13
  belongs_to :account
14
14
 
15
- has_many :repos
15
+ has_many :repos, dependent: :destroy
16
16
  has_many :deployments, dependent: :destroy
17
17
  has_many :user_projects, dependent: :destroy
18
18
  has_many :users, through: :user_projects
@@ -7,7 +7,7 @@ class UffizziCore::ComposeFile::ConfigOptionService
7
7
  raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.boolean_option', value: option)
8
8
  end
9
9
 
10
- option.match(/^[a-zA-Z_][a-zA-Z0-9._\-]+$/).present?
10
+ option.match(/^[\w.-]+$/).present?
11
11
  end
12
12
 
13
13
  def config_options(compose_data)
@@ -13,7 +13,7 @@ en:
13
13
  compose:
14
14
  unsupported_file: Unsupported compose file
15
15
  invalid_file: Invalid compose file
16
- invalid_config_option: Invalid config option '%{value}' - only [a-zA-Z0-9\._\-] characters are allowed
16
+ invalid_config_option: Invalid config option '%{value}' - only a-zA-Z0-9._- characters are allowed
17
17
  no_services: Service services has neither an image nor a build context specified. At least one must be provided.
18
18
  no_ingress: Service ingress has not been defined.
19
19
  invalid_image_value: Invalid image value '%{value}'
@@ -30,7 +30,7 @@ en:
30
30
  invalid_memory_type: Memory '%{value}' contains an invalid type, it should be a string
31
31
  invalid_memory_value: Invalid memory value '%{value}'
32
32
  invalid_memory: The memory should be one of the `125m` `250m` `500m` `1000m` `2000m` `4000m` values
33
- image_build_no_specified: Service %{value} has neither an image nor a build context specified. At least one must be provided.
33
+ image_build_no_specified: Service '%{value}' has neither an image nor a build context specified. At least one must be provided.
34
34
  build_context_no_specified: The context option should be specified
35
35
  config_file_not_found: Config file not found '%{name}'
36
36
  invalid_context: Invalid context value '%{value}'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.5'
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: 0.2.2
4
+ version: 0.2.5
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: 2022-06-15 00:00:00.000000000 Z
12
+ date: 2022-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm