eac_ruby_gem_support 0.1.1 → 0.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: e0b01eaeeacb27dde9db9ee7c460a91dfce7e564df1d1ab7ca5067818d2146b0
4
- data.tar.gz: f3c9c225930a87e5ced905b1525c3d71bebf76e1bc747b1b6691492d47d7da9e
3
+ metadata.gz: 84b3ca5402c7c6e6f3db0c188918cb13068e4910ae638347460d7247ebbb6e89
4
+ data.tar.gz: 39ce126f55b25a5fc2e2a665795b2cfd5c2c63e95b8c4424372e4b66d73e8cae
5
5
  SHA512:
6
- metadata.gz: ef7bd293bf95b15eb99ada22def74dcf2a4127cd163fc60e8e4a3cba143b3781d0c224dffc5a3ca4ab8d9f29cd4164a084798103cec5f7177dcadfd06307874a
7
- data.tar.gz: 33541713ec4534f02c8e24c5469f695a1943b4a45fb64796dc2f1af7c6034863260d502af47c25af119c45d1b09b94b3dbd0e2d678feb9eed99fae71b8645ba9
6
+ metadata.gz: eee5209187b9d48ac954e710bf3b7e466ffb556325f88e8379fceb980a508ede8d7df5f3dcea661b32c5ee4ae36cf9b8a886b1df22c9a37e7cc26666ffaa050a
7
+ data.tar.gz: 94ea6d74d01eff15e49da65069cd3f70cf8f4024cf8beeeee97e07492cf15865ac16872cc2a555d6f1685df70789c12a5138cbb21cef0ff2285c84da156caf83
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemSupport
4
- require 'eac_ruby_gems_support/spec/examples/rubocop_check'
5
- require 'eac_ruby_gems_support/version'
4
+ require 'eac_ruby_gem_support/rspec'
5
+ require 'eac_ruby_gem_support/version'
6
6
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRubyGemSupport
6
+ module Rspec
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,73 @@
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 Filesystem
11
+ def purge_temp_files
12
+ ::FileUtils.rm_rf(temp_set.pop) while temp_set.any?
13
+ end
14
+
15
+ # @return [Pathname]
16
+ def temp_copy(source_path)
17
+ source_path = to_pathname(source_path)
18
+ if source_path.file?
19
+ temp_file_copy(source_path)
20
+ elsif source_path.directory?
21
+ temp_dir_copy(source_path)
22
+ else
23
+ raise "Source path \"#{source_path}\" is not a file or directory"
24
+ end
25
+ end
26
+
27
+ # @return [Pathname]
28
+ def temp_dir(*mktmpdir_args)
29
+ add_to_temp_set(::Dir.mktmpdir(*mktmpdir_args))
30
+ end
31
+
32
+ # @return [Pathname]
33
+ def temp_dir_copy(source_path)
34
+ r = temp_dir
35
+ ::FileUtils.cp_r("#{source_path}/.", r.to_path)
36
+ r
37
+ end
38
+
39
+ # @return [Pathname]
40
+ def temp_file(*tempfile_args)
41
+ file = ::Tempfile.new(*tempfile_args)
42
+ path = file.path
43
+ file.close
44
+ add_to_temp_set(path)
45
+ end
46
+
47
+ # @return [Pathname]
48
+ def temp_file_copy(source_path)
49
+ r = temp_file
50
+ ::FileUtils.cp(to_pathname(source_path).to_path, r.to_path)
51
+ r
52
+ end
53
+
54
+ # @return [Pathname]
55
+ def to_pathname(path)
56
+ path.is_a?(::Pathname) ? path : ::Pathname.new(path.to_s)
57
+ end
58
+
59
+ private
60
+
61
+ def add_to_temp_set(path)
62
+ r = to_pathname(path)
63
+ temp_set << r
64
+ r
65
+ end
66
+
67
+ def temp_set
68
+ @temp_set ||= []
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_gem_support/rspec/helpers/filesystem'
5
+ require 'eac_ruby_gem_support/rspec/specs/rubocop'
6
+ require 'tmpdir'
7
+
8
+ module EacRubyGemSupport
9
+ 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
18
+ end
19
+
20
+ private
21
+
22
+ def setup_filesystem_helper
23
+ setup_obj.rspec_config.include ::EacRubyGemSupport::Rspec::Helpers::Filesystem
24
+ setup_obj.rspec_config.after(:each) { purge_temp_files }
25
+ end
26
+
27
+ def setup_load_path
28
+ $LOAD_PATH.push setup_obj.app_root_path.join('lib').to_path
29
+ end
30
+
31
+ def setup_example_persistence
32
+ setup_obj.rspec_config.example_status_persistence_file_path =
33
+ example_persistence_path.to_path
34
+ end
35
+
36
+ # @return [Pathname]
37
+ def example_persistence_path
38
+ ::File.join(::Dir.tmpdir, setup_obj.app_root_path.basename.to_path.variableize).to_pathname
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec'
4
+ require 'rubocop'
5
+
6
+ module EacRubyGemSupport
7
+ module Rspec
8
+ module Specs
9
+ module Rubocop
10
+ def describe_rubocop # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
11
+ this = self
12
+ ::RSpec.describe ::RuboCop do
13
+ before do
14
+ ::RuboCop::ConfigLoader.ignore_parent_exclusion = true
15
+ end
16
+
17
+ let(:root_path) { this.app_root_path }
18
+ let(:config_store) do
19
+ r = ::RuboCop::ConfigStore.new
20
+ r.for(root_path)
21
+ r
22
+ end
23
+ let(:runner) { ::RuboCop::Runner.new({}, config_store) }
24
+
25
+ it 'rubocop return ok' do
26
+ expect(::Dir.chdir(root_path) { runner.run([]) }).to eq(true)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemSupport
4
- VERSION = '0.1.1'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_gem_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.3.1
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: 2020-04-22 00:00:00.000000000 Z
11
+ date: 2021-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: eac_ruby_utils
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.72'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.72'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +87,10 @@ extensions: []
73
87
  extra_rdoc_files: []
74
88
  files:
75
89
  - lib/eac_ruby_gem_support.rb
76
- - lib/eac_ruby_gem_support/spec/examples/rubocop_check.rb
90
+ - lib/eac_ruby_gem_support/rspec.rb
91
+ - lib/eac_ruby_gem_support/rspec/helpers/filesystem.rb
92
+ - lib/eac_ruby_gem_support/rspec/setup.rb
93
+ - lib/eac_ruby_gem_support/rspec/specs/rubocop.rb
77
94
  - lib/eac_ruby_gem_support/version.rb
78
95
  homepage: https://github.com/esquilo-azul/eac_ruby_gem_support
79
96
  licenses: []
@@ -94,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
111
  - !ruby/object:Gem::Version
95
112
  version: '0'
96
113
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.7.7
114
+ rubygems_version: 3.1.6
99
115
  signing_key:
100
116
  specification_version: 4
101
117
  summary: Development support for Ruby' Gem.
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubocop'
4
-
5
- RSpec.shared_examples 'rubocop_check' do |root_path|
6
- before do
7
- ::RuboCop::ConfigLoader.ignore_parent_exclusion = true
8
- end
9
-
10
- let(:root_path) { root_path }
11
- let(:config_store) do
12
- r = ::RuboCop::ConfigStore.new
13
- r.for(root_path)
14
- r
15
- end
16
- let(:runner) { ::RuboCop::Runner.new({}, config_store) }
17
-
18
- it 'rubocop return ok' do
19
- expect(::Dir.chdir(root_path) { runner.run([]) }).to eq(true)
20
- end
21
- end