devfile 0.4.4 → 0.4.7

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: 403bb10e98201ddac6dc0d3bb58553caa249f00f9cbdd36d79acb2ee9c1b2e19
4
- data.tar.gz: fa8ba44516794d99cdb756bc4563918d5b4199b5db9754814e0a9734e56d79fd
3
+ metadata.gz: 69c6bb7b99311c36cfe9f9ca9c892fe51d073d5c57e7aba296f721cc2863f27e
4
+ data.tar.gz: f540eccfc1ec86f2851ccd03e3177f9fd8e84aff2d31cb6bd1ebf18aa7541742
5
5
  SHA512:
6
- metadata.gz: 9e09b3c9be8431072f35177be4507946cdb93d787a902eba2a864de19757072cfee57ad985eef995907a7898b1ac484f8fcc3bf89887685ed0283bcacfb11f0f
7
- data.tar.gz: 6deefe9bb1f3074ce7c393f4536d9bc970daa344d0be69a560dfd07bded589e20a1c8962010e9b40df38a3bba40d06dd2e3387e43f32784109623fbbfccfe593
6
+ metadata.gz: d503e9ce55a37900b56edaf0b5b4f71ab31a7b9abd142f8cbc1b4a017dbd77059054268f7c6a96bd020b4eb0f130e26721fdf876752367a73c9925ecc9488a89
7
+ data.tar.gz: a603e0a61dfe7e932ee76459f35545576557fe03bbbd7fd949b3c8dc6d0d39ba519d535511a3b7c65fd9437178f06224cebb607f6f6f3c55e21b12b949fb1a0d
data/lib/devfile.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'open3'
4
+ require_relative 'ruby_cpu_to_go_arch'
4
5
 
5
6
  # Module that works with the Devfile standard
6
7
  module Devfile
@@ -9,21 +10,10 @@ module Devfile
9
10
 
10
11
  # Set of services to parse a devfile and output k8s manifests
11
12
  class Parser
12
- FILE_PATH = File.expand_path('./../bin/devfile', File.dirname(__FILE__))
13
13
  DEVFILE_GEMSPEC = Gem.loaded_specs['devfile']
14
- RUBY_CPU_TO_GOARCH = {
15
- 'x86_64' => 'amd64',
16
- 'aarch64' => 'arm64',
17
- 'amd64' => 'amd64',
18
- 'arm64' => 'arm64',
19
- 'universal' => 'arm64'
20
- # This exist because if Rosetta is enabled on mac, it means both arm and amd64 bianries
21
- # can be run so the gem lib sets the CPU as "universal".
22
- # see: https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
23
- }.freeze
24
14
  ARCH = RUBY_CPU_TO_GOARCH[Gem::Platform.local.cpu] || Gem::Platform.local.cpu
25
15
  SYSTEM_PLATFORM = "#{ARCH}-#{Gem::Platform.local.os}"
26
- PLATFORM_SPECIFIC_BINARY_PATH = File.expand_path("./../bin/devfile-#{SYSTEM_PLATFORM}", File.dirname(__FILE__))
16
+ FILE_PATH = File.expand_path("./../out/devfile-#{SYSTEM_PLATFORM}", File.dirname(__FILE__))
27
17
 
28
18
  class << self
29
19
  def get_deployment(devfile, name, namespace, labels, annotations, replicas)
@@ -53,13 +43,9 @@ module Devfile
53
43
  private
54
44
 
55
45
  def call(*cmd)
56
- file_path = FILE_PATH
57
- if ruby_platform?
58
- raise_if_unsupported_system_platform!
59
- file_path = PLATFORM_SPECIFIC_BINARY_PATH
60
- end
46
+ raise_if_unsupported_system_platform! if ruby_platform?
61
47
 
62
- stdout, stderr, status = Open3.capture3({}, file_path, *cmd.map(&:to_s))
48
+ stdout, stderr, status = Open3.capture3({}, FILE_PATH, *cmd.map(&:to_s))
63
49
  raise(CliError, stderr) unless status.success?
64
50
 
65
51
  stdout
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Devfile
4
+ # Gem::Platform.local.cpu can return a varied arch depending on the distribution,
5
+ # but they still refer to the same arch
6
+ RUBY_CPU_TO_GOARCH = {
7
+ 'x86_64' => 'amd64',
8
+ 'aarch64' => 'arm64',
9
+ 'amd64' => 'amd64',
10
+ 'arm64' => 'arm64',
11
+ 'universal' => 'arm64'
12
+ # This exist because if Rosetta is enabled on mac, it means both arm and amd64 bianries
13
+ # can be run so the gem lib sets the CPU as "universal".
14
+ # see: https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
15
+ }.freeze
16
+ end
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-06 00:00:00.000000000 Z
10
+ date: 2025-08-15 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Library used to generate kubernetes manifests from a Devfile.
13
13
  email:
@@ -18,17 +18,17 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - bin/devfile
22
- - bin/devfile-amd64-darwin
23
- - bin/devfile-amd64-linux
24
- - bin/devfile-arm64-darwin
25
- - bin/devfile-arm64-linux
26
21
  - ext/devfile.go
27
22
  - ext/go.mod
28
23
  - ext/go.sum
29
24
  - ext/main.go
30
25
  - ext/volume.go
31
26
  - lib/devfile.rb
27
+ - lib/ruby_cpu_to_go_arch.rb
28
+ - out/devfile-amd64-darwin
29
+ - out/devfile-amd64-linux
30
+ - out/devfile-arm64-darwin
31
+ - out/devfile-arm64-linux
32
32
  homepage: https://gitlab.com
33
33
  licenses:
34
34
  - MIT
data/bin/devfile DELETED
Binary file