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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96112f72042a8deaa33c44615735b0cf1583cbf8ff3d9f2063a9c34fae618de6
4
- data.tar.gz: 7f154465e01e5159bce9ab4ff6548fcf74564fdb7cc8b57dec8e88958966e1aa
3
+ metadata.gz: f3fe73f3d18d1dc566b80140f294c5028e0e60787dcb5c56e4112af8f0128e5c
4
+ data.tar.gz: c5f73243393de32161c70d0ac4933db9b6261cb37e89a2e3e7702c45500240f6
5
5
  SHA512:
6
- metadata.gz: 80afd152f8767046e2a6a0314a3d05ca4d94039be98a19d14e2b56d8dc2bbdae8ed6485e4fede075a59311a33635665766a64539f423c4023e64bbf6db6da5fa
7
- data.tar.gz: 5b4fdc45bea0e0b534b46f291121702d0bca002ed579eb01c10c8836def784ed086f499d9a74c2939c34ab20fe9e134536b0e39359afb26cfd630fcce52c555f
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
@@ -1,3 +1,7 @@
1
+ ## 1.3.1 (2023-03-30)
2
+ * Fix pki express operator finalizer
3
+ * Improve pathname call with exists
4
+
1
5
  ## 1.3.0 (2021-08-04)
2
6
  * Adds culture and time zone attributes to PkiExpressOperator
3
7
 
data/Gemfile CHANGED
@@ -1,4 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify the gem's dependencies in pki_express.gemspec
4
- gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'rspec'
8
+ end
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.0'
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
@@ -1 +1,7 @@
1
- require 'bundler/gem_tasks'
1
+ require 'rake'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.pattern = Dir.glob('spec/**/*_spec.rb')
7
+ end
@@ -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.exist?(temp_folder)
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.exist?(transfer_data_folder)
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
- ObjectSpace.define_finalizer(self, self.class.method(:finalize))
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
- @temp_files.each do |file|
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
@@ -1,3 +1,3 @@
1
1
  module PkiExpress
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
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', '~> 1.7'
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
@@ -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.0
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: 2021-08-04 00:00:00.000000000 Z
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: '1.7'
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: '1.7'
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.0.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