pki_express 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +22 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +5 -1
- data/README.md +1 -1
- data/Rakefile +7 -1
- data/lib/pki_express/pki_express_config.rb +3 -3
- data/lib/pki_express/pki_express_operator.rb +9 -3
- data/lib/pki_express/version.rb +1 -1
- data/pki_express.gemspec +1 -1
- data/spec/pki_express/pki_express_operator_spec.rb +31 -0
- data/spec/spec_helper.rb +13 -0
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3fe73f3d18d1dc566b80140f294c5028e0e60787dcb5c56e4112af8f0128e5c
|
4
|
+
data.tar.gz: c5f73243393de32161c70d0ac4933db9b6261cb37e89a2e3e7702c45500240f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ceaea14d93ffbda8c76725e7d178e4530a90d928fb2d6ffdbfb5308534f07793ecc0bd40de485d7fd5415a9f3e2812cf2c70c4c4bb277c6831590cb9fd5616d
|
7
|
+
data.tar.gz: 382bc00219a77605c809fcd3499cca7e1e238faff2896d4ec219533241efc228af99f4697695b309859b519badeff5cdf423751d2ee9b7ce5b473cb949a1c88a
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: push
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby-version: ['3.1', '2.7']
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
16
|
+
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
- name: Install dependencies
|
20
|
+
run: bundle install
|
21
|
+
- name: Run tests
|
22
|
+
run: bundle exec rake spec
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This library contains classes that encapsulate the calls to PKI Express.
|
|
7
7
|
The recommended way to install **PKI Expresss lib** is through setting in your Gemfile:
|
8
8
|
|
9
9
|
````ruby
|
10
|
-
gem 'pki_express', '~> 1.3.
|
10
|
+
gem 'pki_express', '~> 1.3.1'
|
11
11
|
````
|
12
12
|
|
13
13
|
And with installing via [Bundler](http://bundler.io/) on your project root folder:
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ module PkiExpress
|
|
5
5
|
@@single_temp_folder = nil
|
6
6
|
|
7
7
|
def initialize(pki_express_home = nil, temp_folder = nil, transfer_data_folder = nil)
|
8
|
-
if not temp_folder.nil? and Pathname.
|
8
|
+
if not temp_folder.nil? and Pathname.new(temp_folder).exist?
|
9
9
|
@temp_folder = temp_folder
|
10
10
|
else
|
11
11
|
if @@single_temp_folder.nil?
|
@@ -14,7 +14,7 @@ module PkiExpress
|
|
14
14
|
@temp_folder = @@single_temp_folder
|
15
15
|
end
|
16
16
|
|
17
|
-
if not transfer_data_folder.nil? and Pathname.
|
17
|
+
if not transfer_data_folder.nil? and Pathname.new(transfer_data_folder).exist?
|
18
18
|
@transfer_data_folder = transfer_data_folder
|
19
19
|
else
|
20
20
|
@transfer_data_folder = @temp_folder
|
@@ -23,4 +23,4 @@ module PkiExpress
|
|
23
23
|
@pki_express_home = pki_express_home
|
24
24
|
end
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'shellwords'
|
2
|
+
require 'securerandom'
|
2
3
|
require 'open3'
|
4
|
+
require 'tmpdir'
|
5
|
+
require 'tempfile'
|
3
6
|
|
4
7
|
module PkiExpress
|
5
8
|
|
@@ -21,11 +24,14 @@ module PkiExpress
|
|
21
24
|
@culture = nil
|
22
25
|
@time_zone = nil
|
23
26
|
|
24
|
-
|
27
|
+
@id = SecureRandom.uuid
|
28
|
+
ObjectSpace.define_finalizer(@id, proc {
|
29
|
+
self.class.finalize(@temp_files)
|
30
|
+
})
|
25
31
|
end
|
26
32
|
|
27
|
-
def self.finalize
|
28
|
-
|
33
|
+
def self.finalize(temp_files)
|
34
|
+
temp_files.each do |file|
|
29
35
|
File.delete(file) if File.exist?(file)
|
30
36
|
end
|
31
37
|
end
|
data/lib/pki_express/version.rb
CHANGED
data/pki_express.gemspec
CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
'source_code_uri' => 'https://github.com/LacunaSoftware/PkiExpressRuby'
|
23
23
|
}
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler', '~>
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
26
26
|
spec.add_development_dependency 'rake', '~> 13'
|
27
27
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
module PkiExpress
|
4
|
+
describe PkiExpressOperator do
|
5
|
+
it "should remove files created by child classes when GC remove its instance" do
|
6
|
+
operator = ChildOperator.new
|
7
|
+
temp_files = []
|
8
|
+
(1..3).each {
|
9
|
+
created_file = operator.create_temp_file
|
10
|
+
temp_files.append(created_file)
|
11
|
+
expect(File.exist?(created_file)).to equal(true)
|
12
|
+
}
|
13
|
+
operator = nil
|
14
|
+
GC.start
|
15
|
+
|
16
|
+
temp_files.each do |file|
|
17
|
+
expect(File.exist?(file)).to equal(false)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class ChildOperator < PkiExpressOperator
|
23
|
+
def initialize(config=PkiExpressConfig.new)
|
24
|
+
super(config)
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_temp_file
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../lib/pki_express'
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.expect_with :rspec do |expectations|
|
5
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
6
|
+
end
|
7
|
+
|
8
|
+
config.mock_with :rspec do |mocks|
|
9
|
+
mocks.verify_partial_doubles = true
|
10
|
+
end
|
11
|
+
|
12
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pki_express
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Medeiros
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,7 +46,9 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- ".gitattributes"
|
49
|
+
- ".github/workflows/test.yml"
|
49
50
|
- ".gitignore"
|
51
|
+
- ".rspec"
|
50
52
|
- CHANGELOG.md
|
51
53
|
- Gemfile
|
52
54
|
- README.md
|
@@ -120,6 +122,8 @@ files:
|
|
120
122
|
- lib/pki_express/version.rb
|
121
123
|
- lib/pki_express/version_manager.rb
|
122
124
|
- pki_express.gemspec
|
125
|
+
- spec/pki_express/pki_express_operator_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
123
127
|
homepage: http://docs.lacunasoftware.com/en-us/articles/pki-express
|
124
128
|
licenses:
|
125
129
|
- MIT
|
@@ -128,7 +132,7 @@ metadata:
|
|
128
132
|
changelog_uri: https://github.com/LacunaSoftware/PkiExpressRuby/blob/develop/CHANGELOG.md
|
129
133
|
documentation_uri: http://docs.lacunasoftware.com/en-us/articles/pki-express
|
130
134
|
source_code_uri: https://github.com/LacunaSoftware/PkiExpressRuby
|
131
|
-
post_install_message:
|
135
|
+
post_install_message:
|
132
136
|
rdoc_options: []
|
133
137
|
require_paths:
|
134
138
|
- lib
|
@@ -143,8 +147,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
147
|
- !ruby/object:Gem::Version
|
144
148
|
version: '0'
|
145
149
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
150
|
+
rubygems_version: 3.4.10
|
151
|
+
signing_key:
|
148
152
|
specification_version: 4
|
149
153
|
summary: Gem for using PKI Express on Ruby
|
150
|
-
test_files:
|
154
|
+
test_files:
|
155
|
+
- spec/pki_express/pki_express_operator_spec.rb
|
156
|
+
- spec/spec_helper.rb
|