kube-dsl 0.7.1 → 0.7.4

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: 9ca9613963279e66541e85bfe45b157444fee563f4edefb02928f0bcf15add0d
4
- data.tar.gz: 60af16f282ff8e1bab075edde009f8165a3b5824dfa0113023680166214bcfee
3
+ metadata.gz: 317a95c1f49b4f9460c92621300cfb523182369c51f6b2dc049a9a3be5b5b71c
4
+ data.tar.gz: be508abd66a920df63db42e055da34ec9d43cceca82848dfb61e5af367ec8b1f
5
5
  SHA512:
6
- metadata.gz: d8c869cb2894eb6613c1c3194d58dfeb9da9460df505cfa7a256d6e8079abcdda168fb4b2fab6995e832fe99f54617ff5509a4e11f3988a3013d37f3bf4b32af
7
- data.tar.gz: 8a2412c3e79468c71b40b1d47c2058d3d2857749be503fa62a483bf41cea8ba0d94296f3cefe32f88bfd812cb1432605edf29ba984d9d26b1e0785f507236044
6
+ metadata.gz: 265b052d47f2b57acf953b28cabc544817d24f2786ac17c99fd18bbaf5eb9a3bfeaa880204a74d32602dcc086e9d702682c7240c1c373abf4f92aa4ddfe0ca09
7
+ data.tar.gz: 9af6ecdbfdff1d22b115f7fc42e000bdede2f69a8ceedeb88f3e7d5658dd937dcde6801675044b2c6a00a4b8668dff0fc31e59c0b3b944456544377b357ae00c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.7.4
2
+ * Strip type annotations during gem build using Curdle.
3
+
4
+ ## 0.7.3
5
+ * Add feature to limit the length of filenames to 100 characters.
6
+ - Rubygems has a hard limit on the number of characters allowed in a filename, which I assume is actually a requirement of whatever archive format it uses.
7
+
8
+ ## 0.7.2
9
+ * Use tapioca for type annotations.
10
+ * Fix a couple of type annotations.
11
+
1
12
  ## 0.7.1
2
13
  * Remove dependency on the defunct sorbet-runtime-stub gem.
3
14
 
data/Gemfile CHANGED
@@ -9,8 +9,10 @@ end
9
9
 
10
10
  group :development do
11
11
  # lock to a specific version to prevent breaking CI when new versions come out
12
- gem 'sorbet', '= 0.5.6433'
13
- gem 'parlour', '~> 6.0'
12
+ gem 'sorbet'
13
+ gem 'tapioca', '~> 0.7'
14
+ gem 'parlour', github: 'camertron/parlour', branch: 'initialize_void' # '~> 7.0'
15
+ gem 'curdle', '~> 1.2'
14
16
  end
15
17
 
16
18
  group :test do
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
1
  require 'bundler'
2
2
  require 'rspec/core/rake_task'
3
- require 'rubygems/package_task'
3
+ require 'curdle'
4
+
5
+ Curdle::Tasks.install
4
6
 
5
7
  require 'kube-dsl'
6
8
  require 'pry-byebug'
7
9
 
8
- Bundler::GemHelper.install_tasks
9
-
10
10
  task default: :spec
11
11
 
12
12
  desc 'Run specs'
@@ -54,7 +54,6 @@ task :generate do
54
54
  )
55
55
 
56
56
  generator.generate_resource_files
57
- generator.generate_rbi_files
58
57
  generator.generate_autoload_files
59
58
  generator.generate_entrypoint_file do |resource, ns|
60
59
  version = resource.ref.version || ''
@@ -1,3 +1,4 @@
1
+ # typed: true
1
2
  module KubeDSL
2
3
  class AllowBlank
3
4
  attr_reader :value
@@ -22,7 +22,7 @@ module KubeDSL
22
22
  validates :run_as_user, field: { format: :integer }, presence: false
23
23
  validates :se_linux_options, object: { kind_of: KubeDSL::DSL::V1::SELinuxOptions }
24
24
  validates :seccomp_profile, object: { kind_of: KubeDSL::DSL::V1::SeccompProfile }
25
- validates :supplemental_groups, field: { format: :string }, presence: false
25
+ validates :supplemental_groups, field: { format: :integer }, presence: false
26
26
  validates :sysctlses, array: { kind_of: KubeDSL::DSL::V1::Sysctl }, presence: false
27
27
  validates :windows_options, object: { kind_of: KubeDSL::DSL::V1::WindowsSecurityContextOptions }
28
28
 
@@ -2,22 +2,22 @@
2
2
 
3
3
  module KubeDSL
4
4
  class DSLObject
5
- extend T::Sig
5
+ # extend T::Sig
6
6
 
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.void)).void }
11
11
  def initialize(&block)
12
12
  instance_eval(&block) if block
13
13
  end
14
14
 
15
- T::Sig::WithoutRuntime.sig { returns(::KubeDSL::Resource) }
15
+ # T::Sig::WithoutRuntime.sig { returns(::KubeDSL::Resource) }
16
16
  def to_resource
17
17
  ::KubeDSL::Resource.new(serialize)
18
18
  end
19
19
 
20
- T::Sig::WithoutRuntime.sig { returns(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])) }
20
+ # T::Sig::WithoutRuntime.sig { returns(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])) }
21
21
  def serialize
22
22
  raise NotImplementedError, "#{__method__} must be defined in subclasses"
23
23
  end
@@ -49,9 +49,18 @@ module KubeDSL
49
49
  [autoload_prefix].tap do |path|
50
50
  path << underscore(namespace) if namespace
51
51
  path << underscore(version) if version
52
- path << "#{underscore(kind)}.rb"
52
+ path << shorten("#{underscore(kind)}.rb")
53
53
  end
54
54
  )
55
55
  end
56
+
57
+ def shorten(filename)
58
+ return filename if filename.size <= 100
59
+
60
+ digest = Digest::MD5.hexdigest(filename)[0...8]
61
+ extname = File.extname(filename)
62
+
63
+ "#{filename.chomp(extname)[0...(100 - extname.size - digest.size - 1)]}_#{digest}#{extname}"
64
+ end
56
65
  end
57
66
  end
@@ -4,55 +4,55 @@ require 'base64'
4
4
 
5
5
  module KubeDSL
6
6
  class KeyValueFields
7
- extend T::Sig
7
+ # extend T::Sig
8
8
 
9
- T::Sig::WithoutRuntime.sig { returns(Symbol) }
9
+ # T::Sig::WithoutRuntime.sig { returns(Symbol) }
10
10
  attr_reader :format
11
11
 
12
- T::Sig::WithoutRuntime.sig { returns(T::Hash[Symbol, String]) }
12
+ # T::Sig::WithoutRuntime.sig { returns(T::Hash[Symbol, String]) }
13
13
  attr_reader :kv_pairs
14
14
 
15
- T::Sig::WithoutRuntime.sig { params(format: Symbol).void }
15
+ # T::Sig::WithoutRuntime.sig { params(format: Symbol).void }
16
16
  def initialize(format: :string)
17
17
  @format = format
18
- @kv_pairs = T.let({}, T::Hash[Symbol, String])
18
+ @kv_pairs = {}
19
19
  end
20
20
 
21
- T::Sig::WithoutRuntime.sig { params(key: Symbol, value: String).void }
21
+ # T::Sig::WithoutRuntime.sig { params(key: Symbol, value: String).void }
22
22
  def add(key, value)
23
23
  @kv_pairs[key] = value
24
24
  end
25
25
 
26
- T::Sig::WithoutRuntime.sig { params(key: Symbol).void }
26
+ # T::Sig::WithoutRuntime.sig { params(key: Symbol).void }
27
27
  def remove(key)
28
28
  @kv_pairs.delete(key)
29
29
  end
30
30
 
31
- T::Sig::WithoutRuntime.sig { params(key: Symbol).returns(T.nilable(String)) }
31
+ # T::Sig::WithoutRuntime.sig { params(key: Symbol).returns(T.nilable(String)) }
32
32
  def get(key)
33
33
  @kv_pairs[key]
34
34
  end
35
35
 
36
- T::Sig::WithoutRuntime.sig { params(key: Symbol, value: String).void }
36
+ # T::Sig::WithoutRuntime.sig { params(key: Symbol, value: String).void }
37
37
  def set(key, value)
38
38
  @kv_pairs[key] = value
39
39
  end
40
40
 
41
- T::Sig::WithoutRuntime.sig { returns(T::Hash[Symbol, String]) }
41
+ # T::Sig::WithoutRuntime.sig { returns(T::Hash[Symbol, String]) }
42
42
  def serialize
43
43
  @kv_pairs.each_with_object({}) do |(key, value), ret|
44
44
  ret[key] = serialize_value(value)
45
45
  end
46
46
  end
47
47
 
48
- T::Sig::WithoutRuntime.sig { params(other: KeyValueFields).void }
48
+ # T::Sig::WithoutRuntime.sig { params(other: KeyValueFields).void }
49
49
  def merge!(other)
50
50
  @kv_pairs.merge!(other.instance_variable_get(:@kv_pairs))
51
51
  end
52
52
 
53
53
  private
54
54
 
55
- T::Sig::WithoutRuntime.sig { params(data: String).returns(String) }
55
+ # T::Sig::WithoutRuntime.sig { params(data: String).returns(String) }
56
56
  def serialize_value(data)
57
57
  case format
58
58
  when :byte
@@ -19,7 +19,10 @@ module KubeDSL
19
19
  def fields_to_rbi(_inflector)
20
20
  [
21
21
  "T::Sig::WithoutRuntime.sig { returns(#{ruby_type}) }",
22
- "def #{ruby_safe_name}; end"
22
+ "def #{ruby_safe_name}; end",
23
+ "",
24
+ "T::Sig::WithoutRuntime.sig { returns(T::Boolean) }",
25
+ "def #{ruby_safe_name}_present?; end"
23
26
  ]
24
27
  end
25
28
 
@@ -2,37 +2,37 @@
2
2
 
3
3
  module KubeDSL
4
4
  class Resource
5
- extend T::Sig
5
+ # extend T::Sig
6
6
 
7
- T::Sig::WithoutRuntime.sig { returns(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])) }
7
+ # T::Sig::WithoutRuntime.sig { returns(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])) }
8
8
  attr_reader :contents
9
9
 
10
- T::Sig::WithoutRuntime.sig { params(contents: T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])).void }
10
+ # T::Sig::WithoutRuntime.sig { params(contents: T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])).void }
11
11
  def initialize(contents)
12
12
  @contents = contents
13
13
  end
14
14
 
15
- T::Sig::WithoutRuntime.sig { returns(T.nilable(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped]))) }
15
+ # T::Sig::WithoutRuntime.sig { returns(T.nilable(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped]))) }
16
16
  def serialize
17
17
  cleanup(contents)
18
18
  end
19
19
 
20
- T::Sig::WithoutRuntime.sig { returns(String) }
20
+ # T::Sig::WithoutRuntime.sig { returns(String) }
21
21
  def to_yaml
22
22
  YAML.dump(serialize)
23
23
  end
24
24
 
25
- T::Sig::WithoutRuntime.sig { returns(Resource) }
25
+ # T::Sig::WithoutRuntime.sig { returns(KubeDSL::Resource) }
26
26
  def to_resource
27
27
  self
28
28
  end
29
29
 
30
30
  private
31
31
 
32
- T::Sig::WithoutRuntime.sig {
33
- params(obj: T.any(String, AllowBlank, T::Array[T.untyped], T::Hash[T.untyped, T.untyped]))
34
- .returns(T.nilable(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])))
35
- }
32
+ # T::Sig::WithoutRuntime.sig {
33
+ # params(obj: T.any(String, AllowBlank, T::Array[T.untyped], T::Hash[T.untyped, T.untyped]))
34
+ # .returns(T.nilable(T.any(String, T::Array[T.untyped], T::Hash[T.untyped, T.untyped])))
35
+ # }
36
36
  def cleanup(obj)
37
37
  case obj
38
38
  when Array
@@ -58,6 +58,10 @@ module KubeDSL
58
58
  indent("module #{mod}", idx)
59
59
  end,
60
60
  *indent("class #{ref.kind} < ::KubeDSL::DSLObject", level + 1),
61
+ *indent("extend KubeDSL::ValueFields::ClassMethods", level + 2),
62
+ *indent("extend KubeDSL::Validations::ClassMethods", level + 2),
63
+ *indent("include KubeDSL::ValueFields::InstanceMethods", level + 2),
64
+ '',
61
65
  *indent(
62
66
  'T::Sig::WithoutRuntime.sig {',
63
67
  ' returns(',
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: true
2
2
 
3
3
  module KubeDSL
4
4
  class SerializeHandler
@@ -1,5 +1,5 @@
1
1
  # typed: strict
2
2
 
3
3
  module KubeDSL
4
- VERSION = '0.7.1'
4
+ VERSION = '0.7.4'
5
5
  end