eac_ruby_gem_support 0.3.1 → 0.5.0

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: 84b3ca5402c7c6e6f3db0c188918cb13068e4910ae638347460d7247ebbb6e89
4
- data.tar.gz: 39ce126f55b25a5fc2e2a665795b2cfd5c2c63e95b8c4424372e4b66d73e8cae
3
+ metadata.gz: 122d4ff9339544e7af89cb7953773e7378a47a1133773e68f3c7100fb2c3f929
4
+ data.tar.gz: 5e026c58b781b90db5cb15e42dc366459fa01890cbd91a48c7cb07685ad8c695
5
5
  SHA512:
6
- metadata.gz: eee5209187b9d48ac954e710bf3b7e466ffb556325f88e8379fceb980a508ede8d7df5f3dcea661b32c5ee4ae36cf9b8a886b1df22c9a37e7cc26666ffaa050a
7
- data.tar.gz: 94ea6d74d01eff15e49da65069cd3f70cf8f4024cf8beeeee97e07492cf15865ac16872cc2a555d6f1685df70789c12a5138cbb21cef0ff2285c84da156caf83
6
+ metadata.gz: 42611e5020f8bbb21bcffee4b2f853805d717e063d09e6d6298f03ca53587261694259b0b4ae816a05da8b36f1b0138b3a7a51961dff5906fdbd6c8fdc4cfbb5
7
+ data.tar.gz: b06df808cce64a4ee25b3c542a17c227bc3d6df9b6609c1192ca5842b2a4a32c9d53ae5d92f7e8c7c21ce495120c5be7cd1cc021654a318613facd5384426bd4
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'tmpdir'
5
+ require 'tempfile'
6
+
7
+ module EacRubyGemSupport
8
+ module Rspec
9
+ module Helpers
10
+ module Utils
11
+ # @return [StandardError, nil] If block raises an error, return this error. If not, return
12
+ # +nil+.
13
+ def capture_error
14
+ yield
15
+ nil
16
+ rescue ::StandardError => e
17
+ e
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -2,40 +2,48 @@
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
4
  require 'eac_ruby_gem_support/rspec/helpers/filesystem'
5
+ require 'eac_ruby_gem_support/rspec/helpers/utils'
5
6
  require 'eac_ruby_gem_support/rspec/specs/rubocop'
6
7
  require 'tmpdir'
7
8
 
8
9
  module EacRubyGemSupport
9
10
  module Rspec
10
- class Setup
11
- common_constructor :setup_obj
12
-
13
- def perform
14
- setup_obj.singleton_class.include ::EacRubyGemSupport::Rspec::Specs::Rubocop
15
- setup_load_path
16
- setup_example_persistence
17
- setup_filesystem_helper
11
+ module Setup
12
+ extend ::ActiveSupport::Concern
13
+ include ::EacRubyGemSupport::Rspec::Specs::Rubocop
14
+
15
+ def self.extended(setup_obj)
16
+ setup_obj.setup_load_path
17
+ setup_obj.setup_example_persistence
18
+ setup_obj.setup_filesystem_helper
18
19
  end
19
20
 
20
- private
21
-
22
21
  def setup_filesystem_helper
23
- setup_obj.rspec_config.include ::EacRubyGemSupport::Rspec::Helpers::Filesystem
24
- setup_obj.rspec_config.after(:each) { purge_temp_files }
22
+ rspec_config.include ::EacRubyGemSupport::Rspec::Helpers::Filesystem
23
+ rspec_config.include ::EacRubyGemSupport::Rspec::Helpers::Utils
24
+ rspec_config.after(:each) { purge_temp_files }
25
25
  end
26
26
 
27
27
  def setup_load_path
28
- $LOAD_PATH.push setup_obj.app_root_path.join('lib').to_path
28
+ $LOAD_PATH.push app_root_path.join('lib').to_path
29
29
  end
30
30
 
31
31
  def setup_example_persistence
32
- setup_obj.rspec_config.example_status_persistence_file_path =
33
- example_persistence_path.to_path
32
+ rspec_config.example_status_persistence_file_path = example_persistence_path.to_path
34
33
  end
35
34
 
36
35
  # @return [Pathname]
37
36
  def example_persistence_path
38
- ::File.join(::Dir.tmpdir, setup_obj.app_root_path.basename.to_path.variableize).to_pathname
37
+ root_tmp.join('example_status_persistence')
38
+ end
39
+
40
+ # The root directory for temporary files.
41
+ # @return [Pathname]
42
+ def root_tmp
43
+ r = ::Pathname.new(::Dir.tmpdir)
44
+ .join(app_root_path.expand_path.to_path.variableize + '_specs_tmp')
45
+ r.mkpath unless r.exist?
46
+ r
39
47
  end
40
48
  end
41
49
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemSupport
4
- VERSION = '0.3.1'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_gem_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-31 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_ruby_utils
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.72'
19
+ version: '0.74'
20
20
  type: :runtime
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: '0.72'
26
+ version: '0.74'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +89,7 @@ files:
89
89
  - lib/eac_ruby_gem_support.rb
90
90
  - lib/eac_ruby_gem_support/rspec.rb
91
91
  - lib/eac_ruby_gem_support/rspec/helpers/filesystem.rb
92
+ - lib/eac_ruby_gem_support/rspec/helpers/utils.rb
92
93
  - lib/eac_ruby_gem_support/rspec/setup.rb
93
94
  - lib/eac_ruby_gem_support/rspec/specs/rubocop.rb
94
95
  - lib/eac_ruby_gem_support/version.rb