k_domain 0.0.31 → 0.0.35

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: fd37834af41956f4c7138d19eaa56a1d12c9b6ff1981469bb0b9a2e66467789f
4
- data.tar.gz: 327490b7eb4ac477444ffd946ee680976b46b4a94f9e27b62c08c6425f888203
3
+ metadata.gz: 23080cbea3c4a31730c81e6f1a090346f3ee10949ac49bda936403b59887834c
4
+ data.tar.gz: 568b7d2c8e01e574c93d160f393f7cd4d183dd156dc4cfd60567a8ebfa8c194b
5
5
  SHA512:
6
- metadata.gz: ff054fb1248bbcdfea2681084811ca8d2057c97ffd98baa8e75b35838531a85d0cc9754711d9d544934ea14a2416bdd5fbdec2f1914fe48143b30a7bf9517685
7
- data.tar.gz: 80257167cf2e331a30415618a93a560c38c01d81597bca2c7437a08afbfe4d18c4d08ebafef3b239e5db7eb07666c2929a58cc04cf78065adb3c14b977dac3db
6
+ metadata.gz: 33b01df862eeb446e09cd5936687d25ce432ccc4213b52bd1371255597b37e343188d27c013560f81784e0eb6f5602285ffc6de193c45196c2f2b75772e4a7d9
7
+ data.tar.gz: ea2ec449e9c9455bc442c9a064fee395dd9d90b4b86d51c369cb037999847196c6511d1a78797ac5561f1a2d86a154fdaa619463df2bc9da090a078486aea582
data/Gemfile CHANGED
@@ -28,6 +28,7 @@ end
28
28
  if ENV.fetch('KLUE_LOCAL_GEMS', 'false').downcase == 'true'
29
29
  group :development, :test do
30
30
  puts 'Using Local GEMs'
31
+ gem 'cmdlet' , path: '../cmdlet'
31
32
  gem 'k_log' , path: '../k_log'
32
33
  gem 'k_util' , path: '../k_util'
33
34
  gem 'peeky' , path: '../peeky'
data/README.md CHANGED
@@ -93,6 +93,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/kluele
93
93
 
94
94
  ## License
95
95
 
96
+
96
97
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
97
98
 
98
99
  ## Code of Conduct
data/k_domain.gemspec CHANGED
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
40
40
  # spec.extensions = ['ext/k_domain/extconf.rb']
41
41
 
42
42
  spec.add_dependency 'activesupport', '~> 7'
43
+ spec.add_dependency 'cmdlet'
43
44
  spec.add_dependency 'dry-struct', '~> 1'
44
45
  spec.add_dependency 'k_log' , '~> 0'
45
46
  spec.add_dependency 'peeky' , '~> 0'
@@ -19,6 +19,10 @@ module KDomain
19
19
  @valid = true
20
20
  end
21
21
 
22
+ def camel(value)
23
+ Cmdlet::Case::Camel.new.call(value)
24
+ end
25
+
22
26
  def call; end
23
27
 
24
28
  def self.run(domain_data, **opts)
@@ -68,7 +68,7 @@ class Step2DomainModels < KDomain::DomainModel::Step
68
68
  def check_type(type)
69
69
  type = type.to_sym if type.is_a?(String)
70
70
 
71
- return type if %i[string integer bigint bigserial boolean float decimal datetime date hstore text jsonb].include?(type)
71
+ return type if %i[string integer bigint bigserial boolean float decimal datetime date hstore text jsonb serial binary].include?(type)
72
72
 
73
73
  if type.nil?
74
74
  guard('nil type detected for db_column[:type]')
@@ -78,7 +78,7 @@ class Step2DomainModels < KDomain::DomainModel::Step
78
78
 
79
79
  guard("new type detected for db_column[:type] - #{type}")
80
80
 
81
- camel.parse(type.to_s).downcase
81
+ camel(type.to_s).downcase
82
82
  end
83
83
 
84
84
  def column_data(name)
@@ -36,7 +36,7 @@ module KDomain
36
36
  def load_retry(file, times, last_error)
37
37
  return if times.negative?
38
38
 
39
- # puts file
39
+ puts file
40
40
  load(file)
41
41
 
42
42
  @controller = ActionController::Base.class_info
@@ -37,6 +37,7 @@ module KDomain
37
37
  def load_retry(file, times, last_error)
38
38
  return if times.negative?
39
39
 
40
+ puts file
40
41
  load(file)
41
42
 
42
43
  @model = ActiveRecord.class_info
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Code extraction requires shims to be loaded before extraction
4
4
  #
5
- # This shims server two purposes
5
+ # This shims serve two purposes
6
6
  #
7
7
  # 1. Inject data capture methods calls that intercept DSL macros so that data can be extracted
8
8
  # 2. Inject fake module/classes that would otherwise break code loading with various exceptions
@@ -18,7 +18,7 @@ module KDomain
18
18
  class Index < Dry::Struct
19
19
  attribute :name , Types::Strict::String
20
20
  attribute :fields , Types::Nominal::Any.optional.default(nil)
21
- attribute :using , Types::Nominal::String
21
+ attribute :using , Types::Nominal::String.optional.default(nil)
22
22
  attribute :order? , Types::Nominal::Hash
23
23
  attribute :where? , Types::Nominal::Any.optional.default(nil)
24
24
  attribute :unique? , Types::Nominal::Any.optional.default(nil)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KDomain
4
- VERSION = '0.0.31'
4
+ VERSION = '0.0.35'
5
5
  end
data/lib/k_domain.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'active_support/core_ext/string'
4
4
  require 'dry-struct'
5
+ require 'cmdlet'
5
6
  require 'k_log'
6
7
  require 'peeky'
7
8
  require 'k_domain/version'
@@ -11,24 +11,60 @@ module ActsAsCommentable
11
11
  end
12
12
  end
13
13
 
14
+ module ActiveModel
15
+ module Validations
16
+ end
17
+ end
18
+
19
+ class ActiveRecord::Base
20
+ # def self.validate(*_p, **_o, &block); end
21
+ def self.validates_with(*_p, **_o, &block); end
22
+ def self.before_save(*_p, **_o, &block); end
23
+ def self.after_commit(*_p, **_o, &block); end
24
+ end
25
+
26
+ module Common
27
+ module Debug
28
+ module Timer
29
+ end
30
+ end
31
+ module Sanitizers
32
+ module UrlSanitizer; end
33
+ end
34
+ end
35
+
36
+ class Base64
37
+ def self.decode64(*_p); end
38
+ end
14
39
 
15
40
  module Scopes
16
41
  module CompanyScopes
17
42
  end
18
43
  end
19
44
 
45
+
46
+ module Validators
47
+ module RuleValidator; end
48
+ end
49
+
50
+ class ApplicationRecord < ActiveRecord::Base
51
+ end
52
+
20
53
  module DeIdentifiable
21
54
  def deidentifiable(*_p, **_o); end
22
55
  end
56
+ module Indexable
57
+ end
23
58
 
24
- class Company < ActiveRecord::Base
59
+ class Company < ApplicationRecord
25
60
  extend DeIdentifiable
26
61
  end
27
- class Estimate < ActiveRecord::Base
62
+ class Estimate < ApplicationRecord
28
63
  extend DeIdentifiable
29
64
  end
30
65
  class Invoice < ActiveRecord::Base
31
66
  extend DeIdentifiable
67
+ extend Indexable
32
68
  end
33
69
  class Address < ActiveRecord::Base
34
70
  extend DeIdentifiable
@@ -37,14 +73,13 @@ class Contact < ActiveRecord::Base
37
73
  extend DeIdentifiable
38
74
  end
39
75
 
40
- class Thread
41
- def initialize(*_p, **_o, &block); end
42
- end
43
76
 
44
- class ApplicationRecord < ActiveRecord::Base
77
+ class Shipment < ApplicationRecord
78
+ module Indexable
79
+ end
45
80
  end
46
81
 
47
- class Email < ActiveRecord::Base
82
+ class Email < ApplicationRecord
48
83
  def self.ses_send(*_p, **_o); end
49
84
  end
50
85
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k_domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 0.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-05 00:00:00.000000000 Z
11
+ date: 2023-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cmdlet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: dry-struct
29
43
  requirement: !ruby/object:Gem::Requirement