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 +4 -4
- data/LICENSE.txt +1 -1
- data/contrast-agent-lib.gemspec +4 -2
- data/lib/consts.rb +1 -0
- data/lib/contrast-agent-lib.rb +33 -12
- data/lib/utils/os.rb +5 -1
- data/lib/utils/version.rb +3 -3
- data/scripts/comment_gemfile.sh +12 -0
- data/scripts/run_gem_specs.sh +22 -0
- data/scripts/uncomment_gemfile.sh +6 -0
- data/shared_libraries/libcontrast_aarch64_c.so +0 -0
- data/shared_libraries/libcontrast_c.dylib +0 -0
- data/shared_libraries/libcontrast_c.so +0 -0
- data/shared_libraries/libcontrast_darwin_arm.dylib +0 -0
- data/shared_libraries/libcontrast_musl_aarch64_c.so +0 -0
- data/shared_libraries/libcontrast_musl_c.so +0 -0
- metadata +40 -7
- data/usage_files/libcontrast_c.dylib +0 -0
- data/usage_files/libcontrast_c.so +0 -0
- data/usage_files/libcontrast_c_musl.so +0 -0
- data/usage_files/libcontrast_darwin_arm.dylib +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a4fa9582b8283c59e869626e08c9f56858dd74fe882998da0461fc5e96e950f
|
4
|
+
data.tar.gz: f6458f645e1a6ad01271015a2249c552a9c4f716c148391c87a338342cb928d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a4d3c5fec6bc33ec7979e0f1a6250b2e6e58aa37d39f0e1ddd55e3c8f03241274ded96ae9edc660ccdd70bff2058c963d809ea463572df8eaeb25eb91d15ebe
|
7
|
+
data.tar.gz: 1dea8563ea084bb1dcc5af30aa19d1eca3920bc86961e66ede5ec90d1148541914d6b45dea280cef9dd302440d52d642c4a719ab1c8fa1642f16344fda624360
|
data/LICENSE.txt
CHANGED
data/contrast-agent-lib.gemspec
CHANGED
@@ -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['
|
46
|
-
spec.files += Dir['
|
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
data/lib/contrast-agent-lib.rb
CHANGED
@@ -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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
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
@@ -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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
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.
|
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-
|
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
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
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.
|
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
|
Binary file
|