kube-dsl 0.8.0 → 0.8.1

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: de8bd85a855059eb721225535bf9116a71a724fa6200204f68fde813131536a8
4
- data.tar.gz: 9086677e1ccdd62fcea750c39b57d6dac113cbb5bba4033db0893c861c843f44
3
+ metadata.gz: 4af0139435aa4871fc15e13abf43a97d651bdb0064f569f0212834f9c958ca31
4
+ data.tar.gz: fb14e4dfe90f30e4761798b86529edafb8445351ca89541c1c6ae53e2fccbf39
5
5
  SHA512:
6
- metadata.gz: 1c4222594087e664ceb1f35d2f22382f42c5a3b78fcee23fd7fcf2d43c4f2d1e426f3e3cebbd42ca8f6d12b02a6c5c0bb465b4f6772b1d411d2130f818da9683
7
- data.tar.gz: 91bad2ac1bb76b7e5c1b906f34e49a6e9cbfba755bf6f80ab6483b1a3fe0ef7f27a6b73c05cb9d0d9fd733683eb8f5053d519d79a1422a65c3101f597dbf7aee
6
+ metadata.gz: 893ed573e9062471b39b9c7368752b373e16962ad552d5b329e950bd55e4b98db46112838821c965ef3f394ca74ae18962d3d95e1ea45f17cf83a48221895f5a
7
+ data.tar.gz: a5f8c38def5e8f622355bb9fa91965bb1d0f536e9240992aa3638894073db18fd5190ccff115fb3ba3f356dfd65baf24791b44dc6a76a4fb1ea7365fa503ab81
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.8.1
2
+ * Fix Sorbet types for blocks passed to DSL methods (#6, @Bo98)
3
+ * Fix handling of number types (#5, @Bo98)
4
+
1
5
  ## 0.8.0
2
6
 
3
7
  * Update Kubernetes to v1.23.17 to match kuby.
@@ -7,7 +7,7 @@ module KubeDSL
7
7
  extend ::KubeDSL::ValueFields
8
8
  extend ::KubeDSL::Validations
9
9
 
10
- # T::Sig::WithoutRuntime.sig { params(block: T.nilable(T.proc.void)).void }
10
+ # T::Sig::WithoutRuntime.sig { params(block: T.nilable(T.proc.bind(::KubeDSL::DSLObject).void)).void }
11
11
  def initialize(&block)
12
12
  instance_eval(&block) if block
13
13
  end
@@ -42,8 +42,9 @@ module KubeDSL
42
42
  next if block && !block.call(resource, ns)
43
43
 
44
44
  method_name = method_name_for(resource)
45
+ resource_type = "::#{ns}::#{resource.ref.kind}"
45
46
 
46
- rbi_code << "#{indent}T::Sig::WithoutRuntime.sig { params(block: T.proc.void).returns(::#{ns}::#{resource.ref.kind}) }\n"
47
+ rbi_code << "#{indent}T::Sig::WithoutRuntime.sig { params(block: T.proc.bind(#{resource_type}).void).returns(#{resource_type}) }\n"
47
48
  rbi_code << "#{indent}def #{method_name}(&block); end\n\n"
48
49
  end
49
50
 
@@ -22,7 +22,7 @@ module KubeDSL
22
22
 
23
23
  def fields_to_rbi(_inflector)
24
24
  [
25
- "T::Sig::WithoutRuntime.sig { params(block: T.nilable(T.proc.void)).returns(::KubeDSL::KeyValueFields) }",
25
+ "T::Sig::WithoutRuntime.sig { params(block: T.nilable(T.proc.bind(::KubeDSL::KeyValueFields).void)).returns(::KubeDSL::KeyValueFields) }",
26
26
  "def #{underscore(name)}(&block); end"
27
27
  ]
28
28
  end
@@ -18,8 +18,8 @@ module KubeDSL
18
18
 
19
19
  def fields_to_rbi(_inflector)
20
20
  [
21
- "T::Sig::WithoutRuntime.sig { returns(#{ruby_type}) }",
22
- "def #{ruby_safe_name}; end",
21
+ "T::Sig::WithoutRuntime.sig { params(block: T.nilable(T.proc.bind(#{ruby_type}).void)).returns(#{ruby_type}) }",
22
+ "def #{ruby_safe_name}(&block); end",
23
23
  "",
24
24
  "T::Sig::WithoutRuntime.sig { returns(T::Boolean) }",
25
25
  "def #{ruby_safe_name}_present?; end"
@@ -5,7 +5,7 @@ module KubeDSL
5
5
 
6
6
  TYPE_MAP = {
7
7
  'boolean' => 'T::Boolean',
8
- 'number' => 'Integer'
8
+ 'number' => 'T.any(Integer, Float)'
9
9
  }
10
10
 
11
11
  TYPE_MAP.freeze
@@ -88,6 +88,8 @@ module KubeDSL
88
88
  [String]
89
89
  when :integer
90
90
  [Integer]
91
+ when :number
92
+ [Integer, Float]
91
93
  when :boolean
92
94
  [TrueClass, FalseClass]
93
95
  else
@@ -1,5 +1,5 @@
1
1
  # typed: strict
2
2
 
3
3
  module KubeDSL
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end