contrast-agent-lib 1.1.0 → 1.1.1

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: 76f0689450bbdbd40bf0e1bd049d10d8da3abe9b2dd9a89785163647bde42eb3
4
- data.tar.gz: 6f399b41d44bda4bb0d9228962f34fd697dee0c69f30e8edb9a2f9c211691f2c
3
+ metadata.gz: 3a4fa9582b8283c59e869626e08c9f56858dd74fe882998da0461fc5e96e950f
4
+ data.tar.gz: f6458f645e1a6ad01271015a2249c552a9c4f716c148391c87a338342cb928d6
5
5
  SHA512:
6
- metadata.gz: 56b80df5e70ddcf1c43602056ce859be9563f53f3e5888fdb59d0e98f9ed6cb783ef72149e3676efb1715018799637e8291925f4ecbe7c6b72da6b5e7a2420ea
7
- data.tar.gz: e44b5c90e33d167beb1e539a1eb78c03d413dbe035afb19866e72259df764fb4bea2796a6c20eba41b562ea285122b20382e7906ed976e6d9d202111b217a9d3
6
+ metadata.gz: 5a4d3c5fec6bc33ec7979e0f1a6250b2e6e58aa37d39f0e1ddd55e3c8f03241274ded96ae9edc660ccdd70bff2058c963d809ea463572df8eaeb25eb91d15ebe
7
+ data.tar.gz: 1dea8563ea084bb1dcc5af30aa19d1eca3920bc86961e66ede5ec90d1148541914d6b45dea280cef9dd302440d52d642c4a719ab1c8fa1642f16344fda624360
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright: 2022 Contrast Security, Inc
1
+ Copyright: 2023 Contrast Security, Inc
2
2
  Contact: support@contrastsecurity.com
3
3
  License: Commercial
4
4
 
@@ -42,13 +42,15 @@ def self.add_files spec
42
42
  spec.files += Dir['scripts/**/*.sh']
43
43
  spec.files += %w[LICENSE.txt Gemfile contrast-agent-lib.gemspec .ruby-version]
44
44
  # add the binary files created.
45
- spec.files += Dir['usage_files/**/*.dylib']
46
- spec.files += Dir['usage_files/**/*.so']
45
+ spec.files += Dir['shared_libraries/**/*.dylib']
46
+ spec.files += Dir['shared_libraries/**/*.so']
47
47
  end
48
48
 
49
49
  # Add dev dependencies
50
50
  def self.add_development_dependencies spec
51
51
  spec.add_development_dependency('ffi', '~> 1.15', '>= 1.15.5')
52
+ spec.add_development_dependency('rspec')
53
+ spec.add_development_dependency('pry-byebug')
52
54
  end
53
55
 
54
56
  Gem::Specification.new do |spec|
data/lib/consts.rb CHANGED
@@ -35,6 +35,7 @@ module ContrastAgentLib
35
35
  URL_PARAMETER = 11
36
36
  MULTIPART_NAME = 12
37
37
  XML_VALUE = 13
38
+ RAW_BODY = 14
38
39
  end
39
40
 
40
41
  module DbType
@@ -6,17 +6,38 @@ require 'utils/os'
6
6
  # Load the constants
7
7
  require_relative 'consts'
8
8
 
9
+ # This module is used to load the dynamic library.
10
+ # It loads the AgentLib constants and the dynamic library file.
9
11
  module ContrastAgentLib
10
- include ContrastAgentLib::OS
11
- LINUX_LIB = File.join(__dir__, '..', 'usage_files/libcontrast_c.so')
12
- MAC_LIB = File.join(__dir__, '..', 'usage_files/libcontrast_c.dylib')
13
- MAC_M1_LIB = File.join(__dir__, '..', 'usage_files/libcontrast_darwin_arm.dylib')
14
- ALPINE_LIB = File.join(__dir__, '..', 'usage_files/libcontrast_c_musl.so')
15
- # Since we need two different extensions for each platform we
16
- # need to detect the used OS before loading the dynamic library.
17
- CONTRAST_C = if ContrastAgentLib::OS.linux?
18
- ContrastAgentLib::OS.alpine? ? ALPINE_LIB : LINUX_LIB
19
- else
20
- ContrastAgentLib::OS.m1_mac? ? MAC_M1_LIB : MAC_LIB
21
- end
12
+ ALPINE_LIB = File.join(__dir__, '..', 'shared_libraries/libcontrast_musl_c.so')
13
+ ALPINE_AARCH64_LIB = File.join(__dir__, '..', 'shared_libraries/libcontrast_musl_aarch64_c.so')
14
+
15
+ LINUX_LIB = File.join(__dir__, '..', 'shared_libraries/libcontrast_c.so')
16
+ LINUX_AARCH64_LIB = File.join(__dir__, '..', 'shared_libraries/libcontrast_aarch64_c.so')
17
+
18
+ MAC_ARM_LIB = File.join(__dir__, '..', 'shared_libraries/libcontrast_darwin_arm.dylib')
19
+ MAC_LIB = File.join(__dir__, '..', 'shared_libraries/libcontrast_c.dylib')
20
+
21
+ class << self
22
+ # Since we need two different extensions for each platform we
23
+ # need to detect the used OS before loading the dynamic library.
24
+ #
25
+ # Checks for the OS architecture and loads the correct library.
26
+ # The order of the checks is important, for example if we check
27
+ # for mac? on m1 macs it will return true for both.
28
+ #
29
+ # @return [String] the path to the correct library.
30
+ def os_dependend_assign
31
+ if OS.alpine?
32
+ return OS.aarch64? ? ALPINE_AARCH64_LIB : ALPINE_LIB
33
+ end
34
+ if OS.linux?
35
+ return OS.aarch64? ? LINUX_AARCH64_LIB : LINUX_LIB
36
+ end
37
+ return MAC_ARM_LIB if OS.arm_mac?
38
+ return MAC_LIB if OS.mac?
39
+ end
40
+ end
41
+
42
+ CONTRAST_C = ContrastAgentLib.os_dependend_assign
22
43
  end
data/lib/utils/os.rb CHANGED
@@ -19,7 +19,7 @@ module ContrastAgentLib
19
19
  @_mac
20
20
  end
21
21
 
22
- def m1_mac?
22
+ def arm_mac?
23
23
  mac? && RbConfig::CONFIG['host_cpu'].include?('arm64')
24
24
  end
25
25
 
@@ -36,6 +36,10 @@ module ContrastAgentLib
36
36
 
37
37
  false
38
38
  end
39
+
40
+ def aarch64?
41
+ @_aarch64 ||= RbConfig::CONFIG['host_cpu'].include?('aarch64')
42
+ end
39
43
  end
40
44
  end
41
45
  end
data/lib/utils/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ContrastAgentLib
5
- module Version
6
- VERSION='1.1.0'
7
- end
5
+ module Version
6
+ VERSION = '1.1.1'
7
+ end
8
8
  end
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+
3
+ echo [RUBY] commenting Gemfile
4
+ cd spec/dl__init_test
5
+ # Comment the Gemfile:
6
+ gem_path=$(echo ./contrast-agent-lib-*.gem)
7
+ gem_version=$(echo $gem_path | grep -o -E "contrast-agent-lib[0-9]....")
8
+
9
+ echo "Updating Gemfile for version... $gem_version "
10
+ gem_version_numbers_only=$(echo $gem_version | grep -o -E "[0-9]....")
11
+ sed -E "s/gem 'contrast-agent-lib', version, path: Dir.pwd/gem 'contrast-agent-lib', version#, path: Dir.pwd/g" Gemfile | tee Gemfile
12
+ cd ../../
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -Eeuo pipefail
4
+
5
+ # Build Gem
6
+ echo [RUBY] building gem
7
+ bundle install
8
+ gem build contrast-agent-lib.gemspec
9
+
10
+ echo [RUBY] moving gem to test folder
11
+ cp contrast-agent-lib-*.gem spec/dl__init_test/
12
+
13
+ # Run rspec:
14
+ echo [RUBY] running RSpec
15
+ echo pwd
16
+ bundle exec rspec spec/agent_lib_spec.rb
17
+
18
+ # Run gem spec:
19
+ echo [RUBY] running Gem Integration tests...
20
+ cd spec/dl__init_test
21
+ bundle install
22
+ bundle exec gem install ./contrast-agent-lib-*.gem
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Uncomment the Gemfile:
4
+ cd spec/dl__init_test
5
+ sed -E "s/gem 'contrast-agent-lib', version#, path: Dir.pwd$/gem 'contrast-agent-lib', version, path: Dir.pwd/g" Gemfile | tee Gemfile
6
+ cd ../../
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contrast-agent-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - teodor.raychev@contrastsecurity.com
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-02-03 00:00:00.000000000 Z
15
+ date: 2023-07-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: ffi
@@ -34,6 +34,34 @@ dependencies:
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: 1.15.5
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ - !ruby/object:Gem::Dependency
52
+ name: pry-byebug
53
+ requirement: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ type: :development
59
+ prerelease: false
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
37
65
  description: Gem including the interface for the Rust Agent Library, which will be
38
66
  used within the Ruby-Agent
39
67
  email:
@@ -51,10 +79,15 @@ files:
51
79
  - lib/utils/os.rb
52
80
  - lib/utils/version.rb
53
81
  - scripts/build_gem.sh
54
- - usage_files/libcontrast_c.dylib
55
- - usage_files/libcontrast_c.so
56
- - usage_files/libcontrast_c_musl.so
57
- - usage_files/libcontrast_darwin_arm.dylib
82
+ - scripts/comment_gemfile.sh
83
+ - scripts/run_gem_specs.sh
84
+ - scripts/uncomment_gemfile.sh
85
+ - shared_libraries/libcontrast_aarch64_c.so
86
+ - shared_libraries/libcontrast_c.dylib
87
+ - shared_libraries/libcontrast_c.so
88
+ - shared_libraries/libcontrast_darwin_arm.dylib
89
+ - shared_libraries/libcontrast_musl_aarch64_c.so
90
+ - shared_libraries/libcontrast_musl_c.so
58
91
  homepage: https://www.contrastsecurity.com
59
92
  licenses:
60
93
  - CONTRAST SECURITY (see license file)
@@ -77,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
110
  - !ruby/object:Gem::Version
78
111
  version: '0'
79
112
  requirements: []
80
- rubygems_version: 3.4.4
113
+ rubygems_version: 3.2.3
81
114
  signing_key:
82
115
  specification_version: 4
83
116
  summary: This is the Ruby Interface for Rust Agent Library
Binary file
Binary file
Binary file